jiawuxian пре 1 година
родитељ
комит
1dd6a998d2

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/board/AppCockpitMapper.xml

@@ -230,7 +230,7 @@
     <select id="selectOverDueQuestionCount" resultType="java.lang.Integer">
         SELECT count(0)
         FROM core_question
-        WHERE reform_deadline BETWEEN '2023-10-01 00:00:00' AND '2023-11-30 23:59'
+        WHERE reform_deadline BETWEEN #{startDate} AND #{endDate}
           and reform_status != 11
           and confirm_status != 3
     </select>

+ 130 - 36
soc-modules/soc-modules-core/src/main/resources/mapper/board/CockpitMapper.xml

@@ -4,32 +4,56 @@
     <select id="resumption" resultType="com.xunmei.core.board.vo.web.TaskStatisticVo">
         SELECT
         org_id,
-         org_path,
+        org_path,
         count( 0 ) AS task_total,
         SUM( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS completed_count
         FROM
         core_resumption r
         <!--                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
         WHERE
-        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and plan_end_time>=#{startDate}))
+        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and
+        plan_end_time>=#{startDate}))
         and org_path like concat(#{orgPath},'%')
         GROUP BY org_id,org_path
     </select>
-    <select id="safetyCheck" resultType="com.xunmei.core.board.vo.web.TaskStatisticVo">
-        SELECT
-        org_id,
-        org_path,
-        count( 0 ) AS task_total,
-        SUM( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS completed_count
-        FROM
-        core_safety_task r
-        <!--                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
-        WHERE
-        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and plan_end_time>=#{startDate}))
-        and org_path like concat(#{orgPath},'%')
-        GROUP BY
-        org_id,org_path
+    <!--    <select id="safetyCheck" resultType="com.xunmei.core.board.vo.web.TaskStatisticVo">-->
+    <!--        SELECT-->
+    <!--        org_id,-->
+    <!--        org_path,-->
+    <!--        count( 0 ) AS task_total,-->
+    <!--        SUM( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS completed_count-->
+    <!--        FROM-->
+    <!--        core_safety_task r-->
+    <!--        &lt;!&ndash;                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id&ndash;&gt;-->
+    <!--        WHERE-->
+    <!--        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and-->
+    <!--        plan_end_time>=#{startDate}))-->
+    <!--        and org_path like concat(#{orgPath},'%')-->
+    <!--        GROUP BY-->
+    <!--        org_id,org_path-->
+    <!--    </select>-->
+    <select id="safetyCheck" resultType="com.xunmei.core.board.vo.web.WebSafetyCheckVo">
+        SELECT p.check_type                     type,
+               count(0)                      as total,
+               sum(if(t.`status` = 3, 1, 0)) as completed
+        FROM core_safety_task t
+        INNER JOIN core_safecheck_plan p on t.plan_id = p.id
+        where t.org_path like concat(#{orgPath}, '%')
+          and ((
+                           #{startDate}   <![CDATA[<=]]> t.plan_start_time
+                       and #{endDate} >= t.plan_start_time
+                   )
+            or (
+                           #{startDate}    <![CDATA[<=]]> t.plan_end_time
+                       and #{endDate} >= t.plan_end_time
+                   )
+            or (
+                           #{startDate} >= t.plan_start_time
+                       and #{endDate}  <![CDATA[<=]]> t.plan_end_time
+                   ))
+        GROUP BY p.check_type
     </select>
+
     <select id="monitor" resultType="com.xunmei.core.board.vo.web.TaskStatisticVo">
         SELECT
         org_id,
@@ -40,7 +64,8 @@
         core_monitoring_retrieval_task r
         <!--                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
         WHERE
-        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and plan_end_time>=#{startDate}))
+        ((plan_start_time >= #{startDate} and plan_end_time&lt;=#{endDate}) or (plan_start_time&lt;=#{startDate} and
+        plan_end_time>=#{startDate}))
         and org_path like concat(#{orgPath},'%')
         GROUP BY
         org_id,org_path
@@ -55,7 +80,8 @@
         core_edu_training_task r
         <!--                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
         WHERE
-        ((start_date >= #{startDate} and end_date&lt;=#{endDate}) or (start_date&lt;=#{startDate} and end_date>=#{startDate}))
+        ((start_date >= #{startDate} and end_date&lt;=#{endDate}) or (start_date&lt;=#{startDate} and
+        end_date>=#{startDate}))
         and org_path like concat(#{orgPath},'%')
         GROUP BY
         org_id,org_path
@@ -70,29 +96,97 @@
         core_drill_task r
         <!--                INNER  join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
         WHERE
-        ((start_date >= #{startDate} and end_date&lt;=#{endDate}) or (start_date&lt;=#{startDate} and end_date>=#{startDate}))
+        ((start_date >= #{startDate} and end_date&lt;=#{endDate}) or (start_date&lt;=#{startDate} and
+        end_date>=#{startDate}))
         and org_path like concat(#{orgPath},'%')
         GROUP BY
         org_id,org_path
     </select>
-    <select id="orgGA38" resultType="com.xunmei.core.board.vo.web.OrgGA38StatisticVo">
-        SELECT o.id                                           as org_id,
-               o.path                                         as org_path,
-               o.short_name                                   as org_name,
-               IF(c.org_id is null,0,1) as  reach_count
-        FROM sys_org o
-        left join (select distinct org_id from sys_org_physical_defense_construction where standard!=3) c on o.id = c.org_id
-        WHERE (o.type = 4 or o.type=5)
-          and o.deleted = 0
-          and o.path like concat((select path from sys_org where id = #{orgId}), '%')
+    <select id="orgGA38" resultType="com.xunmei.core.board.dto.web.WebGA38InfoDto">
+        SELECT count(0)               as total,
+               o.path                 as org_path,
+               sum(m.ga382021)        as ga382021,
+               sum(m.ga382021current) as ga382021current,
+               sum(m.ga382015)        as ga382015,
+               sum(m.ga382015current) as ga382015current
+        from sys_org o
+                 LEFT JOIN (SELECT org_id,
+                                   sum(standard = 1)                                                 AS ga382021,
+                                   sum(IF(standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382021current,
+                                   sum(standard = 2)                                                 AS ga382015,
+                                   sum(IF(standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382015current
+                            FROM sys_org_physical_defense_construction
+                            WHERE type = 1
+                               OR type = 3
+                            GROUP BY org_id) m on o.id = m.org_id
+        WHERE o.deleted = 0
+          and o.is_lock = 0
+          and (o.type = 4 OR o.type = 5)
+          and o.path like concat(#{orgPath}, '%')
+    </select>
+    <select id="orgInfo" resultType="com.xunmei.core.board.vo.web.OrgInfoVo">
+        select sum(if(o.type = 3, 1, 0))                                     as hangsheCount,
+               sum(if(o.type = 4, 1, 0))                                     as bankingCount,
+               sum(if(o.type = 5, 1, 0))                                     as offlineCount,
+               sum(if(o.type = 4 and oe.business_library is not null, 1, 0)) as bankingStoreCount
+        from sys_org o
+                 LEFT JOIN sys_org_extend oe on o.id = oe.org_id
+        WHERE o.deleted = 0
+          and o.is_lock = 0
+          and o.path like concat(#{orgPath}, '%');
+    </select>
+    <select id="currentMonthVisitInfo" resultType="com.xunmei.core.board.vo.web.VisitInfoVo">
+        SELECT COUNT(*)        as total,
+               sum(l.type = 1) as electronicCount,
+               sum(l.type = 2) as paperCount,
+               sum(l.type = 3) as urgencyCount
+        FROM core_out_in_record r
+                 INNER JOIN core_introduce_letter l ON r.letter_id = l.id
+                 INNER JOIN sys_org o ON r.org_id = o.id
+        where arrival_time >= #{startDate}
+          and o.path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="question" resultType="com.xunmei.core.board.vo.web.QuestionStatisticVo">
-        SELECT count(0) as total,
-               sum(case confirm_status when 0 then 1 else 0 end) as unconfirm,
-               sum(case confirm_status when 1 then 1 else 0 end) as auditing,
-               sum(case confirm_status when 2 then 1 else 0 end) as unreform,
-               sum(case confirm_status when 3 then (if(reform_status is null,1,0)) else 0 end) notQuestion,
-               sum(case reform_status when 11 then 1 else 0 end) reformed
-        FROM core_question WHERE submit_time>=#{date} and org_path like CONCAT(#{orgPath},'%');
+        SELECT count(0)                                          as                              total,
+               sum(case confirm_status when 0 then 1 else 0 end) as                              unconfirm,
+               sum(case confirm_status when 1 then 1 else 0 end) as                              auditing,
+               sum(case confirm_status when 2 then 1 else 0 end) as                              unreform,
+               sum(case confirm_status when 3 then (if(reform_status is null, 1, 0)) else 0 end) notQuestion,
+               sum(case reform_status when 11 then 1 else 0 end)                                 reformed
+        FROM core_question
+        WHERE submit_time >= #{date}
+          and org_path like CONCAT(#{orgPath}, '%');
+    </select>
+
+
+    <select id="selectQuestion" resultType="com.xunmei.core.board.dto.web.WebSyntheticQuestionDto">
+        SELECT count(0)                                  as total,
+               sum(
+                       IF
+                           (q.confirm_status = 0, 1, 0)) AS confirmedCount,
+               sum(qf.count)                             AS dissentCount,
+               sum(
+                       IF
+                           (q.confirm_status = 3, 1, 0)) AS closedCount,
+               sum(
+                       IF
+                           (q.confirm_status = 2, 1, 0)) AS waitReformCount,
+               sum(
+                       IF
+                           (q.reform_status = 11, 1, 0)) AS reformedCount
+        FROM core_question q
+                 LEFT JOIN (SELECT question_id, count(0) AS count
+                            FROM core_question_flow
+                            WHERE execute_step = 1
+                              AND execute_status = 1
+                            GROUP BY question_id) qf ON q.id = qf.question_id
+        WHERE q.submit_time >= #{startDate}
+          AND q.org_path LIKE CONCAT(#{orgPath}, '%')
+    </select>
+    <select id="selectOverDueQuestionCount" resultType="Map">
+        SELECT count(0)                                              as count,
+               if(reform_status != 11 and confirm_status != 3, 1, 0) as overdueCount
+        FROM core_question
+        WHERE reform_deadline >= #{startDate}
     </select>
 </mapper>