作废人员接口

This commit is contained in:
钱涛 2024-04-16 20:12:48 +08:00
parent 0e6449e1e2
commit 1496745488
10 changed files with 357 additions and 6 deletions

View File

@ -0,0 +1,43 @@
package com.engine.salary.entity.employeedeclare.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 人员报送
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EmployeeInformationChangeParam extends BaseQueryParam {
/**
* 人员记录id
*/
@DataCheck(require = true,message = "参数错误id不能为空")
private Long id;
/**
*
*/
private String name;
//证件类型
private CardTypeEnum cardType;
//证件号码
private String cardNum;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.employeedeclare.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 人员报送
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EmployeeInvalidParam extends BaseQueryParam {
/**
* 人员记录id
*/
@DataCheck(require = true,message = "参数错误id不能为空")
private Long id;
}

View File

@ -70,7 +70,8 @@
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO">
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_tax_return t

View File

@ -2,7 +2,9 @@ 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;
@ -13,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* 人员信息登记报送客户端
@ -34,8 +37,8 @@ public class EmployeeClient extends TaxBaseClient {
String url = super.apiConfig.getHost() + "gateway/iit/data/getCompanyEmployee";
GetCompanyEmployeeRequest getCompanyEmployeeRequest = new GetCompanyEmployeeRequest();
getCompanyEmployeeRequest.setNsrsbh( returnPO.getTaxCode());
getCompanyEmployeeRequest.setQymc("");
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);
@ -45,10 +48,10 @@ public class EmployeeClient extends TaxBaseClient {
getCompanyEmployeeRequest.setSmzh(realNamePwd ? returnPO.getRealAccount() : null);
getCompanyEmployeeRequest.setSmmm(realNamePwd ? returnPO.getPwd() : null);
getCompanyEmployeeRequest.setJmsmmm("0");
getCompanyEmployeeRequest.setMmlx(""+returnPO.getPasswordType());
getCompanyEmployeeRequest.setMmlx("" + returnPO.getPasswordType());
getCompanyEmployeeRequest.setSsyf(SalaryDateUtil.getFormatYYYYMM(param.getTaxCycle()));
getCompanyEmployeeRequest.setPageNo(""+param.getCurrent());
getCompanyEmployeeRequest.setPageSize(""+param.getPageSize());
getCompanyEmployeeRequest.setPageNo("" + param.getCurrent());
getCompanyEmployeeRequest.setPageSize("" + param.getPageSize());
String reqJson = JsonUtil.toJsonString(getCompanyEmployeeRequest);
log.info("getCompanyEmployee params --- \n{}\n", reqJson);
@ -62,4 +65,64 @@ public class EmployeeClient extends TaxBaseClient {
}
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;
}
}

View File

@ -0,0 +1,71 @@
package com.engine.salary.remote.tax.request.employee;
import lombok.Data;
import java.util.List;
@Data
public class BatchInvalidSubmissionRequest {
private String bizNo;
/**
* 税号 必填 扣缴单位纳税人识别号
*/
private String nsrsbh;
/**
* 企业名称 必填 扣缴义务人名称例如测试网络科技有限公司
*/
private String qymc;
/**
* 登记序号 必填条件必填 存在多个登记序号时需要指定传入一个.10117440105249764755
*/
private String djxhid;
/**
* 地区编号 必填 6位行政区划代码,精确到市级例如440100,,参考省市区编码
*/
private String areaid;
/**
* 部门编号 必填条件必填 分部门代报时必传
*/
private String bmbh;
/**
* 申报密码 必填条件必填 当mmlx=0时必填
*/
private String sbmm;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密
*/
private String jmsbmm;
/**
* 实名账号 必填
*/
private String smzh;
/**
* 实名密码 必填
*/
private String smmm;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密 参考3.4代报实名密码加密说明
*/
private String jmsmmm;
/**
* 密码类型 必填 0表示申报密码 2表示实名账号实名密码
*/
private String mmlx;
/**
* 人员列表 必填
*/
protected List<RY> rylb;
@Data
public static class RY {
private String xm;
private String zzhm;
private String zzlx;
}
}

View File

@ -0,0 +1,60 @@
package com.engine.salary.remote.tax.request.employee;
import lombok.Data;
@Data
public class InformationChangeRequest {
private String bizNo;
/**
* 税号 必填 扣缴单位纳税人识别号
*/
private String nsrsbh;
/**
* 企业名称 必填 扣缴义务人名称例如测试网络科技有限公司
*/
private String qymc;
/**
* 登记序号 必填条件必填 存在多个登记序号时需要指定传入一个.10117440105249764755
*/
private String djxhid;
/**
* 地区编号 必填 6位行政区划代码,精确到市级例如440100,,参考省市区编码
*/
private String areaid;
/**
* 部门编号 必填条件必填 分部门代报时必传
*/
private String bmbh;
/**
* 申报密码 必填条件必填 当mmlx=0时必填
*/
private String sbmm;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密
*/
private String jmsbmm;
/**
* 实名账号 必填
*/
private String smzh;
/**
* 实名密码 必填
*/
private String smmm;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密 参考3.4代报实名密码加密说明
*/
private String jmsmmm;
/**
* 密码类型 必填 0表示申报密码 2表示实名账号实名密码
*/
private String mmlx;
private String xm;
private String zzlx;
private String zzhm;
}

