Commit 645db83a authored by zhaji's avatar zhaji

"feature-zhaJi:新增与EKP交互流程(调试中)"

parent 2e760999
......@@ -789,5 +789,10 @@ public class InsurancesConstants {
*/
public static final String NO_UPDATE_DETAIL_JURISDICTION = "无更新当前保单信息的权限";
/**
* 保单信息已过期,不能进行出险操作
*/
public static final String INSURANCES_DETAIL_IS_OVERDUE_ERROR = "保单信息已过期,不能进行出险操作";
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EKPInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam;
import org.springframework.core.io.FileSystemResource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.File;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @author zhaji
......@@ -16,39 +25,158 @@ import java.io.File;
*
* @date 2022-08-05 09:42:33
*/
@Slf4j
@Component
public class EKPUtil {
@Getter
public static String url;
@Getter
public static String LoginName;
@Getter
private static String fdModelId;
@Getter
private static String fdFlowId;
@Getter
private static String docStatus;
@Getter
private static String docSubject;
@Value("${ekp.url}")
public void setUrl(String db) {
url = db;
}
@Value("${ekp.LoginName}")
public void setLoginName(String db) {
LoginName = db;
}
@Value("${ekp.fdModelId}")
public void setFdModelId(String db) {
fdModelId = db;
}
@Value("${ekp.fdFlowId}")
public void setFdFlowId(String db) {
fdFlowId = db;
}
@Value("${ekp.docStatus}")
public void setDocStatus(String db) {
docStatus = db;
}
@Value("${ekp.docSubject}")
public void setDocSubject(String db) {
docSubject = db;
}
/**
* 多层级的VO对象,且包含上传功能的样例
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/
public static void testAddNewsInRestTemplate() throws Exception{
public static String sendToEKP(EKPInteractiveParam param){
System.out.println("开始推送EKP");
RestTemplate yourRestTemplate = new RestTemplate();
TInsuranceSettlePushParam formValues = new TInsuranceSettlePushParam();
String jsonObject = new ObjectMapper().writeValueAsString(formValues);
//指向EKP的接口url
String url = "http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel";
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject", new String("接口发起流程".getBytes("UTF-8"),"ISO-8859-1") );
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", 20);
wholeForm.add("fdModelId", "181d73279372e5a55438a47d7436ab7e");
wholeForm.add("fdFlowId", "18267f206233f29cbd3c5ee425c9408a");
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") );
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);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(url, HttpMethod.POST, entity, String.class);
String body = obj.getBody();
System.out.println(body);
}
}
TInsuranceSettlePushParam pushParam = InsuranceDetail2PushParam(param);
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",LoginName);
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("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docCreator", loginData);
wholeForm.add("docStatus", docStatus);
wholeForm.add("fdModelId", fdModelId);
wholeForm.add("fdFlowId", fdFlowId);
//wholeForm.add("formValues", new String(formValues.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") );
System.out.println("wholeForm:"+wholeForm);
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);
//有返回值的情况 VO可以替换成具体的JavaBean
System.out.println("交易开始");
ResponseEntity<String> obj = yourRestTemplate.exchange(url, HttpMethod.POST, entity, String.class);
System.out.println("交易结束");
System.out.println("obj"+obj);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
System.out.println("交易失败"+body);
return body;
}else{
System.out.println("交易成功"+body);
return body;
}
}catch (Exception e){
log.info(e.toString());
return e.getMessage();
}
}
public static TInsuranceSettlePushParam InsuranceDetail2PushParam(EKPInteractiveParam param){
String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
TInsuranceSettlePushParam pushParam = new TInsuranceSettlePushParam();
//单据类型
pushParam.setFd_3adfe6af71a1cc(param.getSettleType());
//项目编码
pushParam.setFd_3adfe658c6229e(param.getDeptNo());
//项目名称
pushParam.setFd_3adfe6592b4158(param.getDeptName());
//客户编码
pushParam.setFd_3adfe6598281e8(param.getCustomerCode());
//客户名称
pushParam.setFd_3adfe7a2688902(param.getCustomerName());
//发生日期
pushParam.setFd_3adfe67c24dace(format);
//姓名
pushParam.setFd_3adfe65d759650(param.getEmpName());
//身份证号
pushParam.setFd_3adfe65dbd9f68(param.getEmpIdcardNo());
//发票号
pushParam.setFd_3adfe65e0cd094(param.getInvoiceNo());
//险种
pushParam.setFd_3adfe65f6599e4(param.getInsuranceTypeName());
//保险公司
pushParam.setFd_3adfe65ea04728(param.getInsuranceCompanyName());
//保单号
pushParam.setFd_3adfe65e60e110(param.getPolicyNo());
//保险开始日期
pushParam.setFd_3adfe6b7e0ede8(param.getPolicyStart().toString());
//保险结束日期
pushParam.setFd_3adfe6b847bfe6(param.getPolicyEnd().toString());
//购买标准
pushParam.setFd_3adfe6d55384c6(param.getBuyStandard());
//实际保费
pushParam.setFd_3adfe6610c0d2c(param.getActualPremium());
//医保
pushParam.setFd_3adfe66041a996(param.getMedicalQuota());
//事故或残疾
pushParam.setFd_3adfe6609aa810(param.getDieDisableQuota());
//预估保费
pushParam.setFd_3adfe6e30f2a3c(param.getEstimatePremium());
//结算月
pushParam.setFd_3aea2f0180eccc(param.getSettleMonth());
return pushParam;
}
}
......@@ -14,7 +14,7 @@ import java.io.Serializable;
@Data
@Tag(name = "项目类")
public class Dept implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 项目编码
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
/**
* @author zhaji
* @description TODO
* @date 2022-08-08 17:59:20
*/
@Data
public class EKP {
@Value("${ekp.url}")
private String url;
@Value("${ekp.fdModelId}")
private String fdModelId;
@Value("${ekp.fdFlowId}")
private String fdFlowId;
@Value("${ekp.docStatus}")
private String docStatus;
@Value("${ekp.docSubject}")
private String docSubject;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* @author zhaji
* @description EKP交互类
* @date 2022-08-09 11:09:12
*/
@Data
public class EKPInteractiveParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 单据类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "单据类型 (0、预估单 1、实缴单)")
private Integer settleType;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 客户编码
*/
@Schema(description = "客户编码")
private String customerCode;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 发生日期
*/
@Schema(description = "发生日期")
private Date happenDate;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保险公司名称(冗余字段)
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private BigDecimal actualPremium;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 单据状态
*/
@Schema(description = "状态:1新增结算单,2作废结算信息,3更新保单信息")
private Integer interactiveType;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.cglib.core.Local;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* @author zhaji
......@@ -11,160 +18,200 @@ import java.time.LocalDate;
* @date 2022-08-05 10:32:16
*/
@Data
public class TInsuranceSettlePushParam {
public class TInsuranceSettlePushParam{
/**
* ID主键 36位
*/
private String fd_id ;
/**
* 单据类型 200 单选(预估单,实缴单,差异单)
* 单据类型 200 单选(1,预估单,2,实缴单,3,差异单)
*/
private String fd_3adfe6af71a1cc;
@Schema(description = "单据类型")
private Integer fd_3adfe6af71a1cc;
/**
* 项目编码 200
*/
@Schema(description = "项目编码")
private String fd_3adfe658c6229e;
/**
* 项目名称 200
*/
@Schema(description = "项目名称")
private String fd_3adfe6592b4158;
/**
* 单号 200
*/
@Schema(description = "单号")
private String fd_3adfe67a9f6364;
/**
* 客户编码 200
*/
@Schema(description = "客户编码")
private String fd_3adfe6598281e8;
/**
* 客户名称 200
*/
@Schema(description = "客户名称")
private String fd_3adfe7a2688902;
/**
* 发生日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe67c24dace;
@Schema(description = "发生日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe67c24dace;
/**
* 姓名 200
*/
@Schema(description = "姓名")
private String fd_3adfe65d759650;
/**
* 身份证号 200
*/
@Schema(description = "身份证号")
private String fd_3adfe65dbd9f68;
/**
* 发票号 200
*/
@Schema(description = "发票号")
private String fd_3adfe65e0cd094;
/**
* 险种 200
*/
@Schema(description = "险种")
private String fd_3adfe65f6599e4;
/**
* 保险公司 200
*/
@Schema(description = "保险公司")
private String fd_3adfe65ea04728;
/**
* 保单号 200
*/
@Schema(description = "保单号")
private String fd_3adfe65e60e110;
/**
* 保险开始日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe6b7e0ede8;
@Schema(description = "保险开始日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe6b7e0ede8;
/**
* 保险结束日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe6b847bfe6;
@Schema(description = "保险结束日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe6b847bfe6;
/**
* 购买标准 精确到小数点后两位
*/
private Double fd_3adfe6d55384c6;
@Schema(description = "购买标准")
private String fd_3adfe6d55384c6;
/**
* 实际保费 精确到小数点后两位
*/
private Double fd_3adfe6610c0d2c;
@Schema(description = "实际保费")
private BigDecimal fd_3adfe6610c0d2c;
/**
* 医保 精确到小数点后两位
*/
private Double fd_3adfe66041a996;
@Schema(description = "医保")
private String fd_3adfe66041a996;
/**
* 事故或残疾 200
*/
@Schema(description = "事故或残疾")
private String fd_3adfe6609aa810;
/**
* 应收 精确到小数点后两位
* 预估保费(应收) 精确到小数点后两位
*/
private Double fd_3adfe6e30f2a3c;
@Schema(description = "预估保费")
private BigDecimal fd_3adfe6e30f2a3c;
/**
* 应收 200 单选(已结算,结算中,未结算)
* 结算状态 200 单选(1未结算,2结算中,3已结算)
*/
@Schema(description = "结算状态")
private String fd_3adfe6ec6a8cbe;
/**
* 收款状态 200 单选(已收,未收)
* 收款状态 200 单选(1未收,2已收)
*/
@Schema(description = "收款状态")
private String fd_3adfe6ef5dfaac;
/**
* 收入结算单号 200
*/
@Schema(description = "收入结算单号")
private String fd_3adfe79fd04606;
/**
* 收款认领单号 200
*/
@Schema(description = "收款认领单号")
private String fd_3adfe7a117f086;
/**
* 应支出 精确到小数点后两位
*/
@Schema(description = "应支出")
private Double fd_3adfe6e3911ffe;
/**
* 支出结算状态 200 单选(已结算,结算中,未结算)
*/
@Schema(description = "支出结算状态")
private String fd_3adfe6eda67236;
/**
* 付款状态 200 单选(已收,未收)
*/
@Schema(description = "付款状态")
private String fd_3adfe6f05531ec;
/**
* 支出结算单号 200
*/
@Schema(description = "支出结算单号")
private String fd_3adfe7a035849c;
/**
* 付款单号 200
*/
@Schema(description = "付款单号")
private String fd_3adfe7a08eba96;
/**
* 结算月份 200
*/
@Schema(description = "结算月份")
private String fd_3aea2f0180eccc;
/**
* 状态 200
*/
@Schema(description = "状态1新增结算单,2作废结算信息,3更新保单信息")
private String fd_3af9197b31071c;
}
......@@ -442,8 +442,8 @@ public class TInsuranceDetailController {
*/
@Operation(summary = "查询项目列表", description = "查询项目列表")
@GetMapping("/deptList")
public R getDeptList() {
return tInsuranceDetailService.getDeptListByUser();
public R getDeptList(){
return tInsuranceDetailService.getDeptList();
}
/**
......
......@@ -42,6 +42,9 @@ import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -2863,7 +2866,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
@Transactional(rollbackFor = Exception.class)
public R<List<RefundExportListVo>> getInsuranceRefundHandlingList(RefundExportListParam param){
YifuUser user = SecurityUtils.getUser();
List<RefundExportListVo> refundExportList;
//todo 根据登录人获取数据权限
......@@ -2901,9 +2903,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceRefund refund = new TInsuranceRefund();
detail.setId(record.getId());
//update状态由「待减员」置为「减员中」
detail.setReduceHandleStatus(CommonConstants.TWO_INT);
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
detail.setReduceHandleStatus(CommonConstants.TWO_INT);
detailList.add(detail);
refund.setInsDetailId(record.getId());
refund.setReduceHandleStatus(CommonConstants.TWO_INT);
......@@ -2917,9 +2918,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
for (TInsuranceDetail s : detailList) {
updateWrapper.eq(TInsuranceDetail :: getId,s.getId())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT)
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
.set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT);
update(updateWrapper);
}
}
......@@ -2973,8 +2972,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}else{
if (CommonConstants.ZERO_INT == deleteFlag ){
tInsuranceDetail.setUpdateTime(LocalDateTime.now());
tInsuranceDetail.setUpdateBy(user.getId());
tInsuranceDetail.setReduceHandleStatus(refundType);
if(CommonConstants.FOUR_INT == refundType){
tInsuranceDetail.setIsOverdue(null);
......@@ -2983,8 +2980,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else {
tInsuranceDetail.setBuyHandleStatus(CommonConstants.THREE_INT);
}
tInsuranceDetail.setUpdateTime(LocalDateTime.now());
successList.add(tInsuranceDetail);
//新增减员记录
//更新减员记录
refund.setInsDetailId(tInsuranceDetail.getId());
refund.setCreateBy(user.getId());
refund.setCreateTime(LocalDateTime.now());
......@@ -3019,33 +3017,53 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Transactional(rollbackFor = Exception.class)
@Override
public R settleMonthChange(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
//初始化线程池
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(settleMonthCheckList)){
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList,user);
//todo 生成EKP通知,通知ekp变更结算月份
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
if(CollectionUtils.isNotEmpty(successList)){
for (SettleMonthChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail ::getId,success.getId())
.set(TInsuranceDetail :: getSettleMonth,success.getSettleMonth())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(success.getId());
insuranceOperate.setCreateBy(user.getId());
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
List<EKPInteractiveParam> deptDetail = getDeptDetail(successList);
for (EKPInteractiveParam ekpInteractiveParam : deptDetail) {
threadPool.execute(() -> {
TInsuranceDetail byId = getById(ekpInteractiveParam.getId());
BeanCopyUtils.copyProperties(byId,ekpInteractiveParam);
String body = EKPUtil.sendToEKP(ekpInteractiveParam);
System.out.println("变更成功后的id为:"+body);
if (!StringUtils.isBlank(body)){
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail ::getId,ekpInteractiveParam.getId())
.set(TInsuranceDetail :: getSettleMonth,ekpInteractiveParam.getSettleMonth())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(ekpInteractiveParam.getId());
insuranceOperate.setCreateBy(user.getId());
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
System.out.println("返回的id为:"+body);
}else{
System.out.println("更新EKP结算月份失败");
for (SettleMonthChangeCheckParam success: successList ){
if(success.getId().equals(ekpInteractiveParam.getId())){
success.setErrorMessage("更新EKP结算月份失败");
errorList.add(success);
}
}
}
});
}
}
tInsuranceOperateService.saveBatch(operateList);
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
return R.ok(errorList,"导入成功");
}
......@@ -3066,9 +3084,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList,user);
//todo 生成EKP通知,通知ekp变更结算所属项目
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
List<TInsuranceOperate> operateList = new ArrayList<>(16);
List<TInsuranceDetail> detailList = new ArrayList<>(16);
if(CollectionUtils.isNotEmpty(successList)){
for (DeptChangeCheckParam success : successList) {
TInsuranceDetail one = getOne(lambdaQuery().getWrapper().eq(TInsuranceDetail::getId, success.getId()));
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
Integer oldSettleType = success.getOldSettleType();
Integer newSettleType = success.getNewSettleType();
......@@ -3375,38 +3395,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.DEPT_CHANGE);
operateList.add(insuranceOperate);
detailList.add(one);
}
}
tInsuranceOperateService.saveBatch(operateList);
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
try{
EKPUtil.testAddNewsInRestTemplate();
}catch (Exception e){
System.out.println(e.getMessage());
}
//EKPUtil.testAddNewsInRestTemplate(detailList);
return R.ok(errorList,"导入成功");
}
/**
* 发送变更结算月至EKP
*
* @author zhaji
* @param successList
* @return void
*/
private void updateMonth2EKP(List<DeptChangeCheckParam> successList) {
for (DeptChangeCheckParam param : successList) {
String newDeptNo = param.getNewDeptNo();
String oldDeptNo = param.getOldDeptNo();
Integer newSettleType = param.getNewSettleType();
Integer oldSettleType = param.getOldSettleType();
String defaultSettleId = param.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId) && CommonConstants.ZERO_INT == newSettleType){
}
}
}
/**
* 发送变更项目至EKP
*
......@@ -3414,16 +3411,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param successList
* @return void
*/
private void updateDept2EKP(List<DeptChangeCheckParam> successList) {
for (DeptChangeCheckParam param : successList) {
String newDeptNo = param.getNewDeptNo();
String oldDeptNo = param.getOldDeptNo();
Integer newSettleType = param.getNewSettleType();
Integer oldSettleType = param.getOldSettleType();
String defaultSettleId = param.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId) && CommonConstants.ZERO_INT == newSettleType){
private void updateDeptNo2EKP(List<TInsuranceDetail> successList) {
for (TInsuranceDetail param : successList) {
}
}
}
......@@ -3630,7 +3620,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail :: getInsuranceTypeName,insuranceTypeName)
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart))
.eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd))
.orderByDesc(TInsuranceDetail::getCreateTime)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL);
List<TInsuranceDetail> list = list(queryWrapper);
if (list.size()>1){
......@@ -3801,6 +3791,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String,List<SettleMonthChangeCheckParam>> map = new HashMap<>(16);
List<SettleMonthChangeCheckParam> errorList = new ArrayList<>();
List<SettleMonthChangeCheckParam> successList = new ArrayList<>();
List<EKPInteractiveParam> ekpList = new ArrayList<>();
for (SettleMonthChangeCheckParam param : settleMonthCheckList) {
//员工姓名
String empName = param.getEmpName();
......@@ -3823,6 +3814,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//项目所属权限验证
if(!deptNoList.stream().anyMatch(u ->u.equals(deptNo))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
errorList.add(param);
......@@ -3903,7 +3895,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail :: getInsuranceTypeName,insuranceTypeName)
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart) )
.eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd))
.orderByDesc(TInsuranceDetail::getCreateTime)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL);
List<TInsuranceDetail> list = list(queryWrapper);
if (list.size()>1){
......@@ -3993,6 +3985,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
param.setId(insuranceDetail.getId());
EKPInteractiveParam ekpInteractiveParam = new EKPInteractiveParam();
BeanCopyUtils.copyProperties(insuranceDetail,ekpInteractiveParam);
ekpInteractiveParam.setSettleMonth(settleMonth);
ekpList.add(ekpInteractiveParam);
successList.add(param);
}
map.put("errorList",errorList);
......@@ -4152,7 +4148,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName)
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart))
.eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd))
.orderByDesc(TInsuranceDetail::getCreateTime)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL);
List<TInsuranceDetail> list = list(queryWrapper);
if (list.size()>1){
......@@ -4279,7 +4275,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R getDeptList(){
List<Dept> deptList = new ArrayList<>();
List<TInsuranceDetail> detailList = new ArrayList<>();
//EKPUtil.testAddNewsInRestTemplate(detailList);
/* List<Dept> deptList = new ArrayList<>();
R<TSettleDomainListVo> tSettleDomainListVoR = archivesDaprUtil.selectAllSettleDomainSelectVos();
if (null != tSettleDomainListVoR && tSettleDomainListVoR.getCode() == CommonConstants.SUCCESS && Common.isNotNull(tSettleDomainListVoR.getData())) {
TSettleDomainListVo data = tSettleDomainListVoR.getData();
......@@ -4292,7 +4290,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
return R.ok(deptList);
return R.ok(deptList);*/
return R.ok();
}
/**
......@@ -4426,5 +4425,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return sql;
}
/**
* 获取项目名称,客户编码,客户名称
*
* @author zhaji
* @param list
* @return {@link List< EKPInteractiveParam>}
*/
public List<EKPInteractiveParam> getDeptDetail(List<SettleMonthChangeCheckParam> list){
//根据项目编码获取项目名称
List<String> collect = list.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<EKPInteractiveParam> ekpInteractiveParams = new ArrayList<>();
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
EKPInteractiveParam ekpInteractiveParam = new EKPInteractiveParam();
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (SettleMonthChangeCheckParam param : list) {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
ekpInteractiveParam.setId(param.getId());
ekpInteractiveParam.setDeptName(projectSetInfoVo.getDepartName());
ekpInteractiveParam.setCustomerName(projectSetInfoVo.getCustomerName());
ekpInteractiveParam.setCustomerCode(projectSetInfoVo.getCustomerCode());
ekpInteractiveParams.add(ekpInteractiveParam);
}
}
return ekpInteractiveParams;
}
}
......@@ -15,3 +15,10 @@ spring:
username: root
password: yf_zsk
url: jdbc:mysql://192.168.1.65:22306/mvp_insurances?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
ekp:
url: http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
fdModelId: '181d73279372e5a55438a47d7436ab7e'
fdFlowId: '18267f206233f29cbd3c5ee425c9408a'
docStatus: '20'
LoginName: 'admin'
docSubject : '接口发起流程'
\ No newline at end of file
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