From 7368363631101705d9dec939680d80f1da10fc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 11 Oct 2023 18:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=9C=8D=E5=8A=A1=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../param/EmployeeDeclareParam.java | 3 +- .../taxagent/po/TaxAgentTaxReturnPO.java | 5 + .../remote/tax/client/EmployeeClient.java | 65 ++++ .../remote/tax/client/TaxBaseClient.java | 46 +++ .../employee/GetCompanyEmployeeRequest.java | 65 ++++ .../employee/GetCompanyEmployeeResponse.java | 334 ++++++++++++++++++ .../salary/web/EmployeeDeclareController.java | 15 + .../wrapper/EmployeeDeclareWrapper.java | 13 + test/ApiDes.java | 20 ++ test/ParseTaxApi.java | 55 +++ 10 files changed, 620 insertions(+), 1 deletion(-) create mode 100644 src/com/engine/salary/remote/tax/client/EmployeeClient.java create mode 100644 src/com/engine/salary/remote/tax/client/TaxBaseClient.java create mode 100644 src/com/engine/salary/remote/tax/request/employee/GetCompanyEmployeeRequest.java create mode 100644 src/com/engine/salary/remote/tax/response/employee/GetCompanyEmployeeResponse.java create mode 100644 test/ApiDes.java create mode 100644 test/ParseTaxApi.java diff --git a/src/com/engine/salary/entity/employeedeclare/param/EmployeeDeclareParam.java b/src/com/engine/salary/entity/employeedeclare/param/EmployeeDeclareParam.java index 8f99c2e98..8af42f76a 100644 --- a/src/com/engine/salary/entity/employeedeclare/param/EmployeeDeclareParam.java +++ b/src/com/engine/salary/entity/employeedeclare/param/EmployeeDeclareParam.java @@ -1,5 +1,6 @@ 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; @@ -20,7 +21,7 @@ import java.util.Date; @Builder @AllArgsConstructor @NoArgsConstructor -public class EmployeeDeclareParam { +public class EmployeeDeclareParam extends BaseQueryParam { /** * 个税扣缴义务人id diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java index 717a5e960..b20fd8d43 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java @@ -38,6 +38,11 @@ public class TaxAgentTaxReturnPO implements Serializable { */ private Long taxAgentId; + /** + * 企业名称 + */ + private Long taxAgentName; + /** * 税号 */ diff --git a/src/com/engine/salary/remote/tax/client/EmployeeClient.java b/src/com/engine/salary/remote/tax/client/EmployeeClient.java new file mode 100644 index 000000000..8ea3f8177 --- /dev/null +++ b/src/com/engine/salary/remote/tax/client/EmployeeClient.java @@ -0,0 +1,65 @@ +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.GetCompanyEmployeeRequest; +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; + +/** + * 人员信息登记报送服务 + *

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(""); + 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); + + } + +} diff --git a/src/com/engine/salary/remote/tax/client/TaxBaseClient.java b/src/com/engine/salary/remote/tax/client/TaxBaseClient.java new file mode 100644 index 000000000..38ba9862a --- /dev/null +++ b/src/com/engine/salary/remote/tax/client/TaxBaseClient.java @@ -0,0 +1,46 @@ +package com.engine.salary.remote.tax.client; + +import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; +import com.engine.salary.mapper.taxagent.TaxAgentTaxReturnMapper; +import com.engine.salary.mapper.taxdeclaration.TaxDeclareApiConfigMapper; +import com.engine.salary.util.Sm4Utils; +import com.engine.salary.util.db.MapperProxyFactory; +import lombok.extern.slf4j.Slf4j; + +/** + * 人员信息登记报送服务 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Slf4j +public class TaxBaseClient { + private TaxDeclareApiConfigMapper getTaxDeclareApiConfigMapper() { + return MapperProxyFactory.getProxy(TaxDeclareApiConfigMapper.class); + } + + + private TaxAgentTaxReturnMapper getTaxAgentTaxReturnMapper() { + return MapperProxyFactory.getProxy(TaxAgentTaxReturnMapper.class); + } + + public Long taxAgentId; + public TaxDeclarationApiConfigPO apiConfig ; + public TaxAgentTaxReturnPO returnPO ; + + public TaxBaseClient(Long taxAgentId) { + this.taxAgentId = taxAgentId; + this.apiConfig = getTaxDeclareApiConfigMapper().getOne(); + TaxAgentTaxReturnPO taxReturnPO = getTaxAgentTaxReturnMapper().selectOneByTaxAgentId(taxAgentId); + try { + // 密码解密 + taxReturnPO.setPwd(Sm4Utils.decryptEcb(apiConfig.getAppSecret(), taxReturnPO.getPwd())); + } catch (Exception e) { + log.error("Sm4Utils.decryptEcb ---- error: {}", e.getMessage()); + } + this.returnPO = taxReturnPO; + } +} diff --git a/src/com/engine/salary/remote/tax/request/employee/GetCompanyEmployeeRequest.java b/src/com/engine/salary/remote/tax/request/employee/GetCompanyEmployeeRequest.java new file mode 100644 index 000000000..799722704 --- /dev/null +++ b/src/com/engine/salary/remote/tax/request/employee/GetCompanyEmployeeRequest.java @@ -0,0 +1,65 @@ +package com.engine.salary.remote.tax.request.employee; + +import lombok.Data; + +@Data +public class GetCompanyEmployeeRequest { + /** + * 税号 必填:是 扣缴单位纳税人识别号 + */ + 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; + + /** + * 所属月份 必填:是 格式YYYYMM年 + */ + private String ssyf; + /** + * 页码 必填:是 大于0 + */ + private String pageNo; + /** + * 数量 必填:是 大于0 + */ + private String pageSize; +} diff --git a/src/com/engine/salary/remote/tax/response/employee/GetCompanyEmployeeResponse.java b/src/com/engine/salary/remote/tax/response/employee/GetCompanyEmployeeResponse.java new file mode 100644 index 000000000..300dc9a1a --- /dev/null +++ b/src/com/engine/salary/remote/tax/response/employee/GetCompanyEmployeeResponse.java @@ -0,0 +1,334 @@ +package com.engine.salary.remote.tax.response.employee; + +import com.engine.salary.entity.taxpayment.response.BaseResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +public class GetCompanyEmployeeResponse extends BaseResponse { + /** + * 返回数据 + */ + private List body; + + + @Data + public static class Employee { + /** + * 其他证件类型 必填:条件必填 见证件类型字典 + */ + private String qtzzlx; + + + /** + * 员工姓名 必填:纳税人姓名 + */ + private String xm; + + /** + * 证件类型 必填:见证件类型字典 + */ + private String zzlx; + + /** + * 证件号码 必填: + */ + private String zzhm; + + /** + * 部门编号 必填:条件必填 若人员存在部门编号则返回 + */ + private String bmbh; + + /** + * 其他证件号码 必填:条件必填 见证件类型字典 + */ + private String qtzzhm; + + /** + * 工号 必填:否 + */ + private String gh; + + /** + * 报送状态 必填: 1 待报送 2 报送中 3 报送失败 4 报送成功 + */ + private String sbzt; + + + /** + * 验证状态 必填: 0 若是身份证,状态为验证中;其他证件为暂不验证 1 验证通过 2 验证不通过 4 待验证 9 同代码0处理 + */ + private String rzzt; + + /** + * 任职受雇类型 必填:是 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育) + */ + private String sfgy; + + /** + * 所属期 必填:否 YYYYMM + */ + private String skssq; + + /** + * 电话号码 必填:是 11位手机号码 + */ + private String lxdh; + + /** + * 人员状态 必填:是 0 :正常 1 :非正常 + */ + private String nsrzt; + + /** + * 入职年度就业情形 必填:否 + */ + private String rzndjyqk; + + /** + * 受雇日期 必填:条件必填 YYYY-MM-DD, + */ + private String rzsgrq; + + /** + * 性别 必填:是 1:男 2:女 + */ + private String xb; + + /** + * 出生日期 必填:是 YYYY-MM-DD + */ + private String csny; + + /** + * 国籍 必填:是 见国籍字典 + */ + private String gj; + + /** + * 人员地区 必填:是 1:境内 2:境外 + */ + private String rydq; + + /** + * 离职日期 必填:否 YYYY-MM-DD,不能大于当前时间 + */ + private String lzrq; + + /** + * 个人投资总额 必填:条件必填 当为股东投资者时必填 + */ + private BigDecimal grgbze; + /** + * 个人投资比例 必填:否 范围为0~100,不包含0 + */ + private BigDecimal grgbbl; + + /** + * 是否残疾 必填:否 0:否 1:是 + */ + private String sfcj; + + /** + * 是否烈属 必填:否 0:否 1:是 + */ + private String sfls; + + /** + * 是否孤老 必填:否 0:否 1:是 + */ + private String sfgl; + + /** + * 残疾证号 必填:条件必填 + */ + private String cjzh; + + /** + * 烈属证号 必填:条件必填 + */ + private String lszh; + + /** + * 邮箱 必填:否 + */ + private String dzyx; + + /** + * 学历 必填:否 10:研究生 20:大学本科 30:大学本科以下 + */ + private String xl; + + /** + * 职务 必填:否 1:高层 3:普通 + */ + private String zw; + + /** + * 人员状态名称 必填:否 + */ + private String nsrztmc; + + /** + * 性别名称 必填:否 + */ + private String xbmc; + + /** + * 人员地区名称 必填:否 + */ + private String rydqmc; + + /** + * 是否残疾名称 必填:否 + */ + private String sfcjmc; + + /** + * 是否烈属名称 必填:否 + */ + private String sflsmc; + + /** + * 是否孤老名称 必填:否 + */ + private String sfglmc; + + /** + * 学历名称 必填:否 + */ + private String xlmc; + + /** + * 职务名称 必填:否 + */ + private String zwmc; + + /** + * 开户银行 必填:否 + */ + private String khyh; + + /** + * 银行账号 必填:否 + */ + private String yhzh; + + /** + * 居住省份 必填:否 中文,例如浙江省 + */ + private String lxdz_sheng; + + /** + * 居住城市 必填:否 中文,例如杭州市 + */ + private String lxdz_shi; + + /** + * 居住区县 必填:否 中文,例如滨江区 + */ + private String lxdz_qx; + + /** + * 居住街道 必填:否 + */ + private String lxdz_jd; + + /** + * 居住详细地址 必填:否 + */ + private String lxdz; + + /** + * 户籍省份 必填:否 中文,例如浙江省 + */ + private String hjszd_sheng; + + /** + * 户籍城市 必填:否 中文,例如杭州市 + */ + private String hjszd_shi; + + /** + * 户籍区县 必填:否 中文,例如滨江区 + */ + private String hjszd_qx; + + /** + * 户籍街道 必填:否 + */ + private String hjszd_jd; + + /** + * 户籍详细地址 必填:否 + */ + private String hjszd_xxdz; + + /** + * 备注 必填:否 + */ + private String bz; + + /** + * 出生地 必填:条件必填 外籍人员必填,填写出生地国家(地区见国籍字典 + */ + private String csd; + + /** + * 涉税事由 必填:是 ("10","任职受雇")("20","提供临时劳务")("30","转让财产")("40","从事投资和经营活动")("90","其他"), + */ + private String sssx; + + + /** + * 首次入境时间 必填:条件必填 证件类型为港澳居民来往内地通行证、港澳居民居住证、台湾居民来往大陆通行证、台湾居民居住证、外国护照、外国人永久居留身份证、外国人来华工作许可证A、外国人来华工作许可证B、外国人来华工作许可证C时,且任职受雇类型选择雇员时必填,格式YYYY-MM-DD + */ + private String scrjsj; + + /** + * 预计离境时间 必填:条件必填 证件类型为港澳居民来往内地通行证、港澳居民居住证、台湾居民来往大陆通行证、台湾居民居住证、外国护照、外国人永久居留身份证、外国人来华工作许可证A、外国人来华工作许可证B、外国人来华工作许可证C时,且任职受雇类型选择雇员时必填,格式YYYY-MM-DD + */ + private String yjljsj; + + /** + * 联系地省份 必填:否 + */ + private String wjrlxdz_sheng; + + /** + * 联系地城市 必填:否 + */ + private String wjrlxdz_shi; + + /** + * 联系地区县 必填:否 + */ + private String wjrlxdz_qx; + + /** + * 联系地街道 必填:否 + */ + private String wjrlxdz_jd; + + /** + * 联系地详细地址 必填:否 + */ + private String wjrlxdz_xxdz; + + /** + * 中文名 必填:否 证件类型为外国护照、外国人永久居留身份证、外国人工作许可证(A类)、外国人工作许可证(B类)、外国人工作许可证(C类)时不可填写,其他证件类型可填写。如果有填写必须为中文 + */ + private String xmzw; + + /** + * 涉税事项是否扣除减除费用 必填:否 + */ + private String sfzdw; + + } +} diff --git a/src/com/engine/salary/web/EmployeeDeclareController.java b/src/com/engine/salary/web/EmployeeDeclareController.java index 75535d32f..420863bbb 100644 --- a/src/com/engine/salary/web/EmployeeDeclareController.java +++ b/src/com/engine/salary/web/EmployeeDeclareController.java @@ -248,6 +248,21 @@ public class EmployeeDeclareController { return new ResponseResult(user).run(getEmployeeDeclareWrapper(user)::getRate, index); } + /** + * 企业人员列表查询 + * @param request + * @param response + * @param param + * @return + */ + @POST + @Path("/getCompanyEmployee") + @Produces(MediaType.APPLICATION_JSON) + public String getCompanyEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getEmployeeDeclareWrapper(user)::getCompanyEmployee, param); + } + // /** // * 人员报送-导出全部人员 // * diff --git a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java index e42aea3d6..5a5b907f7 100644 --- a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java +++ b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java @@ -5,6 +5,7 @@ import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.cache.SalaryCacheKey; +import com.engine.salary.remote.tax.client.EmployeeClient; import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.employeedeclare.bo.EmployeeDeclareList; @@ -16,6 +17,7 @@ import com.engine.salary.enums.SalaryOnOffEnum; import com.engine.salary.enums.employeedeclare.*; import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.remote.tax.response.employee.GetCompanyEmployeeResponse; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; import com.engine.salary.util.SalaryDateUtil; @@ -538,6 +540,17 @@ public class EmployeeDeclareWrapper extends Service { return getSalaryCacheService(user).get(SalaryCacheKey.EMPLOYEE_DECLARE + index); } + public Object getCompanyEmployee(EmployeeDeclareParam param) { + ValidUtil.doValidator(param); + + EmployeeClient employeeClient = new EmployeeClient(param.getTaxAgentId()); + GetCompanyEmployeeResponse companyEmployee = employeeClient.getCompanyEmployee(param); + + + + return companyEmployee; + } + // /** // * 人员报送-导出本月全部的人员 // * diff --git a/test/ApiDes.java b/test/ApiDes.java new file mode 100644 index 000000000..f2751fe24 --- /dev/null +++ b/test/ApiDes.java @@ -0,0 +1,20 @@ +import com.engine.salary.util.excel.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ApiDes { + @ExcelProperty(index = 0) + public String name; + @ExcelProperty(index = 1) + public String mean; + @ExcelProperty(index = 2) + public String type; + @ExcelProperty(index = 3) + public String required; + @ExcelProperty(index = 4) + public String des; +} diff --git a/test/ParseTaxApi.java b/test/ParseTaxApi.java new file mode 100644 index 000000000..957f424d3 --- /dev/null +++ b/test/ParseTaxApi.java @@ -0,0 +1,55 @@ +import com.engine.salary.util.excel.ExcelParseHelper; +import org.apache.commons.lang3.StringUtils; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.List; + +public class ParseTaxApi { + public static void main(String[] args) { + readExcel("H:\\code\\salary\\resource\\sql\\ApiDes.xlsx"); + } + + + public static void readExcel(String path) { + try { + // 获取文件输入流 + InputStream inputStream = new FileInputStream(path); + + List apiDesList = ExcelParseHelper.parse2Map(inputStream, ApiDes.class, 0, 1, 5, "ApiDes.xlsx"); + + /** + * 字段名称 字段含义 字段类型 必填 说明 + * qtzzlx 其他证件类型 String(64) 条件必填 见证件类型字典 + * + * private String qtzzlx; + */ + + apiDesList.forEach(des -> { + String type = des.getType(); + if(StringUtils.isNotEmpty(type)){ + if(type.startsWith("String")){ + type= "String"; + } + } + + String a = "/** * " + + des.getMean() + +" " + + "必填:" + des.getRequired() + +" " + des.getDes() + + " */" + " private " + type + " " + des.getName() + ";"; + System.out.println(a); + + }); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + +}