Explorar o código

Merge remote-tracking branch 'origin/V0.0.5' into V0.0.5

jingyuanchao hai 1 ano
pai
achega
5d8ff904f6
Modificáronse 46 ficheiros con 981 adicións e 202 borrados
  1. 2 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteOrgService.java
  2. 10 4
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java
  3. 1 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/panel/dto/PanelListDto.java
  4. 6 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/DateUtils.java
  5. 22 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/NumberUtils.java
  6. 3 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/mapper/TMonitoringRetrievalPlanMapper.java
  7. 21 4
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java
  8. 37 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/controller/WebCockpitController.java
  9. 35 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/web/WebGA38InfoDto.java
  10. 27 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/web/WebSyntheticQuestionDto.java
  11. 31 5
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/mapper/CockpitMapper.java
  12. 24 6
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/CockpitService.java
  13. 19 39
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/AppCockpitServiceImpl.java
  14. 209 46
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/CockpitServiceImpl.java
  15. 13 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgGA38StatisticVo.java
  16. 16 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgInfoVo.java
  17. 19 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgSecurityInfoVo.java
  18. 15 14
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/QuestionStatisticVo.java
  19. 23 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/VisitInfoVo.java
  20. 16 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/WebDrillInfoVo.java
  21. 12 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/WebSafetyCheckVo.java
  22. 6 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/mapper/CoreEvaluateTaskMapper.java
  23. 27 5
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/service/impl/CoreEvaluatePlanServiceImpl.java
  24. 1 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/vo/CoreEvaluatePlanListVO.java
  25. 4 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/vo/CoreEvaluatePlanVO.java
  26. 2 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/controller/CoreMessageCenterController.java
  27. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/mapper/CoreMessageCenterMapper.java
  28. 44 5
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/impl/CoreMessageCenterServiceImpl.java
  29. 9 7
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/message/mapper/CoreAnnouncementNotificationMapper.java
  30. 2 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java
  31. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java
  32. 3 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java
  33. 29 6
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskBuilderService.java
  34. 10 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskBuilderServiceImpl.java
  35. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/CoreSafecheckPlanServiceImpl.java
  36. 2 1
      soc-modules/soc-modules-core/src/main/resources/mapper/board/AppCockpitMapper.xml
  37. 139 36
      soc-modules/soc-modules-core/src/main/resources/mapper/board/CockpitMapper.xml
  38. 15 0
      soc-modules/soc-modules-core/src/main/resources/mapper/evaluate/CoreEvaluateTaskMapper.xml
  39. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/information/CoreMessageCenterMapper.xml
  40. 38 1
      soc-modules/soc-modules-core/src/main/resources/mapper/message/CoreAnnouncementNotificationMapper.xml
  41. 26 0
      soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml
  42. 6 6
      soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java
  43. 8 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgController.java
  44. 2 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysUserController.java
  45. 2 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java
  46. 41 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

+ 2 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteOrgService.java

