wuhp 2 лет назад
Родитель
Сommit
541f9c8d62

+ 13 - 5
src/main/java/com/ydtech/modules/fnc/service/impl/InsuranceHandlingSettlementMonthServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
 import java.util.Comparator;
@@ -35,12 +36,13 @@ import java.util.stream.Collectors;
 @Service
 public class InsuranceHandlingSettlementMonthServiceImpl extends ServiceImpl<InsuranceHandlingSettlementMonthMapper, InsuranceHandlingSettlementMonthEntity> implements InsuranceHandlingSettlementMonthService {
     @Autowired
-    private InsPlyIncomeService  insPlyIncomeService;
+    private InsPlyIncomeService insPlyIncomeService;
+
     @Override
     public List<InsuranceHandlingSettlementMonthDto> queryList(InsuranceHandlingSettlementMonthVo insuranceHandlingSettlementMonthVo) {
-        List<InsuranceHandlingSettlementMonthDto>  incomeList=  insPlyIncomeService.getInvociAmount(insuranceHandlingSettlementMonthVo);
+        List<InsuranceHandlingSettlementMonthDto> incomeList = insPlyIncomeService.getInvociAmount(insuranceHandlingSettlementMonthVo);
         List<InsuranceHandlingSettlementMonthDto> resultList = baseMapper.queryList(insuranceHandlingSettlementMonthVo);
-        if(resultList.size()>0){
+        if (!resultList.isEmpty()) {
             Map<String, InsuranceHandlingSettlementMonthDto> latestByTaskId = resultList.stream()
                     .collect(Collectors.toMap(
                             InsuranceHandlingSettlementMonthDto::getIncomeSigningTime, // 用于生成Map的键
@@ -52,9 +54,15 @@ public class InsuranceHandlingSettlementMonthServiceImpl extends ServiceImpl<Ins
             for (InsuranceHandlingSettlementMonthDto   incomeItem   : incomeList){
                 String incomeSigningTime = incomeItem.getIncomeSigningTime();
                 InsuranceHandlingSettlementMonthDto insuranceHandlingSettlementMonthDto = latestByTaskId.get(incomeSigningTime);
-                incomeItem.setRemainingAmount(insuranceHandlingSettlementMonthDto.getRemainingAmount());
-                incomeItem.setTotalAmount(insuranceHandlingSettlementMonthDto.getTotalAmount());
+                if(ObjectUtils.isEmpty(insuranceHandlingSettlementMonthDto)){
+                    incomeItem.setRemainingAmount(incomeItem.getTotalAmount());
+                    incomeItem.setTotalAmount(incomeItem.getTotalAmount());
+                }else {
+                    incomeItem.setRemainingAmount(insuranceHandlingSettlementMonthDto.getRemainingAmount());
+                    incomeItem.setTotalAmount(insuranceHandlingSettlementMonthDto.getTotalAmount());
+                }
                 incomeItem.setCreateTime(null);
+
                 if( incomeItem.getSettlementAmount() ==null || incomeItem.getSettlementAmount().compareTo(BigDecimal.ZERO)==0){
                     incomeItem.setSettlementAmount(new BigDecimal("0.00"));