소스 검색

安全指数代码提交

jingyuanchao 1 년 전
부모
커밋
f839da8ab9
14개의 변경된 파일116개의 추가작업 그리고 168개의 파일을 삭제
  1. 2 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteOrgService.java
  2. 5 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java
  3. 19 13
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/ResumptionMapper.java
  4. 1 3
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/ResumptionService.java
  5. 2 11
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ResumptionServiceImpl.java
  6. 2 6
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java
  7. 0 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskService.java
  8. 2 11
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java
  9. 10 20
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java
  10. 24 57
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionMapper.xml
  11. 27 45
      soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml
  12. 6 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java
  13. 2 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java
  14. 14 1
      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

@@ -176,4 +176,6 @@ public interface RemoteOrgService {
     @PostMapping("/dept/findByOrgTypesAndParent")
     List<SysOrg> findByOrgTypesAndParent(@RequestBody FindOrgTypes types, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
+    @GetMapping("/dept/selectOrgByPath/{orgId}")
+    List<SysOrg> selectOrgByPath(@PathVariable("orgId") Long orgId);
 }

+ 5 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java

@@ -191,6 +191,11 @@ public class RemoteOrgFallbackFactory implements FallbackFactory<RemoteOrgServic
             public List<SysOrg> selectOrgTreeListByCurOrgId(Long id, String source) {
                 return null;
             }
+
+            @Override
+            public List<SysOrg> selectOrgByPath(Long orgId) {
+                return null;
+            }
         };
     }
 }

+ 19 - 13
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/ResumptionMapper.java

