From f3a1ffc586b88a4b8ae43e664f2cefadd3ba7d24 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 04 八月 2022 15:04:19 +0800
Subject: [PATCH] 应急预案废止
---
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java | 94 ++++++++++++++++++++++++++++------------------
1 files changed, 57 insertions(+), 37 deletions(-)
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
index 260b95c..f508e17 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
+++ b/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,
@@ -179,13 +207,13 @@
@Override
- public ResultVO batchDeleteWorkInjuryDeclaration(String ids) {
- if (StringUtils.isBlank(ids)){
+ public ResultVO batchDeleteWorkInjuryDeclaration(Long[] ids) {
+
+ if (ids == null || ids.length==0){
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NULL);
}else{
- String[] idArr = ids.split(",");
- for (String id : idArr) {
- deleteWorkInjuryDeclaration(Long.valueOf(id));
+ for (Long id : ids){
+ deleteWorkInjuryDeclaration(id);
}
return new ResultVO(ResultCodes.OK);
}
@@ -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);
- }*/
}
}
--
Gitblit v1.9.2