| | |
| | | |
| | | private Long planId; |
| | | |
| | | private Long userUId; |
| | | private Long userUid; |
| | | |
| | | private Date startCreate; |
| | | |
| | |
| | | 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() { |
| | |
| | | ", createUid=" + createUid + |
| | | ", updateUid=" + updateUid + |
| | | ", planId=" + planId + |
| | | ", userUId=" + userUId + |
| | | ", userUid=" + userUid + |
| | | ", startCreate=" + startCreate + |
| | | ", remark='" + remark + '\'' + |
| | | '}'; |
| | |
| | | |
| | | PLAN_NOT_EXIST("P1001" , "应急预案不存在"), |
| | | |
| | | PLAN_LOG_NOT_EXIST("P1002" , "应急预案启动记录不存在"), |
| | | PLAN_NULL("P1002" , "应急预案不可为空"), |
| | | |
| | | PLAN_LOG_NOT_EXIST("P1003" , "应急预案启动记录不存在"), |
| | | |
| | | |
| | | |
| | |
| | | |
| | | private Long planId; |
| | | |
| | | private Long userUId; |
| | | private Long userUid; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startCreate; |
| | |
| | | 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() { |
| | |
| | | return "EmergencyPlanLogRespDTO{" + |
| | | "id=" + id + |
| | | ", planId=" + planId + |
| | | ", userUId=" + userUId + |
| | | ", userUid=" + userUid + |
| | | ", startCreate=" + startCreate + |
| | | ", remark='" + remark + '\'' + |
| | | '}'; |
| | |
| | | @Autowired |
| | | private EmergencyPlanLogInfoService emergencyPlanLogInfoService; |
| | | |
| | | @Autowired |
| | | private EmergencyPlanInfoService emergencyPlanInfoService; |
| | | |
| | | @Override |
| | | public SearchResultVO<List<EmergencyPlanLogRespDTO>> selectEmergencyPlanLogList(PageQuery<EmergencyPlanLogQuery> query) { |
| | | Long pageIndex = query.getPageIndex(); |
| | |
| | | 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, |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | </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" > |
| | |
| | | </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" > |
| | |
| | | <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=","> |
| | |
| | | <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> |
| | |
| | | </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" > |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |