From 5d8c028ff37838e0628d5852e41b19efc80e4be1 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期一, 27 十一月 2023 15:09:41 +0800 Subject: [PATCH] Changes --- modules/mainPart/src/main/java/com/zt/life/modules/project/service/EnvironService.java | 68 +++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 26 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/project/service/EnvironService.java b/modules/mainPart/src/main/java/com/zt/life/modules/project/service/EnvironService.java index c8f7deb..326abdf 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/project/service/EnvironService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/project/service/EnvironService.java @@ -2,12 +2,13 @@ import com.zt.common.service.BaseService; import com.zt.life.modules.project.dao.EnvironDao; -import com.zt.life.modules.project.dto.SoftwareTestOrderDto; +import com.zt.life.modules.project.dto.EnvironDto; import com.zt.life.modules.project.model.*; import com.zt.life.modules.sysBaseInfo.model.TestAgencyInfo; import com.zt.life.modules.sysBaseInfo.service.TestAgencyInfoService; import com.zt.life.sys.service.SysOssConfigService; import com.zt.modules.coderule.service.SysCodeRuleService; +import com.zt.modules.oss.service.SysOssService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zt.common.db.query.QueryFilter; @@ -50,13 +51,16 @@ @Autowired private TestAgencyInfoService testAgencyInfoService; + @Autowired + private SysOssService sysOssService; - public SoftwareTestOrderDto getDto(Long environId, Long projectId) { - SoftwareTestOrderDto data = new SoftwareTestOrderDto(); + + public EnvironDto getDto(Long environId, Long projectId) { + EnvironDto data = new EnvironDto(); 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); @@ -68,16 +72,15 @@ List<EnvironAnalysis> environAnalysesList = environAnalysisService.getList(environId); data.setEnvironAnalysisList(environAnalysesList); } else { - Project project = projectService.get(projectId); - Environ environ = new Environ(); + Environ environ =new Environ(); data.setEnviron(environ); - data.getEnviron().setSoftwareName(project.getSoftwareName()); - data.getEnviron().setSoftwareIdentity(project.getSoftwareIdentity()); - data.getEnviron().setProjectId(projectId); + } + 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()); + data.setTestAgencyInfo(testAgencyInfoService.get(10000L)); return data; } @@ -101,54 +104,67 @@ super.deleteLogic(ids); } - public Boolean save(SoftwareTestOrderDto softwareTestOrderDto) { - Long environId = softwareTestOrderDto.getEnviron().getId(); + public Boolean save(EnvironDto environDto) { + Long environId = environDto.getEnviron().getId(); if (environId != null) - baseDao.updateById(softwareTestOrderDto.getEnviron()); + baseDao.updateById(environDto.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()); - environId = softwareTestOrderDto.getEnviron().getId(); + map.put("projectId",environDto.getProjectId().toString()); + environDto.getEnviron().setYear(year); + environDto.getEnviron().setProjectId(environDto.getProjectId()); + environDto.getEnviron().setCode(sysCodeRuleService.getNewCode(map)); + baseDao.insert(environDto.getEnviron()); + environId = environDto.getEnviron().getId(); } - for (EnvironSoftwareResources environSoftwareResources : softwareTestOrderDto.getSoftwareResourcesList()) { + int i = 0; + for (EnvironSoftwareResources environSoftwareResources : environDto.getSoftwareResourcesList()) { environSoftwareResources.setEnvironId(environId); if (environSoftwareResources.getId() != null) { environSoftwareResourcesService.update(environSoftwareResources); } else { + i++; + environSoftwareResources.setNo(i); environSoftwareResources.setEnvironId(environId); environSoftwareResourcesService.insert(environSoftwareResources); } } - - for (EnvironHardwareResources environHardwareResources : softwareTestOrderDto.getHardwareResourcesList()) { + i = 0; + for (EnvironHardwareResources environHardwareResources : environDto.getHardwareResourcesList()) { environHardwareResources.setEnvironId(environId); if (environHardwareResources.getId() != null) { environHardwareResourcesService.update(environHardwareResources); } else { + i++; + environHardwareResources.setNo(i); environHardwareResources.setEnvironId(environId); environHardwareResourcesService.insert(environHardwareResources); } } - for (EnvironAnalysis environAnalysis : softwareTestOrderDto.getEnvironAnalysisList()) { + i = 0; + for (EnvironAnalysis environAnalysis : environDto.getEnvironAnalysisList()) { environAnalysis.setEnvironId(environId); if (environAnalysis.getId() != null) { environAnalysisService.update(environAnalysis); } else { + i++; + environAnalysis.setNo(i); environAnalysis.setEnvironId(environId); environAnalysisService.insert(environAnalysis); } } - - sysOssConfigService.updateOss(softwareTestOrderDto.getId(), softwareTestOrderDto.getFiles());// 淇濆瓨闄勪欢 + if (environDto.getTestAgencyInfo().getId() == 10000) { + environDto.getTestAgencyInfo().setId(environId); + testAgencyInfoService.insert(environDto.getTestAgencyInfo()); + } else { + testAgencyInfoService.update(environDto.getTestAgencyInfo()); + } + sysOssConfigService.updateOss(environDto.getEnviron().getId(), environDto.getFiles());// 淇濆瓨闄勪欢 return true; } } -- Gitblit v1.9.1