songhuangfeng123
2022-07-09 1217e2f8b0f950ea215db9edcc073d9199ca2fe6
应急队伍启动记录
已修改7个文件
已添加13个文件
780 ■■■■■ 文件已修改
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencyPlanLogController.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfo.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfoDO.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyPlanStatus.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencyPlanLogReqDTO.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencyPlanLogRespDTO.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencyPlanLogQuery.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencyPlanLogDBQuery.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencyPlanInfoRepository.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencyPlanLogInfoRepository.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencyPlanLogService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencyPlanInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencyPlanLogInfoService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencyPlanInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencyPlanLogInfoServiceImpl.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanLogServiceImpl.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanInfoMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencyPlanLogController.java
对比新文件
@@ -0,0 +1,65 @@
package com.gkhy.safePlatform.emergency.controller;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.emergency.model.dto.req.EmergencyPlanLogReqDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencyPlanLogRespDTO;
import com.gkhy.safePlatform.emergency.query.EmergencyPlanLogQuery;
import com.gkhy.safePlatform.emergency.service.EmergencyPlanLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.security.Principal;
import java.util.List;
@RestController
@RequestMapping("/emergencyPlanLog")
public class EmergencyPlanLogController {
    @Autowired
    private EmergencyPlanLogService emergencyPlanLogService;
    /**
     * 应急预案启动记录列表
     */
    @RequestMapping(value = "/page/list" ,method = RequestMethod.POST)
    private ResultVO<List<EmergencyPlanLogRespDTO>> list (@RequestBody PageQuery<EmergencyPlanLogQuery> pageQuery){
        PageUtils.checkCheck(pageQuery.getPageIndex(), pageQuery.getPageSize());
        return  emergencyPlanLogService.selectEmergencyPlanLogList(pageQuery);
    }
    /**
     * 应急预案启动记录新增
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultVO addEmergencyPlanLog(Principal principal, @RequestBody EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) {
        String uid = principal.getName();
        return emergencyPlanLogService.addEmergencyPlanLog(Long.valueOf(uid), emergencyPlanLogReqDTO);
    }
    /**
     * 应急预案启动记录详情
     */
    @RequestMapping(value = "/info/{id}",method = RequestMethod.GET)
    public ResultVO<EmergencyPlanLogRespDTO> getEmergencyPlanLogById(@PathVariable("id")Long id){
        return emergencyPlanLogService.getEmergencyPlanLogById(id);
    }
    /**
     * 应急预案修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public ResultVO updateEmergencyPlanLog(Principal principal, @RequestBody EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) {
        String uid = principal.getName();
        return emergencyPlanLogService.updateEmergencyPlanLog(Long.valueOf(uid), emergencyPlanLogReqDTO);
    }
    /**
     * 应急预案删除/批量删除
     */
    @RequestMapping(value = "/batchDelete/{ids}",method = RequestMethod.GET)
    public ResultVO batchDeleteEmergencyPlanLog(@PathVariable("ids")String ids){
        return emergencyPlanLogService.batchDeleteEmergencyPlanLog(ids);
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfo.java
对比新文件
@@ -0,0 +1,128 @@
package com.gkhy.safePlatform.emergency.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
@TableName("emergency_plan_log")
public class EmergencyPlanLogInfo {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Boolean delFlag;
    private Date gmtCreate;
    private Date gmtModitify;
    private Long createUid;
    private Long updateUid;
    private Long planId;
    private Long userUId;
    private Date startCreate;
    private String remark;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Boolean getDelFlag() {
        return delFlag;
    }
    public void setDelFlag(Boolean delFlag) {
        this.delFlag = delFlag;
    }
    public Date getGmtCreate() {
        return gmtCreate;
    }
    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }
    public Date getGmtModitify() {
        return gmtModitify;
    }
    public void setGmtModitify(Date gmtModitify) {
        this.gmtModitify = gmtModitify;
    }
    public Long getCreateUid() {
        return createUid;
    }
    public void setCreateUid(Long createUid) {
        this.createUid = createUid;
    }
    public Long getUpdateUid() {
        return updateUid;
    }
    public void setUpdateUid(Long updateUid) {
        this.updateUid = updateUid;
    }
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    public Long getUserUId() {
        return userUId;
    }
    public void setUserUId(Long userUId) {
        this.userUId = userUId;
    }
    public Date getStartCreate() {
        return startCreate;
    }
    public void setStartCreate(Date startCreate) {
        this.startCreate = startCreate;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogInfo{" +
                "id=" + id +
                ", delFlag=" + delFlag +
                ", gmtCreate=" + gmtCreate +
                ", gmtModitify=" + gmtModitify +
                ", createUid=" + createUid +
                ", updateUid=" + updateUid +
                ", planId=" + planId +
                ", userUId=" + userUId +
                ", startCreate=" + startCreate +
                ", remark='" + remark + '\'' +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfoDO.java
对比新文件
@@ -0,0 +1,73 @@
package com.gkhy.safePlatform.emergency.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
@TableName("emergency_plan_log")
public class EmergencyPlanLogInfoDO {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long planId;
    private Long userUid;
    private Date startCreate;
    private String remark;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    public Long getUserUid() {
        return userUid;
    }
    public void setUserUid(Long userUid) {
        this.userUid = userUid;
    }
    public Date getStartCreate() {
        return startCreate;
    }
    public void setStartCreate(Date startCreate) {
        this.startCreate = startCreate;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogInfoDO{" +
                "id=" + id +
                ", planId=" + planId +
                ", userUid=" + userUid +
                ", startCreate=" + startCreate +
                ", remark='" + remark + '\'' +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyPlanStatus.java
@@ -2,12 +2,14 @@
public enum EmergencyPlanStatus {
    START(1),
    FIRST_LEVEL_APPROEAL(2),
    SECOND_LEVEL_APPROEAL(3),
    END(4);
    START(1,"开始"),
    FIRST_LEVEL_APPROEAL(2,"一级审批"),
    SECOND_LEVEL_APPROEAL(3,"二级审批"),
    END(4,"结束");
    private Integer status;
    private String desc;
    public Integer getStatus() {
        return status;
@@ -17,7 +19,16 @@
        this.status = status;
    }
    EmergencyPlanStatus(Integer status) {
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    EmergencyPlanStatus(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java
@@ -32,6 +32,7 @@
    PLAN_NOT_EXIST("P1001" , "应急预案不存在"),
    PLAN_LOG_NOT_EXIST("P1002" , "应急预案启动记录不存在"),
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencyPlanLogReqDTO.java
对比新文件
@@ -0,0 +1,46 @@
package com.gkhy.safePlatform.emergency.model.dto.req;
import java.util.Date;
import java.util.List;
public class EmergencyPlanLogReqDTO {
    private Long id;
    private Long planId;
    private String remark;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogReqDTO{" +
                "id=" + id +
                ", planId=" + planId +
                ", remark='" + remark + '\'' +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencyPlanLogRespDTO.java
对比新文件
@@ -0,0 +1,70 @@
package com.gkhy.safePlatform.emergency.model.dto.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class EmergencyPlanLogRespDTO {
    private Long id;
    private Long planId;
    private Long userUId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startCreate;
    private String remark;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    public Long getUserUId() {
        return userUId;
    }
    public void setUserUId(Long userUId) {
        this.userUId = userUId;
    }
    public Date getStartCreate() {
        return startCreate;
    }
    public void setStartCreate(Date startCreate) {
        this.startCreate = startCreate;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogRespDTO{" +
                "id=" + id +
                ", planId=" + planId +
                ", userUId=" + userUId +
                ", startCreate=" + startCreate +
                ", remark='" + remark + '\'' +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencyPlanLogQuery.java
对比新文件
@@ -0,0 +1,21 @@
package com.gkhy.safePlatform.emergency.query;
public class EmergencyPlanLogQuery {
    private Long planId ;
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogQuery{" +
                "planId=" + planId +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencyPlanLogDBQuery.java
对比新文件
@@ -0,0 +1,21 @@
package com.gkhy.safePlatform.emergency.query.db;
public class EmergencyPlanLogDBQuery {
    private Long planId ;
    public Long getPlanId() {
        return planId;
    }
    public void setPlanId(Long planId) {
        this.planId = planId;
    }
    @Override
    public String toString() {
        return "EmergencyPlanLogQuery{" +
                "planId=" + planId +
                '}';
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencyPlanInfoRepository.java
@@ -22,4 +22,6 @@
    EmergencyPlanInfoDetailDO selectEmergencyPlanById(@Param("id") Long id);
    void updateEmergencyPlan(EmergencyPlanInfo emergencyPlanInfo);
    void deleteEmergencyPlan(@Param("id")Long id);
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencyPlanLogInfoRepository.java
对比新文件
@@ -0,0 +1,25 @@
package com.gkhy.safePlatform.emergency.repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo;
import com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfoDO;
import com.gkhy.safePlatform.emergency.query.db.EmergencyPlanLogDBQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface EmergencyPlanLogInfoRepository extends BaseMapper<EmergencyPlanLogInfo> {
    List<EmergencyPlanLogInfoDO> selectEmergencyPlanLogList(Page<EmergencyPlanLogInfoDO> page, @Param("query")EmergencyPlanLogDBQuery emergencyPlanLogDBQuery);
    void addEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo);
    EmergencyPlanLogInfoDO selectEmergencyPlanLogById(@Param("id")Long id);
    void updateEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo);
    void deleteEmergencyPlanLog(@Param("id")Long id);
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencyPlanLogService.java
对比新文件
@@ -0,0 +1,23 @@
package com.gkhy.safePlatform.emergency.service;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.emergency.model.dto.req.EmergencyPlanLogReqDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencyPlanLogRespDTO;
import com.gkhy.safePlatform.emergency.query.EmergencyPlanLogQuery;
import java.util.List;
public interface EmergencyPlanLogService {
    SearchResultVO<List<EmergencyPlanLogRespDTO>> selectEmergencyPlanLogList(PageQuery<EmergencyPlanLogQuery> query);
    ResultVO addEmergencyPlanLog(Long uid, EmergencyPlanLogReqDTO emergencyPlanLogReqDTO);
    ResultVO<EmergencyPlanLogRespDTO> getEmergencyPlanLogById(Long id);
    ResultVO updateEmergencyPlanLog(Long uid, EmergencyPlanLogReqDTO emergencyPlanLogReqDTO);
    ResultVO batchDeleteEmergencyPlanLog(String ids);
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencyPlanInfoService.java
@@ -19,4 +19,6 @@
    EmergencyPlanInfoDetailDO selectEmergencyPlanById(Long id);
    void updateEmergencyPlan(EmergencyPlanInfo emergencyPlanInfo);
    void deleteEmergencyPlan(Long planId);
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencyPlanLogInfoService.java
对比新文件
@@ -0,0 +1,23 @@
package com.gkhy.safePlatform.emergency.service.baseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.safePlatform.emergency.entity.*;
import com.gkhy.safePlatform.emergency.query.db.EmergencyPlanDBQuery;
import com.gkhy.safePlatform.emergency.query.db.EmergencyPlanLogDBQuery;
import java.util.List;
public interface EmergencyPlanLogInfoService extends IService<EmergencyPlanLogInfo> {
    List<EmergencyPlanLogInfoDO> selectEmergencyPlanLogList(Page<EmergencyPlanLogInfoDO> page, EmergencyPlanLogDBQuery emergencyPlanLogDBQuery);
    void addEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo);
    EmergencyPlanLogInfoDO selectEmergencyPlanLogById(Long id);
    void updateEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo);
    void deleteEmergencyPlanLog(Long id);
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencyPlanInfoServiceImpl.java
@@ -39,5 +39,10 @@
        emergencyPlanInfoRepository.updateEmergencyPlan(emergencyPlanInfo);
    }
    @Override
    public void deleteEmergencyPlan(Long planId) {
        emergencyPlanInfoRepository.deleteEmergencyPlan(planId);
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencyPlanLogInfoServiceImpl.java
对比新文件
@@ -0,0 +1,47 @@
package com.gkhy.safePlatform.emergency.service.baseService.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo;
import com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfoDO;
import com.gkhy.safePlatform.emergency.query.db.EmergencyPlanLogDBQuery;
import com.gkhy.safePlatform.emergency.repository.EmergencyPlanLogInfoRepository;
import com.gkhy.safePlatform.emergency.service.baseService.EmergencyPlanLogInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("emergencyPlanLogInfoService")
public class EmergencyPlanLogInfoServiceImpl extends ServiceImpl<EmergencyPlanLogInfoRepository, EmergencyPlanLogInfo> implements EmergencyPlanLogInfoService {
    @Autowired
    private EmergencyPlanLogInfoRepository emergencyPlanLogInfoRepository;
    @Override
    public List<EmergencyPlanLogInfoDO> selectEmergencyPlanLogList(Page<EmergencyPlanLogInfoDO> page, EmergencyPlanLogDBQuery emergencyPlanLogDBQuery) {
        return emergencyPlanLogInfoRepository.selectEmergencyPlanLogList(page,emergencyPlanLogDBQuery);
    }
    @Override
    public void addEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo) {
        emergencyPlanLogInfoRepository.addEmergencyPlanLog(emergencyPlanLogInfo);
    }
    @Override
    public EmergencyPlanLogInfoDO selectEmergencyPlanLogById(Long id) {
        return emergencyPlanLogInfoRepository.selectEmergencyPlanLogById(id);
    }
    @Override
    public void updateEmergencyPlanLog(EmergencyPlanLogInfo emergencyPlanLogInfo) {
        emergencyPlanLogInfoRepository.updateEmergencyPlanLog(emergencyPlanLogInfo);
    }
    @Override
    public void deleteEmergencyPlanLog(Long id) {
        emergencyPlanLogInfoRepository.deleteEmergencyPlanLog(id);
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanLogServiceImpl.java
对比新文件
@@ -0,0 +1,126 @@
package com.gkhy.safePlatform.emergency.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.commons.utils.StringUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.emergency.entity.*;
import com.gkhy.safePlatform.emergency.enums.EmergencyResultCodes;
import com.gkhy.safePlatform.emergency.excepiton.EmergencyException;
import com.gkhy.safePlatform.emergency.model.dto.req.*;
import com.gkhy.safePlatform.emergency.model.dto.resp.*;
import com.gkhy.safePlatform.emergency.query.EmergencyPlanLogQuery;
import com.gkhy.safePlatform.emergency.query.db.EmergencyPlanLogDBQuery;
import com.gkhy.safePlatform.emergency.service.EmergencyPlanLogService;
import com.gkhy.safePlatform.emergency.service.baseService.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service("emergencyPlanLogService")
public class EmergencyPlanLogServiceImpl implements EmergencyPlanLogService {
    @Autowired
    private EmergencyPlanLogInfoService emergencyPlanLogInfoService;
    @Override
    public SearchResultVO<List<EmergencyPlanLogRespDTO>> selectEmergencyPlanLogList(PageQuery<EmergencyPlanLogQuery> query) {
        Long pageIndex = query.getPageIndex();
        Long pageSize = query.getPageSize();
        Page<EmergencyPlanLogInfoDO> page = new Page<>(pageIndex, pageSize);
        EmergencyPlanLogDBQuery emergencyPlanLogDBQuery = new EmergencyPlanLogDBQuery();
        if (query.getSearchParams() != null) {
            BeanUtils.copyProperties(query.getSearchParams(), emergencyPlanLogDBQuery);
        }
        List<EmergencyPlanLogInfoDO> emergencyPlanLogListDoInfoList = emergencyPlanLogInfoService.selectEmergencyPlanLogList(page,emergencyPlanLogDBQuery);
        List<EmergencyPlanLogRespDTO> respList =  BeanCopyUtils.copyBeanList(emergencyPlanLogListDoInfoList, EmergencyPlanLogRespDTO.class);
        return new SearchResultVO<>(
                true,
                pageIndex,
                pageSize,
                page.getTotal(),
                respList,
                ResultCodes.OK
                );
    }
    @Override
    public ResultVO addEmergencyPlanLog(Long uid, EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) {
        Date nowDate = new Date();
        // 新增应急预案
        EmergencyPlanLogInfo emergencyPlanLogInfo = new EmergencyPlanLogInfo();
        BeanUtils.copyProperties(emergencyPlanLogReqDTO,emergencyPlanLogInfo);
        emergencyPlanLogInfo.setDelFlag(false);
        emergencyPlanLogInfo.setCreateUid(uid);
        emergencyPlanLogInfo.setGmtCreate(nowDate);
        emergencyPlanLogInfoService.addEmergencyPlanLog(emergencyPlanLogInfo);
        return new ResultVO<>(ResultCodes.OK);
    }
    @Override
    public ResultVO<EmergencyPlanLogRespDTO> getEmergencyPlanLogById(Long id) {
        EmergencyPlanLogRespDTO emergencyPlanLogDetailRespDTO = new EmergencyPlanLogRespDTO();
        // 查询是否存在
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(id);
        if (emergencyPlanLogInfoDetailDO==null){
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        }else{
            BeanUtils.copyProperties(emergencyPlanLogInfoDetailDO,emergencyPlanLogDetailRespDTO);
            return new ResultVO<>(ResultCodes.OK,emergencyPlanLogDetailRespDTO);
        }
    }
    @Override
    public ResultVO updateEmergencyPlanLog(Long uid, EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) {
        // 查询是否存在
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(emergencyPlanLogReqDTO.getId());
        if (emergencyPlanLogInfoDetailDO==null){
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        }else{
            EmergencyPlanLogInfo emergencyPlanLogInfo = new EmergencyPlanLogInfo();
            BeanUtils.copyProperties(emergencyPlanLogReqDTO,emergencyPlanLogInfo);
            emergencyPlanLogInfo.setUpdateUid(uid);
            emergencyPlanLogInfo.setGmtModitify(new Date());
            emergencyPlanLogInfoService.updateEmergencyPlanLog(emergencyPlanLogInfo);
            return new ResultVO<>(ResultCodes.OK);
        }
    }
    @Override
    public ResultVO batchDeleteEmergencyPlanLog(String ids) {
        if (StringUtils.isBlank(ids)) {
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        } else {
            String[] idArr = ids.split(",");
            for (String id : idArr) {
                deleteEmergencyPlanLog(Long.valueOf(id));
            }
            return new ResultVO(ResultCodes.OK);
        }
    }
    private void deleteEmergencyPlanLog(Long id) {
        //查询是否存在
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(id);
        if (emergencyPlanLogInfoDetailDO==null){
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        }else{
            emergencyPlanLogInfoService.deleteEmergencyPlanLog(id);
        }
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanServiceImpl.java
@@ -200,7 +200,7 @@
            EmergencyPlanInfo emergencyPlanInfo = new EmergencyPlanInfo();
            BeanUtils.copyProperties(emergencyPlanReqDTO,emergencyPlanInfo);
            emergencyPlanInfo.setUpdateUid(uid);
            emergencyPlanInfo.setGmtModitify(new Date());
            emergencyPlanInfo.setGmtModitify(nowDate);
            emergencyPlanInfoService.updateEmergencyPlan(emergencyPlanInfo);
            // 更新应急预案区域表
@@ -404,6 +404,7 @@
            throw new EmergencyException(EmergencyResultCodes.PLAN_NOT_EXIST);
        }else{
            Long PlanId = emergencyPlanInfoDetailDO.getId();
            emergencyPlanInfoService.deleteEmergencyPlan(PlanId);
            //删除区域
            emergencyPlanAreaInfoService.deleteEmergencyPlanAreaByPlanId(PlanId);
            //删除适用部门
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanInfoMapper.xml
@@ -75,7 +75,7 @@
    </select>
    <update id="updateEmergencyPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfo">
        update emergency_team
        update emergency_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtCreate != null ">gmt_create = #{gmtCreate},</if>
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
@@ -92,4 +92,8 @@
        </trim>
        where id = #{id}
    </update>
    <update id="deleteEmergencyPlan">
        update emergency_plan set del_flag = 1 where id = #{id}
    </update>
</mapper>
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml
对比新文件
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gkhy.safePlatform.emergency.repository.EmergencyPlanLogInfoRepository">
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfoDO" id="emergencyPlanLogInfoDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="plan_id" property="planId"/>
        <result column="user_uid" property="userUid"/>
        <result column="start_create" property="startCreate"/>
        <result column="remark" property="remark"/>
    </resultMap>
    <select id="selectEmergencyPlanLogList" resultMap="emergencyPlanLogInfoDOResult">
        select id,`plan_id`,`user_uid`,`start_create`,`remark` from emergency_plan_log where del_flag = 0
        <if test="query.planId != null  ">and `plan_id` = #{query.planId}</if>
    </select>
    <insert id="addEmergencyPlanLog" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into emergency_plan_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="delFlag != null ">del_flag,</if>
            <if test="gmtCreate != null ">gmt_create,</if>
            <if test="gmtModitify != null ">gmt_moditify,</if>
            <if test="createUid != null ">create_uid,</if>
            <if test="updateUid != null ">update_uid,</if>
            <if test="plan_id != null ">plan_id,</if>
            <if test="user_uid != null ">user_uid,</if>
            <if test="start_create != null ">start_create,</if>
            <if test="remark != null and remark != ''">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null ">#{id},</if>
            <if test="delFlag != null ">#{delFlag},</if>
            <if test="gmtCreate != null ">#{gmtCreate},</if>
            <if test="gmtModitify != null ">#{gmtModitify},</if>
            <if test="createUid != null ">#{createUid},</if>
            <if test="updateUid != null ">#{updateUid},</if>
            <if test="plan_id != null ">#{planId},</if>
            <if test="user_uid != null ">#{userUid},</if>
            <if test="start_create != null ">#{startCreate},</if>
            <if test="remark != null and remark != ''">#{remark},</if>
        </trim>
    </insert>
    <select id="selectEmergencyPlanLogById" resultMap="emergencyPlanLogInfoDOResult">
        select id,`plan_id`,`user_uid`,`start_create`,`remark` from emergency_plan_log where del_flag = 0 and id = #{id}
    </select>
    <update id="updateEmergencyPlanLog" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo">
        update emergency_plan_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtCreate != null ">gmt_create = #{gmtCreate},</if>
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="createUid != null ">create_uid = #{createUid},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
            <if test="planId != null ">plan_id = #{planId},</if>
            <if test="userUid != null ">user_uid = #{userUid},</if>
            <if test="startCreate != null ">start_create = #{startCreate},</if>
            <if test="remark != null and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="deleteEmergencyPlanLog">
        update emergency_plan_log set del_flag = 1 where id = #{id}
    </update>
</mapper>