Bladeren bron

预案演练库代码提交

jingyuanchao 2 jaren geleden
bovenliggende
commit
9618832cc1

+ 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;

+ 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));
     }
 

+ 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());

+ 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">