1217e2f8b0f950ea215db9edcc073d9199ca2fe6..f8f809db535e735eb47432ed3c4b8c5e7aa879a3
2022-07-11 songhuangfeng123
应急队伍启动记录
f8f809 对比 | 目录
2022-07-11 songhuangfeng123
Merge branches 'genchuang' and 'master' of https://sinanoaq.cn:8888/r/safeP...
37e348 对比 | 目录
2022-07-08 lyfO_o
UP
fea25a 对比 | 目录
已修改9个文件
已添加2个文件
296 ■■■■ 文件已修改
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfo.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencyPlanLogRespDTO.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanLogServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanAreaInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanDepartmentInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanTeamInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencyPlanLogInfo.java
@@ -24,7 +24,7 @@
    private Long planId;
    private Long userUId;
    private Long userUid;
    private Date startCreate;
@@ -86,12 +86,12 @@
        this.planId = planId;
    }
    public Long getUserUId() {
        return userUId;
    public Long getUserUid() {
        return userUid;
    }
    public void setUserUId(Long userUId) {
        this.userUId = userUId;
    public void setUserUid(Long userUid) {
        this.userUid = userUid;
    }
    public Date getStartCreate() {
@@ -120,7 +120,7 @@
                ", createUid=" + createUid +
                ", updateUid=" + updateUid +
                ", planId=" + planId +
                ", userUId=" + userUId +
                ", userUid=" + userUid +
                ", startCreate=" + startCreate +
                ", remark='" + remark + '\'' +
                '}';
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java
@@ -32,7 +32,9 @@
    PLAN_NOT_EXIST("P1001" , "应急预案不存在"),
    PLAN_LOG_NOT_EXIST("P1002" , "应急预案启动记录不存在"),
    PLAN_NULL("P1002" , "应急预案不可为空"),
    PLAN_LOG_NOT_EXIST("P1003" , "应急预案启动记录不存在"),
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencyPlanLogRespDTO.java
@@ -10,7 +10,7 @@
    private Long planId;
    private Long userUId;
    private Long userUid;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startCreate;
@@ -33,12 +33,12 @@
        this.planId = planId;
    }
    public Long getUserUId() {
        return userUId;
    public Long getUserUid() {
        return userUid;
    }
    public void setUserUId(Long userUId) {
        this.userUId = userUId;
    public void setUserUid(Long userUid) {
        this.userUid = userUid;
    }
    public Date getStartCreate() {
@@ -62,7 +62,7 @@
        return "EmergencyPlanLogRespDTO{" +
                "id=" + id +
                ", planId=" + planId +
                ", userUId=" + userUId +
                ", userUid=" + userUid +
                ", startCreate=" + startCreate +
                ", remark='" + remark + '\'' +
                '}';
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyPlanLogServiceImpl.java
@@ -32,6 +32,9 @@
    @Autowired
    private EmergencyPlanLogInfoService emergencyPlanLogInfoService;
    @Autowired
    private EmergencyPlanInfoService emergencyPlanInfoService;
    @Override
    public SearchResultVO<List<EmergencyPlanLogRespDTO>> selectEmergencyPlanLogList(PageQuery<EmergencyPlanLogQuery> query) {
        Long pageIndex = query.getPageIndex();
@@ -42,8 +45,8 @@
        if (query.getSearchParams() != null) {
            BeanUtils.copyProperties(query.getSearchParams(), emergencyPlanLogDBQuery);
        }
        List<EmergencyPlanLogInfoDO> emergencyPlanLogListDoInfoList = emergencyPlanLogInfoService.selectEmergencyPlanLogList(page,emergencyPlanLogDBQuery);
        List<EmergencyPlanLogRespDTO> respList =  BeanCopyUtils.copyBeanList(emergencyPlanLogListDoInfoList, EmergencyPlanLogRespDTO.class);
        List<EmergencyPlanLogInfoDO> emergencyPlanLogListDoInfoList = emergencyPlanLogInfoService.selectEmergencyPlanLogList(page, emergencyPlanLogDBQuery);
        List<EmergencyPlanLogRespDTO> respList = BeanCopyUtils.copyBeanList(emergencyPlanLogListDoInfoList, EmergencyPlanLogRespDTO.class);
        return new SearchResultVO<>(
                true,
@@ -52,21 +55,37 @@
                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);
        // 判断请求中是否存在应急预案id
        if (emergencyPlanLogReqDTO.getPlanId() == null) {
            throw new EmergencyException(EmergencyResultCodes.PLAN_NULL);
        } else {
            EmergencyPlanInfoDetailDO emergencyPlanInfoDetailDO = emergencyPlanInfoService.selectEmergencyPlanById(emergencyPlanLogReqDTO.getPlanId());
            // 判断是否存在该应急预案
            if (emergencyPlanInfoDetailDO == null) {
                throw new EmergencyException(EmergencyResultCodes.PLAN_NOT_EXIST);
            } else {
                Date nowDate = new Date();
                // 新增应急预案启动记录
                EmergencyPlanLogInfo emergencyPlanLogInfo = new EmergencyPlanLogInfo();
                BeanUtils.copyProperties(emergencyPlanLogReqDTO, emergencyPlanLogInfo);
                emergencyPlanLogInfo.setDelFlag(false);
                emergencyPlanLogInfo.setCreateUid(uid);
                emergencyPlanLogInfo.setGmtCreate(nowDate);
        return new ResultVO<>(ResultCodes.OK);
                emergencyPlanLogInfo.setUserUid(uid);
                emergencyPlanLogInfo.setStartCreate(nowDate);
                emergencyPlanLogInfoService.addEmergencyPlanLog(emergencyPlanLogInfo);
                return new ResultVO<>(ResultCodes.OK);
            }
        }
    }
@@ -75,29 +94,40 @@
        EmergencyPlanLogRespDTO emergencyPlanLogDetailRespDTO = new EmergencyPlanLogRespDTO();
        // 查询是否存在
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(id);
        if (emergencyPlanLogInfoDetailDO==null){
        if (emergencyPlanLogInfoDetailDO == null) {
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        }else{
            BeanUtils.copyProperties(emergencyPlanLogInfoDetailDO,emergencyPlanLogDetailRespDTO);
        } else {
            BeanUtils.copyProperties(emergencyPlanLogInfoDetailDO, emergencyPlanLogDetailRespDTO);
            return new ResultVO<>(ResultCodes.OK,emergencyPlanLogDetailRespDTO);
            return new ResultVO<>(ResultCodes.OK, emergencyPlanLogDetailRespDTO);
        }
    }
    @Override
    public ResultVO updateEmergencyPlanLog(Long uid, EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) {
        // 查询是否存在
        // 查询是否存在启动记录
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(emergencyPlanLogReqDTO.getId());
        if (emergencyPlanLogInfoDetailDO==null){
        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);
        } else {
            // 判断请求中是否存在应急预案id
            if (emergencyPlanLogReqDTO.getPlanId() == null) {
                throw new EmergencyException(EmergencyResultCodes.PLAN_NULL);
            } else {
                EmergencyPlanInfoDetailDO emergencyPlanInfoDetailDO = emergencyPlanInfoService.selectEmergencyPlanById(emergencyPlanLogReqDTO.getPlanId());
                // 判断是否存在该应急预案
                if (emergencyPlanInfoDetailDO == null) {
                    throw new EmergencyException(EmergencyResultCodes.PLAN_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);
                    return new ResultVO<>(ResultCodes.OK);
                }
            }
        }
    }
@@ -117,9 +147,9 @@
    private void deleteEmergencyPlanLog(Long id) {
        //查询是否存在
        EmergencyPlanLogInfoDO emergencyPlanLogInfoDetailDO = emergencyPlanLogInfoService.selectEmergencyPlanLogById(id);
        if (emergencyPlanLogInfoDetailDO==null){
        if (emergencyPlanLogInfoDetailDO == null) {
            throw new EmergencyException(EmergencyResultCodes.PLAN_LOG_NOT_EXIST);
        }else{
        } else {
            emergencyPlanLogInfoService.deleteEmergencyPlanLog(id);
        }
    }
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanAreaInfoMapper.xml
@@ -36,7 +36,7 @@
    </resultMap>
    <select id="selectEmergencyPlanAreaByPlanId" resultMap="emergencyPlanAreaInfoDOResult">
        select id , plan_id , area_id from emergency_plan_area where plan_id=#{planId}
        select id , plan_id , area_id from emergency_plan_area where plan_id=#{planId} and del_flag = 0
    </select>
    <update id = "deleteEmergencyPlanAreaByIds" >
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanDepartmentInfoMapper.xml
@@ -36,7 +36,7 @@
    </resultMap>
    <select id="selectEmergencyPlanDepartmentByPlanId" resultMap="emergencyPlanDepartmentInfoDOResult">
        select id , plan_id , department_id from emergency_plan_department where plan_id=#{planId}
        select id , plan_id , department_id from emergency_plan_department where plan_id=#{planId} and del_flag = 0
    </select>
    <update id = "deleteEmergencyPlanDepartmentByIds" >
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml
@@ -27,9 +27,9 @@
            <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="planId != null ">plan_id,</if>
            <if test="userUid != null ">user_uid,</if>
            <if test="startCreate != null ">start_create,</if>
            <if test="remark != null and remark != ''">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -39,9 +39,9 @@
            <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="planId != null ">#{planId},</if>
            <if test="userUid != null ">#{userUid},</if>
            <if test="startCreate != null ">#{startCreate},</if>
            <if test="remark != null and remark != ''">#{remark},</if>
        </trim>
    </insert>
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanTeamInfoMapper.xml
@@ -35,7 +35,7 @@
    </resultMap>
    <select id="selectEmergencyPlanTeamByPlanId" resultMap="emergencyPlanTeamInfoDOResult">
        select id ,plan_id ,team_id  from emergency_plan_team where plan_id=#{planId}
        select id ,plan_id ,team_id  from emergency_plan_team where plan_id=#{planId} and del_flag = 0
    </select>
    <update id = "deleteEmergencyPlanTeamByIds" >
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java
对比新文件
@@ -0,0 +1,57 @@
package com.gkhy.safePlatform.accountController;
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.DepAddRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.DepModRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepRPCRespDTO;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.security.Principal;
import java.util.List;
@RestController
@RequestMapping("/department")
public class DepartmentController {
    @DubboReference(check = false)
    private AccountDepartmentService accountDepartmentService;
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public ResultVO<List<DepRPCRespDTO>> getListTree(){
        return accountDepartmentService.depList();
    }
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultVO<String> addDepartment(Principal principal, @RequestBody DepAddRPCReqDTO depAddRPCReqDTO) {
        String userId = principal.getName();
        return accountDepartmentService.addDep(Long.valueOf(userId) , depAddRPCReqDTO);
    }
    @RequestMapping(value = "/mod", method = RequestMethod.POST)
    public ResultVO<String> addDepartment(Principal principal, @RequestBody DepModRPCReqDTO depModRPCReqDTO) {
        String userId = principal.getName();
        return accountDepartmentService.modDep(Long.valueOf(userId) , depModRPCReqDTO);
    }
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    public ResultVO<String> addDepartment(Principal principal, @RequestBody JSONObject json) {
        String userId = principal.getName();
        Long depId = json.getLong("depId");
        return accountDepartmentService.delDep(Long.valueOf(userId) , depId);
    }
}
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java
对比新文件
@@ -0,0 +1,61 @@
package com.gkhy.safePlatform.accountController;
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountRoleService;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.RoleAddRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.RoleModRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.RoleRPCRespDTO;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.security.Principal;
import java.util.List;
@RestController
@RequestMapping("/role")
public class RoleController {
    @DubboReference(check = false)
    private AccountRoleService accountRoleService;
    /**
     * @Description: 获取所有启用角色
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public ResultVO<List<RoleRPCRespDTO>> addRole(Principal principal){
        return accountRoleService.getRoleList();
    }
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultVO<String> addRole(Principal principal, RoleAddRPCReqDTO roleAddRPCReqDTO){
        String userId = principal.getName();
        return accountRoleService.addRole(Long.valueOf(userId),roleAddRPCReqDTO);
    }
    @RequestMapping(value = "/mod",method = RequestMethod.POST)
    public ResultVO<String> modRole(Principal principal, RoleModRPCReqDTO roleModRPCReqDTO){
        String userId = principal.getName();
        return accountRoleService.modRole(Long.valueOf(userId),roleModRPCReqDTO);
    }
    @RequestMapping(value = "/del",method = RequestMethod.POST)
    public ResultVO<String> modRole(Principal principal, JSONObject json){
        String userId = principal.getName();
        Long depId = json.getLong("depId");
        return accountRoleService.delRole(Long.valueOf(userId),depId);
    }
}
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java
@@ -1,15 +1,21 @@
package com.gkhy.safePlatform.accountController;
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountMenuService;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountUserService;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.AccountAddRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.AccountModRPCReqDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.req.query.AccountRPCQuery;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepUserRPCRespDTO;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.PersonalDetailRPCRespDTO;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -41,5 +47,47 @@
        return accountUserService.getDepList(Long.valueOf(userId), depId);
    }
    /**
     * @Description: 个人信息
     */
    @RequestMapping(value = "/personal", method = RequestMethod.GET)
    public ResultVO<PersonalDetailRPCRespDTO> getPersonal(Principal principal) {
        String userId = principal.getName();
        return accountUserService.getPersonalAccountDetail(Long.valueOf(userId));
    }
    /**
     * @Description: 新增用户信息
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @PreAuthorize("hasRole('ROLE_admin')")
    public ResultVO<String> addUser(Principal principal, @RequestBody AccountAddRPCReqDTO accountAddRPCReqDTO) {
        String userId = principal.getName();
        return  accountUserService.addAccount(Long.valueOf(userId), accountAddRPCReqDTO);
    }
    /**
     * @Description: 修改用户信息
     */
    @RequestMapping(value = "/mod", method = RequestMethod.POST)
    @PreAuthorize("hasRole('ROLE_admin')")
    public ResultVO<String> modUser(Principal principal, @RequestBody AccountModRPCReqDTO accountModRPCReqDTO) {
        String userId = principal.getName();
        return accountUserService.modAccount(Long.valueOf(userId), accountModRPCReqDTO);
    }
    /**
     * @Description: 删除用户信息
     */
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    @PreAuthorize("hasRole('ROLE_admin')")
    public ResultVO<String> delUser(Principal principal, @RequestBody JSONObject json) {
        Long uid = json.getLong("uid");
        String userId = principal.getName();
        return accountUserService.delAccount(Long.valueOf(userId), uid);
    }
}