Kaynağa Gözat

统一web和app总览查询时间为结束和时间

xujie 1 yıl önce
ebeveyn
işleme
9572d204bc

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

@@ -82,20 +82,20 @@
         WHERE t.end_date >= #{date}
           and t.end_date <= #{end}
           and t.org_path like concat(#{orgPath}, '%')
-          and (p.plan_cycle < 4 or t.plan_id is null)
+          <!-- and (p.plan_cycle &lt; 4 or t.plan_id is null) -->
     </select>
 
     <select id="selectOverViewDrillTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
         SELECT sum(if(t.end_date >= #{date}, 1, 0))                            as total,
-               sum(if(t.end_date >= #{date}, (if(t.`status` = 4, 1, 0)), 0))   as completed,
+               sum(if(t.end_date >= #{date}, (if(t.`status` = 3 or t.`status` = 2, 1, 0)), 0))   as completed,
                sum(if(t.end_date &lt; #{date}, 1, 0))                          as prevTotal,
-               sum(if(t.end_date &lt; #{date}, (if(t.`status` = 4, 1, 0)), 0)) as prevcompleted
+               sum(if(t.end_date &lt; #{date}, (if(t.`status` = 3 or t.`status` = 2, 1, 0)), 0)) as prevcompleted
         FROM core_drill_task t
                  left join core_drill_plan p on t.plan_id = p.id
-        WHERE t.end_date >= #{prevdate}
+        WHERE t.end_date >= #{date}
           and t.end_date &lt;= #{end}
           and t.org_path like concat(#{orgPath}, '%')
-          and (p.plan_cycle &lt; 5 or t.plan_id is null)
+          <!-- and (p.plan_cycle &lt; 5 or t.plan_id is null) -->
     </select>
 
     <select id="selectOverViewMonitorTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
@@ -110,7 +110,7 @@
           and t.org_path like concat(#{orgPath}, '%')
     </select>
     <select id="selectOverViewQuestionInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
-        SELECT sum(if(confirm_status >= 2, 1, 0)) as total,
+        SELECT sum(if(confirm_status >= 2 and reform_status is not null, 1, 0)) as total,
                sum(if(reform_status = 11, 1, 0))  as completed
         FROM core_question
         WHERE submit_time >= #{date}
@@ -191,18 +191,10 @@
                sum(r.exception_count)            AS exceptionCount
         FROM core_safety_task r
                  left JOIN core_safecheck_plan p ON r.plan_id = p.id
-        WHERE ((
-                           #{startDate}   <![CDATA[<=]]> r.plan_start_time
-                       and #{endDate} >= r.plan_start_time
-                   )
-            or (
-                           #{startDate}    <![CDATA[<=]]> r.plan_end_time
-                       and #{endDate} >= r.plan_end_time
-                   )
-            or (
-                           #{startDate} >= r.plan_start_time
-                       and #{endDate}  <![CDATA[<=]]> r.plan_end_time
-                   ))
+        WHERE (
+                   #{startDate}    <![CDATA[<=]]> r.plan_end_time
+                   and #{endDate} >= r.plan_end_time
+               )
           AND r.org_path LIKE CONCAT(#{orgPath}, '%')
         GROUP BY p.check_type
     </select>
@@ -220,18 +212,10 @@
         SELECT count(0)          AS total,
                sum(r.STATUS = 3) AS completed
         FROM core_drill_task r
-        WHERE ((
-                           #{startDate}   <![CDATA[<=]]> r.start_date
-                       and #{endDate} >= r.start_date
-                   )
-            or (
-                           #{startDate}    <![CDATA[<=]]> r.end_date
-                       and #{endDate} >= r.end_date
-                   )
-            or (
-                           #{startDate} >= r.start_date
-                       and #{endDate}  <![CDATA[<=]]> r.end_date
-                   ))
+        WHERE (
+                   #{startDate}    <![CDATA[<=]]> r.end_date
+                   and #{endDate} >= r.end_date
+               )
           AND r.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="selectSyntheticQuestion" resultType="com.xunmei.core.board.dto.app.AppSyntheticQuestionDto">
@@ -278,18 +262,10 @@
                            (q.confirm_status >= 2 AND q.reform_status IS NOT NULL AND q.src_type = 2, 1, 0))             AS safetyCheckConfirmedCount,
                sum(if(q.reform_status = 10 and q.reform_deadline &lt;= #{today}, 1, 0)) as overdueCount
         FROM core_question q
-        WHERE ((
-                           #{startDate}   <![CDATA[<=]]> q.submit_time
-                       and #{endDate} >= q.submit_time
-                   )
-            or (
-                           #{startDate}    <![CDATA[<=]]> q.reform_deadline
-                       and #{endDate} >= q.reform_deadline
-                   )
-            or (
-                           #{startDate} >= q.submit_time
-                       and #{endDate}  <![CDATA[<=]]> q.reform_deadline
-                   ))
+        WHERE (
+                   #{startDate}    <![CDATA[<=]]> q.reform_deadline
+                   and #{endDate} >= q.reform_deadline
+               )
           AND q.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="selectOverDueQuestionCount" resultType="java.lang.Integer">

+ 9 - 33
soc-modules/soc-modules-core/src/main/resources/mapper/board/CockpitMapper.xml

@@ -42,18 +42,10 @@
         FROM core_safety_task t
                  left 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
-                   ))
+          and (
+                   #{startDate}    <![CDATA[<=]]> t.plan_end_time
+                   and #{endDate} >= t.plan_end_time
+               )
         GROUP BY p.check_type
     </select>
 
@@ -67,18 +59,10 @@
         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
-        ((
-        #{startDate}   <![CDATA[<=]]> r.plan_start_time
-        and #{endDate} >= r.plan_start_time
-        )
-        or (
+        (
         #{startDate}    <![CDATA[<=]]> r.plan_end_time
         and #{endDate} >= r.plan_end_time
         )
-        or (
-        #{startDate} >= r.plan_start_time
-        and #{endDate}  <![CDATA[<=]]> r.plan_end_time
-        ))
         and org_path like concat(#{orgPath},'%')
         GROUP BY
         org_id,org_path
@@ -208,18 +192,10 @@
                            (q.reform_status = 13, 1, 0))                                 AS overDueReformedCount,
                sum(if(q.confirm_status != 3 and q.reform_status!=11 and q.reform_status!=13 and q.reform_deadline &lt;= #{today}, 1, 0)) as overdueCount
         FROM core_question q
-        WHERE ((
-                           #{startDate}   <![CDATA[<=]]> q.submit_time
-                       and #{endDate} >= q.submit_time
-                   )
-            or (
-                           #{startDate}    <![CDATA[<=]]> q.reform_deadline
-                       and #{endDate} >= q.reform_deadline
-                   )
-            or (
-                           #{startDate} >= q.submit_time
-                       and #{endDate}  <![CDATA[<=]]> q.reform_deadline
-                   ))
+        WHERE (
+                   #{startDate}   <![CDATA[<=]]> q.submit_time
+                   and #{endDate} >= q.submit_time
+               )
           AND q.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="selectOverDueQuestionCount" resultType="Map">