incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentExpressController.java
@@ -38,7 +38,7 @@ @RequestMapping(value = "/add",method = RequestMethod.POST) public ResultVO addAccidentExpress(Authentication authentication, @RequestBody AccidentExpressReqDTO AccidentExpressReqDTO) { ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return accidentExpressService.addAccidentExpress(currentUser.getUid(), AccidentExpressReqDTO); return accidentExpressService.addAccidentExpress(currentUser, AccidentExpressReqDTO); } /** incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java
@@ -20,6 +20,16 @@ private Long createUid; private String createName; public String getCreateName() { return createName; } public void setCreateName(String createName) { this.createName = createName; } private Long updateUid; private String emergencyPrecautions; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java
@@ -12,6 +12,16 @@ @TableId(type = IdType.AUTO) private Long id; private String createName; public String getCreateName() { return createName; } public void setCreateName(String createName) { this.createName = createName; } private Date gmtModitify; private Long createUid; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java
@@ -10,6 +10,16 @@ @TableName("accident_report") public class AccidentReportInfo { private String fillInUserName; public String getFillInUserName() { return fillInUserName; } public void setFillInUserName(String fillInUserName) { this.fillInUserName = fillInUserName; } @TableId(type = IdType.AUTO) private Long id; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java
@@ -11,6 +11,16 @@ @TableName("accident_report") public class AccidentReportInfoDetailDO { private String fillInUserName; public String getFillInUserName() { return fillInUserName; } public void setFillInUserName(String fillInUserName) { this.fillInUserName = fillInUserName; } private String accidentName; private Long accidentDepartmentId; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java
@@ -9,6 +9,16 @@ @TableName("work_injury_declaration") public class WorkInjuryDeclarationInfoPageDO { private String deptName; public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } private String accidentName; public String getAccidentName() { incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java
@@ -34,6 +34,13 @@ WORK_INJURY_DECLARATION_NULL("W1001", "工伤申报不可为空"), WORK_INJURY_DECLARATION_NOT_EXIST("W1002", "工伤申报不存在"), WORK_INJURY_DECLARATION_USERNAME_NULL("W1003", "申报人名称不可为空"), WORK_INJURY_DECLARATION_GENDER_NULL("W1003", "申报人名称不可为空"), WORK_INJURY_DECLARATION_USERNAME_NOT_EXIST("W1005", "申报人部门不可为空"), WORK_INJURY_DECLARATION_TYPE_NULL("W1006", "工伤类型不可为空"), WORK_INJURY_DECLARATION_Date_NULL("W1006", "申报日期不可为空"), ERROR("A3000", "未知错误"); private String code; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java
@@ -9,6 +9,16 @@ private Long id; private String createName; public String getCreateName() { return createName; } public void setCreateName(String createName) { this.createName = createName; } private String emergencyPrecautions; private String accidentCausesPreliminaryAnalysis; @@ -19,7 +29,6 @@ private String accidentCause; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date occurrenceTime; private String occurrencePlace; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java
@@ -8,6 +8,16 @@ public class AccidentReportReqDTO { private String fillInUserName; public String getFillInUserName() { return fillInUserName; } public void setFillInUserName(String fillInUserName) { this.fillInUserName = fillInUserName; } private Long id; private Long accidentExpressId; @@ -26,7 +36,6 @@ private String accidentCause; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date reportDeadline; private String accidentLevel; @@ -43,7 +52,6 @@ private Long fillInUserUid; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date fillInTime; private String relevantPersonnelRecords; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java
@@ -20,7 +20,6 @@ private String workInjuryType; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date declareDate; private BigDecimal lostTime; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java
@@ -5,12 +5,20 @@ import java.io.Serializable; import java.util.Date; import java.util.List; public class AccidentExpressPageRespDTO implements Serializable { private static final long serialVersionUID = -3992394113427902200L; private String createName; public String getCreateName() { return createName; } public void setCreateName(String createName) { this.createName = createName; } private String deptName; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java
@@ -9,6 +9,16 @@ public class AccidentReportDetailRespDTO { private String fillInUserName; public String getFillInUserName() { return fillInUserName; } public void setFillInUserName(String fillInUserName) { this.fillInUserName = fillInUserName; } private String accidentName; private Long accidentDepartmentId; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java
@@ -7,6 +7,16 @@ public class AccidentReportPageRespDTO { private String deptName; public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } private String accidentName; private Long accidentDepartmentId; incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java
@@ -11,6 +11,7 @@ private String accidentName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date occurrenceTime; public String getAccidentName() { incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java
@@ -7,6 +7,16 @@ public class WorkInjuryDeclarationPageRespDTO { private String deptName; public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } private String accidentName; public String getAccidentName() { incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentExpressService.java
@@ -1,5 +1,6 @@ package com.gkhy.safePlatform.incidentManage.service; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; @@ -15,7 +16,7 @@ SearchResultVO<List<AccidentExpressPageRespDTO>> selectAccidentExpressList(PageQuery<AccidentExpressQuery> query); ResultVO addAccidentExpress(Long valueOf, AccidentExpressReqDTO AccidentExpressReqDTO); ResultVO addAccidentExpress(ContextCacheUser contextCacheUser, AccidentExpressReqDTO AccidentExpressReqDTO); ResultVO<AccidentExpressDetailRespDTO> getAccidentExpressById(Long id); incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
@@ -4,6 +4,7 @@ import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; @@ -94,7 +95,9 @@ } @Override public ResultVO addAccidentExpress(Long uid, AccidentExpressReqDTO accidentExpressReqDTO) { public ResultVO addAccidentExpress(ContextCacheUser contextCacheUser, AccidentExpressReqDTO accidentExpressReqDTO) { Long uid = contextCacheUser.getUid(); String uName = contextCacheUser.getRealName(); //必填项验证 checkRequired(accidentExpressReqDTO); @@ -104,6 +107,7 @@ BeanUtils.copyProperties(accidentExpressReqDTO, accidentExpressInfo); accidentExpressInfo.setDelFlag(false); accidentExpressInfo.setCreateUid(uid); accidentExpressInfo.setCreateName(uName); accidentExpressInfo.setGmtCreate(nowDate); accidentExpressInfoService.addAccidentExpress(accidentExpressInfo); //2.新增应急队伍附件 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
@@ -1,6 +1,8 @@ package com.gkhy.safePlatform.incidentManage.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; @@ -18,16 +20,16 @@ import com.gkhy.safePlatform.incidentManage.query.AccidentReportQuery; import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportDBQuery; import com.gkhy.safePlatform.incidentManage.service.AccidentReportService; import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService; import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportFileInfoService; import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportInfoService; import org.apache.dubbo.config.annotation.DubboReference; 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.*; import java.util.stream.Collectors; @Service("accidentReportService") @@ -38,6 +40,12 @@ @Autowired private AccidentReportFileInfoService accidentReportFileInfoService; @DubboReference(check = false) private AccountDepartmentService accountDepartmentService; @Autowired private AccidentExpressInfoService accidentExpressInfoService; @Override @@ -55,10 +63,30 @@ List<AccidentReportInfoPageDO> accidentReportInfoPageDOList = accidentReportInfoService.selectAccidentReportList(page, accidentReportDBQuery); List<AccidentReportPageRespDTO> respList = BeanCopyUtils.copyBeanList(accidentReportInfoPageDOList, AccidentReportPageRespDTO.class); Map<Long, String> depPool = new HashMap<>(); respList.forEach(AccidentReportPageRespDTO -> { // 设置部门名称 if (!depPool.containsKey(AccidentReportPageRespDTO.getAccidentDepartmentId())) { ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(AccidentReportPageRespDTO.getAccidentDepartmentId()); if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) { if (rpcResult.getData() != null) { DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData(); depPool.put(dep.getDepId(), dep.getDepName()); } } } String depName = depPool.get(AccidentReportPageRespDTO.getAccidentDepartmentId()); AccidentReportPageRespDTO.setDeptName(depName); }); return new SearchResultVO<>( true, pageIndex, pageSize,page.getPages(), pageSize, page.getPages(), page.getTotal(), respList, ResultCodes.OK @@ -80,13 +108,13 @@ accidentReportInfo.setStatus(false); accidentReportInfoService.addAccidentReport(accidentReportInfo); //2.新增事故报告附件 if (!CollectionUtils.isEmpty(accidentReportReqDTO.getFileList())){ addAccidentReportFile(accidentReportInfo.getId(),uid,nowDate,accidentReportReqDTO.getFileList()); if (!CollectionUtils.isEmpty(accidentReportReqDTO.getFileList())) { addAccidentReportFile(accidentReportInfo.getId(), uid, nowDate, accidentReportReqDTO.getFileList()); } return new ResultVO(ResultCodes.OK); } private void addAccidentReportFile(Long accidentReportId ,Long uid , Date nowDate , List<AccidentReportFileReqDTO> AccidentReportFileReqDTOList){ private void addAccidentReportFile(Long accidentReportId, Long uid, Date nowDate, List<AccidentReportFileReqDTO> AccidentReportFileReqDTOList) { List<AccidentReportFileInfo> fileInfoList = BeanCopyUtils.copyBeanList(AccidentReportFileReqDTOList, AccidentReportFileInfo.class); fileInfoList.forEach(AccidentReportFileInfo -> { AccidentReportFileInfo.setAccidentReportId(accidentReportId); @@ -94,7 +122,7 @@ AccidentReportFileInfo.setCreateUid(uid); AccidentReportFileInfo.setGmtCreate(nowDate); }); for (AccidentReportFileInfo AccidentReportFileInfo :fileInfoList){ for (AccidentReportFileInfo AccidentReportFileInfo : fileInfoList) { accidentReportFileInfoService.addAccidentReportFile(AccidentReportFileInfo); } } @@ -104,17 +132,17 @@ AccidentReportDetailRespDTO AccidentReportDetailRespDTO = new AccidentReportDetailRespDTO(); //查询是否存在 AccidentReportInfoDetailDO AccidentReportInfoDetailDO = accidentReportInfoService.selectAccidentReportById(id); if (AccidentReportInfoDetailDO==null){ if (AccidentReportInfoDetailDO == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); }else{ BeanUtils.copyProperties(AccidentReportInfoDetailDO,AccidentReportDetailRespDTO); } else { BeanUtils.copyProperties(AccidentReportInfoDetailDO, AccidentReportDetailRespDTO); //查找对应的附件 List<AccidentReportFileInfoDO> AccidentReportFileInfoDOList = accidentReportFileInfoService.selectByAccidentReportId(id); if (!CollectionUtils.isEmpty(AccidentReportFileInfoDOList)){ List<AccidentReportFileRespDTO> accidentReportFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentReportFileInfoDOList , AccidentReportFileRespDTO.class); if (!CollectionUtils.isEmpty(AccidentReportFileInfoDOList)) { List<AccidentReportFileRespDTO> accidentReportFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentReportFileInfoDOList, AccidentReportFileRespDTO.class); AccidentReportDetailRespDTO.setFileList(accidentReportFileRespDTOList); } return new ResultVO<>(ResultCodes.OK ,AccidentReportDetailRespDTO); return new ResultVO<>(ResultCodes.OK, AccidentReportDetailRespDTO); } } @@ -123,21 +151,21 @@ Date nowDate = new Date(); //查询是否存在 AccidentReportInfoDetailDO AccidentReportInfoDetailDO = accidentReportInfoService.selectAccidentReportById(accidentReportReqDTO.getId()); if (AccidentReportInfoDetailDO==null){ if (AccidentReportInfoDetailDO == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); }else{ } else { AccidentReportInfo accidentReportInfo = new AccidentReportInfo(); BeanUtils.copyProperties(accidentReportReqDTO,accidentReportInfo); BeanUtils.copyProperties(accidentReportReqDTO, accidentReportInfo); accidentReportInfo.setUpdateUid(uid); accidentReportInfo.setGmtModitify(nowDate); accidentReportInfoService.updateAccidentReport(accidentReportInfo); //修改事故报告附件 updateAccidentReportFile(uid,accidentReportReqDTO.getId(),nowDate,accidentReportReqDTO.getFileList()); updateAccidentReportFile(uid, accidentReportReqDTO.getId(), nowDate, accidentReportReqDTO.getFileList()); return new ResultVO(ResultCodes.OK); } } private void updateAccidentReportFile(Long uid ,Long accidentReportId ,Date nowDate,List<AccidentReportFileReqDTO> AccidentReportFileReqDTOList){ private void updateAccidentReportFile(Long uid, Long accidentReportId, Date nowDate, List<AccidentReportFileReqDTO> AccidentReportFileReqDTOList) { List<AccidentReportFileInfoDO> accidentReportFileInfoDOList = accidentReportFileInfoService.selectByAccidentReportId(accidentReportId); List<Long> oldIdsList = accidentReportFileInfoDOList.stream().map(AccidentReportFileInfoDO::getId).collect(Collectors.toList()); @@ -147,11 +175,11 @@ List<AccidentReportFileInfo> addList = new ArrayList<>(); //删除的附件集合(id) List<Long> deleteList = new ArrayList<>(); for (AccidentReportFileReqDTO AccidentReportFileReqDTO : AccidentReportFileReqDTOList){ for (AccidentReportFileReqDTO AccidentReportFileReqDTO : AccidentReportFileReqDTOList) { //如果不存在id则表示页面新增的附件 if (AccidentReportFileReqDTO.getId() == null){ if (AccidentReportFileReqDTO.getId() == null) { AccidentReportFileInfo AccidentReportFileInfo = new AccidentReportFileInfo(); BeanUtils.copyProperties(AccidentReportFileReqDTO,AccidentReportFileInfo); BeanUtils.copyProperties(AccidentReportFileReqDTO, AccidentReportFileInfo); AccidentReportFileInfo.setDelFlag(false); AccidentReportFileInfo.setGmtCreate(nowDate); AccidentReportFileInfo.setCreateUid(uid); @@ -159,21 +187,21 @@ addList.add(AccidentReportFileInfo); } //如果存在id则判断页面是否删除 else{ else { newIdsList.add(AccidentReportFileReqDTO.getId()); } } for (Long oldId : oldIdsList){ if (!newIdsList.contains(oldId)){ for (Long oldId : oldIdsList) { if (!newIdsList.contains(oldId)) { deleteList.add(oldId); } } if (!CollectionUtils.isEmpty(addList)){ for (AccidentReportFileInfo AccidentReportFileInfo : addList){ if (!CollectionUtils.isEmpty(addList)) { for (AccidentReportFileInfo AccidentReportFileInfo : addList) { accidentReportFileInfoService.addAccidentReportFile(AccidentReportFileInfo); } } if (!CollectionUtils.isEmpty(deleteList)){ if (!CollectionUtils.isEmpty(deleteList)) { accidentReportFileInfoService.deleteAccidentReportFileByIds(deleteList); } } @@ -181,9 +209,9 @@ @Override public ResultVO batchDeleteAccidentReport(String ids) { if (StringUtils.isBlank(ids)){ if (StringUtils.isBlank(ids)) { throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NULL); }else{ } else { String[] idArr = ids.split(","); for (String id : idArr) { deleteAccidentReport(Long.valueOf(id)); @@ -195,9 +223,9 @@ private void deleteAccidentReport(Long id) { //查询是否存在 AccidentReportInfoDetailDO AccidentReportInfoDetailDO = accidentReportInfoService.selectAccidentReportById(id); if (AccidentReportInfoDetailDO==null){ if (AccidentReportInfoDetailDO == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); }else{ } else { accidentReportInfoService.deleteAccidentReportById(id); //删除附件 accidentReportFileInfoService.deleteAccidentReportFileByAccidentReportId(id); @@ -205,17 +233,21 @@ } /** * 验证必填项 * * @return */ private void checkRequired(AccidentReportReqDTO AccidentReportReqDTO) { //事故快报 if (AccidentReportReqDTO.getAccidentExpressId() == null ) { if (AccidentReportReqDTO.getAccidentExpressId() == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL); } AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(AccidentReportReqDTO.getAccidentExpressId()); if (accidentExpressInfo == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST); } //事故类型 if (StringUtils.isBlank(AccidentReportReqDTO.getAccidentType())) { throw new AccidentException(AccidentResultCodes.REPORT_TYPE_NULL); @@ -225,11 +257,11 @@ throw new AccidentException(AccidentResultCodes.REPORT_GRADE_NULL); } //经济损失 if (AccidentReportReqDTO.getEconomicLoss() == null ) { if (AccidentReportReqDTO.getEconomicLoss() == null) { throw new AccidentException(AccidentResultCodes.REPORT_ECONOMIC_LOSS_NULL); } //要求报告完成期限 if (AccidentReportReqDTO.getReportDeadline() == null ) { if (AccidentReportReqDTO.getReportDeadline() == null) { throw new AccidentException(AccidentResultCodes.REPORT_REPORT_DEADLINE_NULL); } //事故级别 @@ -257,11 +289,11 @@ throw new AccidentException(AccidentResultCodes.REPORT_ACCIDENT_HANDLING_NULL); } //填写人 if (AccidentReportReqDTO.getFillInUserUid() == null ) { if (AccidentReportReqDTO.getFillInUserUid() == null) { throw new AccidentException(AccidentResultCodes.REPORT_FILL_IN_USER_UID_NULL); } //填写日期 if (AccidentReportReqDTO.getFillInTime() == null ) { if (AccidentReportReqDTO.getFillInTime() == null) { throw new AccidentException(AccidentResultCodes.REPORT_FILL_IN_TIME_NULL); } } incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
@@ -1,6 +1,8 @@ package com.gkhy.safePlatform.incidentManage.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; @@ -18,16 +20,16 @@ import com.gkhy.safePlatform.incidentManage.query.WorkInjuryDeclarationQuery; import com.gkhy.safePlatform.incidentManage.query.db.WorkInjuryDeclarationDBQuery; import com.gkhy.safePlatform.incidentManage.service.WorkInjuryDeclarationService; import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService; import com.gkhy.safePlatform.incidentManage.service.baseService.WorkInjuryDeclarationFileInfoService; import com.gkhy.safePlatform.incidentManage.service.baseService.WorkInjuryDeclarationInfoService; import org.apache.dubbo.config.annotation.DubboReference; 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.*; import java.util.stream.Collectors; @Service("workInjuryDeclarationService") @@ -38,6 +40,12 @@ @Autowired private WorkInjuryDeclarationFileInfoService workInjuryDeclarationFileInfoService; @DubboReference(check = false) private AccountDepartmentService accountDepartmentService; @Autowired private AccidentExpressInfoService accidentExpressInfoService; @Override @@ -54,6 +62,26 @@ List<WorkInjuryDeclarationInfoPageDO> WorkInjuryDeclarationInfoPageDOList = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationList(page, WorkInjuryDeclarationDBQuery); List<WorkInjuryDeclarationPageRespDTO> respList = BeanCopyUtils.copyBeanList(WorkInjuryDeclarationInfoPageDOList, WorkInjuryDeclarationPageRespDTO.class); Map<Long, String> depPool = new HashMap<>(); respList.forEach(WorkInjuryDeclarationPageRespDTO -> { // 设置部门名称 if (!depPool.containsKey(WorkInjuryDeclarationPageRespDTO.getDeclareDepartmentId())) { ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(WorkInjuryDeclarationPageRespDTO.getDeclareDepartmentId()); if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) { if (rpcResult.getData() != null) { DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData(); depPool.put(dep.getDepId(), dep.getDepName()); } } } String depName = depPool.get(WorkInjuryDeclarationPageRespDTO.getDeclareDepartmentId()); WorkInjuryDeclarationPageRespDTO.setDeptName(depName); }); return new SearchResultVO<>( true, @@ -211,42 +239,34 @@ * @return */ private void checkRequired(WorkInjuryDeclarationReqDTO WorkInjuryDeclarationReqDTO) { /* //名称 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getAccidentName())) { throw new AccidentException(AccidentResultCodes.Report_NAME_NULL); //申报人姓名 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getDeclareUserName())) { throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NULL); } //部门 if (WorkInjuryDeclarationReqDTO.getAccidentDepartmentId()==null) { throw new AccidentException(AccidentResultCodes.Report_DEPARTMENT_NULL); //事故性别 if (WorkInjuryDeclarationReqDTO.getDeclareUserGender() == null ) { throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_GENDER_NULL); } //发生时间 if (WorkInjuryDeclarationReqDTO.getOccurrenceTime() == null ) { throw new AccidentException(AccidentResultCodes.Report_TIME_NULL); //申报人部门 if (WorkInjuryDeclarationReqDTO.getDeclareDepartmentId()==null) { throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NOT_EXIST); } //发生地点 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getOccurrencePlace())) { throw new AccidentException(AccidentResultCodes.Report_PLACE_NULL); //事故名称 if (WorkInjuryDeclarationReqDTO.getAccidentExpressId() == null ) { throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL); } //事故原因 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getAccidentCause())) { throw new AccidentException(AccidentResultCodes.Report_CAUSE_NULL); AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(WorkInjuryDeclarationReqDTO.getAccidentExpressId()); if (accidentExpressInfo == null) { throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST); } //是否有伤亡 if (WorkInjuryDeclarationReqDTO.getCasualties()==null) { throw new AccidentException(AccidentResultCodes.Report_CASUALTIES_NULL); //工伤类型 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getWorkInjuryType())) { throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_TYPE_NULL); } //简要经过 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getAccidentBriefProcess())) { throw new AccidentException(AccidentResultCodes.Report_BRIEF_PROCESS_NULL); //申报日期 if (WorkInjuryDeclarationReqDTO.getDeclareDate()==null) { throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_Date_NULL); } //初步分析 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getAccidentCausesPreliminaryAnalysis())) { throw new AccidentException(AccidentResultCodes.Report_CASE_PRELIMINARY_ANALYSIS_NULL); } //应急防范措施 if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getEmergencyPrecautions())) { throw new AccidentException(AccidentResultCodes.Report_EMERGENCY_PRECAUTIONS_NULL); }*/ } } incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentExpressInfoMapper.xml
@@ -8,6 +8,7 @@ <id column="id" property="id" jdbcType="BIGINT"/> <result column="gmt_moditify" property="gmtModitify"/> <result column="create_uid" property="createUid"/> <result column="create_name" property="createName"/> <result column="accident_cause" property="accidentCause"/> <result column="occurrence_time" property="occurrenceTime"/> <result column="occurrence_place" property="occurrencePlace"/> @@ -16,7 +17,7 @@ </resultMap> <select id="selectAccidentExpressList" resultMap="AccidentExpressInfoPageDOResult"> select id,`gmt_moditify`,`create_uid`,`accident_cause`,`occurrence_time`,occurrence_place ,accident_department_id ,accident_name select id,`gmt_moditify`,`create_uid`,`accident_cause`,`occurrence_time`,occurrence_place ,accident_department_id ,accident_name ,create_name from accident_express where del_flag = 0 </select> @@ -30,6 +31,7 @@ <if test="gmtModitify != null ">gmt_moditify,</if> <if test="createUid != null ">create_uid,</if> <if test="updateUid != null ">update_uid,</if> <if test="createName != null and createName != ''">create_name,</if> <if test="emergencyPrecautions != null and emergencyPrecautions != ''">emergency_precautions,</if> <if test="accidentCausesPreliminaryAnalysis != null and accidentCausesPreliminaryAnalysis != ''">accident_causes_preliminary_analysis,</if> <if test="accidentBriefProcess != null and accidentBriefProcess != ''">accident_brief_process,</if> @@ -47,6 +49,7 @@ <if test="gmtModitify != null ">#{gmtModitify},</if> <if test="createUid != null ">#{createUid},</if> <if test="updateUid != null ">#{updateUid},</if> <if test="createName != null and createName != ''">#{createName},</if> <if test="emergencyPrecautions != null and emergencyPrecautions != ''">#{emergencyPrecautions},</if> <if test="accidentCausesPreliminaryAnalysis != null and accidentCausesPreliminaryAnalysis != ''">#{accidentCausesPreliminaryAnalysis},</if> <if test="accidentBriefProcess != null and accidentBriefProcess != ''">#{accidentBriefProcess},</if> incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml
@@ -61,6 +61,7 @@ <if test="accidentHandling != null and accidentHandling != ''">accident_handling,</if> <if test="fillInUserUid != null ">fill_in_user_uid,</if> <if test="fillInTime != null ">fill_in_time,</if> <if test="fillInUserName != null and fillInUserName != ''">fill_in_user_name,</if> <if test="relevantPersonnelRecords != null and relevantPersonnelRecords != ''">relevant_personnel_records,</if> <if test="otherMaterials != null and otherMaterials != ''">other_materials,</if> </trim> @@ -89,6 +90,7 @@ <if test="accidentHandling != null and accidentHandling != ''">#{accidentHandling},</if> <if test="fillInUserUid != null ">#{fillInUserUid},</if> <if test="fillInTime != null ">#{fillInTime},</if> <if test="fillInUserName != null and fillInUserName != ''">#{fillInUserName},</if> <if test="relevantPersonnelRecords != null and relevantPersonnelRecords != ''">#{relevantPersonnelRecords},</if> <if test="otherMaterials != null and otherMaterials != ''">#{otherMaterials},</if> </trim> @@ -114,6 +116,7 @@ <result column="rectification_measures" property="rectificationMeasures"/> <result column="accident_handling" property="accidentHandling"/> <result column="fill_in_user_uid" property="fillInUserUid"/> <result column="fill_in_user_name" property="fillInUserName"/> <result column="fill_in_time" property="fillInTime"/> <result column="relevant_personnel_records" property="relevantPersonnelRecords"/> <result column="other_materials" property="otherMaterials"/> @@ -140,6 +143,7 @@ a.`accident_handling`, a.`fill_in_user_uid`, a.fill_in_time, a.fill_in_user_name, a.`relevant_personnel_records`, a.`other_materials`, b.accident_name AS accidentName, @@ -176,6 +180,7 @@ <if test="accidentHandling != null and accidentHandling != ''">accident_handling = #{accidentHandling},</if> <if test="fillInUserUid != null ">fill_in_user_uid = #{fillInUserUid},</if> <if test="fillInTime != null ">fill_in_time = #{fillInTime},</if> <if test="fillInUserName != null and fillInUserName != ''">fill_in_user_name = #{fillInUserName},</if> <if test="relevantPersonnelRecords != null and relevantPersonnelRecords != ''">relevant_personnel_records = #{relevantPersonnelRecords},</if> <if test="otherMaterials != null and otherMaterials != ''">other_materials = #{otherMaterials},</if> </trim>