Bläddra i källkod

两个驾驶舱的问题整改统计时间改为提出-整改与时间范围有交集

jiawuxian 1 år sedan
förälder
incheckning
340b38e4d2

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/app/AppSyntheticQuestionDto.java

@@ -29,4 +29,6 @@ public class AppSyntheticQuestionDto {
     private int safetyCheckReformCount;
     @ApiModelProperty("安全检查已确认数")
     private int safetyCheckConfirmedCount;
+    @ApiModelProperty("逾期数")
+    private int overdueCount;
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/web/WebSyntheticQuestionDto.java

@@ -23,5 +23,5 @@ public class WebSyntheticQuestionDto {
     private int reformedCount;
 
     @ApiModelProperty("已逾期")
-    private int ovedueCount;
+    private int overdueCount;
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/mapper/AppCockpitMapper.java

@@ -130,7 +130,7 @@ public interface AppCockpitMapper extends BaseMapper {
      * @param endDate
      * @return
      */
-    AppSyntheticQuestionDto selectSyntheticQuestion(@Param("orgPath") String orgPath, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
+    AppSyntheticQuestionDto selectSyntheticQuestion(@Param("orgPath") String orgPath, @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("today") Date today);
 
     /**
      * 获取逾期未整改数量

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/mapper/CockpitMapper.java

@@ -38,7 +38,7 @@ public interface CockpitMapper extends BaseMapper {
      * @param startDate
      * @return
      */
-    WebSyntheticQuestionDto selectQuestion(@Param("orgPath") String orgPath, @Param("startDate") Date startDate);
+    WebSyntheticQuestionDto selectQuestion(@Param("orgPath") String orgPath, @Param("startDate") Date startDate, @Param("endDate") Date endDate,@Param("today") Date today);
     /**
      * 获取逾期未整改数量
      * @param orgPath

+ 3 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/AppCockpitServiceImpl.java

@@ -346,17 +346,17 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     public AppSyntheticQuestionVo syntheticQuestion(Long orgId, Date month) {
         SysOrg org = getLoginOrg(orgId);
         DateRange range = DateUtils.getStartAndEnd(month, CycleCommonEnum.MONTHLY);
-        AppSyntheticQuestionDto questionDto = appCockpitMapper.selectSyntheticQuestion(org.getPath(), range.getStartTime(), range.getEndTime());
+        AppSyntheticQuestionDto questionDto = appCockpitMapper.selectSyntheticQuestion(org.getPath(), range.getStartTime(), range.getEndTime(),DateUtil.beginOfDay(new Date()));
         if (ObjectUtil.isNull(questionDto)) {
             questionDto = new AppSyntheticQuestionDto();
         }
-        int overdueCount = appCockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
+//        int overdueCount = appCockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
         AppSyntheticQuestionVo vo = new AppSyntheticQuestionVo();
         vo.getRateByState().put("已确认", (float) questionDto.getConfirmedCount());
         vo.getRateByState().put("有异议", (float) questionDto.getDissentCount());
         vo.getRateByState().put("已关闭", (float) questionDto.getCancelCount());
         vo.getRateByState().put("待整改", (float) questionDto.getWaitReformCount());
-        vo.getRateByState().put("已逾期", (float) overdueCount);
+        vo.getRateByState().put("已逾期", (float) questionDto.getOverdueCount());
         vo.getRateByState().put("已整改", (float) questionDto.getReformedCount());
         vo.getRateByState().put("整改率", NumberUtils.computeRate(questionDto.getConfirmedCount(), questionDto.getReformedCount()));
 

+ 10 - 10
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/CockpitServiceImpl.java

@@ -247,11 +247,11 @@ public class CockpitServiceImpl implements CockpitService {
         SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         DateRange range = getStartAndEnd(dto.getPeriod());
 
-        WebSyntheticQuestionDto questionDto = cockpitMapper.selectQuestion(org.getPath(), range.getStartTime());
+        WebSyntheticQuestionDto questionDto = cockpitMapper.selectQuestion(org.getPath(), range.getStartTime(),range.getEndTime(),DateUtil.beginOfDay(new Date()));
         if (ObjectUtil.isNull(questionDto)) {
             questionDto = new WebSyntheticQuestionDto();
         }
-        Map<String, Object> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
+//        Map<String, Object> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
 
         QuestionStatisticVo vo = new QuestionStatisticVo();
         vo.setTotal(questionDto.getTotal());
@@ -260,14 +260,14 @@ public class CockpitServiceImpl implements CockpitService {
         vo.setClosed(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getClosedCount()));
         vo.setUnreform(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getUnconfirmedCount()));
         vo.setReformed(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getReformedCount()));
-
-        if (overdueCount.size() == 2) {
-            Long count = (Long) overdueCount.get("count");
-            BigDecimal overdue = (BigDecimal) overdueCount.get("overdueCount");
-            vo.setOverdue(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
-        } else {
-            vo.setOverdue(0f);
-        }
+        vo.setOverdue(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getOverdueCount()));
+//        if (overdueCount.size() == 2) {
+//            Long count = (Long) overdueCount.get("count");
+//            BigDecimal overdue = (BigDecimal) overdueCount.get("overdueCount");
+//            vo.setOverdue(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
+//        } else {
+//            vo.setOverdue(0f);
+//        }
 
         return vo;
     }

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

@@ -2,14 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.core.board.mapper.AppCockpitMapper">
     <select id="selectOrgOverview" resultType="com.xunmei.core.board.vo.app.AppOverviewVo">
-        SELECT sum(IF(o.type = 3, 1, 0))                                                    as hangsheCount,
-               sum(IF(o.type = 4, 1, 0))                                                    as bankingCount,
-               sum(IF(o.type = 6, 1, 0))                                                    as centerStoreCount,
-               sum(o.type = 8 || oe.business_library=1)                                     as bankingStoreCount,
-               sum(IF(o.type = 5, 1, 0))                                                    as offlineATMCount,
-               sum(oe.self_service_bank =1)                                                 as onlineATMCount,
-               sum(oe.lobby_equipment)               as lobbyDeviceCount,
-               sum(oe.wall_penetrating_equipment) as throughwallDeviceCount
+        SELECT sum(IF(o.type = 3, 1, 0))                  as hangsheCount,
+               sum(IF(o.type = 4, 1, 0))                  as bankingCount,
+               sum(IF(o.type = 6, 1, 0))                  as centerStoreCount,
+               sum(o.type = 8 || oe.business_library = 1) as bankingStoreCount,
+               sum(IF(o.type = 5, 1, 0))                  as offlineATMCount,
+               sum(oe.self_service_bank = 1)              as onlineATMCount,
+               sum(oe.lobby_equipment)                    as lobbyDeviceCount,
+               sum(oe.wall_penetrating_equipment)         as throughwallDeviceCount
         from sys_org o
                  LEFT JOIN sys_org_extend oe on o.id = oe.org_id
         WHERE o.deleted = 0
@@ -26,16 +26,20 @@
                sum(m.ga382015prev)    as ga382015prev
         from sys_org o
                  LEFT JOIN (SELECT org_id,
-                                   sum(standard = 1)                                         AS ga382021,
+                                   sum(standard = 1)                                               AS ga382021,
                                    sum(IF
-                                       (standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0))   AS ga382021current,
+                                       (standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382021current,
                                    sum(IF
-                                       (standard = 1, IF(date_of_compliance &lt; #{date} and date_of_compliance>=#{prevMonth}, 1, 0), 0)) AS ga382021prev,
-                                   sum(standard = 2)                                         AS ga382015,
+                                       (standard = 1,
+                                        IF(date_of_compliance &lt; #{date} and date_of_compliance >= #{prevMonth}, 1,
+                                           0), 0))                                                 AS ga382021prev,
+                                   sum(standard = 2)                                               AS ga382015,
                                    sum(IF
-                                       (standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0))   AS ga382015current,
+                                       (standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382015current,
                                    sum(IF
-                                       (standard = 2, IF(date_of_compliance &lt; #{date} and date_of_compliance>=#{prevMonth}, 1, 0), 0)) AS ga382015prev
+                                       (standard = 2,
+                                        IF(date_of_compliance &lt; #{date} and date_of_compliance >= #{prevMonth}, 1,
+                                           0), 0))                                                 AS ga382015prev
                             FROM sys_org_physical_defense_construction
                             WHERE type = 1
                                OR type = 3
@@ -46,12 +50,12 @@
           and o.path like concat(#{orgPath}, '%')
     </select>
     <select id="selectOverViewResumptionTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
-        SELECT sum(if(t.ymd_date >= #{date}, 1, 0))                          as total,
+        SELECT sum(if(t.ymd_date >= #{date}, 1, 0))                            as total,
                sum(if(t.ymd_date >= #{date}, (if(t.`status` = 3, 1, 0)), 0))   as completed,
-               sum(if(t.ymd_date &lt; #{date}, 1, 0))                        as prevTotal,
+               sum(if(t.ymd_date &lt; #{date}, 1, 0))                          as prevTotal,
                sum(if(t.ymd_date &lt; #{date}, (if(t.`status` = 3, 1, 0)), 0)) as prevcompleted
         FROM core_resumption t
-        inner join core_resumption_plan p on t.plan_id=p.id and p.plan_cycle &lt; 5
+                 inner join core_resumption_plan p on t.plan_id = p.id and p.plan_cycle &lt; 5
         WHERE t.ymd_date >= #{prevdate}
           and t.org_path like concat(#{orgPath}, '%')
     </select>
@@ -62,43 +66,46 @@
                sum(if(t.ymd_date &lt; #{date}, 1, 0))                          as prevTotal,
                sum(if(t.ymd_date &lt; #{date}, (if(t.`status` = 3, 1, 0)), 0)) as prevcompleted
         FROM core_safety_task t
-        INNER JOIN core_safecheck_plan p on t.plan_id = p.id and p.check_type = 3
+                 INNER JOIN core_safecheck_plan p on t.plan_id = p.id and p.check_type = 3
         WHERE ymd_date >= #{prevdate}
           and org_path like concat(#{orgPath}, '%')
     </select>
 
     <select id="selectOverViewEduTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
-        SELECT sum(if(t.start_date >= #{date}, 1, 0))                          as total,
-               sum(if(t.start_date >= #{date} and t.`status` = 2, 1,  0))   as completed,
-               sum(if(t.start_date &lt; #{date}, 1, 0))                        as prevTotal,
+        SELECT sum(if(t.start_date >= #{date}, 1, 0))                      as total,
+               sum(if(t.start_date >= #{date} and t.`status` = 2, 1, 0))   as completed,
+               sum(if(t.start_date &lt; #{date}, 1, 0))                    as prevTotal,
                sum(if(t.start_date &lt; #{date} and t.`status` = 2, 1, 0)) as prevcompleted
         FROM core_edu_training_task t
-        left join core_edu_training_plan p on t.plan_id =p.id
-        WHERE t.start_date >= #{prevdate} and t.start_date &lt;=#{end}
+                 left join core_edu_training_plan p on t.plan_id = p.id
+        WHERE t.start_date >= #{prevdate}
+          and t.start_date &lt;= #{end}
           and t.org_path like concat(#{orgPath}, '%')
-          and ( p.plan_cycle &lt; 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.start_date >= #{date}, 1, 0))                          as total,
+        SELECT sum(if(t.start_date >= #{date}, 1, 0))                            as total,
                sum(if(t.start_date >= #{date}, (if(t.`status` = 4, 1, 0)), 0))   as completed,
-               sum(if(t.start_date &lt; #{date}, 1, 0))                        as prevTotal,
+               sum(if(t.start_date &lt; #{date}, 1, 0))                          as prevTotal,
                sum(if(t.start_date &lt; #{date}, (if(t.`status` = 4, 1, 0)), 0)) as prevcompleted
         FROM core_drill_task t
-        left join core_drill_plan p on t.plan_id=p.id
-        WHERE t.start_date >= #{prevdate}  and t.start_date &lt;=#{end}
+                 left join core_drill_plan p on t.plan_id = p.id
+        WHERE t.start_date >= #{prevdate}
+          and t.start_date &lt;= #{end}
           and t.org_path like concat(#{orgPath}, '%')
           and (p.plan_cycle &lt; 5 or t.plan_id is null)
     </select>
 
     <select id="selectOverViewMonitorTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
-        SELECT sum(if(t.ymd_date >= #{date}, 1, 0))                          as total,
+        SELECT sum(if(t.ymd_date >= #{date}, 1, 0))                      as total,
                sum(if(t.ymd_date >= #{date} and t.`status` = 2, 1, 0))   as completed,
-               sum(if(t.ymd_date &lt; #{date}, 1, 0))                        as prevTotal,
-               sum(if(t.ymd_date &lt; #{date} and t.`status` = 2, 1,  0)) as prevcompleted
+               sum(if(t.ymd_date &lt; #{date}, 1, 0))                    as prevTotal,
+               sum(if(t.ymd_date &lt; #{date} and t.`status` = 2, 1, 0)) as prevcompleted
         FROM core_monitoring_retrieval_task t
-        inner join core_monitoring_retrieval_plan p on t.plan_id =p.id and p.plan_cycle &lt; 4
-        WHERE t.ymd_date >= #{prevdate} and t.ymd_date &lt; #{end}
+                 inner join core_monitoring_retrieval_plan p on t.plan_id = p.id and p.plan_cycle &lt; 4
+        WHERE t.ymd_date >= #{prevdate}
+          and t.ymd_date &lt; #{end}
           and t.org_path like concat(#{orgPath}, '%')
     </select>
     <select id="selectOverViewQuestionInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
@@ -110,52 +117,55 @@
     </select>
 
     <select id="selectOrgBaseInfo" resultType="com.xunmei.core.board.dto.app.AppOrgBaseInfoDto">
-        SELECT count(0)                                              as total,
-               sum(if(oh.org_id is null, 1, 0))                      as unreachedCount,
-               sum(if(o.type = 4, 1, 0))                             as bankingCount,
-               sum(if(o.type = 4 and oe.self_service_bank=1, 1, 0))  as onlineATMCount,
-               sum(if(o.type = 5, 1, 0))                             as offATMCount,
-               sum(if(o.type = 4 and oh.banking2021>0 and oh.banking2021 is not null, 1, 0)) as bankingGA382021,
-               sum(if(o.type = 4 and oh.banking2015>0 and oh.banking2015 is not null,1, 0)) as bankingGA382015,
-               sum(if(o.type = 4 and oe.self_service_bank=1 and oh.online2021>0 and oh.online2021 is not null,1, 0)) as onlineGA382021,
-               sum(if(o.type = 4 and oe.self_service_bank=1 and oh.online2015>0 and oh.online2015 is not null,1, 0)) as onlineGA382015,
-               sum(if(o.type = 5 and oh.offline2021>0 and oh.offline2021 is not null,1, 0)) as offATMGA382021,
-               sum(if(o.type = 5 and oh.offline2015>0 and oh.offline2015 is not null,1 , 0)) as offATMGA382015,
-               sum(oe.business_library_type = 1)           as businessLibraryOne,
-               sum(oe.business_library_type = 2)           as businessLibraryTwo,
-               sum(oe.business_library_type = 3)           as businessLibraryThree,
-               sum(oe.business_library_type = 4)           as businessLibraryFour,
-               sum(if(oe.askari = 1, 1, 0))                             as orgWithSecurityCount,
-               sum(if(o.type = 4, oe.lobby_equipment,0))    as bankingObbyDeviceCount,
-               sum(if(o.type = 4, oe.wall_penetrating_equipment,0))     as bankingWallDeviceCount,
-               sum(if(o.type = 5, oe.lobby_equipment,0))    as offATMObbyDeviceCount,
-               sum(if(o.type = 5, oe.wall_penetrating_equipment,0))     as offATMWallDeviceCount
+        SELECT count(0)                                                                        as total,
+               sum(if(oh.org_id is null, 1, 0))                                                as unreachedCount,
+               sum(if(o.type = 4, 1, 0))                                                       as bankingCount,
+               sum(if(o.type = 4 and oe.self_service_bank = 1, 1, 0))                          as onlineATMCount,
+               sum(if(o.type = 5, 1, 0))                                                       as offATMCount,
+               sum(if(o.type = 4 and oh.banking2021 > 0 and oh.banking2021 is not null, 1, 0)) as bankingGA382021,
+               sum(if(o.type = 4 and oh.banking2015 > 0 and oh.banking2015 is not null, 1, 0)) as bankingGA382015,
+               sum(if(o.type = 4 and oe.self_service_bank = 1 and oh.online2021 > 0 and oh.online2021 is not null, 1,
+                      0))                                                                      as onlineGA382021,
+               sum(if(o.type = 4 and oe.self_service_bank = 1 and oh.online2015 > 0 and oh.online2015 is not null, 1,
+                      0))                                                                      as onlineGA382015,
+               sum(if(o.type = 5 and oh.offline2021 > 0 and oh.offline2021 is not null, 1, 0)) as offATMGA382021,
+               sum(if(o.type = 5 and oh.offline2015 > 0 and oh.offline2015 is not null, 1, 0)) as offATMGA382015,
+               sum(oe.business_library_type = 1)                                               as businessLibraryOne,
+               sum(oe.business_library_type = 2)                                               as businessLibraryTwo,
+               sum(oe.business_library_type = 3)                                               as businessLibraryThree,
+               sum(oe.business_library_type = 4)                                               as businessLibraryFour,
+               sum(if(oe.askari = 1, 1, 0))                                                    as orgWithSecurityCount,
+               sum(if(o.type = 4, oe.lobby_equipment, 0))                                      as bankingObbyDeviceCount,
+               sum(if(o.type = 4, oe.wall_penetrating_equipment, 0))                           as bankingWallDeviceCount,
+               sum(if(o.type = 5, oe.lobby_equipment, 0))                                      as offATMObbyDeviceCount,
+               sum(if(o.type = 5, oe.wall_penetrating_equipment, 0))                           as offATMWallDeviceCount
         FROM sys_org o
                  LEFT JOIN (select org_id,
                                    banking2021,
-                                   if(banking2015>0 and banking2021=0,1,0) as banking2015,
-                                   if(online2021 >0 or banking2021>0 ,1,0) as online2021,
-                                   if((online2015>0 or banking2015>0) and online2021=0 and banking2021=0 ,1,0) as  online2015,
+                                   if(banking2015 > 0 and banking2021 = 0, 1, 0) as banking2015,
+                                   if(online2021 > 0 or banking2021 > 0, 1, 0)   as online2021,
+                                   if((online2015 > 0 or banking2015 > 0) and online2021 = 0 and banking2021 = 0, 1,
+                                      0)                                         as online2015,
                                    offline2021,
-                                   if(offline2015>0 and offline2021=0,1,0) as offline2015
-                            from (
-                        SELECT org_id,
-                                   sum(type=1 and standard = 1) banking2021,
-                                   sum(type=1 and standard = 2) banking2015,
-                                   sum(type=2 and standard = 1) online2021,
-                                   sum(type=2 and standard = 2) online2015,
-                                   sum(type=3 and standard = 1) offline2021,
-                                   sum(type=3 and standard = 2) offline2015
-                            FROM sys_org_physical_defense_construction
-                            WHERE type = 1 or type=2
-                               OR type = 3
-                            GROUP BY org_id) t1) oh ON o.id = oh.org_id
+                                   if(offline2015 > 0 and offline2021 = 0, 1, 0) as offline2015
+                            from (SELECT org_id,
+                                         sum(type = 1 and standard = 1) banking2021,
+                                         sum(type = 1 and standard = 2) banking2015,
+                                         sum(type = 2 and standard = 1) online2021,
+                                         sum(type = 2 and standard = 2) online2015,
+                                         sum(type = 3 and standard = 1) offline2021,
+                                         sum(type = 3 and standard = 2) offline2015
+                                  FROM sys_org_physical_defense_construction
+                                  WHERE type = 1
+                                     or type = 2
+                                     OR type = 3
+                                  GROUP BY org_id) t1) oh ON o.id = oh.org_id
                  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}, '%')
-          AND ( o.type = 4
-                OR o.type = 5)
+          AND (o.type = 4
+            OR o.type = 5)
     </select>
     <select id="selectSyntheticResumption" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
         SELECT p.plan_type,
@@ -165,7 +175,7 @@
                            (r.STATUS = 3, 1, 0)) AS completed,
                sum(r.exception_count)            AS exceptionCount
         FROM core_resumption r
-        INNER JOIN core_resumption_plan p ON r.plan_id = p.id and p.plan_cycle &lt; 5
+                 INNER JOIN core_resumption_plan p ON r.plan_id = p.id and p.plan_cycle &lt; 5
         WHERE r.ymd_date BETWEEN #{startDate}
             AND #{endDate}
           AND r.org_path LIKE CONCAT(#{orgPath}, '%')
@@ -179,94 +189,108 @@
                            (r.STATUS = 3, 1, 0)) AS completed,
                sum(r.exception_count)            AS exceptionCount
         FROM core_safety_task r
-        left JOIN core_safecheck_plan p ON r.plan_id = p.id
+                 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
-            ))
+                           #{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 r.org_path LIKE CONCAT(#{orgPath}, '%')
         GROUP BY p.check_type
     </select>
-<!--    <select id="selectSyntheticDrill" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">-->
-<!--        SELECT r.type                            as plan_type,-->
-<!--               count(0)                          AS total,-->
-<!--               sum(r.STATUS = 3) AS completed-->
-<!--        FROM core_drill_task r-->
-<!--        WHERE r.start_date BETWEEN #{startDate}-->
-<!--            AND #{endDate}-->
-<!--          AND r.org_path LIKE CONCAT(#{orgPath}, '%')-->
-<!--        GROUP BY r.type-->
-<!--    </select>-->
-        <select id="selectSyntheticDrill" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
-            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
-                       ))
-              AND r.org_path LIKE CONCAT(#{orgPath}, '%')
-        </select>
+    <!--    <select id="selectSyntheticDrill" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">-->
+    <!--        SELECT r.type                            as plan_type,-->
+    <!--               count(0)                          AS total,-->
+    <!--               sum(r.STATUS = 3) AS completed-->
+    <!--        FROM core_drill_task r-->
+    <!--        WHERE r.start_date BETWEEN #{startDate}-->
+    <!--            AND #{endDate}-->
+    <!--          AND r.org_path LIKE CONCAT(#{orgPath}, '%')-->
+    <!--        GROUP BY r.type-->
+    <!--    </select>-->
+    <select id="selectSyntheticDrill" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
+        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
+                   ))
+          AND r.org_path LIKE CONCAT(#{orgPath}, '%')
+    </select>
     <select id="selectSyntheticQuestion" resultType="com.xunmei.core.board.dto.app.AppSyntheticQuestionDto">
         SELECT sum(
                        IF
-                           (q.confirm_status >= 2, 1, 0))                            AS confirmedCount,
-               sum(qf.count)                                                         AS dissentCount,
+                           (q.confirm_status >= 2, 1, 0))                                AS confirmedCount,
+               sum(qf.count)                                                             AS dissentCount,
                sum(
                        IF
-                           (q.confirm_status = 3 AND q.reform_status IS NULL, 1, 0)) AS cancelCount,
+                           (q.confirm_status = 3 AND q.reform_status IS NULL, 1, 0))     AS cancelCount,
                sum(
                        IF
-                           (q.confirm_status = 2, 1, 0))                             AS waitReformCount,
+                           (q.confirm_status = 2, 1, 0))                                 AS waitReformCount,
                sum(
                        IF
-                           (q.reform_status = 11, 1, 0))                             AS reformedCount,
+                           (q.reform_status = 11, 1, 0))                                 AS reformedCount,
                sum(
                        IF
-                           (q.src_type = 1 AND (q.src_task_type = 1 or q.src_task_type = 2 or q.src_task_type = 3), 1, 0))          AS resumptionCount,
+                           (q.src_type = 1 AND (q.src_task_type = 1 or q.src_task_type = 2 or q.src_task_type = 3), 1,
+                            0))                                                          AS resumptionCount,
                sum(
                        IF
-                           (q.src_type = 1 AND (q.src_task_type = 1 or q.src_task_type = 2 or q.src_task_type = 3) AND q.reform_status = 11, 1,
-                            0))                                                         resumptionReformedCount,
+                           (q.src_type = 1 AND (q.src_task_type = 1 or q.src_task_type = 2 or q.src_task_type = 3) AND
+                            q.reform_status = 11, 1,
+                            0))                                                             resumptionReformedCount,
                sum(
                        IF
-                           (q.src_type = 1 AND q.src_task_type = 6, 1, 0))           AS offATMResumptionCount,
+                           (q.src_type = 1 AND q.src_task_type = 6, 1, 0))               AS offATMResumptionCount,
                sum(
                        IF
                            (q.src_type = 1 AND q.src_task_type = 6 AND q.reform_status = 11, 1,
-                            0))                                                         offATMResumptionReformedCount,
+                            0))                                                             offATMResumptionReformedCount,
                sum(
                        IF
-                           (q.src_type = 2, 1, 0))                                   AS safetyCheckCount,
+                           (q.src_type = 2, 1, 0))                                       AS safetyCheckCount,
                sum(
                        IF
-                           (q.src_type = 2 AND q.reform_status = 11, 1, 0))             safetyCheckReformedCount,
+                           (q.src_type = 2 AND q.reform_status = 11, 1, 0))                 safetyCheckReformedCount,
                sum(
                        IF
-                           (q.confirm_status >= 2 AND q.src_type = 2, 1, 0))         AS safetyCheckConfirmedCount
+                           (q.confirm_status >= 2 AND q.src_type = 2, 1, 0))             AS safetyCheckConfirmedCount,
+               sum(if(q.confirm_status != 3 and q.reform_deadline &lt;= #{today}, 1, 0)) as overdueCount
         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 BETWEEN #{startDate} AND #{endDate}
+        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
+                   ))
           AND q.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="selectOverDueQuestionCount" resultType="java.lang.Integer">
@@ -279,10 +303,10 @@
     <select id="selectSyntheticEdu" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
         SELECT count(0) as total, sum(`status` = 2) as completed
         from core_edu_training_task t
-        left join core_edu_training_plan p on t.plan_id =p.id
+                 left join core_edu_training_plan p on t.plan_id = p.id
         where t.start_date BETWEEN #{startDate} and #{endDate}
           AND t.org_path LIKE CONCAT(#{orgPath}, '%')
-        and  (p.plan_cycle &lt; 4 or t.plan_id is null)
+          and (p.plan_cycle &lt; 4 or t.plan_id is null)
     </select>
     <select id="selectSyntheticInout" resultType="com.xunmei.core.board.vo.app.AppSyntheticInOutVo">
         SELECT COUNT(*)        as total,
@@ -299,7 +323,7 @@
     <select id="selectSyntheticMonitor" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
         SELECT count(0) as total, sum(t.`status` = 2) as completed
         from core_monitoring_retrieval_task t
-        inner join core_monitoring_retrieval_plan p on t.plan_id =p.id and p.plan_cycle &lt; 4
+                 inner join core_monitoring_retrieval_plan p on t.plan_id = p.id and p.plan_cycle &lt; 4
         where t.ymd_date BETWEEN #{startDate} and #{endDate}
           and t.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>

+ 27 - 13
soc-modules/soc-modules-core/src/main/resources/mapper/board/CockpitMapper.xml

@@ -9,7 +9,7 @@
         SUM( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS completed_count
         FROM
         core_resumption r
-        inner join  core_resumption_plan p on r.plan_id=p.id and p.plan_cycle &lt; 5
+        inner join core_resumption_plan p on r.plan_id=p.id and p.plan_cycle &lt; 5
         <!--                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
         ((
@@ -48,7 +48,7 @@
                count(0)                      as total,
                sum(if(t.`status` = 3, 1, 0)) as completed
         FROM core_safety_task t
-        left JOIN core_safecheck_plan p on t.plan_id = p.id
+                 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
@@ -101,7 +101,7 @@
         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
-         ((
+        ((
         #{startDate}   <![CDATA[<=]]> r.start_date
         and #{endDate} >= r.start_date
         )
@@ -151,9 +151,9 @@
                if(m.ga382015current is null, 0, 1) as ga382015current
         from sys_org o
                  LEFT JOIN (SELECT org_id,
-                                   sum(standard = 1)                                                 AS ga382021,
-                                   sum(IF(standard = 1 and date_of_compliance >= #{date}, 1,0)) AS ga382021current,
-                                   sum(standard = 2)                                                 AS ga382015,
+                                   sum(standard = 1)                                             AS ga382021,
+                                   sum(IF(standard = 1 and date_of_compliance >= #{date}, 1, 0)) AS ga382021current,
+                                   sum(standard = 2)                                             AS ga382015,
                                    sum(IF(standard = 2 and date_of_compliance >= #{date}, 1, 0)) AS ga382015current
                             FROM sys_org_physical_defense_construction
                             WHERE type = 1
@@ -176,13 +176,13 @@
           and o.path like concat(#{orgPath}, '%');
     </select>
     <select id="orgSecurityInfo" resultType="com.xunmei.core.board.vo.web.OrgSecurityInfoVo">
-        select sum(if(oe.askari = 1, 1, 0))  as equippedCount,
+        select sum(if(oe.askari = 1, 1, 0))                       as equippedCount,
                sum(if(oe.askari != 1 || oe.askari is null, 1, 0)) as unequippedCount
         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.type=4
+          and o.type = 4
           and o.path like concat(#{orgPath}, '%');
     </select>
     <select id="currentMonthVisitInfo" resultType="com.xunmei.core.board.vo.web.VisitInfoVo">
@@ -223,19 +223,33 @@
                            (q.confirm_status = 2, 1, 0)) AS waitReformCount,
                sum(
                        IF
-                           (q.reform_status = 11, 1, 0)) AS reformedCount
+                           (q.reform_status = 11, 1, 0)) AS reformedCount,
+               sum(if(q.confirm_status != 3 and q.reform_deadline &lt;= #{today}, 1, 0)) as overdueCount
         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}
+        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
+                   ))
           AND q.org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
     <select id="selectOverDueQuestionCount" resultType="Map">
-        SELECT count(0)                                              as count,
-               sum(if(reform_status != 11 and confirm_status != 3 and reform_deadline >= #{startDate} and reform_deadline &lt;=#{endDate}, 1, 0)) as overdueCount
-        FROM core_question where org_path LIKE CONCAT(#{orgPath}, '%')
+        SELECT count(0)                                        as count,
+               sum(if(reform_status != 11 and confirm_status != 3 and reform_deadline >= #{startDate} and
+                      reform_deadline &lt;= #{endDate}, 1, 0)) as overdueCount
+        FROM core_question
+        where org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
 </mapper>