@@ -23,53 +23,60 @@ public interface ResumptionMapper extends BaseMapper<Resumption> {
 
     List<Map<String, Object>> findDayTaskList(@Param("year") int year, @Param("quarter") int quarter, @Param("dateTime") String dateTime, @Param("roleId") Long roleId, @Param("orgid") Long orgid);
 
-    List<Map<String, Object>> findMonthTaskList(@Param("year")int year, @Param("month")int month, @Param("type")int type, @Param("roleId")Long roleId,@Param("orgid") Long orgid, @Param("quarter")int quarter);
+    List<Map<String, Object>> findMonthTaskList(@Param("year") int year, @Param("month") int month, @Param("type") int type, @Param("roleId") Long roleId, @Param("orgid") Long orgid, @Param("quarter") int quarter);
 
-    List<Map<String, Object>> findYearTaskList(@Param("year")int year,@Param("type") int type,@Param("roleId") Long roleId, @Param("orgid")Long orgid,@Param("quarter") int quarter);
+    List<Map<String, Object>> findYearTaskList(@Param("year") int year, @Param("type") int type, @Param("roleId") Long roleId, @Param("orgid") Long orgid, @Param("quarter") int quarter);
 
-    Resumption findOneByTaskIdAndDate(@Param("taskId")Long taskId,@Param("year") int year, @Param("quarter")int quarter);
-    List<Map<String, Object>> findOneByTaskId(@Param("taskId")Long taskId,@Param("year")int year,@Param("quarter")int quarter);
+    Resumption findOneByTaskIdAndDate(@Param("taskId") Long taskId, @Param("year") int year, @Param("quarter") int quarter);
+
+    List<Map<String, Object>> findOneByTaskId(@Param("taskId") Long taskId, @Param("year") int year, @Param("quarter") int quarter);
 
     void updateResumption(@Param("resumption") Resumption resumption);
 
     List<ResumptionAppVo> findResumptionApp(@Param("res") ResumptionTaskNewDto res);
+
     List<WorkChangeResumptionVo> findResumptionList(@Param("orgIds") List<Long> orgIds, @Param("date") Date date, @Param("type") Integer type, @Param("status") Integer status, @Param("year") Integer year, @Param("quarter") Integer quarter);
 
-    void deleteResumption(@Param("ids") List<String> ids,@Param("year") Integer year, @Param("quarter") Integer quarter);
+    void deleteResumption(@Param("ids") List<String> ids, @Param("year") Integer year, @Param("quarter") Integer quarter);
+
     /**
      * 根据类型和计划结束时间查询履职
+     *
      * @param type
      * @param planEndTime
      * @return
      */
-    List<Resumption>selectAllByPlanStartTime(@Param("type")Integer type,@Param("planEndTime")String planEndTime);
+    List<Resumption> selectAllByPlanStartTime(@Param("type") Integer type, @Param("planEndTime") String planEndTime);
 
     /**
      * 根据时间和plan_exec查询每天
+     *
      * @param planEndTime
      * @return
      */
-    List<Resumption>selectDay(@Param("planEndTime")String planEndTime,@Param("planExec")String planExec);
+    List<Resumption> selectDay(@Param("planEndTime") String planEndTime, @Param("planExec") String planExec);
 
     List<PanelListVo> selectCurUserTaskList(@Param("request") PanelListDto request);
 
     /**
      * 根据任务id获取数据
+     *
      * @param resumptionId
      * @return
      */
-    List<ResumptionPlanVo> selectResumptionPlan(@Param("resumptionId")Long resumptionId);
+    List<ResumptionPlanVo> selectResumptionPlan(@Param("resumptionId") Long resumptionId);
 
     /**
      * 获取任务的NFC点位情况
+     *
      * @param resumptionId
      * @param areaId
      * @param orgId
      * @return
      */
-    List<ResumptionNFCVo> selectResumptionNFC(@Param("resumptionId")Long resumptionId, @Param("areaId")Long areaId, @Param("orgId")Long orgId);
+    List<ResumptionNFCVo> selectResumptionNFC(@Param("resumptionId") Long resumptionId, @Param("areaId") Long areaId, @Param("orgId") Long orgId);
 
-    List<ResumptionNFCVo> selectNFCOfOrg(@Param("resumptionId")Long resumptionId,@Param("orgId")Long orgId);
+    List<ResumptionNFCVo> selectNFCOfOrg(@Param("resumptionId") Long resumptionId, @Param("orgId") Long orgId);
 
     void updateNameByPlanId(@Param("planName") String planName, @Param("planId") Long planId);
 
@@ -77,9 +84,8 @@ public interface ResumptionMapper extends BaseMapper<Resumption> {
 
     List<CoreSafetyExceptionData> findResumptionListNew(@Param("orgIds") List<Long> orgIds, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("roleId") Long roleId, @Param("request") CoreSafetyIndexReCalculateDto request);
 
-    int saveResumptionExceptionList(@Param("year") int year, @Param("quarter") int quarter, @Param("month") int month, @Param("roleId") Long roleId);
+    int saveResumptionExceptionList(@Param("year") int year, @Param("quarter") int quarter, @Param("month") int month, @Param("roleId") Long roleId, @Param("orgIds") List<Long> orgIds);
 
-    int saveResumptionExceptionListNew(@Param("orgIds") List<Long> orgIds, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("roleId") Long roleId, @Param("request") CoreSafetyIndexReCalculateDto request);
 
-    List<Resumption> selectByYmdDateAndExec(@Param("date")Date date, @Param("exec")Integer exec,@Param("orgId")Long orgId);
+    List<Resumption> selectByYmdDateAndExec(@Param("date") Date date, @Param("exec") Integer exec, @Param("orgId") Long orgId);
 }

+ 1 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/ResumptionService.java

@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xunmei.common.core.domain.panel.dto.PanelListDto;
 import com.xunmei.common.core.domain.panel.vo.PanelListVo;
-import com.xunmei.common.core.domain.safetyindex.dto.CoreSafetyIndexReCalculateDto;
 import com.xunmei.common.core.domain.safetyindex.dto.SafeScoreSourceDto;
 import com.xunmei.common.core.domain.safetyindex.vo.SafeScoreResumptionDataVo;
 import com.xunmei.common.core.utils.ResumptionType;
@@ -50,8 +49,7 @@ public interface ResumptionService extends IService<Resumption> {
 
 //    void dayTaskByWorkTime(Map<String, Object> params);
 
-    void findResumptionList(DateTime time);
-    void findResumptionListNew(List<Long> orgIds, Date startTime, Date endTime, CoreSafetyIndexReCalculateDto request);
+    void findResumptionList(List<Long> orgIds,DateTime time);
 
     List<SafeScoreResumptionDataVo>  findSource(SafeScoreSourceDto request);
 }

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

@@ -13,7 +13,6 @@ import com.xunmei.common.core.domain.panel.dto.PanelListDto;
 import com.xunmei.common.core.domain.panel.enums.PanelTypeEnums;
 import com.xunmei.common.core.domain.panel.vo.PanelListVo;
 import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData;
-import com.xunmei.common.core.domain.safetyindex.dto.CoreSafetyIndexReCalculateDto;
 import com.xunmei.common.core.domain.safetyindex.dto.SafeScoreSourceDto;
 import com.xunmei.common.core.domain.safetyindex.vo.SafeScoreResumptionDataVo;
 import com.xunmei.common.core.utils.DateHelper;
@@ -328,18 +327,10 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
 
     @Override
     @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
-    public void findResumptionList(DateTime time) {
+    public void findResumptionList(List<Long> orgIds,DateTime time) {
         SysRole role = roleService.getRoleByName("网点安全员", SecurityConstants.INNER);
          //baseMapper.findResumptionExceptionList(time.year(), time.quarter(), time.month() + 1, role.getId());
-         baseMapper.saveResumptionExceptionList(time.year(), time.quarter(), time.month() + 1, role.getId());
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
-    public void findResumptionListNew(List<Long> orgIds, Date startTime, Date endTime, CoreSafetyIndexReCalculateDto request) {
-        SysRole role = roleService.getRoleByName("网点安全员", SecurityConstants.INNER);
-         //baseMapper.findResumptionListNew(orgIds,startTime ,endTime,role.getId(),request);
-         baseMapper.saveResumptionExceptionListNew(orgIds,startTime ,endTime,role.getId(),request);
+         baseMapper.saveResumptionExceptionList(time.year(), time.quarter(), time.month() + 1, role.getId(),orgIds);
     }
 
     @Override

+ 2 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java

@@ -186,13 +186,9 @@ public interface CoreMonitoringRetrievalTaskMapper extends BaseMapper<CoreMonito
                                                                 @Param("roleId") Long roleId,
                                                                 @Param("orgIds") List<Long> orgIds);
 
-    int saveMonitorExceptionData(@Param("year") int year, @Param("quarter") int quarter, @Param("month") int month, @Param("roleId") Long roleId);
 
-    int saveMonitorExceptionDataNew(@Param("year") int year,
-                                    @Param("quarter") int quarter,
-                                    @Param("month") int month,
-                                    @Param("roleId") Long roleId,
-                                    @Param("orgIds") List<Long> orgIds);
+    int saveMonitorExceptionData(@Param("year") int year, @Param("quarter") int quarter, @Param("month") int month,
+                                    @Param("roleId") Long roleId, @Param("orgIds") List<Long> orgIds);
 
     List<CoreMonitoringRetrievalTask> selectTaskByIdList(@Param("list") List<String> list);
 

+ 0 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskService.java

@@ -140,7 +140,6 @@ public interface ICoreMonitoringRetrievalTaskService extends IService<CoreMonito
 
     List<PanelListVo> selectCurUserTaskList(PanelListDto panelListDto);
 
-    void selectMonitorExceptionData(DateTime time);
     void selectMonitorExceptionData(List<Long> orgIds,DateTime time);
 
     void taskChangeForTimeWorkChange(WorkTimeChangeEvent event);

+ 2 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java

@@ -651,19 +651,10 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
 
     @Override
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
-    public void selectMonitorExceptionData(DateTime time) {
+    public void selectMonitorExceptionData(List<Long> orgIds,DateTime time) {
         SysRole role = roleService.getRoleByName("网点负责人", SecurityConstants.INNER);
         //扩展字段1:任务状态 扩展字段2 计划id
-        int num = baseMapper.saveMonitorExceptionData(time.year(), time.quarter(), time.month() + 1, role.getId());
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
-    public void selectMonitorExceptionData(List<Long> orgIds, DateTime time) {
-        SysRole role = roleService.getRoleByName("网点安全员", SecurityConstants.INNER);
-        //扩展字段1:任务状态 扩展字段2 计划id
-        int num = baseMapper.saveMonitorExceptionDataNew(time.year(), time.quarter(), time.month() + 1, role.getId(), orgIds);
-
+        int num = baseMapper.saveMonitorExceptionData(time.year(), time.quarter(), time.month() + 1, role.getId(),orgIds);
     }
 
     @Override

+ 10 - 20
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java

@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.Constants;
-import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.safetyindex.domain.*;
 import com.xunmei.common.core.domain.safetyindex.dto.CoreSafetyIndexReCalculateDto;
 import com.xunmei.common.core.domain.safetyindex.vo.SafeIndexRuleCountVo;
@@ -105,7 +104,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
         CompletableFuture.runAsync(() -> {
             //获取安保履职的数据
-            doResumptionExceptionData(time);
+            doResumptionExceptionData(null, time);
         }, threadPoolTaskExecutor);
 
         CompletableFuture.runAsync(() -> {
@@ -115,7 +114,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
         CompletableFuture.runAsync(() -> {
             //获取监控调阅的异常数据
-            doMonitorExceptionData(time);
+            doMonitorExceptionData(null, time);
         }, threadPoolTaskExecutor);
     }
 
@@ -165,9 +164,9 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
     private void reCalculateSafetyIndex(List<Long> orgIds, String date) {
 
-        DateTime time = dealTimeParam(date);
+        DateTime time = DateUtil.parse(date, "yyyy-MM");
         int year = time.year();
-        int month = time.month();
+        int month = time.month()+1;
         //获取指标配置
         List<SafeIndexRuleCountVo> safeIndexConfigVoList = ruleService.findSafeIndexRuleVoList();
         //履职的指标配置
@@ -712,9 +711,6 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
                 .list();
     }
 
-    private void doMonitorExceptionData(DateTime time) {
-        monitoringRetrievalTaskService.selectMonitorExceptionData(time);
-    }
 
     private void doMonitorExceptionData(List<Long> orgIds, DateTime time) {
         monitoringRetrievalTaskService.selectMonitorExceptionData(orgIds, time);
@@ -729,19 +725,12 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
         questionService.selectQuestionExceptionData(startTime, endTime, orgIds);
     }
 
-    private void doResumptionExceptionData(DateTime time) {
+    private void doResumptionExceptionData(List<Long> orgIds, DateTime time) {
         // 逾期数据
         //扩展字段1:计划id
         //扩展字段2:计划执行时刻 (2,3,4 营业前中后)
-        resumptionService.findResumptionList(time);
-
-    }
+        resumptionService.findResumptionList(orgIds, time);
 
-    private void doResumptionExceptionData(List<Long> orgIds, Date startTime, Date endTime, CoreSafetyIndexReCalculateDto request) {
-        // 逾期数据
-        //扩展字段1:计划id
-        //扩展字段2:计划执行时刻 (2,3,4 营业前中后)
-        resumptionService.findResumptionListNew(orgIds, startTime, endTime, request);
     }
 
     @Override
@@ -803,7 +792,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
         coreSafetyExceptionDataMapper.deleteAndUpdateByOrgIdAndDataTime(orgIds, startTime, endTime);
         //重新拉起数据
         //安保履职
-        doResumptionExceptionData(orgIds, startTime, endTime, request);
+        doResumptionExceptionData(orgIds, startTime);
         //问题整改
         doQuestionExceptionData(orgIds, startTime);
 
@@ -816,14 +805,15 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
     @Override
     public void reCalculate(CoreSafetyIndexReCalculateDto request) {
-        List<SysOrg> sysOrgList = orgService.selectOrgTreeListByCurOrgId(request.getOrgId(), SecurityConstants.INNER);
+        List<SysOrg> orgList = orgService.selectOrgByPath(request.getOrgId());
+
         //List<SysOrg> sysOrgList = orgService.selectSysOrgByParentId(request.getOrgId(), SecurityConstants.INNER);
         DateTime time = DateUtil.offsetMonth(new Date(), -1);
         DateTime startTime = DateUtil.beginOfMonth(time);
         DateTime endTime = DateUtil.endOfMonth(startTime);
         request.setQuarter(startTime.quarter());
         //删除现有的异常数据,并重新拉取数据计算
-        List<Long> idList = sysOrgList.stream().map(SysOrg::getId).collect(Collectors.toList());
+        List<Long> idList = orgList.stream().map(SysOrg::getId).collect(Collectors.toList());
         this.deleteAndUpdateByOrgIdAndDataTime(idList, startTime, endTime, request);
     }
 

+ 24 - 57
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionMapper.xml

@@ -336,66 +336,33 @@
     </select>
 
     <insert id="saveResumptionExceptionList">
-        insert into core_safety_exception_data
-        (data_id,org_id,org_name,org_path,data_source,data_time,create_time,extra_field1,extra_field2)
-        SELECT r.id as dataId,
-        r.org_id as orgId,
-        r.org_name as orgName,
-        r.org_path as orgPath,
-        'core_resumption' as dataSource,
-        r.ymd_date as dataTime,
-        now() as createTime,
-        r.plan_id as extraField1,
-        p.plan_cycle as extraField2
-        FROM core_resumption r
-        inner join core_resumption_plan p on r.plan_id = p.id
-        where p.plan_exec in (2, 3, 4)<!--营业前中后-->
-        and p.plan_cycle IN (SELECT cycle
-        FROM core_safety_index_calculate_rule a
-        WHERE a.type_code = 1004
-        GROUP BY org_type,cycle)
-        AND exec_org_type IN (SELECT org_type
-        FROM core_safety_index_calculate_rule a
-        WHERE a.type_code = 1004
-        GROUP BY org_type,cycle)
+        insert into core_safety_exception_data (data_id, org_id, org_name, org_path, data_source, data_time, create_time,
+                                                extra_field1, extra_field2)
+        SELECT  r.id              as dataId,
+                r.org_id          as orgId,
+                r.org_name        as orgName,
+                r.org_path        as orgPath,
+                'core_resumption' as dataSource,
+                r.ymd_date        as dataTime,
+                now()             as createTime,
+                r.plan_id         as extraField1,
+                p.plan_cycle      as extraField2
+        FROM core_resumption r inner join core_resumption_plan p on r.plan_id = p.id
+        where p.plan_exec in (2, 3, 4)
+        and p.plan_cycle IN
+            (SELECT cycle FROM core_safety_index_calculate_rule a WHERE a.type_code = 1004 GROUP BY org_type, cycle)
+        AND exec_org_type IN
+            (SELECT org_type FROM core_safety_index_calculate_rule a WHERE a.type_code = 1004 GROUP BY org_type, cycle)
         and ymd_year =#{year}
         and ymd_quarter=#{quarter}
         and ymd_month=#{month}
-        and status in (4)
+        and status=4
         and p.id in (select distinct pr.plan_id from core_resumption_plan_to_role pr where pr.role_id=#{roleId})
-    </insert>
-
-    <insert id="saveResumptionExceptionListNew">
-        insert into core_safety_exception_data
-        (data_id,org_id,org_name,org_path,data_source,data_time,create_time,extra_field1,extra_field2)
-        SELECT r.id as dataId,
-        r.org_id as orgId,
-        r.org_name as orgName,
-        r.org_path as orgPath,
-        r.plan_id as extraField1,
-        p.plan_cycle as extraField2,
-        r.ymd_date as dataTime,
-        'core_resumption' as dataSource,
-        now() as createTime
-        FROM core_resumption r
-        inner join core_resumption_plan p on r.plan_id = p.id
-        where p.plan_exec in (2, 3, 4)<!--营业前中后-->
-        and p.plan_cycle IN (SELECT cycle
-        FROM core_safety_index_calculate_rule a
-        WHERE a.type_code = 1004
-        GROUP BY org_type,cycle)
-        AND exec_org_type IN (SELECT org_type
-        FROM core_safety_index_calculate_rule a
-        WHERE a.type_code = 1004
-        GROUP BY org_type,cycle)
-        and ymd_year =#{year}
-        and ymd_quarter=#{quarter}
-        and ymd_month=#{month}
-        and status in (4)
-        and role_id =#{roleId}
-        and r.org_id in
-        <foreach collection="orgIds" item="orgId" open="(" separator="," close=")">
-            #{orgId}
-        </foreach>
+        <if test="orgIds != null and orgIds.size>0">
+            and r.org_id in
+            <foreach collection="orgIds" item="orgId" open="(" separator="," close=")">
+                #{orgId}
+            </foreach>
+        </if>
     </insert>
 </mapper>

+ 27 - 45
soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml

@@ -742,55 +742,37 @@
 
     <insert id="saveMonitorExceptionData">
         insert into core_safety_exception_data
-        (data_id,org_id,data_time,data_source,create_time,org_name,org_path,extra_field1,extra_field2)
-        SELECT t.id as dataId,
-        t.org_id as orgId,
-        date_format(t.plan_start_time,'%Y-%m-%d') as dataTime,
-        'core_monitoring_retrieval_task' as dataSource,
-        now() as createTime,
-        t.org_name as orgName,
-        t.org_path as orgPath,
-        t.status as extraField1,
-        t.plan_id as extraField2
-
-        FROM core_monitoring_retrieval_task t where
-        t.ymd_year =#{year}
-        and t.ymd_quarter=#{quarter}
-        and t.ymd_month=#{month}
-        <!--and t.status =3-->
-        and t.role_id = #{roleId}
-    </insert>
-
-    <insert id="saveMonitorExceptionDataNew">
-        insert into core_safety_exception_data
-        (data_id,org_id,data_time,data_source,create_time,org_name,org_path,extra_field1,extra_field2)
-        SELECT t.id as dataId,
-        t.org_id as orgId,
-        t.org_name as orgName,
-        t.org_path as orgPath,
-        date_format(t.plan_start_time,'%Y-%m-%d') as dataTime,
-        'core_monitoring_retrieval_task' as dataSource,
-        now() as createTime,
-        t.status as extraField1,
-        t.plan_id as extraField2
+        (data_id, org_id, data_time, data_source, create_time, org_name, org_path, extra_field1, extra_field2)
+        SELECT t.id                                       as dataId,
+               t.org_id                                   as orgId,
+               date_format(t.plan_start_time, '%Y-%m-%d') as dataTime,
+               'core_monitoring_retrieval_task'           as dataSource,
+               now()                                      as createTime,
+               t.org_name                                 as orgName,
+               t.org_path                                 as orgPath,
+               t.status                                   as extraField1,
+               t.plan_id                                  as extraField2
 
-        FROM core_monitoring_retrieval_task t where
-        t.ymd_year =#{year}
-        and t.ymd_quarter=#{quarter}
-        and t.ymd_month=#{month}
-        <!--and t.status =3-->
-        and t.role_id = #{roleId}
-        and t.org_id in
-        <foreach collection="orgIds" item="orgId" open="(" separator="," close=")">
-            #{orgId}
-        </foreach>
+        FROM core_monitoring_retrieval_task t
+        where t.ymd_year = #{year}
+          and t.ymd_quarter = #{quarter}
+          and t.ymd_month = #{month}
+          and t.status = 3
+          and t.role_id = #{roleId}
+        <if test="orgIds != null and orgIds.size>0">
+            and t.org_id in
+            <foreach collection="orgIds" item="orgId" open="(" separator="," close=")">
+                #{orgId}
+            </foreach>
+        </if>
     </insert>
 
     <select id="selectTaskByIdList" resultMap="CoreMonitoringRetrievalTaskResult">
-        select id, task_name,org_name,  plan_start_time, plan_end_time, role_id from core_monitoring_retrieval_task where id in
-            <foreach collection="list" item="id" open="(" separator="," close=")">
-                #{id}
-            </foreach>
+        select id, task_name,org_name, plan_start_time, plan_end_time, role_id from core_monitoring_retrieval_task where
+        id in
+        <foreach collection="list" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
         order by plan_start_time desc
     </select>
 </mapper>

+ 6 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java

@@ -353,6 +353,7 @@ public class SysDeptController extends BaseController {
     List<SysOrg> findByOrgTypesAndParent(@RequestBody FindOrgTypes types) {
         return orgService.findByOrgTypesAndParent(types);
     }
+
     @ApiOperation(value = "获取机构查询参数")
     @PostMapping("/selectOrgTreeReq")
     R<OrgTreeResp> getOrgTreeResp(@RequestBody OrgTreeReq orgTreeReq) {
@@ -364,4 +365,9 @@ public class SysDeptController extends BaseController {
     String selectOrgNameByPath(Long orgId) {
         return orgService.selectOrgNameByPath(orgId);
     }
+
+    @GetMapping("/selectOrgByPath/{orgId}")
+    List<SysOrg> selectOrgByPath(@PathVariable("orgId") Long orgId) {
+        return orgService.selectOrgByPath(orgId);
+    }
 }

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

@@ -145,4 +145,6 @@ public interface ISysOrgService extends IService<SysOrg> {
     String selectOrgNameByPath(Long orgId);
 
     List<SysOrg> findByOrgTypesAndParent(FindOrgTypes types);
+
+    List<SysOrg> selectOrgByPath(Long orgId);
 }

+ 14 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -586,6 +586,19 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 
     @Override
     public List<SysOrg> findByOrgTypesAndParent(FindOrgTypes types) {
-        return sysOrgMapper.findByOrgTypesAndParent(types.getTypes(),types.getPath());
+        return sysOrgMapper.findByOrgTypesAndParent(types.getTypes(), types.getPath());
+    }
+
+    @Override
+    public List<SysOrg> selectOrgByPath(Long orgId) {
+        SysOrg sysOrg = getById(orgId);
+        if (ObjectUtil.isNull(sysOrg)) {
+            return null;
+        }
+        LambdaQueryWrapper<SysOrg> wrapper = new LambdaQueryWrapper<>();
+        wrapper.likeRight(SysOrg::getPath, sysOrg.getPath());
+        wrapper.eq(SysOrg::getDeleted, 0);
+        wrapper.select(SysOrg::getId, SysOrg::getName, SysOrg::getShortName, SysOrg::getType, SysOrg::getPath, SysOrg::getParentId);
+        return sysOrgMapper.selectList(wrapper);
     }
 }