Commit 0b4b7931 authored by huyuchen's avatar huyuchen

商险优化修改

parent 9b58c4ca
...@@ -1148,6 +1148,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1148,6 +1148,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//操作日志对象 //操作日志对象
List<InsuranceHandleParam> operateList = new ArrayList<>(); List<InsuranceHandleParam> operateList = new ArrayList<>();
//根据id获取所有的商险明细
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList); List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据 //返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>(); List<InsuranceListVO> errorList = new ArrayList<>();
...@@ -1160,6 +1161,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1160,6 +1161,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(detailList)){ if (CollectionUtils.isNotEmpty(detailList)){
TInsuranceReplace one; TInsuranceReplace one;
TInsuranceDetail byId; TInsuranceDetail byId;
List<TInsuranceDetail> updList = new ArrayList<>();
List<TInsuranceReplace> replaceList = new ArrayList<>();
for (TInsuranceDetail detail : detailList) { for (TInsuranceDetail detail : detailList) {
if (detail.getBuyHandleStatus() == CommonConstants.FOUR_INT if (detail.getBuyHandleStatus() == CommonConstants.FOUR_INT
|| detail.getBuyHandleStatus() == CommonConstants.FIVE_INT){ || detail.getBuyHandleStatus() == CommonConstants.FIVE_INT){
...@@ -1187,13 +1190,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1187,13 +1190,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Optional.ofNullable(one).isPresent()){ if (Optional.ofNullable(one).isPresent()){
//替换记录变为失败 //替换记录变为失败
one.setReplaceStatus(CommonConstants.ZERO_INT); one.setReplaceStatus(CommonConstants.ZERO_INT);
tInsuranceReplaceService.updateById(one); replaceList.add(one);
byId = this.getById(one.getFromInsuranceDetailId()); byId = this.getById(one.getFromInsuranceDetailId());
if (Optional.ofNullable(byId).isPresent()){ if (Optional.ofNullable(byId).isPresent()){
//被替换者激活 //被替换者激活
byId.setIsEffect(CommonConstants.ZERO_INT); byId.setIsEffect(CommonConstants.ZERO_INT);
byId.setIsOverdue(CommonConstants.ZERO_INT); byId.setIsOverdue(CommonConstants.ZERO_INT);
this.updateById(byId); updList.add(byId);
} }
} }
} }
...@@ -1215,10 +1218,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1215,10 +1218,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
replaceIdList.add(detail.getId()); replaceIdList.add(detail.getId());
} }
} }
//批量更新商险和替换表
if (!updList.isEmpty()) {
this.updateBatchById(updList);
updList.clear();
}
if (!replaceList.isEmpty()) {
tInsuranceReplaceService.updateBatchById(replaceList);
replaceList.clear();
}
} }
if (CollectionUtils.isNotEmpty(successList)){ if (CollectionUtils.isNotEmpty(successList)){
TInsuranceSettle settle; TInsuranceSettle settle;
SettleVo settleVo; SettleVo settleVo;
R<TIncomeDetailReturnVo> incomeDetailList;
for (TInsuranceDetail detail : successList) { for (TInsuranceDetail detail : successList) {
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){ if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
settle = tInsuranceSettleService.getById(detail.getDefaultSettleId()); settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
...@@ -1286,7 +1299,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1286,7 +1299,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
//已投保退回,收入数据同步处理 //已投保退回,收入数据同步处理
try{ try{
updateInsuranceInfo(detail); TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
incomeDetailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(incomeDetailList) && incomeDetailList.getCode() == CommonConstants.SUCCESS) {
for (TIncomeDetail detailIncome : incomeDetailList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailIncome, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detail1.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
}
}
}catch (Exception e){ }catch (Exception e){
log.error("收入数据同步处理失败:"+e); log.error("收入数据同步处理失败:"+e);
} }
...@@ -1333,7 +1358,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1333,7 +1358,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceHandleImportParam> collectSuccess = successList.stream().filter(e -> InsurancesConstants.SUCCESS.equals(e.getHandType())).collect(Collectors.toList()); List<InsuranceHandleImportParam> collectSuccess = successList.stream().filter(e -> InsurancesConstants.SUCCESS.equals(e.getHandType())).collect(Collectors.toList());
//投保退回的数据 //投保退回的数据
List<InsuranceHandleImportParam> collectRollBack = successList.stream().filter(e -> InsurancesConstants.FAILED.equals(e.getHandType())).collect(Collectors.toList()); List<InsuranceHandleImportParam> collectRollBack = successList.stream().filter(e -> InsurancesConstants.FAILED.equals(e.getHandType())).collect(Collectors.toList());
successList.clear();
//投保成功 //投保成功
if (CollectionUtils.isNotEmpty(collectSuccess)){ if (CollectionUtils.isNotEmpty(collectSuccess)){
List<InsuranceHandleParam> list = new ArrayList<>(); List<InsuranceHandleParam> list = new ArrayList<>();
...@@ -1343,6 +1368,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1343,6 +1368,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
handleParam.setRemark(e.getRemark()); handleParam.setRemark(e.getRemark());
list.add(handleParam); list.add(handleParam);
}); });
collectSuccess.clear();
// 关联档案1 // 关联档案1
this.successfulInsurance(user,list); this.successfulInsurance(user,list);
} }
...@@ -1356,6 +1382,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1356,6 +1382,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
handleParam.setRemark(e.getRemark()); handleParam.setRemark(e.getRemark());
list.add(handleParam); list.add(handleParam);
}); });
collectRollBack.clear();
// 关联档案2 // 关联档案2
this.rollBackInsurance(user,list); this.rollBackInsurance(user,list);
} }
...@@ -1475,10 +1502,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1475,10 +1502,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setEstimatePremium(estimatePremium); settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1 //调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ZERO_INT); settle.setIsEstimatePush(CommonConstants.ZERO_INT);
String settleId = RandomStringUtils.randomNumeric(19); settle.setId(RandomStringUtils.randomNumeric(19));
settle.setId(settleId);
settleList.add(settle); settleList.add(settle);
detail.setDefaultSettleId(settleId); detail.setDefaultSettleId(settle.getId());
successTwo.add(detail); successTwo.add(detail);
//生成收入数据 //生成收入数据
createInsuranceInfo(detail,settleDomain); createInsuranceInfo(detail,settleDomain);
...@@ -1512,10 +1538,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1512,10 +1538,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setIsEstimatePush(CommonConstants.ONE_INT); settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now()); settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now()); settle.setCreateTime(LocalDateTime.now());
String settleId = RandomStringUtils.randomNumeric(19); settle.setId(RandomStringUtils.randomNumeric(19));
settle.setId(settleId);
settleList.add(settle); settleList.add(settle);
detail.setDefaultSettleId(settleId); detail.setDefaultSettleId(settle.getId());
successTwo.add(detail); successTwo.add(detail);
//生成收入数据 //生成收入数据
createInsuranceInfo(detail,settleDomain); createInsuranceInfo(detail,settleDomain);
...@@ -4805,26 +4830,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -4805,26 +4830,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
update(updateWrapper); update(updateWrapper);
//更换项目更新收入 //更换项目更新收入
TInsuranceDetail income = getOne(lambdaQuery().getWrapper().eq(TInsuranceDetail::getId, success.getId())); TInsuranceDetail income = getOne(lambdaQuery().getWrapper().eq(TInsuranceDetail::getId, success.getId()));
if (Common.isNotNull(income)) { if (Common.isNotNull(income) && income.getBuyType() != CommonConstants.FOUR_INT) {
if (income.getBuyType() != CommonConstants.FOUR_INT) {
//判断是否存在当月的商险收入数据 //判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail(); TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(income.getId()); incomeDetail.setSourceId(income.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail); R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS if (Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS
&& detailList.getData().getDetailList().size() > 0) { && !detailList.getData().getDetailList().isEmpty()) {
//原项目生成红冲数据 //原项目生成红冲数据
for (TIncomeDetail detail : detailList.getData().getDetailList()) { for (TIncomeDetail detail : detailList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail(); TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detail,detail1); BeanCopyUtils.copyProperties(detail, detail1);
detail1.setId(CommonConstants.NULL); detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING); detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detail.getMoney().negate()); detail1.setMoney(detail.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1); socialDaprUtils.createTIncomeDetail(detail1);
} }
//新项目下生成收入数据 //新项目下生成收入数据
createInsuranceInfo(income,null); createInsuranceInfo(income, null);
}
} }
} }
//商险id //商险id
...@@ -7257,23 +7280,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -7257,23 +7280,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
socialDaprUtils.createTIncomeDetail(detail); socialDaprUtils.createTIncomeDetail(detail);
} }
//更新收入信息
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail) {
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(insuranceDetail.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS) {
for (TIncomeDetail detail : detailList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detail, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detail1.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
}
}
}
@Override @Override
public void ekpUpdateInsuranceDept(ChangeDeptVo changeDeptVo) { public void ekpUpdateInsuranceDept(ChangeDeptVo changeDeptVo) {
Set<String> detailIdSet = new HashSet<>(); Set<String> detailIdSet = new HashSet<>();
......
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