From a8f3e55b5fb3a051289e2c965c1f1bd5e4470b44 Mon Sep 17 00:00:00 2001 From: jhjang <jhjang@maprex.co.kr> Date: 목, 09 12월 2021 15:14:06 +0900 Subject: [PATCH] Merge branch 'master' of http://192.168.0.25:9001/r/owl-kisa --- src/main/java/kr/wisestone/owl/service/impl/IssueTypeServiceImpl.java | 140 ++++++++++++++++++++++++++-------------------- 1 files changed, 80 insertions(+), 60 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueTypeServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueTypeServiceImpl.java index 5e457e9..0c3b5b1 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueTypeServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueTypeServiceImpl.java @@ -4,6 +4,7 @@ import kr.wisestone.owl.common.ExcelConditionCheck; import kr.wisestone.owl.constant.Constants; import kr.wisestone.owl.constant.MsgConstants; +import kr.wisestone.owl.constant.UsePartner; import kr.wisestone.owl.domain.*; import kr.wisestone.owl.domain.enumType.ProjectType; import kr.wisestone.owl.exception.OwlRuntimeException; @@ -11,6 +12,7 @@ import kr.wisestone.owl.repository.IssueTypeRepository; import kr.wisestone.owl.service.*; import kr.wisestone.owl.util.ConvertUtil; +import kr.wisestone.owl.util.MapUtil; import kr.wisestone.owl.vo.*; import kr.wisestone.owl.web.condition.IssueTypeCondition; import kr.wisestone.owl.web.form.IssueTypeForm; @@ -49,13 +51,7 @@ private WorkspaceService workspaceService; @Autowired - private CompanyFieldService companyFieldService; - - @Autowired - private IspFieldService ispFieldService; - - @Autowired - private HostingFieldService hostingFieldService; + private IssueStatusService issueStatusService; @Autowired private IssueTypeMapper issueTypeMapper; @@ -84,6 +80,8 @@ for (ProjectType projectType : projectTypes) { List<IssueType> issueTypes = Lists.newArrayList(); Workflow workflow = this.workflowService.findByWorkspaceIdAndProjectType(workspace.getId(), projectType); + //String projectKey = "BTS"; + //Project project = this.projectService.findByProjectKey(projectKey); switch (projectType) { case BTS_PROJECT: @@ -123,18 +121,8 @@ Project project = this.projectService.getProject(issueTypeForm.getProjectId()); issueType.setProject(project); - String Yes = "Y"; - String No = "N"; + issueType.setUsePartner(issueTypeForm.getUsePartner()); - if(!issueTypeForm.getCompanyYn().equals(No)){ - issueType.setCompanyYn(Yes); - } - if(!issueTypeForm.getHostingYn().equals(No)){ - issueType.setHostingYn(Yes); - } - if(!issueTypeForm.getIspYn().equals(No)){ - issueType.setIspYn(Yes); - } return this.issueTypeRepository.saveAndFlush(issueType); } @@ -182,10 +170,30 @@ condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); condition.setPageSize(pageable.getPageSize()); condition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); + List<Map<String, Object>> results = this.issueTypeMapper.find(condition); + for (Map<String, Object> result : results) { + Long projectId = MapUtil.getLong(result, "projectId"); + if (projectId != null) { + Project project = this.projectService.getProject(projectId); + ProjectVo projectVo = ConvertUtil.copyProperties(project, ProjectVo.class); + result.put("projectVo", projectVo); + + } + Long issueStatusId = MapUtil.getLong(result, "completeIssueStatusId"); + if (issueStatusId != null) { + IssueStatus issueStatus = this.issueStatusService.getIssueStatus(issueStatusId); + IssueStatusVo issueStatusVo = ConvertUtil.copyProperties(issueStatus, IssueStatusVo.class); + result.put("completeIssueStatusVo", issueStatusVo); + } + } + Long totalCount = this.issueTypeMapper.count(condition); int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1; List<IssueTypeVo> issueTypeVos = ConvertUtil.convertListToListClass(results, IssueTypeVo.class); +// for (IssueTypeVo issueTypeVo : issueTypeVos) { +// +// } // �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦 �젙蹂대�� �뀑�똿�븳�떎. if (condition.getDeep() != null) { @@ -193,6 +201,7 @@ } this.setUseIssueTypeByProject(issueTypeVos); + this.setUseIssueTypeByIssueStatus(issueTypeVos); /*this.setUseIssueTypeByCompanyField(issueTypeVos); this.setUseIssueTypeByIspField(issueTypeVos); this.setUseIssueTypeByHostingField(issueTypeVos);*/ @@ -203,6 +212,15 @@ resJsonData.put(Constants.RES_KEY_CONTENTS, issueTypeVos); return issueTypeVos; + } + + // �씠�뒋 �쑀�삎 紐⑸줉�쓣 議고쉶�븳�떎. + @Override + @Transactional(readOnly = true) + public List<IssueTypeVo> findIssueType(IssueTypeCondition condition) { + condition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); + List<Map<String, Object>> results = this.issueTypeMapper.find(condition); + return ConvertUtil.convertListToListClass(results, IssueTypeVo.class); } // �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦 �젙蹂대�� �뀑�똿�븳�떎. @@ -225,6 +243,17 @@ } } + private void setUseIssueTypeByIssueStatus(List<IssueTypeVo> issueTypeVos) { + for (IssueTypeVo issueTypeVo : issueTypeVos) { + IssueType issueType = this.getIssueType(issueTypeVo.getId()); + + IssueStatus issueStatus = issueType.getIssueStatus(); + if (issueStatus != null) { + issueTypeVo.setCompleteIssueStatusVo(ConvertUtil.copyProperties(issueType.getIssueStatus(), IssueStatusVo.class)); + } + } + } + /*// �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �뾽泥� �젙蹂대�� �뀑�똿�븳�떎. private void setUseIssueTypeByCompanyField(List<IssueTypeVo> issueTypeVos) { for (IssueTypeVo issueTypeVo : issueTypeVos){ @@ -235,26 +264,7 @@ } } } - // �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 ISP �젙蹂대�� �뀑�똿�븳�떎. - private void setUseIssueTypeByIspField(List<IssueTypeVo> issueTypeVos) { - for (IssueTypeVo issueTypeVo : issueTypeVos){ - IssueType issueType = this.getIssueType(issueTypeVo.getId()); - IspField ispField = issueType.getIspField(); - if(ispField != null){ - issueTypeVo.setIspFieldVo(ConvertUtil.copyProperties(issueType.getIspField(), IspFieldVo.class)); - } - } - } - // �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �샇�뒪�똿 �젙蹂대�� �뀑�똿�븳�떎. - private void setUseIssueTypeByHostingField(List<IssueTypeVo> issueTypeVos) { - for (IssueTypeVo issueTypeVo : issueTypeVos){ - IssueType issueType = this.getIssueType(issueTypeVo.getId()); - HostingField hostingField = issueType.getHostingField(); - if(hostingField != null){ - issueTypeVo.setHostingFieldVo(ConvertUtil.copyProperties(issueType.getHostingField(), HostingFieldVo.class)); - } - } - }*/ + */ // �씠�뒋 �쑀�삎 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎. @Override @@ -276,22 +286,40 @@ if (project != null) { issueTypeVo.setProjectVo(ConvertUtil.copyProperties(issueType.getProject(), ProjectVo.class)); } + Integer using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; - /*CompanyField companyField = issueType.getCompanyField(); - if(companyField != null){ - issueTypeVo.setCompanyFieldVo(ConvertUtil.copyProperties(issueType.getCompanyField(), CompanyFieldVo.class)); + List<UsePartnerVo> usePartnerVos = Lists.newArrayList(); + for (Integer usePartner : UsePartner.partners) {// 1 // 2 // 4 + UsePartnerVo usePartnerVo = UsePartner.checkUsePartner(using, usePartner);//3, 1 / 3, 2 / 3, 4 + + if (usePartnerVo != null) { + usePartnerVos.add(usePartnerVo); + } } - IspField ispField = issueType.getIspField(); - if (ispField != null){ - issueTypeVo.setIspFieldVo(ConvertUtil.copyProperties(issueType.getIspField(), IspFieldVo.class)); - } - HostingField hostingField = issueType.getHostingField(); - if (hostingField != null){ - issueTypeVo.setHostingFieldVo(ConvertUtil.copyProperties(issueType.getHostingField(), HostingFieldVo.class)); - }*/ + issueTypeVo.setUsePartnerVos(usePartnerVos); } resJsonData.put(Constants.RES_KEY_CONTENTS, issueTypeVo); + } + + // �씠�뒋 �쑀�삎�쓣 �닔�젙�븳�떎. �옄�룞 醫낅즺 �꽕�젙留� �닔�젙 + @Override + @Transactional + public IssueType modifyIssueTypeCompleteIssueStatus(IssueTypeForm issueTypeForm) { + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. + this.workspaceService.checkUseWorkspace(); + + IssueType issueType = this.getIssueType(issueTypeForm.getId()); + if (issueTypeForm.getCompleteIssueStatusId() != null) { + // api�뿉�꽌 �궗�슜�븯�뒗 �옄�룞 醫낅즺 �씠�뒋 �긽�깭 + IssueStatus issueStatus = this.issueStatusService.getIssueStatus(issueTypeForm.getCompleteIssueStatusId()); + issueType.setIssueStatus(issueStatus); + }else { + issueType.setIssueStatus(null); + } + + this.issueTypeRepository.saveAndFlush(issueType); + return issueType; } // �씠�뒋 �쑀�삎�쓣 �닔�젙�븳�떎. @@ -317,21 +345,13 @@ Project project = this.projectService.getProject(issueTypeForm.getProjectId()); issueType.setProject(project); + issueType.setUsePartner(issueTypeForm.getUsePartner()); + /*if(issueTypeForm.getCompanyId() != null){ CompanyField companyField = this.companyFieldService.getCompany(issueTypeForm.getCompanyId()); issueType.setCompanyField(companyField); - } - if(issueTypeForm.getIspId() != null) { - IspField ispField = this.ispFieldService.getIsp(issueTypeForm.getIspId()); - issueType.setIspField(ispField); - } - if(issueTypeForm.getHostingId() != null) { - HostingField hostingField = this.hostingFieldService.getHosting(issueTypeForm.getHostingId()); - issueType.setHostingField(hostingField); }*/ - issueType.setCompanyYn(issueTypeForm.getCompanyYn()); - issueType.setIspYn(issueTypeForm.getIspYn()); - issueType.setHostingYn(issueTypeForm.getHostingYn()); +// issueType.setCompanyYn(issueTypeForm.getCompanyYn()); this.issueTypeRepository.saveAndFlush(issueType); -- Gitblit v1.8.0