|  |  | 
 |  |  | import com.zt.common.db.query.QueryFilter; | 
 |  |  |  | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |     private TestAgencyInfoService testAgencyInfoService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public SoftwareTestOrderDto getDto(Long projectId, Long environId) { | 
 |  |  |     public SoftwareTestOrderDto getDto(Long environId, Long projectId) { | 
 |  |  |         SoftwareTestOrderDto data = new SoftwareTestOrderDto(); | 
 |  |  |         if (environId != null) { | 
 |  |  |             data.setId(environId); | 
 |  |  |             Environ environ = this.get(environId); | 
 |  |  |             data.setEnviron(environ); | 
 |  |  |             data.setTestAgencyInfo(testAgencyInfoService.get(environId)); | 
 |  |  |  | 
 |  |  |             projectId = environ.getProjectId(); | 
 |  |  |  | 
 |  |  |             List<EnvironSoftwareResources> softwareResourcesList = environSoftwareResourcesService.getList(environId); | 
 |  |  |             data.setSoftwareResourcesList(softwareResourcesList); | 
 |  |  |  | 
 |  |  | 
 |  |  |             List<EnvironAnalysis> environAnalysesList = environAnalysisService.getList(environId); | 
 |  |  |             data.setEnvironAnalysisList(environAnalysesList); | 
 |  |  |         } else { | 
 |  |  |             Project project = projectService.get(projectId); | 
 |  |  |             data.getEnviron().setSoftwareName(project.getSoftwareName()); | 
 |  |  |             data.getEnviron().setSoftwareIdentity(project.getSoftwareIdentity()); | 
 |  |  |             Environ environ =new Environ(); | 
 |  |  |             data.setEnviron(environ); | 
 |  |  |         } | 
 |  |  |         if (projectId != null) { | 
 |  |  |             data.setProjectId(projectId); | 
 |  |  |             data.setProject(projectService.get(projectId)); | 
 |  |  |         } | 
 |  |  |         if (data.getTestAgencyInfo() == null) | 
 |  |  |            data.getEnviron().setAgencyName(testAgencyInfoService.get(10000L).getAgencyName()); | 
 |  |  |            data.getEnviron().setSite(testAgencyInfoService.get(10000L).getSite()); | 
 |  |  |         if (projectId != null) { | 
 |  |  |             data.setOrderId(projectId); | 
 |  |  |             data.setSoftwareTestOrder(softwareTestOrderService.get(projectId)); | 
 |  |  |         } | 
 |  |  |             data.setTestAgencyInfo(testAgencyInfoService.get(10000L)); | 
 |  |  |  | 
 |  |  |         return data; | 
 |  |  |     } | 
 |  |  | 
 |  |  |         if (environId != null) | 
 |  |  |             baseDao.updateById(softwareTestOrderDto.getEnviron()); | 
 |  |  |         else { | 
 |  |  |             SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); | 
 |  |  |             String year = sdf.format(new Date()); | 
 |  |  |             Map<String, String> map = new HashMap<>(); | 
 |  |  |             map.put("funCode", "environ"); | 
 |  |  |             map.put("year",year); | 
 |  |  |             softwareTestOrderDto.getEnviron().setYear(year); | 
 |  |  |             softwareTestOrderDto.getEnviron().setProjectId(softwareTestOrderDto.getProjectId()); | 
 |  |  |             softwareTestOrderDto.getEnviron().setCode(sysCodeRuleService.getNewCode(map)); | 
 |  |  |             baseDao.insert(softwareTestOrderDto.getEnviron()); | 
 |  |  | 
 |  |  |                 environAnalysisService.insert(environAnalysis); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         sysOssConfigService.updateOss(softwareTestOrderDto.getId(), softwareTestOrderDto.getFiles());// 保存附件 | 
 |  |  |         if (softwareTestOrderDto.getTestAgencyInfo().getId() == 10000) { | 
 |  |  |             softwareTestOrderDto.getTestAgencyInfo().setId(environId); | 
 |  |  |             testAgencyInfoService.insert(softwareTestOrderDto.getTestAgencyInfo()); | 
 |  |  |         } else { | 
 |  |  |             testAgencyInfoService.update(softwareTestOrderDto.getTestAgencyInfo()); | 
 |  |  |         } | 
 |  |  |         sysOssConfigService.updateOss(softwareTestOrderDto.getEnviron().getId(), softwareTestOrderDto.getFiles());// 保存附件 | 
 |  |  |         return true; | 
 |  |  |     } | 
 |  |  | } |