Commit 0b4b7931 authored by huyuchen's avatar huyuchen

商险优化修改

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