Преглед на файлове

APP驾驶舱-预案演练调整

jiawuxian преди 1 година
родител
ревизия
e75006e593

+ 9 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/controller/AppCockpitController.java

@@ -101,15 +101,15 @@ public class AppCockpitController extends BaseController {
         return success(vo);
     }
 
-    /**
-     * 综合数据-安全检查
-     */
-    @ApiOperation(value = "综合数据-预案演练", response = AppSyntheticSafetycheckVo.class)
-    @GetMapping("/synthetic/drill")
-    public AjaxResult syntheticDrill(Date date) {
-        AppSyntheticDrillVo vo = appCockpitService.syntheticDrill(date);
-        return success(vo);
-    }
+//    /**
+//     * 综合数据-安全检查
+//     */
+//    @ApiOperation(value = "综合数据-预案演练", response = AppSyntheticSafetycheckVo.class)
+//    @GetMapping("/synthetic/drill")
+//    public AjaxResult syntheticDrill(Date date) {
+//        AppSyntheticDrillVo vo = appCockpitService.syntheticDrill(date);
+//        return success(vo);
+//    }
 
     /**
      * 综合数据-安全检查

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

@@ -109,7 +109,7 @@ public interface AppCockpitMapper extends BaseMapper {
      * @param endDate
      * @return
      */
-    List<AppSyntheticTaskCategoryDto> selectSyntheticDrill (@Param("orgPath") String orgPath,@Param("startDate") Date startDate,@Param("endDate") Date endDate);
+     AppSyntheticTaskCategoryDto selectSyntheticDrill (@Param("orgPath") String orgPath,@Param("startDate") Date startDate,@Param("endDate") Date endDate);
 
     /**
      *

+ 6 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/AppCockpitService.java

@@ -49,12 +49,12 @@ public interface AppCockpitService {
      */
     AppSyntheticSafetycheckVo syntheticSafetyCheck(Date month);
 
-    /**
-     * 综合数据-预案演练
-     * @param date
-     * @return
-     */
-    AppSyntheticDrillVo syntheticDrill(Date date);
+//    /**
+//     * 综合数据-预案演练
+//     * @param date
+//     * @return
+//     */
+//    AppSyntheticDrillVo syntheticDrill(Date date);
 
     /**
      * 综合数据-其它

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

@@ -344,45 +344,45 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         return vo;
     }
 
-    /**
-     * 综合数据-预案演练
-     *
-     * @param date
-     * @return
-     */
-    @Override
-    public AppSyntheticDrillVo syntheticDrill(Date date) {
-        SysOrg org = getLoginOrg();
-        DateRange range = DateUtils.getStartAndEnd(date, CycleCommonEnum.QUARTERLY);
-        List<AppSyntheticTaskCategoryDto> taskCategoryDtos = appCockpitMapper.selectSyntheticDrill(org.getPath(), range.getStartTime(), range.getEndTime());
-        AppSyntheticDrillVo vo = new AppSyntheticDrillVo();
-        vo.setInfoByType(new LinkedHashMap<>());
-        vo.setRateByType(new LinkedHashMap<>());
-
-        Predicate3<List<String>, String, String> predicate3 = (List<String> types, String label, String no) -> {
-            List<AppSyntheticTaskCategoryDto> used = taskCategoryDtos.stream().filter(d -> types.contains(d.getPlanType())).collect(Collectors.toList());
-            int total = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getTotal).sum();
-            int completed = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getCompleted).sum();
-            Float rate = computeRate(total, completed);
-
-            vo.getRateByType().put(label, rate);
-            vo.getInfoByType().put(label, AppSyntheticTaskInfoVo.builder()
-                    .shouldCompleteCount(total)
-                    .completedCount(completed)
-                    .completedRate(rate)
-                    .build());
-
-            return true;
-        };
-
-        predicate3.test(Arrays.asList("1"), "防抢", null);
-        predicate3.test(Arrays.asList("2"), "防盗", null);
-        predicate3.test(Arrays.asList("3"), "反诈", null);
-        predicate3.test(Arrays.asList("5"), "自然灾害", null);
-        predicate3.test(Arrays.asList("4"), "消防及疏散", null);
-        predicate3.test(Arrays.asList("6"), "其它", null);
-        return vo;
-    }
+//    /**
+//     * 综合数据-预案演练
+//     *
+//     * @param date
+//     * @return
+//     */
+//    @Override
+//    public AppSyntheticDrillVo syntheticDrill(Date date) {
+//        SysOrg org = getLoginOrg();
+//        DateRange range = DateUtils.getStartAndEnd(date, CycleCommonEnum.QUARTERLY);
+//        List<AppSyntheticTaskCategoryDto> taskCategoryDtos = appCockpitMapper.selectSyntheticDrill(org.getPath(), range.getStartTime(), range.getEndTime());
+//        AppSyntheticDrillVo vo = new AppSyntheticDrillVo();
+//        vo.setInfoByType(new LinkedHashMap<>());
+//        vo.setRateByType(new LinkedHashMap<>());
+//
+//        Predicate3<List<String>, String, String> predicate3 = (List<String> types, String label, String no) -> {
+//            List<AppSyntheticTaskCategoryDto> used = taskCategoryDtos.stream().filter(d -> types.contains(d.getPlanType())).collect(Collectors.toList());
+//            int total = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getTotal).sum();
+//            int completed = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getCompleted).sum();
+//            Float rate = computeRate(total, completed);
+//
+//            vo.getRateByType().put(label, rate);
+//            vo.getInfoByType().put(label, AppSyntheticTaskInfoVo.builder()
+//                    .shouldCompleteCount(total)
+//                    .completedCount(completed)
+//                    .completedRate(rate)
+//                    .build());
+//
+//            return true;
+//        };
+//
+//        predicate3.test(Arrays.asList("1"), "防抢", null);
+//        predicate3.test(Arrays.asList("2"), "防盗", null);
+//        predicate3.test(Arrays.asList("3"), "反诈", null);
+//        predicate3.test(Arrays.asList("5"), "自然灾害", null);
+//        predicate3.test(Arrays.asList("4"), "消防及疏散", null);
+//        predicate3.test(Arrays.asList("6"), "其它", null);
+//        return vo;
+//    }
 
     @Override
     public AppSyntheticOtherVo syntheticOther(Date date) throws ExecutionException, InterruptedException, TimeoutException {
@@ -391,6 +391,9 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         CompletableFuture<AppSyntheticTaskCategoryDto> edu = CompletableFuture.supplyAsync(() ->
                 appCockpitMapper.selectSyntheticEdu(org.getPath(), range.getStartTime(), range.getEndTime()), threadPoolTaskExecutor
         );
+        CompletableFuture<AppSyntheticTaskCategoryDto> drill = CompletableFuture.supplyAsync(() ->
+                appCockpitMapper.selectSyntheticDrill(org.getPath(), range.getStartTime(), range.getEndTime()), threadPoolTaskExecutor
+        );
         CompletableFuture<AppSyntheticTaskCategoryDto> monitor = CompletableFuture.supplyAsync(() ->
                 appCockpitMapper.selectSyntheticMonitor(org.getPath(), range.getStartTime(), range.getEndTime()), threadPoolTaskExecutor
         );
@@ -400,13 +403,16 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         );
 
         CompletableFuture<Void> allQueries = CompletableFuture.allOf(
-                inout, edu, monitor
+                inout, edu,drill, monitor
         );
 
