Browse Source

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc into V0.0.2

jiawuxian 2 years ago
parent
commit
2f7967965e
20 changed files with 221 additions and 105 deletions
  1. 14 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/domain/CoreDrillDictionary.java
  2. 12 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillDictionaryInsertDto.java
  3. 1 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillDictionaryUpdateDto.java
  4. 3 17
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillTaskEditDto.java
  5. 1 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/vo/CoreDrillTaskReportVo.java
  6. 3 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/retrieval/domain/CoreMonitoringRetrievalTask.java
  7. 3 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/controller/CoreDrillDictionaryController.java
  8. 2 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/mapper/CoreDrillPlanMapper.java
  9. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/mapper/CoreDrillTaskMapper.java
  10. 14 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillDictionaryServiceImpl.java
  11. 19 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillPlanServiceImpl.java
  12. 21 10
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillTaskServiceImpl.java
  13. 2 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java
  14. 2 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskService.java
  15. 6 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java
  16. 2 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/controller/WeatherWarningController.java
  17. 90 64
      soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillDictionaryMapper.xml
  18. 7 0
      soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillPlanMapper.xml
  19. 12 5
      soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillTaskMapper.xml
  20. 6 1
      soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml

+ 14 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/domain/CoreDrillDictionary.java

@@ -28,6 +28,20 @@ public class CoreDrillDictionary extends BaseEntity {
     @TableId
     private Integer id;
 
+    @TableField("org_id")
+    @ApiModelProperty(value = "机构")
+    private Long orgId;
+
+
+    @TableField("org_name")
+    @ApiModelProperty(value = "机构名称")
+    private String orgName;
+
+
+    @TableField("org_path")
+    @ApiModelProperty(value = "机构")
+    private String orgPath;
+
     @TableField("drill_type")
     @ApiModelProperty(value = "演练类型,字典表关联取值")
     private String drillType;

+ 12 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillDictionaryInsertDto.java

@@ -4,18 +4,29 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
 /**
  * @author jingyuanchao
  * @date 2023/9/8 19:15
  */
 @Data
 public class CoreDrillDictionaryInsertDto {
+
+    @NotNull(message = "机构不能为空")
+    @ApiModelProperty(value = "机构")
+    private Long orgId;
+
+    @NotNull(message = "演练类型不能为空")
     @ApiModelProperty(value = "演练类型,字典表关联取值")
     private String drillType;
 
-    @ApiModelProperty(value = "演练项目")
+    @NotEmpty(message = "解决方案不能为空")
+    @ApiModelProperty(value = "解决方案")
     private String drillProjects;
 
+    @NotEmpty(message = "解决方案不能为空")
     @ApiModelProperty(value = "预设案由")
     private String defaultCause;
 }

+ 1 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillDictionaryUpdateDto.java

@@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
  */
 @Data
 public class CoreDrillDictionaryUpdateDto {
-
+    @NotNull(message = "id不能为空")
     private Integer id;
 
     @NotNull(message = "演练类型不能为空")

+ 3 - 17
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/dto/CoreDrillTaskEditDto.java

@@ -19,32 +19,18 @@ public class CoreDrillTaskEditDto {
     @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
     private Long id;
 
-    /**
-     * @see com.xunmei.common.core.enums.drill.DrillType
-     * 类型
-     */
-    @ApiModelProperty(value = "类型")
-    private Integer type;
 
-//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-//    @ApiModelProperty(value = "培训开始时间")
-//    private LocalDateTime trainingStartDateTime;
-//
-//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-//    @ApiModelProperty(value = "培训截止时间")
-//    private LocalDateTime trainingEndDateTime;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "演练时间")
     private LocalDateTime drillTime;
 
 
-
     @ApiModelProperty(value = "演练地点")
     private String drillSite;
 
-//
-//    @ApiModelProperty(value = "总结")
-//    private String note;
+    @ApiModelProperty(value = "类型")
+    private Integer type;
+
 
     @ApiModelProperty(value = "预设案由")
     private String presetCase;

+ 1 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/vo/CoreDrillTaskReportVo.java

@@ -17,6 +17,7 @@ public class CoreDrillTaskReportVo {
 
     @ApiModelProperty(value = "机构名称")
     private String orgName;
+    private String orgPath;
 
 
     @ApiModelProperty(value = "应培训数量")

+ 3 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/retrieval/domain/CoreMonitoringRetrievalTask.java

@@ -120,8 +120,10 @@ private static final long serialVersionUID=1L;
     private Date submitTime;
 
     /** 异常数 */
-            @ApiModelProperty(value = "异常数")
+    @ApiModelProperty(value = "异常数")
     private Integer exceptionCount;
+    @ApiModelProperty(value = "0正常,1删除")
+    private Integer isDeleted;
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
 @Override

+ 3 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/controller/CoreDrillDictionaryController.java

@@ -9,6 +9,7 @@ import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary;
 import com.xunmei.core.drill.service.ICoreDrillDictionaryService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -66,7 +67,7 @@ public class CoreDrillDictionaryController extends BaseController {
     @RequiresPermissions("core:drillDictionary:add")
     @Log(title = "预案演练库", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody CoreDrillDictionaryInsertDto coreDrillDictionary) {
+    public AjaxResult add(@RequestBody @Validated CoreDrillDictionaryInsertDto coreDrillDictionary) {
         return toAjax(coreDrillDictionaryService.insertCoreDrillDictionary(coreDrillDictionary));
     }
 
@@ -77,7 +78,7 @@ public class CoreDrillDictionaryController extends BaseController {
     @RequiresPermissions("core:drillDictionary:edit")
     @Log(title = "预案演练库", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody CoreDrillDictionaryUpdateDto request) {
+    public AjaxResult edit(@RequestBody @Validated CoreDrillDictionaryUpdateDto request) {
         return toAjax(coreDrillDictionaryService.updateCoreDrillDictionary(request));
     }
 

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/mapper/CoreDrillPlanMapper.java

@@ -76,5 +76,7 @@ public interface CoreDrillPlanMapper extends BaseMapper<CoreDrillPlan> {
 
     List<Long> selectIdByParentId(@Param("planId") Long planId);
 
+    List<Long> selectAllIdByParentId(@Param("planId") Long planId);
+
     List<CoreDrillPlanRoleVo> selectPlanRole(@Param("orgId") Long orgId);
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/mapper/CoreDrillTaskMapper.java

@@ -27,7 +27,7 @@ public interface CoreDrillTaskMapper extends BaseMapper<CoreDrillTask> {
 
     CoreDrillTaskDetailVo selectDrillTaskDetail(@Param("id") Long id);
 
-    List<CoreDrillTaskReportVo> selectReport(@Param("request") CoreDrillTaskReportDto request);
+    List<CoreDrillTaskReportVo> selectReport(@Param("request") CoreDrillTaskReportDto request, @Param("planId") Long planId, @Param("planIdList") List<Long> planIdList);
 
     Integer checkHasTask(@Param("planId") Long planId);
 

+ 14 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillDictionaryServiceImpl.java

@@ -52,6 +52,12 @@ public class CoreDrillDictionaryServiceImpl extends ServiceImpl<CoreDrillDiction
 
     @Override
     public TableDataInfo<CoreDrillDictionaryPageVo> selectPage(CoreDrillDictionaryPageDto request) {
+
+        if (request.getCheckSub()) {
+            SysOrg org = getOrg(request.getOrgId());
+            request.setOrgPath(org.getPath());
+        }
+
         //获取数据
         Page<CoreDrillDictionaryPageVo> page = coreDrillDictionaryMapper.selectPageData(request.getPageRequest(), request);
         //抓换为TableDataInfo适配前端
@@ -60,6 +66,10 @@ public class CoreDrillDictionaryServiceImpl extends ServiceImpl<CoreDrillDiction
 
     }
 
+    private SysOrg getOrg(Long orgId) {
+        return RemoteCallHandlerExecutor.executeRemoteCall(() ->
+                orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
+    }
 
     /**
      * 查询预案演练库
@@ -88,6 +98,10 @@ public class CoreDrillDictionaryServiceImpl extends ServiceImpl<CoreDrillDiction
         if (null != drillTypeDictList && ObjectUtil.isNotEmpty(drillTypeDictList)) {
             drillTypeDictList.stream().filter(dict -> ObjectUtil.equal(dict.getDictValue(), request.getDrillType())).findFirst().ifPresent(dict -> dictionary.setDrillTypeName(dict.getDictLabel()));
         }
+        SysOrg sysOrg = getOrg(request.getOrgId());
+        dictionary.setOrgName(sysOrg.getName());
+        dictionary.setOrgPath(sysOrg.getPath());
+        dictionary.setOrgId(sysOrg.getId());
         dictionary.setCreateBy(SecurityUtils.getUserId().toString());
         dictionary.setUpdateBy(SecurityUtils.getUserId().toString());
         dictionary.setCreateTime(new Date());

+ 19 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillPlanServiceImpl.java

@@ -29,6 +29,7 @@ import com.xunmei.core.drill.service.ICoreDrillTaskService;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,6 +53,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
  * @author xunmei
  * @date 2023-09-08
  */
+@Slf4j
 @Service
 public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, CoreDrillPlan> implements ICoreDrillPlanService {
     @Autowired
@@ -256,7 +258,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         }
         Long planId = plan.getId();
         //删除原有数据, 然后重新生成计划,任务
-        List<Long> planIdList = coreDrillPlanMapper.selectIdByParentId(planId);
+        List<Long> planIdList = coreDrillPlanMapper.selectAllIdByParentId(planId);
         if (ObjectUtil.isNotEmpty(planIdList)) {
             coreDrillPlanMapper.deleteBatchIds(planIdList);
             coreDrillPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreDrillPlanToExecOrg>().in(CoreDrillPlanToExecOrg::getPlanId, planIdList));
@@ -271,6 +273,12 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         }
         List<CoreDrillPlan> planList = buildPlanData(plan, drillPlanToRoleList);
 
+        if (plan.getPlanStatus()==1){
+            log.info("计划已被修改为禁用,不再生成任务!");
+            return;
+        }
+
+
         for (CoreDrillPlan drillPlan : planList) {
             final CoreDrillPlanDataVo dataVo = getCoreDrillPlanDataVo(drillPlan.getId());
             CompletableFuture.runAsync(() -> {
@@ -293,6 +301,12 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             //TODO 考虑是否同步修改已生成的任务的名称
             return;
         }
+
+        if (plan.getPlanStatus()==1){
+            log.info("计划已被修改为禁用,不再生成任务!");
+            return;
+        }
+
         //此为情况一,计划没有生成任务或者生成了任务但未执行
         final CoreDrillPlanDataVo dataVo = getCoreDrillPlanDataVo(plan.getId());
         if (ObjectUtil.equal(1, plan.getBuildTaskNow()) && ObjectUtil.equal(0, plan.getPlanStatus())) {
@@ -322,6 +336,10 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         if (standardPlanHasDone != null) {
             throw new RuntimeException("该计划下存在任务已执行的情况,无法修改!");
         }
+        //计划状态
+        if (ObjectUtil.notEqual(request.getPlanStatus(), plan.getPlanStatus())) {
+            flag = false;
+        }
         //计划周期
         if (ObjectUtil.notEqual(request.getPlanCycle(), plan.getPlanCycle())) {
             flag = false;

+ 21 - 10
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillTaskServiceImpl.java

@@ -23,6 +23,7 @@ import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDataVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillTaskDetailVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillTaskPageVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillTaskReportVo;
+import com.xunmei.common.core.domain.edu.vo.CoreEduTrainingTaskReportVo;
 import com.xunmei.common.core.enums.ExportPdfType;
 import com.xunmei.common.core.enums.drill.DrillDoStatus;
 import com.xunmei.common.core.enums.drill.DrillType;
@@ -344,6 +345,16 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 
     @Override
     public List<CoreDrillTaskReportVo> selectCoreDrillTaskReport(CoreDrillTaskReportDto request) {
+        CoreDrillPlan plan = coreDrillPlanMapper.selectById(request.getPlanId());
+        if (ObjectUtil.isNull(plan)) {
+            throw new SystemException("未获取到该计划信息");
+        }
+        List<Long> planIdList = new ArrayList<>();
+        Long planId = request.getPlanId();
+        if (ObjectUtil.equal(1, plan.getStandard()) && ObjectUtil.equal(1, plan.getIssue())) {
+            planIdList = coreDrillPlanMapper.selectIdByParentId(plan.getId());
+            planId = null;
+        }
         request.setStartDate(DateUtil.beginOfMonth(request.getDate()));
         request.setEndDate(DateUtil.endOfMonth(request.getDate()));
         Long orgId = request.getOrgId();
@@ -353,21 +364,21 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
             return new ArrayList<>();
         }
         List<CoreDrillTaskReportVo> result = new ArrayList<>();
-        List<CoreDrillTaskReportVo> list = coreDrillTaskMapper.selectReport(request);
+        List<CoreDrillTaskReportVo> list = coreDrillTaskMapper.selectReport(request, planId, planIdList);
         for (SysOrg org : sysOrgList) {
-            Optional<CoreDrillTaskReportVo> optional = list.stream().filter(vo -> ObjectUtil.equal(vo.getOrgId(), org.getId())).findFirst();
-            CoreDrillTaskReportVo reportVo;
-            if (!optional.isPresent()) {
-                reportVo = new CoreDrillTaskReportVo();
-                reportVo.setPlanId(request.getPlanId());
-                reportVo.setOrgId(org.getId());
-                reportVo.setOrgName(org.getName());
+            List<CoreDrillTaskReportVo> childrenOrgData = list.stream().filter(vo -> vo.getOrgPath().startsWith(org.getPath())).collect(Collectors.toList());
+            CoreDrillTaskReportVo reportVo=new CoreDrillTaskReportVo();
+            reportVo.setOrgId(org.getId());
+            reportVo.setOrgName(org.getName());
+            if (ObjectUtil.isEmpty(childrenOrgData)) {;
                 reportVo.setShouldFinish(0);
                 reportVo.setFinish(0);
                 reportVo.setFinishRate("0%");
             } else {
-                reportVo = optional.get();
-                reportVo.setFinishRate(calculatePercent(reportVo.getShouldFinish(), reportVo.getFinish()));
+                childrenOrgData.stream().map(CoreDrillTaskReportVo::getShouldFinish).reduce(Integer::sum).ifPresent(reportVo::setShouldFinish);
+                childrenOrgData.stream().map(CoreDrillTaskReportVo::getFinish).reduce(Integer::sum).ifPresent(reportVo::setFinish);
+
+                reportVo.setFinishRate(calculatePercent(reportVo.getFinish(), reportVo.getShouldFinish()));
             }
             result.add(reportVo);
         }

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

@@ -83,4 +83,6 @@ public interface CoreMonitoringRetrievalTaskMapper extends BaseMapper<CoreMonito
     void updateTaskStart(@Param("dateTimeNew") Date dateTimeNew);
 
     void deleteTaskByPlanId(@Param("planId") Long planId);
+
+    void updateDeleteTaskByPlanId(@Param("planId") Long planId,@Param("isDeleted") Integer isDeleted);
 }

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

@@ -90,5 +90,7 @@ public interface ICoreMonitoringRetrievalTaskService extends IService<CoreMonito
 
     void updateTaskStart();
 
+
     void deleteTaskByPlanId(Long planId);
+    void updateDeleteTaskByPlanId(Long planId,Integer isDeleted);
 }

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

@@ -365,6 +365,11 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
         coreMonitoringRetrievalTaskMapper.deleteTaskByPlanId(planId);
     }
 
+    @Override
+    public void updateDeleteTaskByPlanId(Long planId,Integer isDeleted) {
+        coreMonitoringRetrievalTaskMapper.updateDeleteTaskByPlanId(planId,isDeleted);
+    }
+
     /**
      * @param cycle    周期
      * @param taskTime 日期
@@ -454,6 +459,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
         task.setRoleId(plan.getRoleId());
         task.setStatus("0");
         task.setCreateTime(DateTime.now());
+        task.setIsDeleted(0);
         return task;
     }
 

+ 2 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/controller/WeatherWarningController.java

@@ -7,6 +7,7 @@ import com.xunmei.common.core.domain.weather.dto.WeatherWarningDto;
 import com.xunmei.common.core.utils.KeyValue;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.security.annotation.InnerAuth;
 import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.core.access.vo.TMonitoringRetrievalPlanVO;
 import com.xunmei.core.weather.service.IWeatherWarningService;
@@ -48,7 +49,7 @@ public class WeatherWarningController {
         List<KeyValue> cityList = weatherWarningService.cityCodeList();
     return AjaxResult.success(cityList);
     }
-
+    @InnerAuth
     @GetMapping(value = "/getDataFromApi")
     public void getDataFromApi() {
         weatherWarningService.getDataFromApi();

+ 90 - 64
soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillDictionaryMapper.xml

@@ -3,14 +3,13 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.core.drill.mapper.CoreDrillDictionaryMapper">
-
     <resultMap type="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary" id="CoreDrillDictionaryResult">
-                <result property="id" column="id"/>
-                <result property="drillType" column="drill_type"/>
-                <result property="drillTypeName" column="drill_type_name"/>
-                <result property="drillProjects" column="drill_projects"/>
-                <result property="defaultCause" column="default_cause"/>
-                <result property="deleted" column="deleted"/>
+        <result property="id" column="id"/>
+        <result property="drillType" column="drill_type"/>
+        <result property="drillTypeName" column="drill_type_name"/>
+        <result property="drillProjects" column="drill_projects"/>
+        <result property="defaultCause" column="default_cause"/>
+        <result property="deleted" column="deleted"/>
     </resultMap>
 
     <sql id="selectCoreDrillDictionaryVo">
@@ -18,88 +17,109 @@
         from core_drill_dictionary
     </sql>
 
-    <select id="selectCoreDrillDictionaryList" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary"
+    <select id="selectCoreDrillDictionaryList"
+            parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary"
             resultMap="CoreDrillDictionaryResult">
         <include refid="selectCoreDrillDictionaryVo"/>
         <where>
-                        <if test="drillType != null  and drillType != ''">
-                            and drill_type = #{drillType}
-                        </if>
-                        <if test="drillTypeName != null  and drillTypeName != ''">
-                            and drill_type_name like concat('%', #{drillTypeName}, '%')
-                        </if>
-                        <if test="drillProjects != null  and drillProjects != ''">
-                            and drill_projects = #{drillProjects}
-                        </if>
-                        <if test="defaultCause != null  and defaultCause != ''">
-                            and default_cause = #{defaultCause}
-                        </if>
+            <if test="drillType != null  and drillType != ''">
+                and drill_type = #{drillType}
+            </if>
+            <if test="drillTypeName != null  and drillTypeName != ''">
+                and drill_type_name like concat('%', #{drillTypeName}, '%')
+            </if>
+            <if test="drillProjects != null  and drillProjects != ''">
+                and drill_projects = #{drillProjects}
+            </if>
+            <if test="defaultCause != null  and defaultCause != ''">
+                and default_cause = #{defaultCause}
+            </if>
         </where>
     </select>
 
     <select id="selectCoreDrillDictionaryById" parameterType="Long"
             resultMap="CoreDrillDictionaryResult">
-            <include refid="selectCoreDrillDictionaryVo"/>
-            where id = #{id}
+        <include refid="selectCoreDrillDictionaryVo"/>
+        where id = #{id}
     </select>
 
-    <insert id="insertCoreDrillDictionary" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary">
+    <insert id="insertCoreDrillDictionary"
+            parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary">
         insert into core_drill_dictionary
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                    <if test="id != null">id,
-                    </if>
-                    <if test="drillType != null">drill_type,
-                    </if>
-                    <if test="drillTypeName != null">drill_type_name,
-                    </if>
-                    <if test="drillProjects != null">drill_projects,
-                    </if>
-                    <if test="defaultCause != null">default_cause,
-                    </if>
-                    <if test="deleted != null">deleted,
-                    </if>
+            <if test="id != null">
+                id,
+            </if>
+            <if test="drillType != null">
+                drill_type,
+            </if>
+            <if test="drillTypeName != null">
+                drill_type_name,
+            </if>
+            <if test="drillProjects != null">
+                drill_projects,
+            </if>
+            <if test="defaultCause != null">
+                default_cause,
+            </if>
+            <if test="deleted != null">
+                deleted,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                    <if test="id != null">#{id},
-                    </if>
-                    <if test="drillType != null">#{drillType},
-                    </if>
-                    <if test="drillTypeName != null">#{drillTypeName},
-                    </if>
-                    <if test="drillProjects != null">#{drillProjects},
-                    </if>
-                    <if test="defaultCause != null">#{defaultCause},
-                    </if>
-                    <if test="deleted != null">#{deleted},
-                    </if>
+            <if test="id != null">
+                #{id},
+            </if>
+            <if test="drillType != null">
+                #{drillType},
+            </if>
+            <if test="drillTypeName != null">
+                #{drillTypeName},
+            </if>
+            <if test="drillProjects != null">
+                #{drillProjects},
+            </if>
+            <if test="defaultCause != null">
+                #{defaultCause},
+            </if>
+            <if test="deleted != null">
+                #{deleted},
+            </if>
         </trim>
     </insert>
 
-    <update id="updateCoreDrillDictionary" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary">
+    <update id="updateCoreDrillDictionary"
+            parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary">
         update core_drill_dictionary
         <trim prefix="SET" suffixOverrides=",">
-                    <if test="drillType != null">drill_type =
-                        #{drillType},
-                    </if>
-                    <if test="drillTypeName != null">drill_type_name =
-                        #{drillTypeName},
-                    </if>
-                    <if test="drillProjects != null">drill_projects =
-                        #{drillProjects},
-                    </if>
-                    <if test="defaultCause != null">default_cause =
-                        #{defaultCause},
-                    </if>
-                    <if test="deleted != null">deleted =
-                        #{deleted},
-                    </if>
+            <if test="drillType != null">
+                drill_type =
+                #{drillType},
+            </if>
+            <if test="drillTypeName != null">
+                drill_type_name =
+                #{drillTypeName},
+            </if>
+            <if test="drillProjects != null">
+                drill_projects =
+                #{drillProjects},
+            </if>
+            <if test="defaultCause != null">
+                default_cause =
+                #{defaultCause},
+            </if>
+            <if test="deleted != null">
+                deleted =
+                #{deleted},
+            </if>
         </trim>
         where id = #{id}
     </update>
 
     <delete id="deleteCoreDrillDictionaryById" parameterType="Long">
         delete
-        from core_drill_dictionary where id = #{id}
+        from core_drill_dictionary
+        where id = #{id}
     </delete>
 
     <delete id="deleteCoreDrillDictionaryByIds" parameterType="String">
@@ -118,6 +138,12 @@
         <if test="request.drillType != null">
             and d.drill_type=#{request.drillType}
         </if>
+        <if test="request.checkSub==false">
+            and d.org_id=#{request.orgId}
+        </if>
+        <if test="request.checkSub==true">
+            and d.org_path like concat(#{request.orgPath},'%')
+        </if>
     </select>
 
     <select id="selectDetailData" resultType="com.xunmei.common.core.domain.drill.vo.CoreDrillDictionaryDetailVo">

+ 7 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillPlanMapper.xml

@@ -605,4 +605,11 @@
                  INNER JOIN sys_role sr on r.role_id = sr.id
         where p.belong_org_id = #{orgId}
     </select>
+
+    <select id="selectAllIdByParentId" resultType="java.lang.Long">
+        select id
+        from core_drill_plan
+        where parent_id = #{planId}
+          and deleted = 0
+    </select>
 </mapper>

+ 12 - 5
soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillTaskMapper.xml

@@ -122,15 +122,22 @@
     <select id="selectReport" resultType="com.xunmei.common.core.domain.drill.vo.CoreDrillTaskReportVo">
         SELECT t.org_id AS orgId,
         t.org_name AS orgName,
+        t.org_path AS orgPath,
         ifnull(count(0),0) AS shouldFinish,
-        ifnull(SUM(t.status != 3),0) AS finish
+        ifnull(SUM(t.status = 3),0) AS finish
         from core_drill_task t inner join sys_org o on t.org_id = o.id
         <where>
-            <if test="request.orgId != null">
-                and o.parent_id=#{request.orgId}
+            <if test="request.orgPath != null">
+                and o.path like concat(#{request.orgPath}, '%')
             </if>
-            <if test="request.planId != null">
-                and t.plan_id=#{request.planId}
+            <if test="planId != null">
+                and t.plan_id=#{planId}
+            </if>
+            <if test="planIdList.size()>0">
+                and t.plan_id in
+                <foreach collection="planIdList" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
             </if>
             <if test="request.startDate != null">
                 and t.start_date>=#{request.startDate}

+ 6 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml

@@ -97,7 +97,7 @@
     <select id="selectPageList" resultType="com.xunmei.common.core.domain.retrieval.vo.CoreMonitoringRetrievalTaskVo">
         select a.*,b.role_name as roleName,c.name as retrievalUserName from core_monitoring_retrieval_task a left join
         sys_role b on a.role_id = b.id left join sys_user c on a.retrieval_user = c.id
-        where 1=1
+        where is_deleted = 0
         <if test="request.orgId != null ">
             and a.org_id = #{request.orgId}
         </if>
@@ -357,6 +357,7 @@
           and status!=2
     </update>
 
+
     <delete id="deleteCoreMonitoringRetrievalTaskById" parameterType="Long">
         delete
         from core_monitoring_retrieval_task
@@ -372,4 +373,8 @@
     <delete id="deleteTaskByPlanId">
         delete from core_monitoring_retrieval_task where plan_id = #{planId} and status  in (0,3)
     </delete>
+
+    <update id="updateDeleteTaskByPlanId">
+        update core_monitoring_retrieval_task set is_deleted = #{isDeleted} where plan_id = #{planId}
+    </update>
 </mapper>