Commit d9e5f5d3 authored by hongguangwu's avatar hongguangwu

收入优化

parent 7214fabe
......@@ -5,6 +5,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpIncomeProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.log4j.Log4j2;
import org.codehaus.jackson.map.ObjectMapper;
......@@ -29,13 +31,12 @@ public class EkpIncomeUtil {
/**
* @param param 内容传参
* @param type 1:管理费2:风险金
* @Description:
* @Author: hgw
* @Date: 2022/9/5 16:12
* @return: java.lang.String
**/
public String sendToEKP(EkpIncomeParam param, String type) {
public String sendToEkpManage(EkpIncomeParamManage param) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
......@@ -48,13 +49,45 @@ public class EkpIncomeUtil {
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
if (CommonConstants.ONE_STRING.equals(type)) {
wholeForm.add("fdModelId", ekpProperties.getFdModelIdManage());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdManage());
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword") 是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(wholeForm, headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return null;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
}
}
public String sendToEkpRisk(EkpIncomeParamRisk param) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
String formValues = new ObjectMapper().writeValueAsString(param);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName", ekpProperties.getLoginName());
MultiValueMap<String, Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelIdRisk());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdRisk());
}
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
......
package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
......@@ -12,7 +13,6 @@ import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import cn.hutool.json.JSONObject;
/**
* @Author fxj
......@@ -35,25 +35,23 @@ public class EkpSalaryUtil {
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",ekpProperties.getLoginName());
String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") )
wholeForm.add("docSubject",ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
//wholeForm.add("docCreator", loginData);
//wholeForm.add("docCreator", loginData)
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowId());
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"))
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
System.out.println("wholeForm:"+wholeForm);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") )
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
......
......@@ -48,14 +48,6 @@ public class EkpIncomeParam implements Serializable {
* 身份证号
**/
private String fd_3adfef94dcdbb4;
/**
* 生成月份
**/
private String fd_3ae0c3032cffc8;
/**
* 结算月份
**/
private String fd_3ae0c3044e5958;
/**
* 管理费、风险金金额
**/
......@@ -72,12 +64,4 @@ public class EkpIncomeParam implements Serializable {
* 收款状态
**/
private String fd_3adfefaaef583e;
/**
* 结算单号
**/
private String fd_3aead7204bb594;
/**
* 收款单号
**/
private String fd_3aeae59b70fe5a;
}
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
/**
* @Author hgw
* @Date 2022-9-6 15:06:24
* @Description 收入明细对应参数
* @Version 1.0
*/
@Data
public class EkpIncomeParamManage extends EkpIncomeParam {
/**
* 生成月份
**/
private String fd_3ae0c23b2e9a92;
/**
* 结算月份
**/
private String fd_3ae0c23cb3fccc;
/**
* 结算单号
**/
private String fd_3aead3c68b1078;
/**
* 收款单号
**/
private String fd_3aeae58b14691c;
}
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
/**
* @Author hgw
* @Date 2022-9-6 15:06:24
* @Description 收入明细对应参数
* @Version 1.0
*/
@Data
public class EkpIncomeParamRisk extends EkpIncomeParam {
/**
* 生成月份
**/
private String fd_3ae0c3032cffc8;
/**
* 结算月份
**/
private String fd_3ae0c3044e5958;
/**
* 结算单号
**/
private String fd_3aead7204bb594;
/**
* 收款单号
**/
private String fd_3aeae59b70fe5a;
}
income.url=http://119.96.227.251.8080/api/sys-modeling/appModelRestService/addModel
income.url=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
income.fdModelIdManage=181d76db26e419a88dba97b0c406689e
income.fdFlowIdManage=182d3b6e522b2690119e70d4ff082136
income.fdModelIdRisk=181d76db26e419a88dba97b0c406689e
income.fdFlowIdRisk=182d3b6e522b2690119e70d4ff082136
income.fdModelIdRisk=181d76db26e4112e14b9bb4274d06ba1
income.fdFlowIdRisk=182d3bdadab3a52be024e154e99b5f8b
income.docStatus=20
income.loginName=admin
income.docSubject=\u6536\u5165\u660E\u7EC6\u6570\u636E\u63A5\u53E3
......
......@@ -444,7 +444,7 @@
<!-- 获取薪资明细 -->
<select id="getEkpSalaryParamList" resultMap="ekpSalaryParamVoMap">
select
a.id fd_id
a.id
,ifnull(a.DEPT_NO,'') fd_3adfedf98ccba2
,ifnull(a.DEPT_NAME,'') fd_3adfedf9d2bf1c
,'' fd_3adfedfa4410aa
......@@ -462,16 +462,16 @@
,if(a.FUND_PRIORITY='1','缴纳月','生成月') fd_3adfedff3a7430
,if(a.OWN_FLAG='1','是','否') fd_3adfee0009d070
,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') fd_3adfee01dea2fa
,ifnull(a.RELAY_SALARY,'') fd_3adfee12cb8840
,ifnull(pdeduction.SALARY_MONEY,'') fd_3adfee1374ed7a
,ifnull(a.RELAY_SALARY,'0') fd_3adfee12cb8840
,ifnull(pdeduction.SALARY_MONEY,'0') fd_3adfee1374ed7a
,ifnull(ifnull(withholidingUnitSocial.SALARY_MONEY,unitSocial.SALARY_MONEY),'') fd_3adfee1e2b2f78
,ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'') fd_3adfee1e88723e
,ifnull(ifnull(withholidingUnitFund.SALARY_MONEY,unitFund.SALARY_MONEY),'') fd_3adfee1ee24680
,ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'') fd_3adfee1f32fa24
,ifnull(a.SALARY_TAX,'') fd_3adfee1f901c46
,ifnull(a.SALARY_TAX,'0') fd_3adfee1f901c46
,'' fd_3adfee1ff1ca6a
,'' fd_3adfee203f86b2
,ifnull(a.ACTUAL_SALARY,'') fd_3adfee20fe5ba4
,ifnull(a.ACTUAL_SALARY,'0') fd_3adfee20fe5ba4
,'' fd_3adfee21802434
,'' fd_3adfee4ba5ad36
,'' fd_3adfee4c0c59ee
......
......@@ -32,6 +32,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpIncomeUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
......@@ -272,10 +274,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
public void pushDetail() {
List<TIncome> list = baseMapper.selectList(Wrappers.<TIncome>query().lambda()
.eq(TIncome::getSendStatus, CommonConstants.ZERO_STRING));
String sendBack;
for (TIncome income : list) {
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
......@@ -286,15 +287,34 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
/**
* @param income
* @Description: 判断类型发送
* @Author: hgw
* @Date: 2022/9/6 15:15
* @return: java.lang.String
**/
private String getSendBack(TIncome income) {
String sendBack;
if (CommonConstants.ONE_STRING.equals(income.getFeeType())) {
EkpIncomeParamManage sendParam = new EkpIncomeParamManage();
this.copyToEkpManage(income, sendParam);
sendBack = ekpIncomeUtil.sendToEkpManage(sendParam);
} else {
EkpIncomeParamRisk sendParam = new EkpIncomeParamRisk();
this.copyToEkpRisk(income, sendParam);
sendBack = ekpIncomeUtil.sendToEkpRisk(sendParam);
}
return sendBack;
}
// 复制并保存
private boolean saveIncome(TIncomeDetail tIncomeDetail) {
TIncome income = new TIncome();
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
......@@ -312,7 +332,68 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/9/5 16:57
* @return: void
**/
private void copyToEkp(TIncome income, EkpIncomeParam sendParam) {
private void copyToEkpManage(TIncome income, EkpIncomeParamManage sendParam) {
// 项目编码
sendParam.setFd_3adfef5e5b9d34(income.getDeptNo());
// 项目名称
sendParam.setFd_3adfef5eb6691c(income.getDeptName());
// 单号
sendParam.setFd_3adfef7f5d2b52("");
// 客户编码
sendParam.setFd_3adfef80202ab2(income.getUnitNo());
// 客户名称
sendParam.setFd_3adfef7fc1c886(income.getUnitName());
// 类型:单选(人,人次,比例,固定值,总额)
// feeMode收费方式:1按比例2金额-人数3金额-人次
if (CommonConstants.ONE_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("比例");
} else if (CommonConstants.TWO_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("人");
} else {
sendParam.setFd_3adda3037e3bda("人次");
}
// 产生来源:单选(社保,工资,商险)
// sourceType1社保2公积金3商险4薪资
if (CommonConstants.THREE_STRING.equals(income.getSourceType())) {
sendParam.setFd_3adda320daef5a("商险");
} else if (CommonConstants.FOUR_STRING.equals(income.getSourceType())) {
sendParam.setFd_3adda320daef5a("工资");
} else {
sendParam.setFd_3adda320daef5a("社保");
}
// 姓名
sendParam.setFd_3adfef948da848(income.getEmpName());
// 身份证号
sendParam.setFd_3adfef94dcdbb4(income.getEmpIdcard());
// 生成月份
if (Common.isEmpty(income.getCreateMonth()) || income.getCreateMonth().length() != 6) {
sendParam.setFd_3ae0c23b2e9a92("1970-02");
} else {
sendParam.setFd_3ae0c23b2e9a92(income.getCreateMonth().substring(0, 4)
+ CommonConstants.CENTER_SPLIT_LINE_STRING + income.getCreateMonth().substring(4, 6));
}
// 结算月份
if (Common.isEmpty(income.getPayMonth()) || income.getPayMonth().length() != 6) {
sendParam.setFd_3ae0c23cb3fccc("1970-02");
} else {
sendParam.setFd_3ae0c23cb3fccc(income.getPayMonth().substring(0, 4)
+ CommonConstants.CENTER_SPLIT_LINE_STRING + income.getPayMonth().substring(4, 6));
}
// 管理费、风险金金额
sendParam.setFd_3adfef963bae28(String.valueOf(income.getMoney()));
// 应收
sendParam.setFd_3adfefa3daae72(String.valueOf(income.getMoney()));
// 结算状态
sendParam.setFd_3adfefaaa3bbd0("未结算");
// 收款状态
sendParam.setFd_3adfefaaef583e("未收");
// 结算单号
sendParam.setFd_3aead3c68b1078("");
// 收款单号
sendParam.setFd_3aeae58b14691c("");
}
private void copyToEkpRisk(TIncome income, EkpIncomeParamRisk sendParam) {
// 项目编码
sendParam.setFd_3adfef5e5b9d34(income.getDeptNo());
// 项目名称
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment