From ebfd37816a332308519b30af5bfb017c5052be69 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 목, 13 1월 2022 17:34:35 +0900
Subject: [PATCH] Merge branch 'master' of http://192.168.0.25:9001/r/owl-kisa

---
 src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
index 4cf7a5d..fefabe8 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -87,6 +87,9 @@
     private CompanyFieldService companyFieldService;
 
     @Autowired
+    private CompanyFieldCategoryService companyFieldCategoryService;
+
+    @Autowired
     private IspFieldService ispFieldService;
 
     @Autowired
@@ -209,6 +212,9 @@
     @Autowired
     private IssueRelationMapper issueRelationMapper;
 
+    @Autowired
+    private WorkflowTransitionService workflowTransitionService;
+
     @Override
     protected JpaRepository<Issue, Long> getRepository() {
         return this.issueRepository;
@@ -259,6 +265,9 @@
             }
         } else if (issueApiForm.getIssueStatusId() == null){
             throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST));
+        } else if (!this.workflowTransitionService.contains(issueApiForm.getIssueStatusId(), workflow.getId())) {
+            //�씠�뒋 �긽�깭 �쑀�슚�꽦 �솗�씤
+            throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST_IN_WORKFLOW));
         }
 
         // �봽濡쒖젥�듃 �엯�젰
@@ -1518,7 +1527,7 @@
 
                 case "02": //  �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭,  �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦�옄, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂�, �뙎湲�, 湲곕줉�쓣 �뀑�똿�븳�떎.
                     this.setIssueDetail(issueVo, issue, user);    //  �씠�뒋 �긽�꽭 �젙蹂대�� �뀑�똿�븳�떎.
-                    this.setIssueTableConfigs(issue, issueVo);
+                    this.setIssueTableConfigs(issue, issueVo, issueCondition);
                     issueVo.setProjectVo(ConvertUtil.copyProperties(issue.getProject(), ProjectVo.class));
                     break;
             }
@@ -1530,8 +1539,9 @@
     }
 
     // �뀒�씠釉� �꽕�젙 �뀑�똿
-    private void setIssueTableConfigs(Issue issue, IssueVo issueVo) {
-        Long IssueTypeId = issue.getIssueType().getId();
+    private void setIssueTableConfigs(Issue issue, IssueVo issueVo, IssueCondition issueCondition) {
+        //Long IssueTypeId = issue.getIssueType().getId();
+        Long IssueTypeId = issueCondition.getIssueTypeId();
 
         for (int tableConfigType : IssueTableConfig.IssueTableTypes) {
             if (tableConfigType != IssueTableConfig.ISSUE_TABLE_TYPE_MAIN) {
@@ -1555,7 +1565,10 @@
 
         List<Issue> downIssueList = this.issueRepository.findByParentIssueId(issue.getId());
         if(downIssueList != null && downIssueList.size() > 0) {
-            int startPage = (int) Math.floor(issueVo.getDownPage()/issueVo.getDownPageSize());
+            int startPage = 0;
+            if (issueVo.getDownPage() != 0) {
+                startPage = (int) Math.floor(issueVo.getDownPage()/issueVo.getDownPageSize());
+            }
             Pageable pageable = PageRequest.of(startPage, issueVo.getDownPageSize());
             downIssues = this.issueRepository.findByParentIssueId(issue.getId(), pageable);
         }
@@ -1673,7 +1686,7 @@
             issueVo.setRelTotalCount(totalCount);
             for (Map<String, Object> result : results) {
                 IssueRelationVo issueRelationVo = ConvertUtil.convertMapToClass(result, IssueRelationVo.class);
-                Issue relationIssue = this.findOne(issueRelationVo.getId());
+                Issue relationIssue = this.findOne(MapUtil.getLong(result, "relationIssueId"));
                 IssueVo relIssueVo = ConvertUtil.copyProperties(relationIssue, IssueVo.class);
                 Project project = this.projectService.getProject(relationIssue.getProject().getId());
                 relIssueVo.setProjectId(project.getId());
@@ -2792,6 +2805,26 @@
             CompanyField companyField = issueCompany.getCompanyField();
             if (companyField != null) {
                 issueCompanyVo.setCompanyId(issueCompany.getCompanyField().getId());
+                if (issueCompany.getCompanyTypeId() != null) {
+                    CompanyFieldCategory companyType = this.companyFieldCategoryService.find(issueCompany.getCompanyTypeId());
+                    issueCompanyVo.setCompanyTypeName(companyType.getUseValue());
+                }
+                if (issueCompany.getParentSectorId() != null) {
+                    CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(issueCompany.getParentSectorId());
+                    issueCompanyVo.setParentSectorName(parentSector.getUseValue());
+                }
+                if (issueCompany.getChildSectorId() != null) {
+                    CompanyFieldCategory childSector = this.companyFieldCategoryService.find(issueCompany.getChildSectorId());
+                    issueCompanyVo.setChildSectorName(childSector.getUseValue());
+                }
+                if (issueCompany.getRegionId() != null) {
+                    CompanyFieldCategory region = this.companyFieldCategoryService.find(issueCompany.getRegionId());
+                    issueCompanyVo.setRegionName(region.getUseValue());
+                }
+                if (issueCompany.getStatusId() != null) {
+                    CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId());
+                    issueCompanyVo.setStatusName(status.getUseValue());
+                }
             }
             issueCompanyVos.add(issueCompanyVo);
         }

--
Gitblit v1.8.0