|
|
@@ -2142,21 +2142,22 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
LocalDateTime localDateTime = date.atStartOfDay();
|
|
|
item.setIsNotCar(insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
|
- BigDecimal totalAmount = item.getRemainingAmount(); //开票金额
|
|
|
+ BigDecimal totalAmount = item.getRemainingAmount(); //开票未结算
|
|
|
BigDecimal settlementAmount = item.getSettlementAmount(); //结算金额
|
|
|
- if(settlementAmount.compareTo(BigDecimal.ZERO) > 0){
|
|
|
InsuranceHandlingSettlementMonthEntity byId = insuranceHandlingSettlementMonthService.getById(item.getId());
|
|
|
- allsettlementAmount = this.calculateTotal(byId.getSettlementAmount(),item.getSettlementAmount(),null);
|
|
|
-
|
|
|
+ if(ObjectUtils.isNotEmpty(byId)){
|
|
|
+ allsettlementAmount = this.calculateTotal(byId.getSettlementAmount(),item.getSettlementAmount(),null);
|
|
|
+ item.setSettlementAmount(allsettlementAmount);
|
|
|
+ }else {
|
|
|
+ item.setSettlementAmount(item.getSettlementAmount());
|
|
|
+ }
|
|
|
BigDecimal subtract1 = totalAmount.subtract(settlementAmount);
|
|
|
item.setRemainingAmount(subtract1);
|
|
|
item.setCreateTime(LocalDateTime.now());
|
|
|
item.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());
|
|
|
item.setSigningTime(localDateTime);
|
|
|
item.setSettlementDocumentaryFeesId(byIdSettlementDocumentaryFeesEntity.getId());
|
|
|
- item.setSettlementAmount(allsettlementAmount);
|
|
|
insuranceHandlingListNew.add(item);
|
|
|
- }
|
|
|
}
|
|
|
if(insuranceHandlingSettlementMonthDtos.size()>0){
|
|
|
insuranceHandlingSettlementMonthService.updateBatchById(insuranceHandlingListNew);
|