فهرست منبع

1.控制台财务跟单金额统计调整

wuhp 1 سال پیش
والد
کامیت
f1828c71fb

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java

@@ -41,4 +41,10 @@ public interface SettlementDocumentaryFeesMapper  extends BaseMapper<SettlementD
     List<SettlementDocumentaryFeesEntity> queryRecord(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
 
     List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params);
+    /**
+     *
+     * @param params
+     * @return  查询已开票金额
+     */
+    List<SettlementDocumentaryFeesEntity> queryAmount(HashMap<String, Object> params);
 }

+ 7 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java

@@ -45,4 +45,11 @@ public interface SettlementDocumentaryFeesService extends IService<SettlementDoc
      */
     List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params);
 
+    /**
+     *
+     * @param params
+     * @return  查询已开票金额
+     */
+    List<SettlementDocumentaryFeesEntity> queryAmount(HashMap<String, Object> params);
+
 }

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

@@ -2267,8 +2267,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 invoicCommissionFeevalue = invoicCommissionFeevalue.add(invoicIcommissionFeevalue);  //开票金额
 
             }
-            params.put("settlementStatus", "2"); // 结算
-            List<SettlementDocumentaryFeesEntity> settleInsPlyIncomes = settlementDocumentaryFeesService.queryNew(params);  //金额总数
+            List<SettlementDocumentaryFeesEntity> settleInsPlyIncomes = settlementDocumentaryFeesService.queryAmount(params);  //金额总数
             for (SettlementDocumentaryFeesEntity settleInsPlyIncome : settleInsPlyIncomes) {
                 BigDecimal settleIcommissionFeevalue = settleInsPlyIncome.getSettlementAmount();// 已结算金额
                 readyCommissionFeevalue = readyCommissionFeevalue.add(settleIcommissionFeevalue);  //已结算总

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

@@ -262,6 +262,16 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
     public List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params) {
         return  baseMapper.bxSumGroupByMonth(params);
     }
+    /**
+     *
+     * @param params
+     * @return  查询已开票金额
+     */
+    @Override
+    public List<SettlementDocumentaryFeesEntity> queryAmount(HashMap<String, Object> params) {
+
+        return baseMapper.queryAmount(params);
+    }
 
     private int compareAmount(BigDecimal settlementAmount, BigDecimal settlementAmount1) {
 

+ 5 - 2
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2520,13 +2520,15 @@
             a.subSigndate as "yearAndMonth",
             a.allAmount as "commissionFeevalue",
             IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0) as "noInvoicCommissionFeevalue",
-            IFNULL(b.remainingAmount,0) +IFNULL(c.invoicNotOther,0) as "settlementAmount",
-            (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0)))  as "readyCommissionFeevalue",
+            IFNULL(a.allInvoicCommissionFeevalue,0) - IFNULL( b.settCommAmount,0) + ifnull(c.invoicNotOther,0) as "settlementAmount",
+        a.allAmount -(
+        IFNULL( c.settAmountOther, 0 ) + IFNULL( b.settCommAmount, 0 )) - (IFNULL( a.allInvoicCommissionFeevalue, 0 ) - IFNULL( b.settCommAmount, 0 ))  AS "readyCommissionFeevalue",
             a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "noSettlementAmount"
         FROM
             (
                 SELECT
                     DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
+                    SUM( CASE WHEN a.handling_fees_status != '0' AND a.task_id IS NOT NULL THEN IFNULL( a.commission_feevalue, 0 ) ELSE 0 END ) AS "allInvoicCommissionFeevalue",
                     IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
                 FROM
                     ins_ply_income a
@@ -2652,6 +2654,7 @@
                     a.company_id
             ) a
                 LEFT JOIN (
+
                select
                     sum( a.invoicAmount ) AS "invoicAmount",
                     sum( a.noSettHandlingFee ) AS "noSettHandlingFee",

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

@@ -309,6 +309,73 @@
 
     </select>
 
+
+    <select id="queryAmount" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
+        select
+        a.id as "id",
+        a.total_orders as "totalOrders",
+        DATE_FORMAT( a.signing_time, '%Y-%m') as "yearMonthSignDate",
+        a.time_frame as "timeFrame",
+        a.total_amount as "totalAmount",
+        a.create_time as "createTime",
+        a.start_time as "startTime",
+        a.end_time as "endTime",
+        a.invoiced_settled_amount as "settlementAmount",
+        a.agree_ment_id as "agreeMentId",
+        a.partner_companies_id as "partnerCompaniesId",
+        a.invoicing_method as "invoicingMethod",
+        a.tax_points as "taxPoints",
+        a.expend_amount as "expendAmount",
+        a.parent_id as "parentId",
+        a.handling_fees_status as "handlingFeesStatus",
+        a.agreement_type as "agreementType",
+        a.settlement_time as "settlementTime",
+        a.settlement_image_id as "settlementImageId",
+        a.Invoiced_not_settled_amount as "InvoicedNotSettledAmount",
+        a.completion_status as "completionStatus",
+        a.task_id as "taskId",
+        upf.url as "imageUrl",
+        a.unsettled_amount as "unsettledAmount"
+        from  settlement_documentary_fees  a
+        LEFT  JOIN   ins_upload_files  upf   on  a.settlement_image_id=upf.id
+        <where>
+            1=1
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                and a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and a.agreement_type =#{agreementType}
+            </if>
+            <if test="parentId !=null  and  parentId  !=''">
+                and a.parent_id =#{parentId}
+            </if>
+            <if test="settlementStatus !=null  and  settlementStatus  !=''">
+                and a.settlement_status =#{settlementStatus}
+            </if>
+            <if test="completionStatus !=null  and  completionStatus  !=''">
+                and a.completion_status =#{completionStatus}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signing_time) =#{year}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signing_time) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signing_time) =#{day}
+            </if>
+        </where>
+        ORDER  BY  a.create_time desc
+
+    </select>
+
+
     <select id="querySettleNew" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
         select
         a.id as "id",