-
         allQueries.get(TIMEOUT, TimeUnit.SECONDS);
 
         AppSyntheticOtherVo vo = new AppSyntheticOtherVo();
+        vo.getDrill().setShouldCompleteCount(drill.get().getTotal());
+        vo.getDrill().setCompletedCount(drill.get().getCompleted());
+        vo.getDrill().setCompletedRate(computeRate(drill.get().getTotal(), drill.get().getCompleted()));
+
         vo.getEdu().setShouldCompleteCount(edu.get().getTotal());
         vo.getEdu().setCompletedCount(edu.get().getCompleted());
         vo.getEdu().setCompletedRate(computeRate(edu.get().getTotal(), edu.get().getCompleted()));

+ 7 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/app/AppSyntheticOtherVo.java

@@ -8,6 +8,8 @@ import lombok.Data;
  */
 @Data
 public class AppSyntheticOtherVo {
+    @ApiModelProperty("预案演练")
+    private AppSyntheticTaskInfoVo drill;
     @ApiModelProperty("教育培训")
     private AppSyntheticTaskInfoVo edu;
     @ApiModelProperty("监控调阅")
@@ -15,9 +17,10 @@ public class AppSyntheticOtherVo {
     @ApiModelProperty("出入管理")
     private AppSyntheticInOutVo inout;
 
-    public  AppSyntheticOtherVo(){
-        this.edu=new AppSyntheticTaskInfoVo();
-        this.monitor=new AppSyntheticTaskInfoVo();
-        this.inout=new AppSyntheticInOutVo();
+    public AppSyntheticOtherVo() {
+        this.drill = new AppSyntheticTaskInfoVo();
+        this.edu = new AppSyntheticTaskInfoVo();
+        this.monitor = new AppSyntheticTaskInfoVo();
+        this.inout = new AppSyntheticInOutVo();
     }
 }

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

@@ -163,16 +163,24 @@
           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 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 r.start_date BETWEEN #{startDate}
+                AND #{endDate}
+              AND r.org_path LIKE CONCAT(#{orgPath}, '%')
+        </select>
     <select id="selectSyntheticQuestion" resultType="com.xunmei.core.board.dto.app.AppSyntheticQuestionDto">
         SELECT sum(
                        IF