Browse Source

统计报表排查 停用、删除的机构; 解决履职统计 履职任务有多个问题时 应完成数统计变多的问题

zhulu 1 năm trước cách đây
mục cha
commit
73d3995fce

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/MonitorAccessReportMapper.xml

@@ -31,7 +31,7 @@
         b.id
     </select>
     <select id="selectNetworkNumberByPath" resultType="java.lang.Integer">
-        SELECT COUNT(1) FROM sys_org WHERE path LIKE  concat( #{orgPath}, '%') AND type=4 AND deleted=0
+        SELECT COUNT(1) FROM sys_org WHERE path LIKE  concat( #{orgPath}, '%') AND type=4 AND deleted=0 AND is_lock=0 AND deleted=0
     </select>
     <select id="selectAll" resultType="com.xunmei.core.reportForms.monitor.vo.MonitoringAccessVO">
         SELECT

+ 52 - 30
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/ResumptionReportMapper.xml

@@ -6,8 +6,8 @@
 
     <select id="selectReport" resultType="com.xunmei.core.reportForms.resumption.vo.ResumptionDayVO">
         SELECT
-        COUNT( d.id ) AS totalRealityRectificationNumber,
-        COUNT( a.id ) AS frontPlanNumber,
+        IFNULL(SUM( a.exception_reform_count ) ,0)AS totalRealityRectificationNumber,
+        COUNT(DISTINCT  a.id ) AS frontPlanNumber,
         IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 ) AS frontRealityNumber,
         IF
         (
@@ -25,16 +25,22 @@
         )) AS frontRate,
         IFNULL( SUM( a.exception_count ), 0 ) AS frontAbnormalNumber,
         IFNULL(
-        CONCAT( ROUND( COUNT( d.id )/ IFNULL( SUM( a.exception_count ), 0 )* 100, 2 ), '%' ),
+        CONCAT( ROUND( COUNT( a.exception_reform_count )/ IFNULL( SUM( a.exception_count ), 0 )* 100, 2 ), '%' ),
         '0%'
         ) AS totalRealityRectificationRate
         FROM
-        core_resumption a
-        LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
-        LEFT JOIN core_question d ON a.id = d.src_task_id
-        AND d.reform_status = 11
+        (
+            SELECT
+            r.*,
+            b.plan_type,
+            (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
+            FROM
+            core_resumption r
+            INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
+            LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
+        ) a
         WHERE
-            b.plan_type = #{planType}
+            a.plan_type = #{planType}
           AND a.type = 2
           <if test="orgId !=null">
               AND a.org_id = #{orgId}
@@ -78,12 +84,18 @@
         '%'
         )) AS realityRate
         FROM
-            core_resumption a
-                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
-                LEFT JOIN core_question c ON c.src_task_id = a.id
-                AND reform_status = 11
+        (
+                SELECT
+                r.*,
+                b.plan_type,
+                (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
+                FROM
+                core_resumption r
+                INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
+                LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
+        ) a
         WHERE
-            b.plan_type =4
+            a.plan_type =4
           <if test="orgId !=null">
               and a.org_id=#{orgId}
           </if>
@@ -114,20 +126,24 @@
       /*  COUNT( c.id ) AS realityRectificationNumber,*/
         IF
         (
-        COUNT( c.id )= 0
+        COUNT( a.exception_reform_count )= 0
         OR IFNULL( a.exception_count, 0 )= 0,
         '0%',
-        CONCAT(ROUND(COUNT( c.id )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
+        CONCAT(ROUND(COUNT( a.exception_reform_count )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
         FROM
-        core_resumption a
-        LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
-        LEFT JOIN core_question c ON c.src_task_id = a.id
-        AND reform_status = 11
+        (
+            SELECT
+            r.*,
+            b.plan_type,
+            (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
+            FROM
+            core_resumption r
+            INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
+            LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
+        ) a
         WHERE
-        b.plan_type =5
+        a.plan_type =5
         <if test="startTime !=null and endTime !=null">
-
-
             and ((
             #{startTime} &lt;= a.plan_start_time
             and #{endTime} >= a.plan_start_time
@@ -166,20 +182,26 @@
         ),
         '%'
         )) AS realityRate,
-        COUNT( c.id ) AS realityRectificationNumber,
+        IFNULL(SUM( c.exception_reform_count ),0) AS realityRectificationNumber,
         IF
         (
-        COUNT( c.id )= 0
+        COUNT( c.exception_reform_count )= 0
         OR IFNULL( a.exception_count, 0 )= 0,
         '0%',
-        CONCAT(ROUND(COUNT( c.id )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
+        CONCAT(ROUND(COUNT( c.exception_reform_count )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
         FROM
-        core_resumption a
-        LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
-        LEFT JOIN core_question c ON c.src_task_id = a.id
-        AND reform_status = 11
+        (
+            SELECT
+            r.*,
+            b.plan_type,
+            (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
+            FROM
+            core_resumption r
+            INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
+            LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
+        ) a
         WHERE
-        b.plan_type =6
+        a.plan_type =6
         <if test="date !=null">
             AND a.ymd_date like concat(#{date},'%')
         </if>