Commit 0ee7e8ff authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

Feature zhaji

See merge request fangxinjiang/yifu!215
parents f3a03fb5 d5222570
package com.yifu.cloud.plus.v1.yifu.ekp.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @author zhaji
* @description TODO
* @date 2022-08-31 08:57:02
*/
@Data
@Component
@PropertySource("classpath:ekpInsuranceConfig.properties")
@ConfigurationProperties(value = "insurance",ignoreInvalidFields = false)
public class EkpInsuranceProperties {
String insuranceUrl;
String insuranceFdModelId;
String insuranceFdFlowId;
String insuranceDocStatus;
String insuranceLoginName;
String insuranceFocSubject;
}
...@@ -30,15 +30,4 @@ public class EkpSalaryProperties { ...@@ -30,15 +30,4 @@ public class EkpSalaryProperties {
String docSubject; String docSubject;
String insuranceUrl;
String insuranceFdModelId;
String insuranceFdFlowId;
String insuranceDocStatus;
String insuranceLoginName;
String insuranceFocSubject;
} }
...@@ -3,15 +3,14 @@ package com.yifu.cloud.plus.v1.yifu.ekp.util; ...@@ -3,15 +3,14 @@ package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpSalaryProperties; import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpInsuranceProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EKPInsurancePushParam; import com.yifu.cloud.plus.v1.yifu.ekp.vo.EKPInsurancePushParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EKPInteractiveParam; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam; import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -28,17 +27,17 @@ import java.time.format.DateTimeFormatter; ...@@ -28,17 +27,17 @@ import java.time.format.DateTimeFormatter;
* @date 2022-08-05 09:42:33 * @date 2022-08-05 09:42:33
*/ */
@Slf4j @Slf4j
@EnableConfigurationProperties(EkpSalaryProperties.class) @EnableConfigurationProperties(EkpInsuranceProperties.class)
public class EKPInsuranceUtil { public class EkpInsuranceUtil {
@Resource @Resource
private EkpSalaryProperties ekpProperties; private EkpInsuranceProperties ekpInsuranceProperties;
/** /**
* 多层级的VO对象,且包含上传功能的样例 * 多层级的VO对象,且包含上传功能的样例
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"] * 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/ */
public String sendToEKP(EKPInteractiveParam param){ public String sendToEkp(EkpInteractiveParam param){
log.info("推送EKP开始"); log.info("推送EKP开始");
RestTemplate yourRestTemplate = new RestTemplate(); RestTemplate yourRestTemplate = new RestTemplate();
EKPInsurancePushParam pushParam = insuranceDetail2PushParam(param); EKPInsurancePushParam pushParam = insuranceDetail2PushParam(param);
...@@ -48,16 +47,16 @@ public class EKPInsuranceUtil { ...@@ -48,16 +47,16 @@ public class EKPInsuranceUtil {
//指向EKP的接口url //指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap //把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject(); JSONObject loginName = new JSONObject();
loginName.append("LoginName",ekpProperties.getInsuranceLoginName()); loginName.append("LoginName",ekpInsuranceProperties.getInsuranceLoginName());
String loginData = new ObjectMapper().writeValueAsString(loginName); String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>(); 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.getInsuranceFocSubject()); wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceFocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}"); wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
//wholeForm.add("docCreator", loginData); //wholeForm.add("docCreator", loginData);
wholeForm.add("docStatus", ekpProperties.getInsuranceDocStatus()); wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpProperties.getInsuranceFdModelId()); wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getInsuranceFdFlowId()); wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceFdFlowId());
//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", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") ); //wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
...@@ -69,7 +68,7 @@ public class EKPInsuranceUtil { ...@@ -69,7 +68,7 @@ public class EKPInsuranceUtil {
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果 //必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers); HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean //有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class); ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
log.info("obj:"+obj); log.info("obj:"+obj);
String body = obj.getBody(); String body = obj.getBody();
if (StringUtils.isBlank(body)){ if (StringUtils.isBlank(body)){
...@@ -92,7 +91,7 @@ public class EKPInsuranceUtil { ...@@ -92,7 +91,7 @@ public class EKPInsuranceUtil {
* @param param 转换类 * @param param 转换类
* @return {@link TInsuranceSettlePushParam} * @return {@link TInsuranceSettlePushParam}
*/ */
public static EKPInsurancePushParam insuranceDetail2PushParam(EKPInteractiveParam param){ public static EKPInsurancePushParam insuranceDetail2PushParam(EkpInteractiveParam param){
String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
EKPInsurancePushParam pushParam = new EKPInsurancePushParam(); EKPInsurancePushParam pushParam = new EKPInsurancePushParam();
param.setHappenDate(format); param.setHappenDate(format);
......
insurance.insuranceUrl=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
insurance.insuranceFdModelId=181d73279372e5a55438a47d7436ab7e
insurance.insuranceFdFlowId=18267f206233f29cbd3c5ee425c9408a
insurance.insuranceDocStatus=20
insurance.insuranceLoginName=admin
insurance.insuranceFocSubject=\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3
...@@ -4,11 +4,5 @@ ekp.fdFlowId=182b40249c1bc940d7226b941c7a4183 ...@@ -4,11 +4,5 @@ ekp.fdFlowId=182b40249c1bc940d7226b941c7a4183
ekp.docStatus=20 ekp.docStatus=20
ekp.LoginName=admin ekp.LoginName=admin
ekp.docSubject=\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3 ekp.docSubject=\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3
ekp.insuranceUrl=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
ekp.insuranceFdModelId=181d73279372e5a55438a47d7436ab7e
ekp.insuranceFdFlowId=18267f206233f29cbd3c5ee425c9408a
ekp.insuranceDocStatus=20
ekp.insuranceLoginName=admin
ekp.insuranceFocSubject='??????'
...@@ -15,7 +15,7 @@ import java.time.LocalDate; ...@@ -15,7 +15,7 @@ import java.time.LocalDate;
* @date 2022-08-09 11:09:12 * @date 2022-08-09 11:09:12
*/ */
@Data @Data
public class EKPInteractiveParam implements Serializable { public class EkpInteractiveParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L; private static final long serialVersionUID = -2689686777914935788L;
......
...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; ...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EKPInsuranceUtil; import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants; import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEkp; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEkp;
...@@ -17,12 +17,11 @@ import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceEkpSer ...@@ -17,12 +17,11 @@ import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceEkpSer
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleService; import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils; import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils; import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EKPInteractiveParam; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,7 +41,7 @@ import java.util.List; ...@@ -42,7 +41,7 @@ import java.util.List;
public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, TInsuranceEkp> implements TInsuranceEkpService { public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, TInsuranceEkp> implements TInsuranceEkpService {
@Resource @Resource
EKPInsuranceUtil eKPInsuranceUtil; EkpInsuranceUtil eKPInsuranceUtil;
@Resource @Resource
TInsuranceSettleService tInsuranceSettleService; TInsuranceSettleService tInsuranceSettleService;
...@@ -84,10 +83,10 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T ...@@ -84,10 +83,10 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
failList.add(tInsuranceEkp); failList.add(tInsuranceEkp);
continue; continue;
} }
EKPInteractiveParam ekpParam = new EKPInteractiveParam(); EkpInteractiveParam ekpParam = new EkpInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam); BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
if(actualStatus.equals(InsurancesConstants.SETTLE_ZERO)){ if(actualStatus.equals(InsurancesConstants.SETTLE_ZERO)){
String s = eKPInsuranceUtil.sendToEKP(ekpParam); String s = eKPInsuranceUtil.sendToEkp(ekpParam);
//如果发送成功 //如果发送成功
if (StringUtils.isNotBlank(s)){ if (StringUtils.isNotBlank(s)){
//预估则更新预估保费 //预估则更新预估保费
...@@ -134,7 +133,7 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T ...@@ -134,7 +133,7 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
ekpParam.setActualPremium(actualPremium.negate()); ekpParam.setActualPremium(actualPremium.negate());
} }
ekpParam.setInteractiveType(CommonConstants.ONE_INT); ekpParam.setInteractiveType(CommonConstants.ONE_INT);
String s = eKPInsuranceUtil.sendToEKP(ekpParam); String s = eKPInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){ if(StringUtils.isNotBlank(s)){
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT); tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp); successLit.add(tInsuranceEkp);
...@@ -143,7 +142,7 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T ...@@ -143,7 +142,7 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
} }
//如果为红冲数据则正常发送 //如果为红冲数据则正常发送
}else if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){ }else if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
String s = eKPInsuranceUtil.sendToEKP(ekpParam); String s = eKPInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){ if(StringUtils.isNotBlank(s)){
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT); tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp); successLit.add(tInsuranceEkp);
......
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