From c9529bd19a8d61666b71824dd751682c1e9dc288 Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期一, 15 八月 2022 10:39:31 +0800 Subject: [PATCH] Merge branches 'genchuang' and 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into master --- incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java | 104 +++++++++++++++++++++++++++++++--------------------- 1 files changed, 62 insertions(+), 42 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 80b673f..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 @@ -55,10 +63,30 @@ 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, pageIndex, - pageSize, + pageSize,page.getPages(), page.getTotal(), respList, ResultCodes.OK @@ -104,7 +132,7 @@ //查询是否存在 WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(id); if (WorkInjuryDeclarationInfoDetailDO==null){ - throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); + throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST); }else{ BeanUtils.copyProperties(WorkInjuryDeclarationInfoDetailDO,WorkInjuryDeclarationDetailRespDTO); //查找对应的附件 @@ -123,7 +151,7 @@ //查询是否存在 WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(WorkInjuryDeclarationReqDTO.getId()); if (WorkInjuryDeclarationInfoDetailDO==null){ - throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); + throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST); }else{ WorkInjuryDeclarationInfo WorkInjuryDeclarationInfo = new WorkInjuryDeclarationInfo(); BeanUtils.copyProperties(WorkInjuryDeclarationReqDTO,WorkInjuryDeclarationInfo); @@ -179,13 +207,13 @@ @Override - public ResultVO batchDeleteWorkInjuryDeclaration(String ids) { - if (StringUtils.isBlank(ids)){ - throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NULL); + 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); } @@ -195,7 +223,7 @@ //查询是否存在 WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(id); if (WorkInjuryDeclarationInfoDetailDO==null){ - throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST); + throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST); }else{ workInjuryDeclarationInfoService.deleteWorkInjuryDeclarationById(id); //删除附件 @@ -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