View File

@ -176,6 +176,19 @@ public interface EmployeeDeclareService{
*/
void getDeclareFeedback(EmployeeDeclareParam param, EmployeeDeclareRateDTO employeeDeclareRate);
/**
* 作废人员
* @param param
*/
String invalid(EmployeeInvalidParam param);
/**
* 关键信息变更
* @param param
* @return
*/
String informationChange(EmployeeInformationChangeParam param);
/**
* 同步任职受雇日期为入职日期
*
@ -184,4 +197,5 @@ public interface EmployeeDeclareService{
String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param);
void batchInsert(List<EmployeeDeclarePO> insertList);
}

View File

@ -42,6 +42,9 @@ import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum;
import com.engine.salary.enums.taxdeclaration.EnumDeclareApiBusinessType;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper;
import com.engine.salary.remote.tax.client.EmployeeClient;
import com.engine.salary.remote.tax.request.employee.BatchInvalidSubmissionRequest;
import com.engine.salary.remote.tax.request.employee.InformationChangeRequest;
import com.engine.salary.service.*;
import com.engine.salary.util.*;
import com.engine.salary.util.db.IdGenerator;
@ -718,6 +721,44 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
}
}
@Override
public String invalid(EmployeeInvalidParam param) {
List<EmployeeDeclarePO> employeeDeclarePOS = listByIds(Collections.singletonList(param.getId()));
if (CollectionUtils.isEmpty(employeeDeclarePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "未找到该人员"));
}
BatchInvalidSubmissionRequest request = new BatchInvalidSubmissionRequest();
List<BatchInvalidSubmissionRequest.RY> rys = employeeDeclarePOS.stream().map(po -> {
BatchInvalidSubmissionRequest.RY ry = new BatchInvalidSubmissionRequest.RY();
ry.setXm(po.getEmployeeName());
ry.setZzhm(po.getCardNum());
ry.setZzlx(CardTypeEnum.getByValue(po.getCardType()).getDefaultLabel());
return ry;
}).collect(Collectors.toList());
request.setRylb(rys);
EmployeeClient employeeClient = new EmployeeClient(employeeDeclarePOS.get(0).getTaxAgentId());
String s = employeeClient.batchInvalidSubmission(request);
return s;
}
@Override
public String informationChange(EmployeeInformationChangeParam param) {
EmployeeDeclarePO employeeDeclarePO = getById(param.getId());
if (employeeDeclarePO == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "未找到该人员"));
}
InformationChangeRequest request =new InformationChangeRequest();
request.setXm(param.getName());
request.setZzlx(param.getCardType().getDefaultLabel());
request.setZzhm(param.getCardNum());
EmployeeClient employeeClient = new EmployeeClient(employeeDeclarePO.getTaxAgentId());
String s = employeeClient.informationChange(request);
return s;
}
@Override
public String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param) {
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);

View File

@ -242,6 +242,22 @@ public class EmployeeDeclareController {
return new ResponseResult<EmployeeDeclareParam, String>(user).run(getEmployeeDeclareWrapper(user)::getDeclareFeedback, employeeDeclareParam);
}
@POST
@Path("/invalid")
@Produces(MediaType.APPLICATION_JSON)
public String invalid(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeInvalidParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<EmployeeInvalidParam, String>(user).run(getEmployeeDeclareWrapper(user)::invalid, param);
}
@POST
@Path("/informationChange")
@Produces(MediaType.APPLICATION_JSON)
public String informationChange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeInformationChangeParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<EmployeeInformationChangeParam, String>(user).run(getEmployeeDeclareWrapper(user)::informationChange, param);
}
/**
* 人员报送-后端业务逻辑是否已经完成
*

View File

@ -543,6 +543,17 @@ public class EmployeeDeclareWrapper extends Service {
return employeeDeclareRate.getIndex();
}
public String invalid(EmployeeInvalidParam param) {
return getEmployeeDeclareService(user).invalid(param);
}
public String informationChange(EmployeeInformationChangeParam param) {
return getEmployeeDeclareService(user).informationChange(param);
}
/**
* 获取人员报送相关后端接口是否已经完成
*