Commit 4c29d2ec authored by 李灿灿's avatar 李灿灿

商险推送ekp之前的逻辑完善

parent c39075c6
......@@ -579,10 +579,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
if (CollectionUtils.isNotEmpty(successList)){
//todo 判断是否推送过保费到ekp,如果推送过就新增一条负的,将结算表中的数据求和放到明细表中
for (TInsuranceDetail detail : successList) {
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
TInsuranceSettle burden = new TInsuranceSettle();
BeanCopyUtils.copyProperties(settle,burden);
burden.setId(null);
burden.setCreateTime(LocalDateTime.now());
burden.setUpdateTime(LocalDateTime.now());
if (burden.getActualPremium() != null){
burden.setActualPremium(burden.getActualPremium().negate());
burden.setActualPushTime(LocalDateTime.now());
detail.setActualPremium(new BigDecimal("0.00"));
}
if (burden.getEstimatePremium() != null){
burden.setEstimatePremium(burden.getEstimatePremium().negate());
burden.setEstimatePushTime(LocalDateTime.now());
detail.setEstimatePremium(new BigDecimal("0.00"));
}
tInsuranceSettleService.save(burden);
//推送负的给ekp
detail.setDefaultSettleId(burden.getId());
}
}
}
//更新状态
this.saveOrUpdateBatch(successList);
//todo 判断是否推送过保费到ekp,如果推送过就新增一条负的,将结算表中的数据求和放到明细表中
}
//根据项目编码获取项目名称
setProjectNameByDeptNo(errorList);
......@@ -676,7 +702,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
......@@ -706,7 +734,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
......@@ -781,17 +811,50 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (detail.getActualPremium() != null){
// 已推送过,只更新发票号
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
this.updateById(detail);
}else {
}
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
}
if (StringUtils.isNotBlank(success.getActualPremium())){
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
// todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
settle.setActualPremium(detail.getActualPremium());
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调更新接口
}
}else {
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setActualPremium(detail.getActualPremium());
//调完ekp接口才会是1
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
//调新增接口
}
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
}
}
......
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