weaver-hrm-salary/src/com/engine/salary/remote/tax/client/EmployeeClient.java

129 lines
7.1 KiB
Java
Raw Normal View History

2023-10-11 18:24:02 +08:00
package com.engine.salary.remote.tax.client;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareParam;
import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum;
2024-04-16 20:12:48 +08:00
import com.engine.salary.remote.tax.request.employee.BatchInvalidSubmissionRequest;
2023-10-11 18:24:02 +08:00
import com.engine.salary.remote.tax.request.employee.GetCompanyEmployeeRequest;
2024-04-16 20:12:48 +08:00
import com.engine.salary.remote.tax.request.employee.InformationChangeRequest;
2023-10-11 18:24:02 +08:00
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;
2024-04-16 20:12:48 +08:00
import java.util.UUID;
2023-10-11 18:24:02 +08:00
/**
2023-12-06 15:19:07 +08:00
* 人员信息登记报送客户端
2023-10-11 18:24:02 +08:00
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @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();
2024-04-16 20:12:48 +08:00
getCompanyEmployeeRequest.setNsrsbh(returnPO.getTaxCode());
getCompanyEmployeeRequest.setQymc(returnPO.getTaxAgentName());
2023-10-11 18:24:02 +08:00
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");
2024-04-16 20:12:48 +08:00
getCompanyEmployeeRequest.setMmlx("" + returnPO.getPasswordType());
2023-10-11 18:24:02 +08:00
getCompanyEmployeeRequest.setSsyf(SalaryDateUtil.getFormatYYYYMM(param.getTaxCycle()));
2024-04-16 20:12:48 +08:00
getCompanyEmployeeRequest.setPageNo("" + param.getCurrent());
getCompanyEmployeeRequest.setPageSize("" + param.getPageSize());
2023-10-11 18:24:02 +08:00
String reqJson = JsonUtil.toJsonString(getCompanyEmployeeRequest);
log.info("getCompanyEmployee params --- \n{}\n", reqJson);
Map<String, String> params = new HashMap<>(1);
Map<String, String> 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);
}
2024-04-16 20:12:48 +08:00
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<String, String> params = new HashMap<>(1);
Map<String, String> 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<String, String> params = new HashMap<>(1);
Map<String, String> 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;
}
2023-10-11 18:24:02 +08:00
}