Просмотр исходного кода

1.控制台应收 变成未收总金额

wuhp 1 год назад
Родитель
Сommit
b7e0835a85

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -228,4 +228,7 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
 
 
     List<ProfitAnalysisDto> changeAmount(@Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
     List<ProfitAnalysisDto> changeAmount(@Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
 
 
+    BigDecimal queryDateByNotTypeSumAmount(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
+
+    BigDecimal queryDateByTypeNotSumAmount(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
 }
 }

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

@@ -3408,10 +3408,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
         financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
         //总应收
         //总应收
         financialReceivablesQueryVo.setType("1");
         financialReceivablesQueryVo.setType("1");
-        BigDecimal ptSumAmount =  baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
+
+        BigDecimal ptSumAmount =  baseMapper.queryDateByTypeNotSumAmount(financialReceivablesQueryVo);
+
         financialReceivablesQueryVo.setType("2");
         financialReceivablesQueryVo.setType("2");
         //总应收
         //总应收
-        BigDecimal sySumAmount =  baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
+        BigDecimal sySumAmount =  baseMapper.queryDateByNotTypeSumAmount(financialReceivablesQueryVo);
 
 
 
 
         return new FinancialReceivablesAllVo(ptSumAmount !=null? ptSumAmount.toString(): "0",sySumAmount !=null  ? sySumAmount.toString() : "0",year+"",list);
         return new FinancialReceivablesAllVo(ptSumAmount !=null? ptSumAmount.toString(): "0",sySumAmount !=null  ? sySumAmount.toString() : "0",year+"",list);

+ 119 - 8
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2454,23 +2454,58 @@
     </select>
     </select>
 
 
     <select id="queryDateByTypeSumAmount" resultType="java.math.BigDecimal">
     <select id="queryDateByTypeSumAmount" resultType="java.math.BigDecimal">
+          select
+             IFNULL( sum(a.readyCommissionFeevalue),0) as "noSettlementAmount"
+          from  (
         SELECT
         SELECT
-          SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ))
+        a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "readyCommissionFeevalue"
+        FROM
+        (
+        SELECT
+        DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
+        IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
         FROM
         FROM
         ins_ply_income a
         ins_ply_income a
-        LEFT JOIN
-        ptl_agreement pa ON pa.id = a.agreement_id
+        LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
         <where>
         <where>
-            <if test="vo.type !=null  and  vo.type  !=''">
-                and pa.agreement_type =#{vo.type}
-            </if>
+            pa.agreement_type = '2'
             <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
             <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
                 and a.is_not_car =#{vo.isNotCar}
                 and a.is_not_car =#{vo.isNotCar}
             </if>
             </if>
-            <if test="vo.year !=null  and  vo.year !=''">
-                and  DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
+        </where>
+        GROUP BY
+        DATE_FORMAT( a.signdate, '%Y-%m' )
+        ) a
+        LEFT JOIN (
+        SELECT
+        DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
+        sum( a.settlement_amount ) AS "settCommAmount",
+        sum(a.remaining_amount) as "remainingAmount",
+        sum(a.total_amount) as "invoicComm"
+        FROM
+        sys_insurance_handling_settlement_month a
+        <where>
+            1=1
+            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                and a.is_not_car =#{vo.isNotCar}
             </if>
             </if>
         </where>
         </where>
+        GROUP BY
+        DATE_FORMAT( a.signing_time, '%Y-%m' )
+        ) b ON a.subSigndate = b.subSigndate
+        left  join  (
+        select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" ,  sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
+        from
+        settlement_documentary_fees  a
+        where a.settlement_status='1'
+        and handling_fees_status ='1'
+        <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+            and a.is_not_car =#{vo.isNotCar}
+        </if>
+        GROUP BY 	DATE_FORMAT( a.signing_time, '%Y-%m' )
+        )  c  on c.subSigndate=a.subSigndate
+        order by    a.subSigndate
+                           ) a
     </select>
     </select>
 
 
     <select id="queryDateByType"
     <select id="queryDateByType"
@@ -3459,4 +3494,80 @@
         pa.docking_person
         pa.docking_person
         order by  sum( a.all_fee_value ) - sum(case when a.handling_fees_status =1 then a.all_fee_value else 0 end) desc
         order by  sum( a.all_fee_value ) - sum(case when a.handling_fees_status =1 then a.all_fee_value else 0 end) desc
     </select>
     </select>
+
+
+    <select id="queryDateByNotTypeSumAmount" resultType="java.math.BigDecimal">
+        select  IFNULL(sum(a.noSettlementAmount),0) as "sySumAmount"
+        from  (
+        SELECT
+        (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0)))  as "noSettlementAmount"
+        FROM
+        (
+        SELECT
+        DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
+        IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
+        FROM
+        ins_ply_income a
+        LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
+        <where>
+            pa.agreement_type = '2'
+            <if test="vo.year !=null  and  vo.year !=''">
+                and  DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
+            </if>
+        </where>
+        GROUP BY
+        DATE_FORMAT( a.signdate, '%Y-%m' )
+        ) a
+        LEFT JOIN (
+        SELECT
+        DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
+        sum( a.settlement_amount ) AS "settCommAmount",
+        sum(a.remaining_amount) as "remainingAmount",
+        sum(a.total_amount) as "invoicComm"
+        FROM
+        sys_insurance_handling_settlement_month a
+        <where>
+            <if test="vo.year !=null  and  vo.year !=''">
+                DATE_FORMAT( a.signing_time, '%Y' ) =#{vo.year}
+            </if>
+        </where>
+        GROUP BY
+        DATE_FORMAT( a.signing_time, '%Y-%m' )
+        ) b ON a.subSigndate = b.subSigndate
+        left  join  (
+        select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" ,  sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
+        from
+        settlement_documentary_fees  a
+        <where>
+            a.settlement_status='1'
+            and handling_fees_status ='1'
+            <if test="vo.year !=null  and  vo.year !=''">
+                and    DATE_FORMAT( a.signing_time, '%Y' ) =#{vo.year}
+            </if>
+        </where>
+        GROUP BY 	DATE_FORMAT( a.signing_time, '%Y-%m' )
+        )  c  on c.subSigndate=a.subSigndate
+        ORDER BY   a.subSigndate
+    ) a
+    </select>
+
+
+    <select id="queryDateByTypeNotSumAmount" resultType="java.math.BigDecimal">
+        SELECT
+        IFNULL(a.notInvoicAmount, 0) as "noSettlementAmount"
+        FROM (
+        SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "notInvoicAmount"
+        FROM ins_ply_income a
+        LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
+        <where>
+            pa.agreement_type = '1'
+            and a.handling_fees_status = '0'
+            <if test="vo.year !=null  and  vo.year !=''">
+                and   DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
+            </if>
+        </where>
+        ) a
+
+
+    </select>
 </mapper>
 </mapper>