人员服务客户端

This commit is contained in:
钱涛 2023-10-11 18:24:02 +08:00
parent 59f24d3a14
commit 7368363631
10 changed files with 620 additions and 1 deletions

View File

@ -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

View File

@ -38,6 +38,11 @@ public class TaxAgentTaxReturnPO implements Serializable {
*/
private Long taxAgentId;
/**
* 企业名称
*/
private Long taxAgentName;
/**
* 税号
*/

View File

@ -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;
/**
* 人员信息登记报送服务
* <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();
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<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);
}
}

View File

@ -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;
/**
* 人员信息登记报送服务
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @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;
}
}

View File

@ -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;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密
*/
private String jmsbmm;
/**
* 实名账号 必填
*/
private String smzh;
/**
* 实名密码 必填
*/
private String smmm;
/**
* 加密实名密码 必填 默认不传则设置为00表示不加密1表示加密 参考3.4代报实名密码加密说明
*/
private String jmsmmm;
/**
* 密码类型 必填 0表示申报密码 2表示实名账号实名密码
*/
private String mmlx;
/**
* 所属月份 必填 格式YYYYMM年
*/
private String ssyf;
/**
* 页码 必填 大于0
*/
private String pageNo;
/**
* 数量 必填 大于0
*/
private String pageSize;
}

View File

@ -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<Employee> 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;
}
}

View File

@ -248,6 +248,21 @@ public class EmployeeDeclareController {
return new ResponseResult<String, EmployeeDeclareRateDTO>(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<EmployeeDeclareParam, Object>(user).run(getEmployeeDeclareWrapper(user)::getCompanyEmployee, param);
}
// /**
// * 人员报送-导出全部人员
// *

View File

@ -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;
}
// /**
// * 人员报送-导出本月全部的人员
// *

20
test/ApiDes.java Normal file
View File

@ -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;
}

55
test/ParseTaxApi.java Normal file
View File

@ -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<ApiDes> 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();
}
}
}