Преглед изворни кода

1.结算新逻辑调整4.0

wuhp пре 2 година
родитељ
комит
e75d8dc736

+ 21 - 9
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -385,7 +385,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncomeLogService.saveLog(insPlyIncomeLog);  //添加日志
     }
 
-    private String setNoPolicyno(com.ydtech.modules.fnc.entity.InsAreaCompany insAreaCompany) {
+    private String setNoPolicyno(InsAreaCompany insAreaCompany) {
         if (insAreaCompany.getJypremium() == null || insAreaCompany.getJypremium().compareTo(BigDecimal.ZERO) == 0) {  // 非车跟单费
             return null;
         }
@@ -2113,7 +2113,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
         List<InsuranceHandlingSettlementMonthEntity> insuranceHandlingList = insPlyIncomeVo.getInsuranceHandlingList();
 
-
+        ArrayList<InsuranceHandlingSettlementMonthEntity> insuranceHandlingListNew = new ArrayList<>();
 
 
 //        判断是否是第一次结算
@@ -2127,6 +2127,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 //      分批结算
         BigDecimal allsettlementAmount = BigDecimal.ZERO;
         for(InsuranceHandlingSettlementMonthEntity item :  insuranceHandlingList){
+
+
             String incomeSigningTime = item.getIncomeSigningTime();
 
             DateTimeFormatter yearMonthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
@@ -2143,19 +2145,23 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             BigDecimal totalAmount = item.getRemainingAmount();  //开票金额
             BigDecimal settlementAmount = item.getSettlementAmount();  //结算金额
             if(settlementAmount.compareTo(BigDecimal.ZERO) > 0){
-                allsettlementAmount = this.calculateTotal(settlementAmount,allsettlementAmount,null);
+                InsuranceHandlingSettlementMonthEntity byId = insuranceHandlingSettlementMonthService.getById(item.getId());
+                allsettlementAmount = this.calculateTotal(byId.getSettlementAmount(),item.getSettlementAmount(),null);
+
                 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(insuranceHandlingList);
+            insuranceHandlingSettlementMonthService.updateBatchById(insuranceHandlingListNew);
         }else{
-            insuranceHandlingSettlementMonthService.saveBatch(insuranceHandlingList);
+            insuranceHandlingSettlementMonthService.saveBatch(insuranceHandlingListNew);
         }
 
         return HttpResult.ok();
@@ -3357,8 +3363,14 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }else{
             year = Integer.parseInt(financialReceivablesQueryVo.getYear());
         }
+        List<FinancialReceivablesVo> list = new ArrayList<>();
+        if("2".equals(financialReceivablesQueryVo.getType())){
+            list.addAll(baseMapper.queryDateByType(financialReceivablesQueryVo))  ;
+        }else {
+            list.addAll(baseMapper.queryDateByTypePt(financialReceivablesQueryVo))  ;
+
+        }
 
-        List<FinancialReceivablesVo> list  =  baseMapper.queryDateByType(financialReceivablesQueryVo);
 
         financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getYearBeginDateStr(year)+" 00:00:00");
         financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
@@ -3435,9 +3447,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         } else {
              amountMap = this.platformSett(resultData, financialReceivablesQueryVo);
         }
-        vo.setYisSumAmount(amountMap.get("yishouAmount").toString());
-        vo.setYsSumAmount(amountMap.get("yinshouAmount").toString());
-        vo.setWsSumAmount(amountMap.get("weishouAmount").toString());
+//        vo.setYisSumAmount(amountMap.get("yishouAmount").toString());
+//        vo.setYsSumAmount(amountMap.get("yinshouAmount").toString());
+//        vo.setWsSumAmount(amountMap.get("weishouAmount").toString());
         return vo;
     }
 

+ 1 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsuranceHandlingSettlementMonthServiceImpl.java

@@ -70,6 +70,7 @@ public class InsuranceHandlingSettlementMonthServiceImpl extends ServiceImpl<Ins
             list.stream().forEach(item -> {
                 if (item.getRemainingAmount() == null || item.getRemainingAmount().compareTo(BigDecimal.ZERO) == 0) {
                     item.setRemainingAmount(item.getTotalAmount());
+                    item.setSettlementAmount(BigDecimal.ZERO);
                 }
             });
             return list;

+ 1 - 0
src/main/resources/mapper/modules/insuranceHandlingSettlementMonth/InsuranceHandlingSettlementMonthMapper.xml

@@ -12,6 +12,7 @@
                 a.remaining_amount  as  "remainingAmount",
                 a.create_time  as  "createTime",
                 a.signing_time  as  "signingTime",
+                0  as "settlementAmount",
                 DATE_FORMAT( a.signing_time, '%Y-%m' )  as  "incomeSigningTime",
                 a.creater_id  as  "createrId"
     </sql>