package com.engine.salary.remote.tax.client; import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareParam; import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum; import com.engine.salary.remote.tax.request.employee.BatchInvalidSubmissionRequest; import com.engine.salary.remote.tax.request.employee.GetCompanyEmployeeRequest; import com.engine.salary.remote.tax.request.employee.InformationChangeRequest; import com.engine.salary.remote.tax.response.employee.GetCompanyEmployeeResponse; import com.engine.salary.util.HttpUtil; import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SingnatureData; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.Map; import java.util.UUID; /** * 人员信息登记报送客户端 *

Copyright: Copyright (c) 2023

*

Company: 泛微软件

* * @author qiantao * @version 1.0 **/ @Slf4j public class EmployeeClient extends TaxBaseClient { public EmployeeClient(Long taxAgentId) { super(taxAgentId); } //4.2.3企业人员列表查询 public GetCompanyEmployeeResponse getCompanyEmployee(EmployeeDeclareParam param) { String url = super.apiConfig.getHost() + "gateway/iit/data/getCompanyEmployee"; GetCompanyEmployeeRequest getCompanyEmployeeRequest = new GetCompanyEmployeeRequest(); getCompanyEmployeeRequest.setNsrsbh(returnPO.getTaxCode()); getCompanyEmployeeRequest.setQymc(returnPO.getTaxAgentName()); getCompanyEmployeeRequest.setDjxhid(StringUtils.isNotEmpty(returnPO.getTaxRegistrationNumber()) ? returnPO.getTaxRegistrationNumber() : null); getCompanyEmployeeRequest.setAreaid(returnPO.getAreaCode()); getCompanyEmployeeRequest.setBmbh(StringUtils.isNotEmpty(returnPO.getDepartmentCode()) ? returnPO.getDepartmentCode() : null); boolean realNamePwd = TaxAgentTaxReturnPasswordTypeEnum.REAL_NAME_PASSWORD.getValue().equals(returnPO.getPasswordType()); getCompanyEmployeeRequest.setSbmm(realNamePwd ? null : returnPO.getPwd()); getCompanyEmployeeRequest.setJmsbmm("0"); getCompanyEmployeeRequest.setSmzh(realNamePwd ? returnPO.getRealAccount() : null); getCompanyEmployeeRequest.setSmmm(realNamePwd ? returnPO.getPwd() : null); getCompanyEmployeeRequest.setJmsmmm("0"); getCompanyEmployeeRequest.setMmlx("" + returnPO.getPasswordType()); getCompanyEmployeeRequest.setSsyf(SalaryDateUtil.getFormatYYYYMM(param.getTaxCycle())); getCompanyEmployeeRequest.setPageNo("" + param.getCurrent()); getCompanyEmployeeRequest.setPageSize("" + param.getPageSize()); String reqJson = JsonUtil.toJsonString(getCompanyEmployeeRequest); log.info("getCompanyEmployee params --- \n{}\n", reqJson); Map params = new HashMap<>(1); Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); // 开始请求 String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); log.info("getCompanyEmployee res --- {}", res); return JsonUtil.parseObject(res, GetCompanyEmployeeResponse.class); } public String batchInvalidSubmission(BatchInvalidSubmissionRequest batchInvalidSubmissionRequest) { String url = super.apiConfig.getHost() + "gateway/iit/declare/batchInvalidSubmission"; batchInvalidSubmissionRequest.setNsrsbh(returnPO.getTaxCode()); batchInvalidSubmissionRequest.setBizNo(UUID.randomUUID().toString().replace("-", "")); batchInvalidSubmissionRequest.setQymc(returnPO.getTaxAgentName()); batchInvalidSubmissionRequest.setDjxhid(StringUtils.isNotEmpty(returnPO.getTaxRegistrationNumber()) ? returnPO.getTaxRegistrationNumber() : null); batchInvalidSubmissionRequest.setAreaid(returnPO.getAreaCode()); batchInvalidSubmissionRequest.setBmbh(StringUtils.isNotEmpty(returnPO.getDepartmentCode()) ? returnPO.getDepartmentCode() : null); boolean realNamePwd = TaxAgentTaxReturnPasswordTypeEnum.REAL_NAME_PASSWORD.getValue().equals(returnPO.getPasswordType()); batchInvalidSubmissionRequest.setSbmm(realNamePwd ? null : returnPO.getPwd()); batchInvalidSubmissionRequest.setJmsbmm("0"); batchInvalidSubmissionRequest.setSmzh(realNamePwd ? returnPO.getRealAccount() : null); batchInvalidSubmissionRequest.setSmmm(realNamePwd ? returnPO.getPwd() : null); batchInvalidSubmissionRequest.setJmsmmm("0"); batchInvalidSubmissionRequest.setMmlx("" + returnPO.getPasswordType()); String reqJson = JsonUtil.toJsonString(batchInvalidSubmissionRequest); log.info("batchInvalidSubmission params --- \n{}\n", reqJson); Map params = new HashMap<>(1); Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); // 开始请求 String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); log.info("batchInvalidSubmission res --- {}", res); // return JsonUtil.parseObject(res, GetCompanyEmployeeResponse.class); return res; } public String informationChange(InformationChangeRequest informationChangeRequest) { String url = super.apiConfig.getHost() + "gateway/iit/employee/informationChange"; informationChangeRequest.setNsrsbh(returnPO.getTaxCode()); informationChangeRequest.setBizNo(UUID.randomUUID().toString().replace("-", "")); informationChangeRequest.setQymc(returnPO.getTaxAgentName()); informationChangeRequest.setDjxhid(StringUtils.isNotEmpty(returnPO.getTaxRegistrationNumber()) ? returnPO.getTaxRegistrationNumber() : null); informationChangeRequest.setAreaid(returnPO.getAreaCode()); informationChangeRequest.setBmbh(StringUtils.isNotEmpty(returnPO.getDepartmentCode()) ? returnPO.getDepartmentCode() : null); boolean realNamePwd = TaxAgentTaxReturnPasswordTypeEnum.REAL_NAME_PASSWORD.getValue().equals(returnPO.getPasswordType()); informationChangeRequest.setSbmm(realNamePwd ? null : returnPO.getPwd()); informationChangeRequest.setJmsbmm("0"); informationChangeRequest.setSmzh(realNamePwd ? returnPO.getRealAccount() : null); informationChangeRequest.setSmmm(realNamePwd ? returnPO.getPwd() : null); informationChangeRequest.setJmsmmm("0"); informationChangeRequest.setMmlx("" + returnPO.getPasswordType()); String reqJson = JsonUtil.toJsonString(informationChangeRequest); log.info("informationChangeRequest params --- \n{}\n", reqJson); Map params = new HashMap<>(1); Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); // 开始请求 String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); log.info("informationChangeRequest res --- {}", res); // return JsonUtil.parseObject(res, GetCompanyEmployeeResponse.class); return res; } }