| | |
| | | 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; |
| | |
| | | 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") |
| | |
| | | |
| | | @Autowired |
| | | private WorkInjuryDeclarationFileInfoService workInjuryDeclarationFileInfoService; |
| | | |
| | | @DubboReference(check = false) |
| | | private AccountDepartmentService accountDepartmentService; |
| | | |
| | | @Autowired |
| | | private AccidentExpressInfoService accidentExpressInfoService; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | 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, |
| | |
| | | * @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); |
| | | }*/ |
| | | } |
| | | |
| | | } |