Browse Source

首页统计sql修改

dudm 3 years ago
parent
commit
f6cc98207b

+ 8 - 2
sc-service/src/main/java/com/huyi/service/common/report/controller/ReportCreditController.java

@@ -611,8 +611,14 @@ public class ReportCreditController extends BaseController {
                 //周
                 map.put("date",date);
             }
-            //报销所含项目
-            String amt = reportCreditService.financeRecordMonth(map);
+            //已生效
+            String effectBalance =  reportCreditService.getEffectBalance(map);
+            //融资中
+            String availableBalance =  reportCreditService.getAvailableBalance(map);
+            //已放款
+            String loanBalance =  reportCreditService.getLoanBalance(map);
+            //开立金额
+            String amt = AmtUtil.add(AmtUtil.add(effectBalance, availableBalance), loanBalance);
             data.add(amt);
         }
         //开立额度数据对象

+ 21 - 6
sc-service/src/main/resources/mapper/common/ReportCreditMapper.xml

@@ -88,6 +88,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="zfpType != null  and zfpType != ''">
             AND zfp_type = #{zfpType}
         </if>
+        <if test="date != null  and date != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m-%d') = #{date}
+        </if>
+        <if test="month != null  and month != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m') = #{month}
+        </if>
 
     </select>
 
@@ -117,6 +123,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="zfpType != null  and zfpType != ''">
             AND zfp_type = #{zfpType}
         </if>
+        <if test="date != null  and date != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m-%d') = #{date}
+        </if>
+        <if test="month != null  and month != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m') = #{month}
+        </if>
 
     </select>
 
@@ -150,6 +162,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="zfpType != null  and zfpType != ''">
             AND zfp_type = #{zfpType}
         </if>
+        <if test="date != null  and date != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m-%d') = #{date}
+        </if>
+        <if test="month != null  and month != ''">
+            AND DATE_FORMAT(zfi_sign_date, '%Y-%m') = #{month}
+        </if>
 
     </select>
 
@@ -282,15 +300,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         zfp_management_id                   'managementCompanyId',
         scy_name                            'managementName'
         FROM
-        zc_finance_pro_com_rel
-        LEFT JOIN zc_finance_inf
-        ON zfpcr_id = zfi_core_quota_id
-        AND zfi_status IN ('02','04','05','07')
+        zc_finance_inf
         LEFT JOIN zc_finance_product
-        ON zfp_id = zfpcr_product_id
+        ON zfp_id = zfi_product_id
         LEFT JOIN sys_company
         ON scy_id = zfp_management_id
-        WHERE zfpcr_status = '00'
+        WHERE zfi_status IN ('02','04','05','07')
         <if test="paramMap.coreCompanyId != null  and paramMap.coreCompanyId != ''">
             AND zfi_core_id = #{paramMap.coreCompanyId}
         </if>