Jelajahi Sumber

1.結算调整优化 5.0 过滤条件优化

wuhp 2 tahun lalu
induk
melakukan
f49ddcbc8a

+ 20 - 8
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -592,10 +592,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(insPlyIncomeVo.getJqStartDate() !=null){
             params.put("jqEndDate",insPlyIncomeVo.getJqEndDate());
         }
-        if(insPlyIncomeVo.getJqStartDate() !=null){
+        if(insPlyIncomeVo.getSyStartDate() !=null){
             params.put("syStartDate",insPlyIncomeVo.getSyStartDate());
         }
-        if(insPlyIncomeVo.getJqStartDate() !=null){
+        if(insPlyIncomeVo.getSyEndDate() !=null){
             params.put("syEndDate",insPlyIncomeVo.getSyEndDate());
         }
         if( StringUtils.isNotEmpty(insPlyIncomeVo.getProvinceId())){
@@ -611,7 +611,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             params.put("deptId",insPlyIncomeVo.getDeptId());
         }
         if( StringUtils.isNotEmpty(insPlyIncomeVo.getAllPartnerCompaniesId())){
-            params.put("allPartnerCompaniesId",insPlyIncomeVo.getAllPartnerCompaniesId());
+            params.put("allPartnerCompaniesId",insPlyIncomeVo.getAllPartnerCompaniesId().substring(0,5));
         }
         if( StringUtils.isNotEmpty(insPlyIncomeVo.getProvincePartnerCompaniesId())){
             params.put("provincePartnerCompaniesId",insPlyIncomeVo.getProvincePartnerCompaniesId());
@@ -1514,13 +1514,24 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
     @Override
     public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){// 判断 ins_ply_income  是否完全结算完 如果结算完则改为已结算状态
-            this.changeHandStatus(insPlyIncomeVo.getIds(),insPlyIncomeVo);
+//         表内总金额
+        BigDecimal invoicCommissionFeevalue = insPlyIncomeVo.getInvoicCommissionFeevalue();
+        BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
+
+
+        HashMap<String, Object> params = new HashMap<>();
+        params = this.saveParams(insPlyIncomeVo,params);
+        params.put("handlingFeesStatus",insPlyIncomeVo.getHandlingFeesStatus());
+        List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
+        for (InsPlyIncome  item : insPlyIncomes){
+            if(settlementAmount.compareTo(invoicCommissionFeevalue) ==0){
+                item.setHandlingFeesStatus("1");
+                baseMapper.updateById(item);
+            }
         }
 //            分批结算
         SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
 
-
         settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getInvoicId());   //开票号
         settlementDocumentaryFeesVo.setSettlementTime(insPlyIncomeVo.getSettlementTime());   //结算时间
         settlementDocumentaryFeesVo.setSettlementStatus("2");   //2为结算状态
@@ -1735,6 +1746,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     public InsPlyIncome ptTotalAmount(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
         params = this.saveParams(insPlyIncomeVo, params);
+        params.remove("handlingFeesStatus");
         InsPlyIncome totalledAmount =baseMapper.ptTotalAmount(params);  //总金额
         return totalledAmount;
     }
@@ -1913,8 +1925,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     BigDecimal jqOtherCostsProportion = item.getJqOtherCostsProportion();
                     BigDecimal syOtherCostsProportion = item.getSyOtherCostsProportion();
 
-                    BigDecimal jqNoTaxPremium = byBxLicenseno.getJqNoTaxPremium();//交强含税保费
-                    BigDecimal syNoTaxPremium = byBxLicenseno.getSyNoTaxPremium();// 商业不含税比例
+                    BigDecimal jqNoTaxPremium = byBxLicenseno.getJqPremium();//交强含税
+                    BigDecimal syNoTaxPremium = byBxLicenseno.getSyPremium();// 商业不含税
                     BigDecimal jqOtherAmount = jqNoTaxPremium.multiply(item.getJqOtherCostsProportion().divide(new BigDecimal(100)));  //交强跟单费用
                     BigDecimal syOtherAmount = syNoTaxPremium.multiply(item.getSyOtherCostsProportion().divide(new BigDecimal(100)));
 

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -60,6 +60,9 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
             if(StringUtils.isNotEmpty(settlementDocumentaryFeesVo.getPartnerCompaniesId())){
                 params.put("partnerCompaniesId",settlementDocumentaryFeesVo.getPartnerCompaniesId());
             }
+            if(StringUtils.isNotEmpty(settlementDocumentaryFeesVo.getParentId())){
+                params.put("parentId",settlementDocumentaryFeesVo.getParentId());
+            }
             PageInfo<List<SettlementDocumentaryFeesEntity>> pageHelper = null;
             List<SettlementDocumentaryFeesEntity> list = this.baseMapper.querySettle(params);
             pageHelper = new PageInfo(list);

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -340,6 +340,9 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty(value = "保司省公司")
     private String provincePartnerCompaniesId;
 
+    @ApiModelProperty(value = "parentId")
+    private String parentId;
+
 
 
 

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java

@@ -99,7 +99,7 @@ public class SettlementDocumentaryFeesVo implements Serializable {
     private LocalDate settlementTime;
 
 
-    @ApiModelProperty("开票id")
+    @ApiModelProperty("父母id")
     private String parentId;
 
 

+ 21 - 19
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -184,9 +184,10 @@
                     and a.handling_fees_status =#{handlingFeesStatus}
                 </if>
 
-               <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
-                    and eic.parent_id =#{allPartnerCompaniesId}
+                <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
+                    AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
                 </if>
+
                <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
                     and eic.parent_id =#{provincePartnerCompaniesId}
                 </if>
@@ -196,15 +197,15 @@
                 </if>
 
                 <if test="provinceId != null and provinceId != ''">
-                    and a.deptid like "${provinceId}%"
+                    and a.dept_id LIKE CONCAT(#{provinceId}, '%')
                 </if>
 
                 <if test="cityId != null and cityId != ''">
-                    and a.deptid like "${cityId}%"
+                    and a.dept_id LIKE CONCAT(#{cityId}, '%')
                 </if>
 
                 <if test="countyId != null and countyId != ''">
-                    and a.deptid like "${countyId}%"
+                    and a.dept_id  LIKE CONCAT(#{countyId}, '%')
                 </if>
                <if test="taskId != null and taskId != ''">
                     and a.task_id = #{taskId}
@@ -306,10 +307,12 @@
                   AND  a.insured_name =#{insuredName}
                 </if>
                 <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
-                   AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate}  AND a.jq_start_date &gt; = #{jqStartDate}
+                    AND DATE(a.jq_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
                 </if>
                 <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
-                   AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate}  AND a.sy_start_date &gt; = #{syStartDate}
+                    AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
                 </if>
 
             </where>
@@ -659,10 +662,12 @@
                     and a.is_not_car =#{isNotCar}
                 </if>
                 <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
-                    AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate}  AND a.jq_start_date &gt; = #{jqStartDate}
+                    AND DATE(a.jq_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
                 </if>
                 <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
-                    AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate}  AND a.sy_start_date &gt; = #{syStartDate}
+                    AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
                 </if>
 
                 <if test="isOther !=null  and  isOther  !=''">
@@ -1071,7 +1076,7 @@
                 AND   a.partner_companies_name =#{partnerCompaniesName}
             </if>
             <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
-                and eic.parent_id =#{allPartnerCompaniesId}
+                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
             </if>
             <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
                 and eic.parent_id =#{provincePartnerCompaniesId}
@@ -1124,8 +1129,8 @@
         IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00)  as "invoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
-        IFNULL(IFNULL(max(f.settleMentAmount) , 0.00)  *  MAX(f.taxPoints) /100,0) as  "taxesFees",
-        IFNULL  ( IFNULL(max(f.settleMentAmount) , 0.00)  - ( IFNULL(max(f.settleMentAmount) , 0.00)  *  MAX(f.taxPoints) /100) ,0) as   "expendAmount",
+        IFNULL(max(f.taxesFees) , 0.00) as  "taxesFees",
+        IFNULL(max(f.expendAmount),0) as   "expendAmount",
         sum( a.other_feevalue ) AS "otherFeevalue"
         FROM
         ins_ply_income a
@@ -1152,6 +1157,7 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
         settlement_amount ) AS "settleMentAmount",
         SUM(a.expend_amount) as  "expendAmount",
+        IFNULL(sum(settlement_amount ) ,0) -IFNULL(SUM(a.expend_amount),0) as  "taxesFees",
         SUM(a.tax_points) as  "taxPoints"
         FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
@@ -1204,7 +1210,7 @@
                 and a.is_not_documentary   =#{isOther}
             </if>
             <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
-                and eic.parent_id =#{allPartnerCompaniesId}
+                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
             </if>
             <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
                 and eic.parent_id =#{provincePartnerCompaniesId}
@@ -1411,16 +1417,12 @@
                        and  pa.docking_person  =#{dockingPerson}
                    </if>
 
-                   <if test="provinceId != null and provinceId != ''">
-                       and a.deptid like "${provinceId}%"
-                   </if>
-
                    <if test="cityId != null and cityId != ''">
-                       and a.deptid like "${cityId}%"
+                       and a.dept_id LIKE CONCAT(#{cityId}, '%')
                    </if>
 
                    <if test="countyId != null and countyId != ''">
-                       and a.deptid like "${countyId}%"
+                       and a.dept_id  LIKE CONCAT(#{countyId}, '%')
                    </if>
 
                    <if test="orderno !=null  and  orderno  !=''">

+ 3 - 0
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -73,6 +73,9 @@
             <if test="agreementType !=null  and  agreementType  !=''">
                 and a.agreement_type =#{agreementType}
             </if>
+            <if test="parentId !=null  and  parentId  !=''">
+                and a.parent_id =#{parentId}
+            </if>
         </where>
     </select>