@@ -65,6 +65,8 @@ public interface RemoteOrgService {
     @GetMapping("/org/selectOrgTreeListByCurOrgId")
     List<SysOrg> selectOrgTreeListByCurOrgId(@RequestParam("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
+    @GetMapping("/org/selectchildfromdb")
+    List<SysOrg> selectChildrenFromDb(@RequestParam("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
     @GetMapping("/dept/get/{orgId}")
     SysOrg selectOrgById(@PathVariable("orgId") Long orgId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

+ 10 - 4
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java

@@ -17,6 +17,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -60,8 +61,8 @@ public class RemoteOrgFallbackFactory implements FallbackFactory<RemoteOrgServic
             }
 
             @Override
-            public List<SysOrg> selectSysOrgByParentIds( List<Long> parentIds,String source){
-                return  new ArrayList<>();
+            public List<SysOrg> selectSysOrgByParentIds(List<Long> parentIds, String source) {
+                return new ArrayList<>();
             }
 
             @Override
@@ -165,12 +166,12 @@ public class RemoteOrgFallbackFactory implements FallbackFactory<RemoteOrgServic
             }
 
             @Override
-            public R<List<SysOrgVO>> hangsheWholePathTree(Long orgId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source) {
+            public R<List<SysOrgVO>> hangsheWholePathTree(Long orgId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) {
                 return R.fail();
             }
 
             @Override
-            public R<OrgTreeResp>  getOrgTreeResp(OrgTreeReq orgTreeReq) {
+            public R<OrgTreeResp> getOrgTreeResp(OrgTreeReq orgTreeReq) {
                 log.error("获取机构树失败:{}", throwable.getMessage());
                 return R.fail();
             }
@@ -193,6 +194,11 @@ public class RemoteOrgFallbackFactory implements FallbackFactory<RemoteOrgServic
             }
 
             @Override
+            public List<SysOrg> selectChildrenFromDb(@RequestParam("id") Long id, String source) {
+                return new ArrayList<>();
+            }
+
+            @Override
             public List<SysOrg> selectOrgByPath(Long orgId) {
                 return new ArrayList<>();
             }

+ 1 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/panel/dto/PanelListDto.java

@@ -21,6 +21,7 @@ public class PanelListDto {
     @ApiModelProperty(value = "当前用户菜单权限id")
     private List<Long> permList;
 
+
     private Date startTime;
     private Date endTime;
 

+ 6 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/DateUtils.java

@@ -171,6 +171,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return toLocalDateTime(date).toLocalDate();
     }
 
+    /**
+     * 适用于教育培训、预案演练
+     * @param date
+     * @param cycle
+     * @return
+     */
     public static DateRange getStartAndEnd(Date date, Integer cycle) {
         LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
         LocalDateTime startDateTime;

+ 22 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/NumberUtils.java

@@ -0,0 +1,22 @@
+package com.xunmei.common.core.utils;
+
+import cn.hutool.core.util.ObjectUtil;
+
+public class NumberUtils {
+    /**
+     * 计算比例
+     *
+     * @param total
+     * @param divisor
+     * @return
+     */
+    public static float computeRate(Integer total, Integer divisor) {
+        if (ObjectUtil.equal(total, 0) || ObjectUtil.isNull(total)) {
+            return 1F;
+        } else if (ObjectUtil.equal(divisor, 0) || ObjectUtil.isNull(divisor)) {
+            return 0F;
+        } else {
+            return (divisor.floatValue() / total.floatValue());
+        }
+    }
+}

+ 3 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/mapper/TMonitoringRetrievalPlanMapper.java

@@ -88,6 +88,8 @@ public interface TMonitoringRetrievalPlanMapper extends BaseMapper<TMonitoringRe
      * @return 结果
      */
     int deleteTMonitoringRetrievalPlanByIds(Long[] ids);
-  List<AccessDataVo>   selectPointByTask(Long taskId);
+
+    List<AccessDataVo> selectPointByTask(Long taskId);
+
     AccessPdfVO selectTask(Long taskId);
 }

+ 21 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java

@@ -90,6 +90,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     private RemoteFileService fileService;
     @Autowired
     private CoreMonitoringRetrievalTaskMapper coreMonitoringRetrievalTaskMapper;
+    @Autowired
+    private ICoreRegisterBookPdfService iCoreRegisterBookPdfService;
 
     @Override
     public TableDataInfo selectPage(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
@@ -170,8 +172,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(collect, status);
         if (CollectionUtils.isNotEmpty(coreMonitoringRetrievalTasks)) {
             isComplete = true;
-        }else {
-            isComplete=false;
+        } else {
+            isComplete = false;
         }
         if (plan.getPlanStatus() == 0) {
             isComplete = false;
@@ -858,13 +860,27 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
             }
             if ("1".equals(monitoringRetrievalPlan.getPlanCycle())) {
                 LocalDate currentDate = LocalDate.now();
+                //为了删除PDF查询要删除的任务id
+                List<Long> longs = coreMonitoringRetrievalTaskBuilderService.selectTaskByToday(id, currentDate.toString());
+                if (CollectionUtils.isNotEmpty(longs)){
+                    longs.forEach(l->{
+                        iCoreRegisterBookPdfService.deleteWithFile(l);
+                    });
+                }
+
                 coreMonitoringRetrievalTaskBuilderService.deleteTaskByToday(id, currentDate.toString());
             } else {
                 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                 String format = simpleDateFormat.format(new Date());
+                //为了删除PDF查询要删除的任务id
+                List<Long> longs = coreMonitoringRetrievalTaskBuilderService.selectTaskByStartTime(id, format);
+                if (CollectionUtils.isNotEmpty(longs)){
+                    longs.forEach(l->{
+                        iCoreRegisterBookPdfService.deleteWithFile(l);
+                    });
+                }
                 coreMonitoringRetrievalTaskBuilderService.deleteTaskByStartTime(id, format);
             }
-
         }
         return i;
     }
@@ -912,6 +928,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         //  registerBookPdf.setId(appSafetyCheckTask.getId());
         registerBookPdf.setRegisterBookType(RegisterBookType.MONITOR_ACCESS.getNum());
         registerBookPdf.setDate(new Date());
+        registerBookPdf.setId(accessPdfVO.getTaskId());
         SysOrg org = remoteOrgService.selectSysOrgById(accessPdf.getOrgId(), SecurityConstants.INNER);
         registerBookPdf.setOrgId(org.getId());
         registerBookPdf.setOrgPath(org.getPath());
@@ -953,7 +970,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
             dataVos.add(v);
         }
         accessPdf.setDataVos(dataVos);
-        String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.MONITOR_ACCESS,accessPdfVO.getOrgName());
+        String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.MONITOR_ACCESS, accessPdfVO.getOrgName());
         accessPdf.setDest(fileName);
         return accessPdf;
     }

+ 37 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/controller/WebCockpitController.java

@@ -5,6 +5,7 @@ import com.xunmei.common.core.web.controller.BaseController;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.core.board.dto.web.TaskStatisticDto;
 import com.xunmei.core.board.service.CockpitService;
+import com.xunmei.core.board.vo.web.VisitInfoVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
@@ -76,8 +77,42 @@ public class WebCockpitController extends BaseController {
      */
     @ApiOperation(value = "统计GA38达标情况")
     @GetMapping("/orgga38")
-    public AjaxResult orgGA38(Long orgId) {
-        return success(cockpitService.orgGA38(orgId));
+    public AjaxResult orgGA38(TaskStatisticDto dto) {
+        return success(cockpitService.orgGA38(dto));
+    }
+
+    /**
+     * 机构信息
+     */
+    @ApiOperation(value = "统计机构信息")
+    @GetMapping("/orginfo")
+    public AjaxResult orgInfo(Long orgId) {
+        return success(cockpitService.orgInfo(orgId));
+    }
+
+    /**
+     * 机构信息
+     */
+    @ApiOperation(value = "统计机构信息")
+    @GetMapping("/orgsecurityinfo")
+    public AjaxResult orgSecurityInfo(Long orgId) {
+        return success(cockpitService.orgSecurityInfo(orgId));
+    }
+
+
+    /**
+     * 本月来访
+     *
+     * @param orgPath
+     * @return
+     */
+    /**
+     * 机构信息
+     */
+    @ApiOperation(value = "统计机构信息")
+    @GetMapping("/currentmonthvisit")
+    public AjaxResult currentMonthVisitInfo(Long orgId) {
+        return success(cockpitService.currentMonthVisitInfo(orgId));
     }
 
     /**

+ 35 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/web/WebGA38InfoDto.java

@@ -0,0 +1,35 @@
+package com.xunmei.core.board.dto.web;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * APP驾驶舱总览GA38信息
+ */
+@Data
+public class WebGA38InfoDto {
+    /**
+     * 应完成数
+     */
+    private int total;
+
+    private String path;
+
+    @ApiModelProperty("GA38-2021总达标数")
+    private int  ga382021;
+
+    @ApiModelProperty("本周期的GA38-2021达标数")
+    private int  ga382021current;
+
+    @ApiModelProperty("本周期前的GA38-2021达标数")
+    private int  ga382021prev;
+
+    @ApiModelProperty("本周期前的GA38-2015达标数")
+    private int  ga382015;
+
+    @ApiModelProperty("本周期的GA38-2015达标数")
+    private int  ga382015current;
+
+    @ApiModelProperty("本周期前的GA38-2015达标数")
+    private int  ga382015prev;
+}

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

@@ -0,0 +1,27 @@
+package com.xunmei.core.board.dto.web;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class WebSyntheticQuestionDto {
+    private int total;
+
+    @ApiModelProperty("待确认")
+    private int unconfirmedCount;
+
+    @ApiModelProperty("有异议(只有安全检查才会)")
+    private int dissentCount;
+
+    @ApiModelProperty("已关闭")
+    private int closedCount;
+
+    @ApiModelProperty("待整改")
+    private int waitReformCount;
+
+    @ApiModelProperty("已整改")
+    private int reformedCount;
+
+    @ApiModelProperty("已逾期")
+    private int ovedueCount;
+}

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

@@ -1,26 +1,52 @@
 package com.xunmei.core.board.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xunmei.core.board.vo.web.OrgGA38StatisticVo;
-import com.xunmei.core.board.vo.web.QuestionStatisticVo;
-import com.xunmei.core.board.vo.web.TaskStatisticVo;
+import com.xunmei.core.board.dto.app.AppSyntheticQuestionDto;
+import com.xunmei.core.board.dto.web.WebGA38InfoDto;
+import com.xunmei.core.board.dto.web.WebSyntheticQuestionDto;
+import com.xunmei.core.board.vo.web.*;
 import org.apache.ibatis.annotations.Param;
+import org.omg.CORBA.INTERNAL;
 
 import java.util.List;
 import java.util.Date;
+import java.util.Map;
+
 public interface CockpitMapper extends BaseMapper {
     List<TaskStatisticVo> resumption(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
 
-    List<TaskStatisticVo> safetyCheck(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
+    List<WebSafetyCheckVo> safetyCheck(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
 
     List<TaskStatisticVo> edu(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
     List<TaskStatisticVo> monitor(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
 
     List<TaskStatisticVo> drill(@Param("startDate") Date start,@Param("endDate") Date end,@Param("orgPath") String orgPath);
 
-    List<OrgGA38StatisticVo> orgGA38(@Param("orgId") Long orgId);
+    List<WebGA38InfoDto> orgGA38(@Param("orgPath") String orgPath, @Param("date") Date date);
+
+    OrgInfoVo orgInfo(@Param("orgPath") String orgPath);
+
+    OrgSecurityInfoVo orgSecurityInfo(@Param("orgPath") String orgPath);
+
+    VisitInfoVo currentMonthVisitInfo(@Param("orgPath") String orgPath, @Param("startDate") Date startDate);
 
     QuestionStatisticVo question(@Param("date") Date start,@Param("orgPath") String orgPath);
+
+    /**
+     *
+     * @param orgPath
+     * @param startDate
+     * @return
+     */
+    WebSyntheticQuestionDto selectQuestion(@Param("orgPath") String orgPath, @Param("startDate") Date startDate);
+    /**
+     * 获取逾期未整改数量
+     * @param orgPath
+     * @param startDate
+     * @return
+     */
+    Map<String,Long> selectOverDueQuestionCount(@Param("orgPath") String orgPath, @Param("startDate") Date startDate);
+
 }
 
 

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

@@ -1,9 +1,7 @@
 package com.xunmei.core.board.service;
 
 import com.xunmei.core.board.dto.web.TaskStatisticDto;
-import com.xunmei.core.board.vo.web.OrgGA38StatisticVo;
-import com.xunmei.core.board.vo.web.QuestionStatisticVo;
-import com.xunmei.core.board.vo.web.TaskStatisticVo;
+import com.xunmei.core.board.vo.web.*;
 
 import java.util.List;
 
@@ -16,7 +14,7 @@ public interface CockpitService {
     /**
      * 统计近期下级机构安全检查情况
      */
-    List<TaskStatisticVo> safetyCheck(TaskStatisticDto dto);
+    List<WebSafetyCheckVo> safetyCheck(TaskStatisticDto dto);
 
     /**
      * 统计近期下级视频调阅情况
@@ -31,12 +29,32 @@ public interface CockpitService {
     /**
      * 统计近期下级机构预案演练情况
      */
-    List<TaskStatisticVo> drill(TaskStatisticDto dto);
+    List<WebDrillInfoVo> drill(TaskStatisticDto dto);
+
 
     /**
      * 统计GA38达标情况
      */
-    List<OrgGA38StatisticVo> orgGA38(Long orgId);
+    List<OrgGA38StatisticVo> orgGA38(TaskStatisticDto dto);
+
+    /**
+     * 机构信息
+     * @return
+     */
+    OrgInfoVo orgInfo(Long orgId);
+
+    /**
+     * 机构信息
+     * @return
+     */
+    OrgSecurityInfoVo orgSecurityInfo(Long orgId);
+
+    /**
+     * 本月来访
+     * @param orgPath
+     * @return
+     */
+    VisitInfoVo currentMonthVisitInfo(Long orgId);
 
     /**
      * 隐患统计

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

@@ -11,6 +11,7 @@ import com.xunmei.common.core.domain.panel.vo.PanelListVo;
 import com.xunmei.common.core.enums.CycleCommonEnum;
 import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.core.utils.NumberUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.board.dto.app.*;
 import com.xunmei.core.board.mapper.AppCockpitMapper;
@@ -129,19 +130,19 @@ public class AppCockpitServiceImpl implements AppCockpitService {
 
         vo.setBanking2021(new AppGa38RateVo());
         vo.getBanking2021().setTotal(baseInfoDto.getBankingCount());
-        vo.getBanking2021().setRate(computeRate(baseInfoDto.getBankingCount(), baseInfoDto.getBankingGA382021()));
+        vo.getBanking2021().setRate(NumberUtils.computeRate(baseInfoDto.getBankingCount(), baseInfoDto.getBankingGA382021()));
 
         vo.setBanking2015(new AppGa38RateVo());
         vo.getBanking2015().setTotal(baseInfoDto.getBankingCount());
-        vo.getBanking2015().setRate(computeRate(baseInfoDto.getBankingCount(), baseInfoDto.getBankingGA382015()));
+        vo.getBanking2015().setRate(NumberUtils.computeRate(baseInfoDto.getBankingCount(), baseInfoDto.getBankingGA382015()));
 
         vo.setOfflineATM2021(new AppGa38RateVo());
         vo.getOfflineATM2021().setTotal(baseInfoDto.getOffATMCount());
-        vo.getOfflineATM2021().setRate(computeRate(baseInfoDto.getOffATMCount(), baseInfoDto.getOffATMGA382021()));
+        vo.getOfflineATM2021().setRate(NumberUtils.computeRate(baseInfoDto.getOffATMCount(), baseInfoDto.getOffATMGA382021()));
 
         vo.setOfflineATM2015(new AppGa38RateVo());
         vo.getOfflineATM2015().setTotal(baseInfoDto.getOffATMCount());
-        vo.getOfflineATM2015().setRate(computeRate(baseInfoDto.getOffATMCount(), baseInfoDto.getOffATMGA382015()));
+        vo.getOfflineATM2015().setRate(NumberUtils.computeRate(baseInfoDto.getOffATMCount(), baseInfoDto.getOffATMGA382015()));
 
         vo.setBusinessStoreInfo(new LinkedHashMap<>());
         vo.getBusinessStoreInfo().put("一类库", baseInfoDto.getBusinessLibraryOne());
@@ -310,7 +311,7 @@ public class AppCockpitServiceImpl implements AppCockpitService {
             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);
+            Float rate = NumberUtils.computeRate(total, completed);
 
             vo.getRateByType().put(label, rate);
             vo.getInfoByType().put(label, AppSyntheticTaskInfoVo.builder()
@@ -345,22 +346,22 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         vo.getRateByState().put("待整改", (float) questionDto.getWaitReformCount());
         vo.getRateByState().put("已逾期", (float) overdueCount);
         vo.getRateByState().put("已整改", (float) questionDto.getReformedCount());
-        vo.getRateByState().put("整改率", computeRate(questionDto.getConfirmedCount(), questionDto.getReformedCount()));
+        vo.getRateByState().put("整改率", NumberUtils.computeRate(questionDto.getConfirmedCount(), questionDto.getReformedCount()));
 
         vo.getResumption().put("隐患数", (float) questionDto.getResumptionCount());
         vo.getResumption().put("已整改", (float) questionDto.getResumptionReformedCount());
-        vo.getResumption().put("整改率", computeRate(questionDto.getResumptionCount(), questionDto.getResumptionReformedCount()));
+        vo.getResumption().put("整改率", NumberUtils.computeRate(questionDto.getResumptionCount(), questionDto.getResumptionReformedCount()));
 
         vo.getOffATMCheck().put("隐患数", (float) questionDto.getOffATMResumptionCount());
         vo.getOffATMCheck().put("已整改", (float) questionDto.getOffATMResumptionReformedCount());
-        vo.getOffATMCheck().put("整改率", computeRate(questionDto.getOffATMResumptionCount(), questionDto.getOffATMResumptionReformedCount()));
+        vo.getOffATMCheck().put("整改率", NumberUtils.computeRate(questionDto.getOffATMResumptionCount(), questionDto.getOffATMResumptionReformedCount()));
 
         vo.getSafetyCheck().put("隐患数", (float) questionDto.getSafetyCheckCount());
         vo.getSafetyCheck().put("有异议", (float) questionDto.getDissentCount());
         vo.getSafetyCheck().put("已取消", (float) questionDto.getCancelCount());
         vo.getSafetyCheck().put("已确认", (float) questionDto.getSafetyCheckConfirmedCount());
         vo.getSafetyCheck().put("已整改", (float) questionDto.getSafetyCheckReformCount());
-        vo.getSafetyCheck().put("整改率", computeRate(questionDto.getSafetyCheckConfirmedCount(), questionDto.getSafetyCheckReformCount()));
+        vo.getSafetyCheck().put("整改率", NumberUtils.computeRate(questionDto.getSafetyCheckConfirmedCount(), questionDto.getSafetyCheckReformCount()));
 
         return vo;
 
@@ -381,7 +382,7 @@ public class AppCockpitServiceImpl implements AppCockpitService {
             int total = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getTotal).sum();
             int completed = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getCompleted).sum();
             int exceptionCount = used.stream().mapToInt(AppSyntheticTaskCategoryDto::getExceptionCount).sum();
-            Float rate = computeRate(total, completed);
+            Float rate = NumberUtils.computeRate(total, completed);
 
             vo.getRateByType().put(label, rate);
             vo.getTaskInfoByType().put(label, AppSyntheticSafetycheckTaskVo.builder()
@@ -423,7 +424,7 @@ public class AppCockpitServiceImpl implements AppCockpitService {
 //            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);
+//            Float rate = NumberUtils.computeRate(total, completed);
 //
 //            vo.getRateByType().put(label, rate);
 //            vo.getInfoByType().put(label, AppSyntheticTaskInfoVo.builder()
@@ -496,15 +497,15 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         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.getDrill().setCompletedRate(NumberUtils.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()));
+        vo.getEdu().setCompletedRate(NumberUtils.computeRate(edu.get().getTotal(), edu.get().getCompleted()));
 
         vo.getMonitor().setShouldCompleteCount(monitor.get().getTotal());
         vo.getMonitor().setCompletedCount(monitor.get().getCompleted());
-        vo.getMonitor().setCompletedRate(computeRate(monitor.get().getTotal(), monitor.get().getCompleted()));
+        vo.getMonitor().setCompletedRate(NumberUtils.computeRate(monitor.get().getTotal(), monitor.get().getCompleted()));
 
         vo.getInout().setDepartment(inout.get().getDepartment());
         vo.getInout().setEmergency(inout.get().getEmergency());
@@ -527,8 +528,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         }
         vo.setCurrentCompletedCount(dto.getCompleted());
         vo.setShouldComplete(dto.getTotal());
-        vo.setCurrentCompletedRate(computeRate(dto.getTotal(), dto.getCompleted()));
-        float prevRate = computeRate(dto.getPrevTotal(), dto.getPrevCompleted());
+        vo.setCurrentCompletedRate(NumberUtils.computeRate(dto.getTotal(), dto.getCompleted()));
+        float prevRate = NumberUtils.computeRate(dto.getPrevTotal(), dto.getPrevCompleted());
         vo.setPrevCompletedRate(prevRate);
         vo.setCompare(vo.getCurrentCompletedRate() - prevRate);
 
@@ -557,31 +558,10 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     private AppOverviewItemVo computeGa38(int total, int completed, int currentCompleted, int prevCompleted) {
         AppOverviewItemVo vo = new AppOverviewItemVo();
         vo.setShouldComplete(total);
-        vo.setCurrentCompletedRate(computeRate(total, completed));
-        vo.setPrevCompletedRate(computeRate(total, prevCompleted));
+        vo.setCurrentCompletedRate(NumberUtils.computeRate(total, completed));
+        vo.setPrevCompletedRate(NumberUtils.computeRate(total, prevCompleted));
         vo.setCompare(((float) currentCompleted) - prevCompleted);
         vo.setCurrentCompletedCount(currentCompleted);
         return vo;
     }
-
-    /**
-     * 计算比例
-     *
-     * @param total
-     * @param divisor
-     * @return
-     */
-    private float computeRate(Integer total, Integer divisor) {
-        if (ObjectUtil.equal(total, 0) || ObjectUtil.isNull(total)) {
-            return 1F;
-        } else if (ObjectUtil.equal(divisor, 0) || ObjectUtil.isNull(divisor)) {
-            return 0F;
-        } else {
-            return (divisor.floatValue() / total.floatValue());
-        }
-    }
-
-//    private void throwIfNull(Date date){
-//
-//    }
 }

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

@@ -4,23 +4,29 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.domain.DateRange;
+import com.xunmei.common.core.enums.CycleCommonEnum;
 import com.xunmei.common.core.exception.ServiceException;
+import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.core.utils.NumberUtils;
+import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.core.board.dto.web.TaskStatisticDto;
+import com.xunmei.core.board.dto.web.WebGA38InfoDto;
+import com.xunmei.core.board.dto.web.WebSyntheticQuestionDto;
 import com.xunmei.core.board.enums.PeriodEnum;
 import com.xunmei.core.board.mapper.CockpitMapper;
 import com.xunmei.core.board.service.CockpitService;
-import com.xunmei.core.board.vo.web.OrgGA38StatisticVo;
-import com.xunmei.core.board.vo.web.QuestionStatisticVo;
-import com.xunmei.core.board.vo.web.TaskStatisticVo;
+import com.xunmei.core.board.vo.web.*;
+import com.xunmei.system.api.RemoteDictDataService;
 import com.xunmei.system.api.RemoteOrgService;
+import com.xunmei.system.api.domain.SysDictData;
 import com.xunmei.system.api.domain.SysOrg;
+import org.apache.http.annotation.Obsolete;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Date;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class CockpitServiceImpl implements CockpitService {
@@ -30,90 +36,223 @@ public class CockpitServiceImpl implements CockpitService {
     @Resource
     RemoteOrgService remoteOrgService;
 
+    @Resource
+    RemoteDictDataService remoteDictDataService;
+
     @Override
     public List<TaskStatisticVo> resumption(TaskStatisticDto dto) {
         Date date = getStartDate(dto.getPeriod());
-        SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         String orgPath = org.getPath();
         List<TaskStatisticVo> list = cockpitMapper.resumption(date, DateUtil.endOfDay(new Date()), orgPath);
-        return taskStatistic(list, dto, org);
+        return taskStatistic(list, dto.getOrgId());
     }
 
     @Override
-    public List<TaskStatisticVo> safetyCheck(TaskStatisticDto dto) {
+    public List<WebSafetyCheckVo> safetyCheck(TaskStatisticDto dto) {
         Date date = getStartDate(dto.getPeriod());
-        SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
-        String orgPath = org.getPath();
-        List<TaskStatisticVo> list = cockpitMapper.safetyCheck(date, DateUtil.endOfDay(new Date()), orgPath);
-        return taskStatistic(list, dto, org);
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
+
+//        String orgPath = org.getPath();
+        List<WebSafetyCheckVo> list = cockpitMapper.safetyCheck(date, DateUtil.endOfDay(new Date()), org.getPath());
+        List<SysDictData> dicts = remoteDictDataService.selectDictByeType("check_type", SecurityConstants.INNER);
+        dicts.sort(Comparator.comparing(SysDictData::getDictSort));
+        List<WebSafetyCheckVo> r = dicts.stream()
+                .filter(d->ObjectUtil.notEqual(d.getDictValue(),"1") && ObjectUtil.notEqual(d.getDictValue(),"2") )
+                .map(d -> {
+            Optional<WebSafetyCheckVo> voOpt = list.stream().filter(i -> ObjectUtil.equal(i.getType(), d.getDictValue())).findFirst();
+            WebSafetyCheckVo vo;
+            if (voOpt.isPresent()) {
+                vo = voOpt.get();
+            } else {
+                vo = new WebSafetyCheckVo();
+            }
+            String label = d.getDictLabel();
+            switch (d.getDictValue()) {
+                case "1":
+                    label = "省联社检查";
+                    break;
+                case "2":
+                    label = "办事处检查";
+                    break;
+                case "3":
+                    label = "网点自查";
+                    break;
+                case "4":
+                    label = "全面检查";
+                    break;
+                case "5":
+                    label = "阶段性检查";
+                    break;
+                case "6":
+                    label = "专项检查";
+                    break;
+                case "7":
+                    label = "其它检查";
+                    break;
+            }
+            vo.setType(label);
+            return vo;
+        }).collect(Collectors.toList());
+
+        return r;
     }
 
     @Override
+    @Obsolete
     public List<TaskStatisticVo> monitor(TaskStatisticDto dto) {
         Date date = getStartDate(dto.getPeriod());
-        SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         String orgPath = org.getPath();
         List<TaskStatisticVo> list = cockpitMapper.monitor(date, DateUtil.endOfDay(new Date()), orgPath);
-        return taskStatistic(list, dto, org);
+        return taskStatistic(list, dto.getOrgId());
     }
 
     @Override
     public List<TaskStatisticVo> edu(TaskStatisticDto dto) {
         Date date = getStartDate(dto.getPeriod());
-        SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         String orgPath = org.getPath();
         List<TaskStatisticVo> list = cockpitMapper.edu(date, DateUtil.endOfDay(new Date()), orgPath);
-        return taskStatistic(list, dto, org);
+        return taskStatistic(list, dto.getOrgId());
     }
 
     @Override
-    public List<TaskStatisticVo> drill(TaskStatisticDto dto) {
+    public List<WebDrillInfoVo> drill(TaskStatisticDto dto) {
         Date date = getStartDate(dto.getPeriod());
-        SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
-        String orgPath = org.getPath();
-        List<TaskStatisticVo> list = cockpitMapper.drill(date, DateUtil.endOfDay(new Date()), orgPath);
-        return taskStatistic(list, dto, org);
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
+//        String orgPath = org.getPath();
+        List<TaskStatisticVo> list = cockpitMapper.drill(date, DateUtil.endOfDay(new Date()), org.getPath());
+        list = taskStatistic(list, dto.getOrgId());
+
+        List<WebDrillInfoVo> r = list.stream().map(i -> {
+            WebDrillInfoVo vo = new WebDrillInfoVo();
+            vo.setOrgName(i.getOrgName());
+            vo.setTotal((int) i.getTaskTotal());
+            vo.setCompleted((int) i.getCompletedCount());
+            vo.setCompletedRate(i.getCompletedRate());
+            return vo;
+        }).collect(Collectors.toList());
+
+        return r;
     }
 
     @Override
-    public List<OrgGA38StatisticVo> orgGA38(Long orgId) {
-        List<OrgGA38StatisticVo> data = cockpitMapper.orgGA38(orgId);
-        List<OrgGA38StatisticVo> r = getGA38Children(orgId);
-        for (OrgGA38StatisticVo orgVo : data) {
+    public List<OrgGA38StatisticVo> orgGA38(TaskStatisticDto dto) {
+        Date date = getStartDate(dto.getPeriod());
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
+        List<WebGA38InfoDto> data = cockpitMapper.orgGA38(org.getPath(), date);
+        List<OrgGA38StatisticVo> r = getGA38Children(dto.getOrgId());
+        for (WebGA38InfoDto orgVo : data) {
             for (OrgGA38StatisticVo statisticVo : r) {
-                if (orgVo.getOrgPath().startsWith(statisticVo.getOrgPath())) {
+                if (orgVo.getPath().startsWith(statisticVo.getOrgPath())) {
                     statisticVo.setTotal(1 + statisticVo.getTotal());
-                    statisticVo.setReachCount(orgVo.getReachCount() + statisticVo.getReachCount());
+                    statisticVo.setGa382021(orgVo.getGa382021() + statisticVo.getGa382021());
+                    statisticVo.setGa382015(orgVo.getGa382015() + statisticVo.getGa382015());
+                    if (orgVo.getGa382021() > 0 || orgVo.getGa382015() > 0) {
+                        statisticVo.setReachCount(1 + statisticVo.getReachCount());
+                    }
+//                    statisticVo.setReachCount(orgVo.getReachCount() + statisticVo.getReachCount());
                 }
             }
         }
 
         r.forEach(i -> {
-            if (ObjectUtil.equal(i.getTotal(), 0F)) {
-                i.setReachRate(1F);
-            } else {
-                i.setReachRate(i.getReachCount() / i.getTotal());
-            }
+            i.setReachRate(NumberUtils.computeRate(i.getTotal(), i.getReachCount()));
         });
+
         r.sort(new Comparator<OrgGA38StatisticVo>() {
             @Override
             public int compare(OrgGA38StatisticVo o1, OrgGA38StatisticVo o2) {
-                return NumberUtil.compare(o2.getReachRate(),o1.getReachRate());
+                return NumberUtil.compare(o2.getReachRate(), o1.getReachRate());
             }
         });
 
         return r;
     }
 
+    /**
+     * 机构信息
+     *
+     * @return
+     */
+    @Override
+    public OrgInfoVo orgInfo(Long orgId) {
+        SysOrg org = getOrgThrowIfNull(orgId);
+        return cockpitMapper.orgInfo(org.getPath());
+    }
+
+    /**
+     * 机构信息
+     *
+     * @return
+     */
+    @Override
+    public OrgSecurityInfoVo orgSecurityInfo(Long orgId) {
+        SysOrg org = getOrgThrowIfNull(orgId);
+        OrgSecurityInfoVo vo = cockpitMapper.orgSecurityInfo(org.getPath());
+        vo.setEquippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getEquippedCount()));
+        vo.setUnequippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getUnequippedCount()));
+
+        return vo;
+    }
+
+    /**
+     * 本月来访
+     *
+     * @param orgPath
+     * @return
+     */
+    @Override
+    public VisitInfoVo currentMonthVisitInfo(Long orgId) {
+        SysOrg org = getOrgThrowIfNull(orgId);
+        DateRange range = DateUtils.getStartAndEnd(new Date(), CycleCommonEnum.MONTHLY);
+        VisitInfoVo vo = cockpitMapper.currentMonthVisitInfo(org.getPath(), range.getStartTime());
+        int total = 0;
+        if (ObjectUtil.isNotNull(vo)) {
+            total = vo.getPaperCount() + vo.getElectronicCount() + vo.getUrgencyCount();
+            vo.setElectronicRate(NumberUtils.computeRate(total, vo.getElectronicCount()));
+            vo.setUrgencyRate(NumberUtils.computeRate(total, vo.getUrgencyCount()));
+            vo.setPaperRate(NumberUtils.computeRate(total, vo.getPaperCount()));
+        }
+
+
+
+        return vo;
+    }
+
     @Override
     public QuestionStatisticVo question(TaskStatisticDto dto) {
+        SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         Date date = getStartDate(dto.getPeriod());
-        String orgPath = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER).getPath();
-        return cockpitMapper.question(date, orgPath);
+
+        WebSyntheticQuestionDto questionDto = cockpitMapper.selectQuestion(org.getPath(), date);
+        if (ObjectUtil.isNull(questionDto)) {
+            questionDto = new WebSyntheticQuestionDto();
+        }
+        Map<String, Long> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), date);
+
+        QuestionStatisticVo vo = new QuestionStatisticVo();
+        vo.setTotal(questionDto.getTotal());
+        vo.setUnconfirm(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getUnconfirmedCount()));
+        vo.setDissent(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getDissentCount()));
+        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() > 0) {
+            Long count = overdueCount.get("count");
+            Long overdue = overdueCount.get("overdueCount");
+            vo.setClosed(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
+        } else {
+            vo.setClosed(1f);
+        }
+
+        return vo;
     }
 
-    private List<TaskStatisticVo> taskStatistic(List<TaskStatisticVo> data, TaskStatisticDto dto,SysOrg org) {
-        List<TaskStatisticVo> r = getTaskChildren(org);
+    private List<TaskStatisticVo> taskStatistic(List<TaskStatisticVo> data, Long orgId) {
+        List<TaskStatisticVo> r = getTaskChildren(orgId);
         for (TaskStatisticVo orgVo : data) {
             for (TaskStatisticVo statisticVo : r) {
                 if (orgVo.getOrgPath().startsWith(statisticVo.getOrgPath())) {
@@ -150,15 +289,25 @@ public class CockpitServiceImpl implements CockpitService {
         }
     }
 
-    private List<TaskStatisticVo> getTaskChildren(SysOrg org) {
-        List<SysOrg> children=remoteOrgService.selectOrgTreeListByCurOrgId(org.getId(), SecurityConstants.INNER);
+//    private DateRange getStartAndEnd(Integer period) {
+//        Date start = getStartDate(period);
+//        Date end = DateUtil.endOfDay(new Date());
+//        return new DateRange(start, end);
+//    }
+
+    private List<TaskStatisticVo> getTaskChildren(Long orgId) {
+        List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
         List<TaskStatisticVo> list = new ArrayList<>();
 
         for (SysOrg child : children) {
             TaskStatisticVo vo = new TaskStatisticVo();
             vo.setOrgPath(child.getPath());
             vo.setOrgId(child.getId());
-            vo.setOrgName(child.getName());
+            if (StringUtils.isEmpty(child.getBreviary())) {
+                vo.setOrgName(child.getShortName());
+            } else {
+                vo.setOrgName(child.getBreviary());
+            }
             vo.setTaskTotal(0F);
             vo.setCompletedCount(0F);
             list.add(vo);
@@ -168,20 +317,34 @@ public class CockpitServiceImpl implements CockpitService {
     }
 
     private List<OrgGA38StatisticVo> getGA38Children(Long orgId) {
-        List<SysOrg> children=remoteOrgService.selectOrgTreeListByCurOrgId(orgId, SecurityConstants.INNER);
+        List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
         List<OrgGA38StatisticVo> list = new ArrayList<>();
         for (SysOrg child : children) {
             OrgGA38StatisticVo vo = new OrgGA38StatisticVo();
             vo.setOrgPath(child.getPath());
             vo.setOrgId(child.getId());
-            vo.setOrgName(child.getName());
-            vo.setTotal(0F);
-            vo.setReachCount(0F);
+            if (StringUtils.isEmpty(child.getBreviary())) {
+                vo.setOrgName(child.getShortName());
+            } else {
+                vo.setOrgName(child.getBreviary());
+            }
+
+            vo.setTotal(0);
+            vo.setReachCount(0);
             list.add(vo);
         }
 
         return list;
     }
+
+    private SysOrg getOrgThrowIfNull(Long orgId) {
+        SysOrg org = remoteOrgService.selectOrgById(orgId, SecurityConstants.INNER);
+        if (ObjectUtil.isNull(org)) {
+            throw new ServiceException("机构不存在");
+        }
+
+        return org;
+    }
 //
 //    private List<SysOrg> getChildren(SysOrg org) {
 //        List<SysOrg> children=remoteOrgService.selectOrgTreeListByCurOrgId(org.getId(), SecurityConstants.INNER);

+ 13 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgGA38StatisticVo.java

@@ -21,12 +21,23 @@ public class OrgGA38StatisticVo {
     /**
      * 机构总数
      */
-    private float total;
+    private int total;
+
+    /**
+     * 2015达标数量
+     */
+    private int ga382015;
+
+    /**
+     * 2021达标数量
+     */
+    private int ga382021;
 
     /**
      * 达标数
      */
-    private float reachCount;
+    @JsonIgnore
+    private int reachCount;
 
     /**
      * 达标率

+ 16 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgInfoVo.java

@@ -0,0 +1,16 @@
+package com.xunmei.core.board.vo.web;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class OrgInfoVo {
+    @ApiModelProperty("行社数量")
+    private int hangsheCount;
+    @ApiModelProperty("营业网点数量")
+    private int bankingCount;
+    @ApiModelProperty("离行数量")
+    private int offlineCount;
+    @ApiModelProperty("网点业务库数量")
+    private int bankingStoreCount;
+}

+ 19 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/OrgSecurityInfoVo.java

@@ -0,0 +1,19 @@
+package com.xunmei.core.board.vo.web;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 机构安保情况
+ */
+@Data
+public class OrgSecurityInfoVo {
+    @ApiModelProperty("配备有保安的数量")
+    private int equippedCount;
+    @ApiModelProperty("配备的比例")
+    private float equippedRate;
+    @ApiModelProperty("未配备有保安的数量")
+    private int unequippedCount;
+    @ApiModelProperty("未配备的比例")
+    private float unequippedRate;
+}

+ 15 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/QuestionStatisticVo.java

@@ -7,29 +7,30 @@ import lombok.Data;
  */
 @Data
 public class QuestionStatisticVo {
-    private int total;
+    private float total;
     /**
-     * 确认
+     * 确认
      */
-    private int unconfirm;
-
+    private float unconfirm;
     /**
-     * 异议审批中
+     * 异议
      */
-    private int auditing;
-
+    private float dissent;
+    /**
+     * 已关闭
+     *
+     */
+    private float closed;
     /**
      * 待整改
      */
-    private int unreform;
-
+    private float unreform;
     /**
-     * 异议隐患
+     * 已整改
      */
-    private int notQuestion;
-
+    private float reformed;
     /**
-     * 整改完成
+     * 已逾期
      */
-    private int reformed;
+    private float overdue;
 }

+ 23 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/VisitInfoVo.java

@@ -0,0 +1,23 @@
+package com.xunmei.core.board.vo.web;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 来访信息
+ */
+@Data
+public class VisitInfoVo {
+    @ApiModelProperty("纸质来访数量")
+    private int paperCount;
+    @ApiModelProperty("纸质来访比例")
+    private float paperRate=1f;
+    @ApiModelProperty("紧急来访数量")
+    private int urgencyCount;
+    @ApiModelProperty("紧急来访比例")
+    private float urgencyRate=1f;
+    @ApiModelProperty("电子来访数量")
+    private int electronicCount;
+    @ApiModelProperty("电子来访比例")
+    private float electronicRate=1f;
+}

+ 16 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/WebDrillInfoVo.java

@@ -0,0 +1,16 @@
+package com.xunmei.core.board.vo.web;
+
+import lombok.Data;
+
+/**
+ * web驾驶舱预案演练
+ */
+@Data
+public class WebDrillInfoVo {
+    private String orgName;
+
+    private int total;
+
+    private int completed;
+    private float completedRate;
+}

+ 12 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/vo/web/WebSafetyCheckVo.java

@@ -0,0 +1,12 @@
+package com.xunmei.core.board.vo.web;
+
+import lombok.Data;
+
+@Data
+public class WebSafetyCheckVo {
+    private  String type;
+
+    private int total;
+
+    private int completed;
+}

+ 6 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/mapper/CoreEvaluateTaskMapper.java

@@ -34,6 +34,12 @@ public interface CoreEvaluateTaskMapper extends BaseMapper<CoreEvaluateTask> {
     CoreEvaluateTask selectCoreEvaluateTaskById(Long id);
 
     /**
+     * 根据计划id查询对应任务
+     * @param
+     * @return
+     */
+    List<CoreEvaluateTask>selectTaskByPlanIdAndStatus(@Param("planId") Long planId,@Param("statusList") String[]statusList);
+    /**
      * 查询外包评价任务列表
      *
      * @param coreEvaluateTask 外包评价任务
@@ -81,7 +87,6 @@ public interface CoreEvaluateTaskMapper extends BaseMapper<CoreEvaluateTask> {
 
     Page<Map> statistics(@Param("page") Page<Map> page, @Param("request") EvaluateTaskStatisticsDTO request);
 
-    //List<LinkedHashMap> statisticsAll(@Param("request") EvaluateTaskStatisticsDTO request);
     LinkedHashMap statisticsAll(@Param("request") EvaluateTaskStatisticsDTO request);
 
     List<Map> getContentByTaskId(@Param("id") Long id, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

+ 27 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/service/impl/CoreEvaluatePlanServiceImpl.java

@@ -16,10 +16,7 @@ import com.xunmei.core.evaluate.domain.*;
 import com.xunmei.core.evaluate.dto.CoreEvaluatePlanDTO;
 import com.xunmei.core.evaluate.dto.EvaluateQueryDTO;
 import com.xunmei.core.evaluate.dto.EvaluateTaskStatisticsDTO;
-import com.xunmei.core.evaluate.mapper.CoreEvaluateContentMapper;
-import com.xunmei.core.evaluate.mapper.CoreEvaluatePlanContentMapper;
-import com.xunmei.core.evaluate.mapper.CoreEvaluatePlanMapper;
-import com.xunmei.core.evaluate.mapper.CoreEvaluateRoleMapper;
+import com.xunmei.core.evaluate.mapper.*;
 import com.xunmei.core.evaluate.service.ICoreEvaluatePlanService;
 import com.xunmei.core.evaluate.service.ICoreEvaluateTaskService;
 import com.xunmei.core.evaluate.vo.CoreEvaluatePlanListVO;
@@ -67,6 +64,8 @@ public class CoreEvaluatePlanServiceImpl extends ServiceImpl<CoreEvaluatePlanMap
     private ICoreEvaluateTaskService coreEvaluateTaskService;
     @Resource
     private RemoteRoleService remoteRoleService;
+    @Autowired
+    private CoreEvaluateTaskMapper coreEvaluateTaskMapper;
 
     /**
      * 查询外包评价计划
@@ -83,6 +82,20 @@ public class CoreEvaluatePlanServiceImpl extends ServiceImpl<CoreEvaluatePlanMap
         coreEvaluatePlanVO.setRoleIds(roleList);
         List<CoreEvaluateContent> byEvaluateId = coreEvaluateContentMapper.getByEvaluateId(id);
         coreEvaluatePlanVO.setCoreEvaluateContentList(byEvaluateId);
+        //是否有已完成的任务
+        String[] status = {"2"};
+        List<CoreEvaluateTask> coreEvaluateTasks = coreEvaluateTaskMapper.selectTaskByPlanIdAndStatus(id, status);
+        coreEvaluatePlanVO.setIsComplete(false);
+        if (CollectionUtils.isNotEmpty(coreEvaluateTasks)) {
+            coreEvaluatePlanVO.setIsComplete(true);
+        }
+        //是否有任务
+        String[] status1 = {"0","1","2"};
+        List<CoreEvaluateTask> coreEvaluateTasks1 = coreEvaluateTaskMapper.selectTaskByPlanIdAndStatus(id, status1);
+        coreEvaluatePlanVO.setIsHaveTask(false);
+        if (CollectionUtils.isNotEmpty(coreEvaluateTasks1)){
+            coreEvaluatePlanVO.setIsHaveTask(true);
+        }
         return coreEvaluatePlanVO;
     }
 
@@ -240,11 +253,12 @@ public class CoreEvaluatePlanServiceImpl extends ServiceImpl<CoreEvaluatePlanMap
             coreEvaluatePlanContent.setEvaluateId(coreEvaluatePlanDTO.getId());
             coreEvaluatePlanContentMapper.insert(coreEvaluatePlanContent);
         });
+        //
         return i;
     }
 
     @Override
-    public int distribute(Long id,Boolean immediateEffect) {
+    public int distribute(Long id, Boolean immediateEffect) {
         CoreEvaluatePlanVO coreEvaluatePlanVO = this.selectCoreEvaluatePlanById(id);
         CoreEvaluatePlan coreEvaluatePlan = baseMapper.selectById(id);
         coreEvaluatePlan.setBuildTaskNow(immediateEffect);
@@ -398,6 +412,14 @@ public class CoreEvaluatePlanServiceImpl extends ServiceImpl<CoreEvaluatePlanMap
             evaluateQueryDTO.setOrgId(null);
         }
         page = coreEvaluatePlanMapper.selectPageList(page, evaluateQueryDTO);
+        page.getRecords().forEach(p -> {
+            String[] status = {"2"};
+            List<CoreEvaluateTask> coreEvaluateTasks = coreEvaluateTaskMapper.selectTaskByPlanIdAndStatus(p.getId(), status);
+            p.setIsComplete(false);
+            if (CollectionUtils.isNotEmpty(coreEvaluateTasks)) {
+                p.setIsComplete(true);
+            }
+        });
         //抓换为TableDataInfo适配前端
         return TableDataInfo.build(page);
     }

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/vo/CoreEvaluatePlanListVO.java

@@ -56,4 +56,5 @@ public class CoreEvaluatePlanListVO {
 
     @ApiModelProperty(value = "状态")
     private String status;
+    private Boolean isComplete;
 }

+ 4 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/vo/CoreEvaluatePlanVO.java

@@ -14,6 +14,7 @@ import java.util.List;
 public class CoreEvaluatePlanVO {
     private Long id;
     private Boolean buildTaskNow;
+    private String status;
     /**
      * 外包评价名称
      */
@@ -42,5 +43,7 @@ public class CoreEvaluatePlanVO {
     private String evaluateCycle;
     @ApiModelProperty(value = "内容")
     private List<CoreEvaluateContent> coreEvaluateContentList;
-
+    private Boolean isComplete;
+    private Boolean isHaveTask;
+    private String isDistribute;
 }

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/controller/CoreMessageCenterController.java

@@ -44,8 +44,8 @@ public class CoreMessageCenterController extends BaseController {
     }
 
     @ApiOperation(value = "查询消息列表是否有未读")
-    @GetMapping("/isRead")
-    public AjaxResult isRead() {
+    @GetMapping("/haveRead")
+    public AjaxResult haveRead() {
         return success(coreMessageCenterService.isRead());
     }
 

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/mapper/CoreMessageCenterMapper.java

@@ -23,7 +23,7 @@ import java.util.List;
 public interface CoreMessageCenterMapper extends BaseMapper<CoreMessageCenter> {
 
     Page<CoreMessageCenterVO> selectByPage(Page<CoreMessageCenter> page, @Param("request") CoreMessageCenterDTO request);
-    Integer selectNoRead();
+    Integer selectNoRead(Long userId);
     /**
      * 查询消息中心
      *

+ 44 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/impl/CoreMessageCenterServiceImpl.java

@@ -1,23 +1,36 @@
 package com.xunmei.core.information.service.impl;
 
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.domain.message.vo.MessageAppPageVo;
 import com.xunmei.common.core.domain.retrieval.domain.CoreMonitoringRetrievalTask;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.information.domain.CoreMessageCenter;
 import com.xunmei.core.information.dto.CoreMessageCenterDTO;
 import com.xunmei.core.information.mapper.CoreMessageCenterMapper;
 import com.xunmei.core.information.service.ICoreMessageCenterService;
 import com.xunmei.core.information.vo.CoreMessageCenterVO;
 import com.xunmei.core.message.mapper.CoreAnnouncementNotificationMapper;
+import com.xunmei.system.api.RemoteOrgService;
+import com.xunmei.system.api.RemoteRoleService;
+import com.xunmei.system.api.RemoteUserService;
+import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.api.domain.SysRole;
+import com.xunmei.system.api.model.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 消息中心Service业务层处理
@@ -29,8 +42,15 @@ import java.util.List;
 public class CoreMessageCenterServiceImpl extends ServiceImpl<CoreMessageCenterMapper, CoreMessageCenter> implements ICoreMessageCenterService {
     @Autowired
     private CoreMessageCenterMapper coreMessageCenterMapper;
-@Autowired
-private CoreAnnouncementNotificationMapper coreAnnouncementNotificationMapper;
+    @Autowired
+    private CoreAnnouncementNotificationMapper coreAnnouncementNotificationMapper;
+    @Resource
+    private RemoteOrgService remoteOrgService;
+    @Autowired
+    private RemoteUserService remoteUserService;
+    @Autowired
+    private RemoteRoleService remoteRoleService;
+
     /**
      * 查询消息中心
      *
@@ -73,9 +93,28 @@ private CoreAnnouncementNotificationMapper coreAnnouncementNotificationMapper;
 
     @Override
     public Boolean isRead() {
-        Integer integer1 = baseMapper.selectNoRead();
-        Integer integer = coreAnnouncementNotificationMapper.selectNoRead();
-        if (integer+integer1==0){
+        Long userId = SecurityUtils.getUserId();
+        Integer integer1 = baseMapper.selectNoRead(userId);
+        //通知
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        SysOrg sysOrg = remoteOrgService.selectSysOrgById(loginUser.getOrgId(), SecurityConstants.INNER);
+        List<SysRole> roleByUserId = remoteRoleService.getRoleByUserId(loginUser.getUserid(), SecurityConstants.INNER);
+        List<Long> collect = roleByUserId.stream().map(SysRole::getId).collect(Collectors.toList());
+        Long[] roles;
+        if (CollectionUtils.isNotEmpty(collect)) {
+            roles = collect.toArray(new Long[collect.size()]);
+        } else {
+            roles = null;
+        }
+        //通知
+        List<MessageAppPageVo> messageAppPageVos = coreAnnouncementNotificationMapper.selectAll(loginUser.getOrgId(), roles);
+        List<Long> longs = coreAnnouncementNotificationMapper.selectReadByUser(loginUser.getUserid());
+        List<Long> collect1 = messageAppPageVos.stream().map(MessageAppPageVo::getId).collect(Collectors.toList());
+        Integer i = 0;
+        if (CollectionUtils.isNotEmpty(collect1) && CollectionUtils.isNotEmpty(longs) && longs.size() != collect1.size()) {
+            i = 1;
+        }
+        if (i + integer1 == 0) {
             return false;
         }
         return true;

+ 9 - 7
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/message/mapper/CoreAnnouncementNotificationMapper.java

@@ -74,24 +74,26 @@ public interface CoreAnnouncementNotificationMapper extends BaseMapper<CoreAnnou
 
     void insertBatchToRole(@Param("list") List<CoreAnnouncementNotificationToRole> list);
 
-    Page<CoreAnnouncementNotificationPageVo> selectPageList( @Param("page") Page<CoreAnnouncementNotificationPageVo> page,  @Param("request")CoreAnnouncementNotificationPageDto request);
+    Page<CoreAnnouncementNotificationPageVo> selectPageList(@Param("page") Page<CoreAnnouncementNotificationPageVo> page, @Param("request") CoreAnnouncementNotificationPageDto request);
 
     List<CoreAnnouncementNotificationToOrg> selectOrgIds(@Param("records") List<CoreAnnouncementNotificationPageVo> records);
 
     List<CoreAnnouncementNotificationToRole> selectRoleIds(@Param("records") List<CoreAnnouncementNotificationPageVo> records);
 
     void deleteRole(@Param("notificationId") Long notificationId);
-    void deleteOrg(@Param("notificationId") Long id);
-
-    void deleteNotificationToUsers(@Param("notificationId")  Long notificationId);
 
-    Page<MessageAppPageVo> selectAppPage(@Param("page")Page<MessageAppPageVo> page, @Param("request")CoreAnnouncementNotificationAppPageDto request);
+    void deleteOrg(@Param("notificationId") Long id);
 
-    List<CoreAnnouncementNotificationToUser> selectNotificationToUsers(@Param("request")CoreAnnouncementNotificationAppPageDto request, @Param("records")List<MessageAppPageVo> records);
+    void deleteNotificationToUsers(@Param("notificationId") Long notificationId);
+List<MessageAppPageVo> selectAll(@Param("orgId") Long orgId,@Param("roles") Long[]roles);
+    Page<MessageAppPageVo> selectAppPage(@Param("page") Page<MessageAppPageVo> page, @Param("request") CoreAnnouncementNotificationAppPageDto request);
+List<Long> selectReadByUser(Long userId);
+    List<CoreAnnouncementNotificationToUser> selectNotificationToUsers(@Param("request") CoreAnnouncementNotificationAppPageDto request, @Param("records") List<MessageAppPageVo> records);
 
     CoreAnnouncementNotificationToUser checkIsRead(@Param("request") CoreAnnouncementNotificationAppPageDto request);
 
     void insertNotificationUser(@Param("notificationUser") CoreAnnouncementNotificationToUser notificationUser);
-Integer selectNoRead();
 
+    Integer selectNoRead(Long userId);
+List<Long> selectAllTongZhi(@Param("orgId") Long orgId,@Param("orgType") Integer orgType,@Param("roles") Long[]roles);
 }

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -298,7 +298,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         Date now = new Date();
         Date effectiveTime = new Date();
         if (!immediateEffect) {
-            effectiveTime = DateUtil.offset(DateUtil.beginOfDay(DateUtils.getStartAndEnd(now, plan.getPlanCycle()).getEndTime()), DateField.DAY_OF_YEAR, 1);
+            effectiveTime = DateUtil.offset(DateUtil.beginOfDay(DateUtils.getStartAndEnd(now,CycleCommonEnum.getEnum(plan.getPlanCycle())).getEndTime()), DateField.DAY_OF_YEAR, 1);
         }
         plan.setPublishTime(now);
         plan.setEffectiveTime(effectiveTime);
@@ -749,7 +749,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
      * @return
      */
     private Boolean needCopyOnEdit(AppPlan plan) {
-        DateRange dateRange = DateUtils.getStartAndEnd(new Date(), plan.getPlanCycle());
+        DateRange dateRange = DateUtils.getStartAndEnd(new Date(), CycleCommonEnum.getEnum(plan.getPlanCycle()));
         if (ObjectUtil.equal(plan.getPlanStatus(), PlanStatus.USING.getCode()) && new Date().before(plan.getEffectiveTime())) {
             return false;
         } else if (ObjectUtil.equal(plan.getPlanStatus(), PlanStatus.USING.getCode())

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java

@@ -190,7 +190,7 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
 
         //删除本周期未完成任务
         Date workDate = new Date();
-        DateRange dr = DateUtils.getStartAndEnd(workDate, appPlans.stream().findFirst().get().getPlanCycle());
+        DateRange dr = DateUtils.getStartAndEnd(workDate,CycleCommonEnum.getEnum(appPlans.stream().findFirst().get().getPlanCycle()) );
         LambdaUpdateWrapper<Resumption> wrapper = new LambdaUpdateWrapper<>();
         wrapper.ge(Resumption::getYmdDate, dr.getStartTime())
                 .le(Resumption::getYmdDate, dr.getEndTime())

+ 3 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java

@@ -110,7 +110,7 @@ public interface CoreMonitoringRetrievalTaskMapper extends BaseMapper<CoreMonito
     void deleteAllTaskByPlanId(@Param("planId") Long planId);
 
     void deleteTaskByStartTime(@Param("planId") Long planId, @Param("endTime") String endTime);
-
+ List<Long>   selectTaskByStartTime(@Param("planId") Long planId, @Param("endTime") String endTime);
     void deleteAllTaskByPlanIds(@Param("planIds") Long[] planIds);
 
     void deleteDayTaskByTime(@Param("planId") Long planId, @Param("cycle") String cycle, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
@@ -119,6 +119,8 @@ public interface CoreMonitoringRetrievalTaskMapper extends BaseMapper<CoreMonito
 
     void deleteTaskByToday(@Param("planId") Long planId, @Param("day") String day);
 
+    List<Long> selectTaskByToday(@Param("planId") Long planId, @Param("day") String day);
+
     /**
      * 删除周任务
      *

+ 29 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskBuilderService.java

@@ -116,12 +116,35 @@ public interface ICoreMonitoringRetrievalTaskBuilderService extends IService<Cor
      * @param planId
      */
     void deleteAllTaskByPlanId(Long planId);
-    //删除今天之后的任务
-void  deleteTaskByStartTime(Long planId,String startTime);
-void  deleteTaskByToday(Long planId,String day);
+
+    //删除结束时间今天之后的任务
+    void deleteTaskByStartTime(Long planId, String startTime);
+
+    /**
+     * 查询结束时间是当前之后的任务
+     * @param planId
+     * @param startTime
+     * @return
+     */
+    List<Long>selectTaskByStartTime(Long planId, String startTime);
+
+    /**
+     * 删除今天的任务
+     * @param planId
+     * @param day
+     */
+    void deleteTaskByToday(Long planId, String day);
+
+    /**
+     * 查询今天的任务
+     * @param planId
+     * @param day
+     * @return
+     */
+    List<Long>selectTaskByToday(Long planId, String day);
+
     void deleteAllTaskByPlanIds(List<Long> planId);
 
-//    List<CoreMonitoringRetrievalTask> selectAllTaskByPlanId(List<Long> planId,List<String>status);
 
     /**
      * 删除日任务
@@ -140,6 +163,6 @@ void  deleteTaskByToday(Long planId,String day);
 
     void updateDeleteTaskByPlanId(Long planId, Integer isDeleted);
 
-//    void selectMonitorExceptionData(List<Long> orgIds,DateTime time);
 
-    void taskChangeForTimeWorkChange(WorkTimeChangeEvent event);}
+    void taskChangeForTimeWorkChange(WorkTimeChangeEvent event);
+}

+ 10 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskBuilderServiceImpl.java

@@ -267,11 +267,21 @@ public class CoreMonitoringRetrievalTaskBuilderServiceImpl extends ServiceImpl<C
     }
 
     @Override
+    public List<Long> selectTaskByStartTime(Long planId, String startTime) {
+        return coreMonitoringRetrievalTaskMapper.selectTaskByStartTime(planId,startTime);
+    }
+
+    @Override
     public void deleteTaskByToday(Long planId, String day) {
         coreMonitoringRetrievalTaskMapper.deleteTaskByToday(planId,day);
     }
 
     @Override
+    public List<Long> selectTaskByToday(Long planId, String day) {
+        return coreMonitoringRetrievalTaskMapper.selectTaskByToday(planId,day);
+    }
+
+    @Override
     public void deleteAllTaskByPlanIds(List<Long> planId) {
         Long[] longs = planId.toArray(new Long[planId.size()]);
         //   coreMonitoringRetrievalTaskMapper.deleteAllTaskByPlanIds(longs);

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/CoreSafecheckPlanServiceImpl.java

@@ -778,7 +778,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
      * @return
      */
     private Boolean needCopyOnEdit(CoreSafecheckPlan plan) {
-        DateRange dateRange = DateUtils.getStartAndEnd(new Date(), plan.getPlanCycle());
+        DateRange dateRange = DateUtils.getStartAndEnd(new Date(), SafetyPlanCycle.toCommon(plan.getPlanCycle()));
         if (ObjectUtil.equal(plan.getPlanStatus(), PlanStatus.USING.getCode()) && new Date().before(plan.getEffectiveTime())) {
             return false;
         } else if (ObjectUtil.equal(plan.getPlanStatus(), PlanStatus.USING.getCode())

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

@@ -131,6 +131,7 @@
                             GROUP BY org_id) 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 path like concat(#{orgPath}, '%')
           AND ( o.type = 4
                 OR o.type = 5)
@@ -230,7 +231,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>

+ 139 - 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,106 @@
         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 o.path,
+               if(m.ga382021 is null, 0, 1)        as ga382021,
+               if(m.ga382021current is null, 0, 1) as ga382021current,
+               if(m.ga382015 is null, 0, 1)        as ga382015,
+               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, 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="orgSecurityInfo" resultType="com.xunmei.core.board.vo.web.OrgSecurityInfoVo">
+        select sum(if(oe.askari = 1, 1, 0))  as equippedCount,
+               sum(if(oe.askari != 1, 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.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>

+ 15 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/evaluate/CoreEvaluateTaskMapper.xml

@@ -255,6 +255,21 @@
         GROUP BY
         a.id
     </select>
+    <select id="selectTaskByPlanIdAndStatus" resultType="com.xunmei.core.evaluate.domain.CoreEvaluateTask">
+        SELECT
+            *
+        FROM
+            core_evaluate_task
+        WHERE
+            plan_id = #{planId}
+        <if test="statusList != null">
+            AND `status` IN
+            <foreach collection="statusList" item="status" open="(" separator="," close=")">
+                #{status}
+            </foreach>
+        </if>
+
+    </select>
 
 
     <insert id="insertCoreEvaluateTask" parameterType="com.xunmei.core.evaluate.domain.CoreEvaluateTask">

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/information/CoreMessageCenterMapper.xml

@@ -80,7 +80,7 @@
         FROM
             core_message_center
         WHERE
-            is_read = 0
+            is_read = 0 AND user_id=#{userId}
     </select>
 
     <insert id="insertCoreMessageCenter" parameterType="com.xunmei.core.information.domain.CoreMessageCenter">

+ 38 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/message/CoreAnnouncementNotificationMapper.xml

@@ -111,6 +111,42 @@
         WHERE
                 id NOT IN ( SELECT announcement_notification_id FROM core_announcement_notification_to_user )
     </select>
+    <select id="selectAllTongZhi" resultType="java.lang.Long">
+        SELECT
+            a.id
+        FROM
+            core_announcement_notification a
+                LEFT JOIN core_announcement_notification_to_org b ON a.id = b.announcement_notification_id
+                LEFT JOIN core_announcement_notification_to_role c ON a.id = c.announcement_notification_id
+        WHERE
+            a.tag_org_type = #{orgType}
+          AND b.org_id = #{orgId}
+          <if test="roles !=null">
+              AND c.role_id
+              in
+              <foreach collection="roles" item="item" open="(" close=")" separator=",">
+                  #{item}
+              </foreach>
+          </if>
+    </select>
+    <select id="selectAll" resultType="com.xunmei.common.core.domain.message.vo.MessageAppPageVo">
+        select T.*,T.file_list as strFileList from (select a.* from core_announcement_notification a
+        left join core_announcement_notification_to_role b on a.id = b.announcement_notification_id
+        left join core_announcement_notification_to_org c on a.id = c.announcement_notification_id
+        where a.messag_status = 1 and c.org_id = #{orgId} and (a.messag_type = 0 or (b.role_id in
+        <foreach collection="roles" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach> and a.messag_type=1))
+        GROUP BY a.id) T
+    </select>
+    <select id="selectReadByUser" resultType="java.lang.Long">
+        SELECT
+            announcement_notification_id
+        FROM
+            core_announcement_notification_to_user
+        WHERE
+            user_id=#{userId}
+    </select>
 
     <insert id="insertCoreAnnouncementNotification" parameterType="com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotification">
         insert into core_announcement_notification
@@ -184,7 +220,8 @@
         </foreach>
     </insert>
     <insert id="insertNotificationUser">
-        insert into core_announcement_notification_to_user(id,announcement_notification_id,org_id,user_id)values(#{notificationUser.id},#{notificationUser.announcementNotificationId},#{notificationUser.orgId},#{notificationUser.userId})
+        insert into core_announcement_notification_to_user(id,announcement_notification_id,org_id,user_id)
+        values(#{notificationUser.id},#{notificationUser.announcementNotificationId},#{notificationUser.orgId},#{notificationUser.userId})
     </insert>
 
     <update id="updateCoreAnnouncementNotification" parameterType="com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotification">

+ 26 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml

@@ -836,4 +836,30 @@
 
                            OR parent_id = #{planId}) b)
     </select>
+    <select id="selectTaskByToday" resultType="java.lang.Long">
+        SELECT
+            id
+        FROM
+            core_monitoring_retrieval_task
+        WHERE
+            ymd_date LIKE #{day}
+          AND plan_id IN (
+            SELECT
+                id
+            FROM
+                ( SELECT id FROM core_monitoring_retrieval_plan WHERE id = #{planId} OR parent_id = #{planId} ) b)
+    </select>
+    <select id="selectTaskByStartTime" resultType="java.lang.Long">
+        SELECT
+            id
+        FROM
+            core_monitoring_retrieval_task
+        WHERE
+            plan_end_time > #{endTime}
+          AND plan_id IN (
+            SELECT
+                id
+            FROM
+                ( SELECT id FROM core_monitoring_retrieval_plan WHERE id = #{planId} OR parent_id = #{planId} ) b)
+    </select>
 </mapper>

+ 6 - 6
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -524,16 +524,16 @@ public class PdfUtil {
 
     public static void dealAccessPBody(Document document, PdfPTable table, Font tableFont, Font tableTitleFont, List<AccessDataVo> data) throws DocumentException {
 
-        PdfUtil.createPDFCell(tableTitleFont, table, "序号", Element.ALIGN_MIDDLE, 3, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "硬盘录像机", Element.ALIGN_MIDDLE, 16, 0);
+        PdfUtil.createPDFCell(tableTitleFont, table, "序号", Element.ALIGN_MIDDLE, 5, 0);
+        PdfUtil.createPDFCell(tableTitleFont, table, "硬盘录像机", Element.ALIGN_MIDDLE, 15, 0);
         PdfUtil.createPDFCell(tableTitleFont, table, "通道名称", Element.ALIGN_MIDDLE, 9, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "检查项目", Element.ALIGN_MIDDLE, 9, 0);
+        PdfUtil.createPDFCell(tableTitleFont, table, "检查项目", Element.ALIGN_MIDDLE, 8, 0);
         PdfUtil.createPDFCell(tableTitleFont, table, "存在问题", Element.ALIGN_MIDDLE, 9, 0);
         for (int i = 1; i <= data.size(); i++) {
-            PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 3, 0);
-            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getHostName(), Element.ALIGN_MIDDLE, 16, 0);
+            PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 5, 0);
+            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getHostName(), Element.ALIGN_MIDDLE, 15, 0);
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getVideoChannelName(), Element.ALIGN_MIDDLE, 9, 0);
-            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getProject(), Element.ALIGN_MIDDLE, 9, 0);
+            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getProject(), Element.ALIGN_MIDDLE, 8, 0);
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getAbnormalIllustrate(), Element.ALIGN_MIDDLE, 9, 0);
         }
         document.add(table);

+ 8 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgController.java

@@ -170,6 +170,14 @@ public class SysOrgController extends BaseController {
 
         return sysOrgService.selectOrgTreeListByCurOrgId(id);
     }
+
+    @ApiOperation(value = "从数据库中查询下级")
+    @InnerAuth
+    @GetMapping("/selectchildfromdb")
+    public List<SysOrg> selectChildrenFromDb(Long id) {
+        return sysOrgService.selectChildrenFromDb(id);
+    }
+
     /**
      * 获取机构及其上级机构的id列表
      *

+ 2 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysUserController.java

@@ -190,10 +190,11 @@ public class SysUserController extends BaseController {
         SysUser user = userService.selectUserById(SecurityUtils.getUserId());
         SysOrg org = orgMapper.selectOne(new LambdaQueryWrapper<SysOrg>()
                 .eq(SysOrg::getId, user.getOrgId())
-                .select(SysOrg::getType, SysOrg::getShortName));
+                .select(SysOrg::getType, SysOrg::getShortName,SysOrg::getPath));
         if (ObjectUtil.isNotEmpty(org)) {
             user.setOrgType(org.getType());
             user.setOrgShortName(org.getShortName());
+            user.setOrgPath(org.getPath());
         }
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);

+ 2 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java

@@ -162,6 +162,8 @@ public interface ISysOrgService extends IService<SysOrg> {
 
     List<SysOrg> selectOrgTreeListByCurOrgId(Long id);
 
+    List<SysOrg> selectChildrenFromDb(Long id);
+
     SysOrg selectByShortName(String shortName);
 
     String selectOrgNameByPath(Long orgId);

+ 41 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -822,6 +822,47 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
         return orgList;
     }
 
+    /**
+     * 从数据库中查询下级
+     * @param id
+     * @return
+     */
+    public List<SysOrg> selectChildrenFromDb(Long id) {
+        SysOrg org = getById(id);
+        if (ObjectUtil.hasEmpty(org, org.getType())) {
+            throw new ServiceException(ErrorMsgConstants.CUR_USER_ORT_TYPE_ERROR);
+        }
+        OrgTypeEnum orgTypeEnum = OrgTypeEnum.getOrgTypeEnum(org.getType());
+        LambdaQueryWrapper<SysOrg> wrapper = new LambdaQueryWrapper<SysOrg>();
+        wrapper.notLike(SysOrg::getName, "各部门").notLike(SysOrg::getShortName, "各部门").isNotNull(SysOrg::getPath);
+
+        switch (orgTypeEnum) {
+            case SHEGN_LIAN_SHE:
+                wrapper.eq(SysOrg::getType, OrgTypeEnum.DIQU_HANG_SHE.getCode()).like(SysOrg::getName, "地区行社");
+                break;
+            case BAN_SHI_CHU:
+                wrapper.eq(SysOrg::getType, OrgTypeEnum.HANG_SHE.getCode()).likeLeft(SysOrg::getPath, org.getPath());
+                break;
+            default:
+                if (org.getName().contains("地区行社")) {
+                    wrapper.eq(SysOrg::getType, OrgTypeEnum.HANG_SHE.getCode()).likeLeft(SysOrg::getPath, org.getPath());
+                } else {
+                    wrapper.eq(SysOrg::getParentId, org.getId());
+                }
+        }
+
+        wrapper.select(SysOrg::getId,SysOrg::getShortName,SysOrg::getBreviary,SysOrg::getType,SysOrg::getPath);
+
+        List<SysOrg> orgs= baseMapper.selectList(wrapper);
+        orgs.forEach(item->{
+            if(ObjectUtil.isNull(item.getSort())){
+                item.setSort(0);
+            }
+        });
+        orgs.sort(Comparator.comparing(SysOrg::getSort));
+        return  orgs;
+    }
+
     @Override
     public SysOrg selectByShortName(String shortName) {
         List<SysOrg> sysOrgs = baseMapper.selectByShortName(shortName);