diff --git a/src/com/engine/salary/entity/employeedeclare/param/EmployeeInformationChangeParam.java b/src/com/engine/salary/entity/employeedeclare/param/EmployeeInformationChangeParam.java new file mode 100644 index 000000000..7809661f7 --- /dev/null +++ b/src/com/engine/salary/entity/employeedeclare/param/EmployeeInformationChangeParam.java @@ -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; + +/** + * 人员报送 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @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; + + +} diff --git a/src/com/engine/salary/entity/employeedeclare/param/EmployeeInvalidParam.java b/src/com/engine/salary/entity/employeedeclare/param/EmployeeInvalidParam.java new file mode 100644 index 000000000..fa67731ce --- /dev/null +++ b/src/com/engine/salary/entity/employeedeclare/param/EmployeeInvalidParam.java @@ -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; + +/** + * 人员报送 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class EmployeeInvalidParam extends BaseQueryParam { + + /** + * 人员记录id + */ + @DataCheck(require = true,message = "参数错误,id不能为空") + private Long id; + + +} diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentTaxReturnMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentTaxReturnMapper.xml index 59ce83251..da28243a6 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentTaxReturnMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentTaxReturnMapper.xml @@ -70,7 +70,8 @@ - SELECT FROM hrsa_tax_agent_tax_return t diff --git a/src/com/engine/salary/remote/tax/client/EmployeeClient.java b/src/com/engine/salary/remote/tax/client/EmployeeClient.java index 90da29385..f1f452c13 100644 --- a/src/com/engine/salary/remote/tax/client/EmployeeClient.java +++ b/src/com/engine/salary/remote/tax/client/EmployeeClient.java @@ -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 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; + } + } diff --git a/src/com/engine/salary/remote/tax/request/employee/BatchInvalidSubmissionRequest.java b/src/com/engine/salary/remote/tax/request/employee/BatchInvalidSubmissionRequest.java new file mode 100644 index 000000000..a56c5103f --- /dev/null +++ b/src/com/engine/salary/remote/tax/request/employee/BatchInvalidSubmissionRequest.java @@ -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; + /** + * 加密实名密码 必填:否 默认不传则设置为0,0表示不加密;1表示加密 + */ + private String jmsbmm; + /** + * 实名账号 必填:是 + */ + private String smzh; + /** + * 实名密码 必填:是 + */ + private String smmm; + /** + * 加密实名密码 必填:否 默认不传则设置为0,0表示不加密;1表示加密 参考3.4代报、实名密码加密说明 + */ + private String jmsmmm; + + /** + * 密码类型 必填:是 0表示申报密码; 2表示实名账号实名密码 + */ + private String mmlx; + + /** + * 人员列表 必填:是 + */ + protected List rylb; + + + @Data + public static class RY { + private String xm; + private String zzhm; + private String zzlx; + } +} diff --git a/src/com/engine/salary/remote/tax/request/employee/InformationChangeRequest.java b/src/com/engine/salary/remote/tax/request/employee/InformationChangeRequest.java new file mode 100644 index 000000000..32d364545 --- /dev/null +++ b/src/com/engine/salary/remote/tax/request/employee/InformationChangeRequest.java @@ -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; + /** + * 加密实名密码 必填:否 默认不传则设置为0,0表示不加密;1表示加密 + */ + private String jmsbmm; + /** + * 实名账号 必填:是 + */ + private String smzh; + /** + * 实名密码 必填:是 + */ + private String smmm; + /** + * 加密实名密码 必填:否 默认不传则设置为0,0表示不加密;1表示加密 参考3.4代报、实名密码加密说明 + */ + private String jmsmmm; + + /** + * 密码类型 必填:是 0表示申报密码; 2表示实名账号实名密码 + */ + private String mmlx; + + private String xm; + private String zzlx; + private String zzhm; +} diff --git a/src/com/engine/salary/service/EmployeeDeclareService.java b/src/com/engine/salary/service/EmployeeDeclareService.java index ed184159a..3243a0234 100644 --- a/src/com/engine/salary/service/EmployeeDeclareService.java +++ b/src/com/engine/salary/service/EmployeeDeclareService.java @@ -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 insertList); + } diff --git a/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java b/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java index 3fb74033c..f21a640c0 100644 --- a/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java +++ b/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java @@ -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 employeeDeclarePOS = listByIds(Collections.singletonList(param.getId())); + if (CollectionUtils.isEmpty(employeeDeclarePOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "未找到该人员")); + } + + BatchInvalidSubmissionRequest request = new BatchInvalidSubmissionRequest(); + List 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 employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL); diff --git a/src/com/engine/salary/web/EmployeeDeclareController.java b/src/com/engine/salary/web/EmployeeDeclareController.java index fa54d79f3..c94c9da12 100644 --- a/src/com/engine/salary/web/EmployeeDeclareController.java +++ b/src/com/engine/salary/web/EmployeeDeclareController.java @@ -242,6 +242,22 @@ public class EmployeeDeclareController { return new ResponseResult(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(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(user).run(getEmployeeDeclareWrapper(user)::informationChange, param); + } + /** * 人员报送-后端业务逻辑是否已经完成 * diff --git a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java index f4ab000ff..fe681eb07 100644 --- a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java +++ b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java @@ -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); + } + + + + /** * 获取人员报送相关后端接口是否已经完成 *