package com.gkhy.labRiskManage.application.experiment.service.impl; import com.gkhy.labRiskManage.api.controller.experiment.dto.req.*; import com.gkhy.labRiskManage.api.controller.experiment.dto.resp.ExperimentAndEmergencyRespDTO; import com.gkhy.labRiskManage.application.experiment.converter.ExperimentAppConverter; import com.gkhy.labRiskManage.application.experiment.dto.bo.*; import com.gkhy.labRiskManage.application.experiment.dto.dto.*; import com.gkhy.labRiskManage.application.experiment.service.ExperimentAppService; import com.gkhy.labRiskManage.application.riskReport.dto.dto.ReportAppQueryDTO; import com.gkhy.labRiskManage.commons.domain.SearchResult; import com.gkhy.labRiskManage.commons.enums.ResultCode; import com.gkhy.labRiskManage.commons.enums.StatusEnum; import com.gkhy.labRiskManage.commons.exception.BusinessException; import com.gkhy.labRiskManage.commons.model.PageQuery; import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAssessLog; import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentInfo; import com.gkhy.labRiskManage.domain.experiment.enums.*; import com.gkhy.labRiskManage.domain.experiment.model.bo.*; import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentAndTypeDTO; import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentInfoDTO; import com.gkhy.labRiskManage.domain.experiment.service.*; import com.gkhy.labRiskManage.domain.riskReport.entity.ReportRiskAssessInfo; import com.gkhy.labRiskManage.domain.riskReport.service.ReportRiskAssessInfoService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @Service public class ExperimentAppServiceImpl implements ExperimentAppService { @Autowired private ExperimentInfoService experimentInfoService; @Autowired private ExperimentHazardousWasteService experimentHazardousWasteService; @Autowired private ExperimentAndStuffService experimentAndStuffService; @Autowired private ExperimentAndDeviceService experimentAndDeviceService; @Autowired private ExperimentAndPersonService experimentAndPersonService; @Autowired private ReportRiskAssessInfoService reportRiskAssessInfoService; @Autowired private ExperimentAndSiteService experimentAndSiteService; @Autowired private ExperimentAndEmergencyService experimentAndEmergencyService; @Autowired private ExperimentAppConverter experimentAppConverter; @Autowired private ExperimentAssessLogService experimentAssessLogService; @Autowired private ExperimentAndTypeService experimentAndTypeService; @Transactional @Override public int save(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.save(currentUserId,experimentAppInsertBO); //设备中间表 List deviceAppInsertBOList = experimentAppConverter.getDeviceInsertBOList(experimentInsertReqBO.getDeviceList(),experimentInfoDTO.getId()); //材料中间表 List stuffInsertBOList = experimentAppConverter.getStuffInsertBOList(experimentInsertReqBO.getStuffList(),experimentInfoDTO.getId()); //实验人员 List personIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getPersons())){ personIds = experimentInsertReqBO.getPersons().stream().map(ExperimentAndPersonInsertReqBO::getPersonId).collect(Collectors.toList()); } //实验地点中间表 List siteIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getSiteList())){ siteIds = experimentInsertReqBO.getSiteList().stream().map(ExperimentAndSiteInsertReqBO::getSiteId).collect(Collectors.toList()); } //实验类型中间表 List typeIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); } //危废中间表 List hazardousWasteInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),experimentInfoDTO.getId()); } //应急演练 List experimentAndEmergencyAppInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), experimentInfoDTO.getId()); } // 暂存清空了之前绑定数据 dealDelete(experimentInfoDTO.getId(),currentUserId); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); experimentAndPersonService.saveBatch(currentUserId,personIds,experimentInfoDTO.getId()); experimentAndSiteService.saveBatch(currentUserId, siteIds, experimentInfoDTO.getId()); experimentAndTypeService.saveBatch(currentUserId, typeIds, experimentInfoDTO.getId()); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } @Override @Transactional public int temporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { // if(ExperimentStagingEnum.SAVE.getValue().equals(experimentInsertReqBO.getStagingTag())){ // throw new BusinessException(this.getClass(),ResultCode.PARAM_ERROR_NULL.getCode(),"已保存数据不可操作暂存!"); // } //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.temporary(currentUserId,experimentAppInsertBO); //删除业务数据 dealDelete(experimentInfoDTO.getId(),currentUserId); temporary(currentUserId,experimentInsertReqBO,experimentInfoDTO.getId(),experimentAppInsertBO); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } @Transactional @Override public int developSave(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.developSave(currentUserId,experimentAppInsertBO); //设备中间表 List deviceAppInsertBOList = experimentAppConverter.getDeviceInsertBOList(experimentInsertReqBO.getDeviceList(),experimentInfoDTO.getId()); //材料中间表 List stuffInsertBOList = experimentAppConverter.getStuffInsertBOList(experimentInsertReqBO.getStuffList(),experimentInfoDTO.getId()); //实验人员 List personIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getPersons())){ personIds = experimentInsertReqBO.getPersons().stream().map(ExperimentAndPersonInsertReqBO::getPersonId).collect(Collectors.toList()); } //实验地点中间表 List siteIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getSiteList())){ siteIds = experimentInsertReqBO.getSiteList().stream().map(ExperimentAndSiteInsertReqBO::getSiteId).collect(Collectors.toList()); } //危废中间表 List hazardousWasteInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),experimentInfoDTO.getId()); } //应急演练 List experimentAndEmergencyAppInsertBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), experimentInfoDTO.getId()); } //实验类型中间表 List typeIds = new ArrayList<>(); if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); } // 暂存清空了之前绑定数据 dealDelete(experimentInfoDTO.getId(),currentUserId); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); experimentAndPersonService.saveBatch(currentUserId,personIds,experimentInfoDTO.getId()); experimentAndSiteService.saveBatch(currentUserId, siteIds, experimentInfoDTO.getId()); experimentAndTypeService.saveBatch(currentUserId, typeIds, experimentInfoDTO.getId()); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } @Override @Transactional public int developTemporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { //实验基础信息 ExperimentAppInsertBO experimentAppInsertBO = new ExperimentAppInsertBO(); BeanUtils.copyProperties(experimentInsertReqBO,experimentAppInsertBO); ExperimentInfoDTO experimentInfoDTO = experimentInfoService.developTemporary(currentUserId,experimentAppInsertBO); //处理中间表数据 dealDelete(experimentInfoDTO.getId(),currentUserId); temporary(currentUserId,experimentInsertReqBO,experimentInfoDTO.getId(),experimentAppInsertBO); Integer code = StatusEnum.SUCCESS.getCode(); if(ObjectUtils.isEmpty(experimentInfoDTO)){ code = StatusEnum.FAIL.getCode(); } return code; } /** * 处理删除 * @param id * @param currentUserId */ private void dealDelete(Long id ,Long currentUserId){ experimentAndTypeService.deleteByExperimentId(id); experimentAndDeviceService.deleteByExperimentId(id,currentUserId); experimentHazardousWasteService.deleteByExperimentId(id,currentUserId); experimentAndPersonService.deleteByExperimentId(id,currentUserId); experimentAndStuffService.deleteByExperimentId(id,currentUserId); experimentAndSiteService.deleteByExperimentId(id); experimentAndEmergencyService.deleteByExperimentId(id); } /** * 处理中间表数据 * @param currentUserId * @param experimentInsertReqBO * @param experimentAppInsertBO */ private void temporary(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO,Long id ,ExperimentAppInsertBO experimentAppInsertBO) { if (!CollectionUtils.isEmpty(experimentInsertReqBO.getDeviceList())){ //设备中间表 List deviceAppInsertBOList = experimentAppConverter.getDeviceInsertBOList(experimentInsertReqBO.getDeviceList(),id); experimentAndDeviceService.saveBatch(currentUserId,deviceAppInsertBOList); } if (!CollectionUtils.isEmpty(experimentInsertReqBO.getStuffList())) { //材料中间表 List stuffInsertBOList = experimentAppConverter.getStuffInsertBOList(experimentInsertReqBO.getStuffList(), id); experimentAndStuffService.saveBatch(currentUserId,stuffInsertBOList); } //实验人员 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getPersons())){ List personIds = experimentInsertReqBO.getPersons().stream().map(ExperimentAndPersonInsertReqBO::getPersonId).collect(Collectors.toList()); experimentAndPersonService.saveBatch(currentUserId,personIds,id); } //实验地点中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getSiteList())){ List siteIds = experimentInsertReqBO.getSiteList().stream().map(ExperimentAndSiteInsertReqBO::getSiteId).collect(Collectors.toList()); experimentAndSiteService.saveBatch(currentUserId, siteIds, id); } //实验类型中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getTypeList())){ List typeIds = experimentInsertReqBO.getTypeList().stream().map(ExperimentAndTypeInsertReqBO::getTypeId).collect(Collectors.toList()); experimentAndTypeService.saveBatch(currentUserId, typeIds, id); } //危废中间表 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getHazardousWasteList())){ List hazardousWasteInsertBOList = experimentAppConverter.getHazardousWasteInsertBOList(experimentInsertReqBO.getHazardousWasteList(),id); experimentHazardousWasteService.saveBatch(currentUserId,hazardousWasteInsertBOList); } //应急演练 if(!CollectionUtils.isEmpty(experimentInsertReqBO.getEmergencyList())){ List experimentAndEmergencyAppInsertBOList = experimentAppConverter.getExperimentAndEmergencyAppInsertBOList(experimentInsertReqBO.getEmergencyList(), id); experimentAndEmergencyService.saveBatch(currentUserId,experimentAndEmergencyAppInsertBOList); } } @Transactional @Override public int rectifySave(Long currentUserId, ExperimentInsertReqBO experimentInsertReqBO) { //修该原有实验已整改 boolean flag = experimentInfoService.updateRectify(experimentInsertReqBO.getId()); //新建 int save = this.save(currentUserId, experimentInsertReqBO); if(flag && save == StatusEnum.SUCCESS.getCode()){ return StatusEnum.SUCCESS.getCode(); } return StatusEnum.FAIL.getCode(); } @Override public SearchResult> applyEvaluationListByPage(PageQuery appPageQuery,Long currentUserId) { PageQuery pageQuery = new PageQuery<>(); pageQuery.setPageSize(appPageQuery.getPageSize()); pageQuery.setPageIndex(appPageQuery.getPageIndex()); ExperimentInfoQueryBO queryBO = new ExperimentInfoQueryBO(); if(!ObjectUtils.isEmpty(appPageQuery.getSearchParams())){ BeanUtils.copyProperties(appPageQuery.getSearchParams(),queryBO); } queryBO.setStatus(ExperimentStatusEnum.YES_APPLY.getValue()); pageQuery.setSearchParams(queryBO); SearchResult> searchResult = experimentInfoService.listByPage(pageQuery,currentUserId); SearchResult> result = new SearchResult<>(); if(!ObjectUtils.isEmpty(searchResult)){ BeanUtils.copyProperties(searchResult,result); } List experimentInfoDTOS = (List)searchResult.getData(); List experimentInfoAppQueryDTOS = BeanCopyUtils.copyBeanList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); for (ExperimentInfoAppQueryDTO experimentInfo : experimentInfoAppQueryDTOS) { List assessLogs = experimentAssessLogService.getAssessLogs(experimentInfo.getExperimentCode()); if (assessLogs.size() > 0){ experimentInfo.setExperimentAssessLogs(assessLogs); } ReportRiskAssessInfo byExperimentId = reportRiskAssessInfoService.getByExperimentId(experimentInfo.getId()); if (!ObjectUtils.isEmpty(byExperimentId)){ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); //获取分页数据 return result; } /** * 删除 * * @param id * @param currentUserId * @return */ @Transactional(rollbackFor = Exception.class) @Override public int deleteById(Long id, Long currentUserId) { experimentInfoService.deleteById(id,currentUserId); experimentAndDeviceService.deleteByExperimentId(id,currentUserId); experimentHazardousWasteService.deleteByExperimentId(id,currentUserId); experimentAndPersonService.deleteByExperimentId(id,currentUserId); experimentAndStuffService.deleteByExperimentId(id,currentUserId); experimentAndSiteService.deleteByExperimentId(id); experimentAndEmergencyService.deleteByExperimentId(id); experimentAndTypeService.deleteByExperimentId(id); return StatusEnum.SUCCESS.getCode(); } @Override public int updateDevelop(Long currentUserId, List appDevelopUpdateBOList) { int code = StatusEnum.SUCCESS.getCode(); List developUpdateBOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(appDevelopUpdateBOList)){ developUpdateBOList = BeanCopyUtils.copyBeanList(appDevelopUpdateBOList,ExperimentDevelopUpdateBO.class); } boolean flag = experimentInfoService.updateDevelop(currentUserId,developUpdateBOList); if(!flag){ code = StatusEnum.FAIL.getCode(); } return code; } @Override public int applyEvaluation(Long currentUserId, List ids) { int code = StatusEnum.SUCCESS.getCode(); boolean flag = experimentInfoService.applyEvaluation(currentUserId,ids); if(!flag){ code = StatusEnum.FAIL.getCode(); } return code; } @Override public int revokeApplyEvaluation(Long currentUserId, List ids) { int code = StatusEnum.SUCCESS.getCode(); boolean flag = experimentInfoService.revokeApplyEvaluation(currentUserId,ids); if(!flag){ code = StatusEnum.FAIL.getCode(); } return code; } @Override public List getExperimentInfoList(Long currentUserId) { List experimentInfoList = experimentInfoService.getExperimentInfoList(currentUserId); return experimentAppConverter.getExperimentInfoAppVoList(experimentInfoList); } @Override public SearchResult> projectListByPage(PageQuery appPageQuery,Long currentUserId) { PageQuery pageQuery = new PageQuery<>(); pageQuery.setPageSize(appPageQuery.getPageSize()); pageQuery.setPageIndex(appPageQuery.getPageIndex()); ExperimentInfoQueryBO queryBO = new ExperimentInfoQueryBO(); if(!ObjectUtils.isEmpty(appPageQuery.getSearchParams())){ BeanUtils.copyProperties(appPageQuery.getSearchParams(),queryBO); } queryBO.setExperimentTag(ExperimentTagEnum.NEW_CREATE.getValue()); pageQuery.setSearchParams(queryBO); SearchResult> searchResult = experimentInfoService.listByPage(pageQuery,currentUserId); SearchResult> result = new SearchResult<>(); if(!ObjectUtils.isEmpty(searchResult)){ BeanUtils.copyProperties(searchResult,result); } List experimentInfoDTOS = (List)searchResult.getData(); List experimentInfoAppQueryDTOS = BeanCopyUtils.list2OtherList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); for (ExperimentInfoAppQueryDTO experimentInfo : experimentInfoAppQueryDTOS) { List assessLogs = experimentAssessLogService.getAssessLogs(experimentInfo.getExperimentCode()); if (assessLogs.size() > 0){ experimentInfo.setExperimentAssessLogs(assessLogs); } ReportRiskAssessInfo byExperimentId = reportRiskAssessInfoService.getByExperimentId(experimentInfo.getId()); if (!ObjectUtils.isEmpty(byExperimentId)){ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); //获取分页数据 return result; } @Override public SearchResult> developListByPage(PageQuery appPageQuery,Long currentUserId) { PageQuery pageQuery = new PageQuery<>(); pageQuery.setPageSize(appPageQuery.getPageSize()); pageQuery.setPageIndex(appPageQuery.getPageIndex()); ExperimentInfoQueryBO queryBO = new ExperimentInfoQueryBO(); if(!ObjectUtils.isEmpty(appPageQuery.getSearchParams())){ BeanUtils.copyProperties(appPageQuery.getSearchParams(),queryBO); } queryBO.setExperimentTag(ExperimentTagEnum.AREADLY_DEVELOP.getValue()); pageQuery.setSearchParams(queryBO); SearchResult> searchResult = experimentInfoService.listByPage(pageQuery,currentUserId); SearchResult> result = new SearchResult<>(); if(!ObjectUtils.isEmpty(searchResult)){ BeanUtils.copyProperties(searchResult,result); } List experimentInfoDTOS = (List)searchResult.getData(); List experimentInfoAppQueryDTOS = BeanCopyUtils.list2OtherList(experimentInfoDTOS, ExperimentInfoAppQueryDTO.class); for (ExperimentInfoAppQueryDTO experimentInfo : experimentInfoAppQueryDTOS) { List assessLogs = experimentAssessLogService.getAssessLogs(experimentInfo.getExperimentCode()); if (assessLogs.size() > 0){ experimentInfo.setExperimentAssessLogs(assessLogs); } ReportRiskAssessInfo byExperimentId = reportRiskAssessInfoService.getByExperimentId(experimentInfo.getId()); if (!ObjectUtils.isEmpty(byExperimentId)){ experimentInfo.setAssessLevel(byExperimentId.getAssessLevel()); experimentInfo.setAssessTime(byExperimentId.getAssessTime()); } List types = experimentInfo.getTypes(); if (!CollectionUtils.isEmpty(types)){ String collect = types.stream().map(type -> type.getTypeName()).collect(Collectors.joining(",")); experimentInfo.setExperimentTypeName(collect); } } result.setData(experimentInfoAppQueryDTOS); //获取分页数据 return result; } private List getExperimentInfoAppQueryDTO(List experimentInfoDTOS){ List experimentInfoAppQueryDTOS = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTOS)){ List expermentIds = experimentInfoDTOS.stream().map(ExperimentInfoDTO::getId).collect(Collectors.toList()); //获取关联的评估数据 List reportAppQueryDTOS = reportRiskAssessInfoService.listRiskReport(expermentIds); //遍历实验 for (ExperimentInfoDTO experimentInfoDTO:experimentInfoDTOS){ ExperimentInfoAppQueryDTO experimentInfoAppQueryDTO = new ExperimentInfoAppQueryDTO(); BeanUtils.copyProperties(experimentInfoDTO,experimentInfoAppQueryDTO); //实验场所 List siteAppQueryDTOs = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getSites())){ siteAppQueryDTOs = BeanCopyUtils.copyBeanList(experimentInfoDTO.getSites(),ExperimentAndSiteAppQueryDTO.class); } experimentInfoAppQueryDTO.setSites(siteAppQueryDTOs); //人员 List personAppQueryDTOList = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getPersons())){ personAppQueryDTOList = BeanCopyUtils.copyBeanList(experimentInfoDTO.getPersons(),ExperimentAndPersonAppQueryDTO.class); } experimentInfoAppQueryDTO.setPersons(personAppQueryDTOList); //设备 List deviceAppQueryDTOList = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getDevices())){ deviceAppQueryDTOList = BeanCopyUtils.copyBeanList(experimentInfoDTO.getDevices(),ExperimentAndDeviceAppQueryDTO.class); } experimentInfoAppQueryDTO.setDevices(deviceAppQueryDTOList); //材料 List stuffAppQueryDTOList = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getStuffs())){ stuffAppQueryDTOList = BeanCopyUtils.copyBeanList(experimentInfoDTO.getStuffs(),ExperimentAndStuffAppQueryDTO.class); } experimentInfoAppQueryDTO.setStuffs(stuffAppQueryDTOList); //危废 List wasteAppQueryDTOList = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getWastes())){ wasteAppQueryDTOList = BeanCopyUtils.copyBeanList(experimentInfoDTO.getWastes(),ExperimentHazardousWasteAppQueryDTO.class); } experimentInfoAppQueryDTO.setWastes(wasteAppQueryDTOList); //应急演练 List emergencies = new ArrayList<>(); if(!ObjectUtils.isEmpty(experimentInfoDTO.getEmergencies())){ emergencies = BeanCopyUtils.copyBeanList(experimentInfoDTO.getEmergencies(),ExperimentAndEmergencyRespDTO.class); } experimentInfoAppQueryDTO.setEmergencies(emergencies); //风险评估 if(!ObjectUtils.isEmpty(reportAppQueryDTOS)){ List selectList = reportAppQueryDTOS.stream().filter(item -> item.getExperimentId().equals(experimentInfoDTO.getId())).collect(Collectors.toList()); if(selectList.size()>0){ experimentInfoAppQueryDTO.setAssessLevel(selectList.get(0).getAssessLevel()); experimentInfoAppQueryDTO.setAssessTime(selectList.get(0).getAssessTime()); } }else { experimentInfoAppQueryDTO.setAssessLevel((byte)0); } experimentInfoAppQueryDTOS.add(experimentInfoAppQueryDTO); } } return experimentInfoAppQueryDTOS; } }