소스 검색

1.平台需求

wuhp 2 년 전
부모
커밋
4a2a13e45f

+ 42 - 2
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -711,6 +711,9 @@ handlingProportion,
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getCreateTimeQuery())){
             params.put("createTimeQuery", insPlyIncomeVo.getCreateTimeQuery());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getSettlementDate())){
+            params.put("settlementDate", insPlyIncomeVo.getSettlementDate());
+        }
 
         return params;
     }
@@ -782,8 +785,10 @@ handlingProportion,
         BigDecimal totalAmount = BigDecimal.ZERO;
         BigDecimal totalHandingAmount = BigDecimal.ZERO;
         BigDecimal totalOtherAmount = BigDecimal.ZERO;
-        HashMap<String, Object> params = new HashMap<>();
         HashMap<String, Object> resultHashMap = new HashMap<>();
+        HashSet<String> partnerCompaniesIdSet = new HashSet<>();
+        LocalDateTime now = LocalDateTime.now();
+        String  reason ="";
         ArrayList<HashMap<String, Object>> resultNoSelect = new ArrayList<>();
         try {
             List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsPlyIncomeExcelDto.class, 0, 1, 1);
@@ -803,6 +808,28 @@ handlingProportion,
                 }
                 InsPlyIncome insPlyIncome = baseMapper.findByLicenseno(objectObjectHashMap);
                 if (ObjectUtils.isNotEmpty(insPlyIncome)) {
+//                  如果能查询出来则 修改结算  变成已结算
+                    if(excelItem.getJqReceivableProportion()!=null  &&  excelItem.getJqReceivableProportion().compareTo(BigDecimal.ZERO) !=0 ){
+                        objectObjectHashMap.put("jqReceivableProportion", excelItem.getJqReceivableProportion());   //非车保单号
+                        List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(objectObjectHashMap);
+                        if(insPlyIncomes.isEmpty()){
+                            reason="交强应收比例错误!";
+                        }
+                    }
+                    if(excelItem.getSyReceivableProportion()!=null  &&  excelItem.getSyReceivableProportion().compareTo(BigDecimal.ZERO) !=0 ){
+                        objectObjectHashMap.put("syReceivableProportion", excelItem.getSyReceivableProportion());   //非车保单号
+                        List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(objectObjectHashMap);
+                        if(insPlyIncomes.isEmpty()){
+                            reason="商业应收比例错误!";
+                        }
+                    }
+                    if(excelItem.getNoReceivableProportion()!=null  &&  excelItem.getNoReceivableProportion().compareTo(BigDecimal.ZERO) !=0 ){
+                        objectObjectHashMap.put("noReceivableProportion", excelItem.getNoReceivableProportion());   //非车保单号
+                        List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(objectObjectHashMap);
+                        if(insPlyIncomes.isEmpty()){
+                            reason="非车应收比例错误!";
+                        }
+                    }
                     if (insPlyIncome.getAllFeeValue() != null && insPlyIncome.getAllFeeValue().compareTo(BigDecimal.ZERO) != 0) {
                         totalAmount = totalAmount.add(insPlyIncome.getAllFeeValue());  //总金额
                     }
@@ -812,11 +839,24 @@ handlingProportion,
                     if (insPlyIncome.getOtherFeevalue() != null && insPlyIncome.getOtherFeevalue().compareTo(BigDecimal.ZERO) != 0) {
                         totalOtherAmount = totalOtherAmount.add(insPlyIncome.getOtherFeevalue());   //总跟单费
                     }
+                    if(StringUtils.isNotEmpty(reason)){
+                        insPlyIncome.setSettlementUserId(BaseController.getUser().getId());
+                        insPlyIncome.setSettlementTime(now);
+                        insPlyIncome.setHandlingFeesStatus("1");
+                        baseMapper.updateById(insPlyIncome);
+                    }
+                    //判断是否是相同保司机构
+                    partnerCompaniesIdSet.add(insPlyIncome.getPartnerCompaniesId());
+                    objectObjectHashMap.put("reason",reason);
+                    resultNoSelect.add(objectObjectHashMap);  // 添加未匹配的车牌号
                 } else {
+                    objectObjectHashMap.put("reason","未查询车辆");
                     resultNoSelect.add(objectObjectHashMap);  // 添加未匹配的车牌号
                 }
             }
