| | |
| | | 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.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") |
| | |
| | | |
| | | @Autowired |
| | | private AccidentReportFileInfoService accidentReportFileInfoService; |
| | | |
| | | @DubboReference(check = false) |
| | | private AccountDepartmentService accountDepartmentService; |
| | | |
| | | @Autowired |
| | | private AccidentExpressInfoService accidentExpressInfoService; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | 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, |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 验证必填项 |
| | | * |
| | | * @return |
| | | */ |
| | | private void checkRequired(AccidentReportReqDTO AccidentReportReqDTO) { |
| | |
| | | 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); |