-
+            if(partnerCompaniesIdSet.size()>0){
+                throw new SystemException("表里有不同保司机构");
+            }
             resultHashMap.put("totalAmount", totalAmount);
             resultHashMap.put("totalHandingAmount", totalHandingAmount);
             resultHashMap.put("totalOtherAmount", totalOtherAmount);

+ 2 - 5
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -388,10 +388,7 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("创建时间查询")
     private String createTimeQuery;
 
-
-
-
-
-
+    @ApiModelProperty(value = "结算日期")
+    private String settlementDate;
 
 }

+ 25 - 4
src/main/java/com/ydtech/modules/inv/model/dto/InsPlyIncomeExcelDto.java

@@ -4,28 +4,49 @@ package com.ydtech.modules.inv.model.dto;
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Data
 public class InsPlyIncomeExcelDto {
     /**
      * 车牌号
      */
-    @Excel(name = "车牌号")
+    @Excel(name = "车牌号" ,isImportField = "true")
     private String licenseno;
     /**
      * 交强保单号
      */
-    @Excel(name = "交强保单号")
+    @Excel(name = "交强保单号" ,isImportField = "true")
     private String policyno;
 
     /**
      * 商业保单号
      */
-    @Excel(name = "商业保单号")
+    @Excel(name = "商业保单号" ,isImportField = "true")
     private String syPolicyno;
 
     /**
      * 非车保单号
      */
-    @Excel(name = "非车保单号")
+    @Excel(name = "非车保单号" ,isImportField = "true")
     private String noPolicyno;
+
+    /**
+     * 交强应收比例
+     */
+    @Excel(name = "交强应收比例" ,isImportField = "true" )
+    private BigDecimal jqReceivableProportion;
+
+
+    /**
+     * 商业应收比例
+     */
+    @Excel(name = "商业应收比例" ,isImportField = "true")
+    private BigDecimal syReceivableProportion;
+
+    /**
+     * 非车应收比例
+     */
+    @Excel(name = "非车应收比例" ,isImportField = "true")
+    private BigDecimal noReceivableProportion;
 }

+ 7 - 4
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -304,6 +304,10 @@
                 AND a.settlement_time =#{settlementTime}
             </if>
 
+            <if test="settlementDate !=null  and  settlementDate  !=''">
+                AND a.settlement_time =#{settlementDate}
+            </if>
+
             <if test="userId !=null  and  userId  !=''">
                 and a.userId   =#{userId}
             </if>
@@ -933,15 +937,14 @@
 
     <select id="totalPinAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
         select
-        MAX(a.partner_companies_id) as "partnerCompaniesId",
+        a.partner_companies_id as "partnerCompaniesId",
         MAX( ec.name ) AS "companyName",
         sum( a.commission_feevalue ) AS "commissionFeevalue",
         sum( a.other_feevalue ) AS "otherFeevalue",
         SUM( a.commission_feevalue + a.other_feevalue ) AS "totalFeevalue",
         GROUP_CONCAT(a.id) as "ids",
         MAX( a.partner_companies_name) as "partnerCompaniesName",
-        MAX(pa.docking_person) as "dockingPerson",
-        a.agreement_id AS "agreementId"
+        MAX(pa.docking_person) as "dockingPerson"
         from ins_ply_income a
         LEFT JOIN esm_ins_company ec on ec.id= a.company_id
         LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
@@ -975,7 +978,7 @@
                 AND day(a.signdate) =#{day}
             </if>
         </where>
-        GROUP BY a.agreement_id
+        GROUP BY a.partner_companies_id
     </select>
 
     <select id="queryInvoicing" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">