From 47c5ce77b114324effdce5b3735ed0e661846108 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 목, 06 1월 2022 10:58:23 +0900 Subject: [PATCH] - 이슈 상세페이지 연관,하위 이슈 페이징 처리 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 442 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 252 insertions(+), 190 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 10d95d0..b4b9710 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java @@ -14,6 +14,7 @@ import kr.wisestone.owl.exception.OwlRuntimeException; import kr.wisestone.owl.mapper.DepartmentMapper; import kr.wisestone.owl.mapper.IssueMapper; +import kr.wisestone.owl.mapper.IssueRelationMapper; import kr.wisestone.owl.mapper.ProjectMapper; import kr.wisestone.owl.repository.IssueRelationRepository; import kr.wisestone.owl.repository.IssueRepository; @@ -33,6 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.messaging.simp.SimpMessagingTemplate; @@ -195,6 +198,9 @@ @Autowired private WorkflowDepartmentRepository workflowDepartmentRepository; + @Autowired + private IssueRelationMapper issueRelationMapper; + @Override protected JpaRepository<Issue, Long> getRepository() { return this.issueRepository; @@ -313,7 +319,7 @@ } } - private void findCompanyField(IssueForm issueForm) { + private IssueForm findCompanyField(IssueForm issueForm) { if(issueForm.getIssueCustomFields() != null && issueForm.getIssueCustomFields().size() > 0) { CompanyFieldCondition condition = new CompanyFieldCondition(); List<Map<String, Object>> companyFields = this.companyFieldService.find(condition); @@ -356,6 +362,7 @@ issueForm.setIssueHostingFields(issueHostingFields); } } + return issueForm; } private User convertToUser(String token) { @@ -375,12 +382,20 @@ IssueForm issueForm = this.convertToIssueForm(issueApiForm, user); List<Issue> issues = Lists.newArrayList(); - if (issueForm.getParentIssueId() != null) { + if (issueForm.getParentIssueId() != null // 湲곗〈 異붽��맂 �긽�쐞 �씪媛먯씠 �뾾嫄곕굹 �꽕�젙�맂 以묐났 �씠�뒋 id媛� �뾾�쓣�븣 + || issueApiForm.getUseIssueCustomFieldIds().size() == 0) { issues.add(addIssue(user, issueForm, issueApiForm.getMultipartFiles())); } else { - // �긽�쐞 �씠�뒋 異붽� + // 媛��긽 �긽�쐞 �씠�뒋 異붽� IssueForm parentIssueForm = issueForm.clone(); + // 媛��긽 �긽�쐞 �씠�뒋 異붽� parentIssueForm.setUseIssueCustomFields(issueApiForm.getUseIssueCustomFieldIds()); + // 媛숈� �룄硫붿씤 �뾽泥� 李얘린 + IssueForm partners = this.findCompanyField(parentIssueForm); + parentIssueForm.setIssueCompanyFields(partners.getIssueCompanyFields()); + parentIssueForm.setIssueIspFields(partners.getIssueIspFields()); + parentIssueForm.setIssueHostingFields(partners.getIssueHostingFields()); + Issue issue = addIssue(user, parentIssueForm, null); issues.add(issue); // �븯�쐞 �씠�뒋 異붽� @@ -413,7 +428,9 @@ IssueCustomFieldValueFormComparator comp = new IssueCustomFieldValueFormComparator(); Collections.sort(issueCustomFieldValueForms, comp); + List<String> userValues = Lists.newArrayList(); for (IssueCustomFieldValueForm issueCustomFieldValueForm : issueCustomFieldValueForms) { + userValues.add(issueCustomFieldValueForm.getUseValue()); for(CustomFieldApiOverlap customFieldApiOverlap : customFieldApiOverlaps) { if (customFieldApiOverlap.getCustomField().getId().equals(issueCustomFieldValueForm.getCustomFieldId())) { if (useIdx > 0) { @@ -427,6 +444,7 @@ IssueCustomFieldValueCondition issueCustomFieldValueCondition = new IssueCustomFieldValueCondition(); issueCustomFieldValueCondition.setUseValue(concatUseValue); + issueCustomFieldValueCondition.setUseValues(userValues); issueCustomFieldValueCondition.setIssueTypeId(issueApiform.getIssueTypeId()); List<Map<String, Object>> results = this.issueMapper.findByCustomFieldValue(issueCustomFieldValueCondition); if (results != null && results.size() > 0) { @@ -492,12 +510,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm.getIssueCompanyFields()); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm.getIssueIspFields()); + this.issueIspService.modifyIssueIspField(issue, issueForm); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm.getIssueHostingFields()); - + this.issueHostingService.modifyIssueHostingField(issue, issueForm); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -586,11 +603,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm.getIssueCompanyFields()); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm.getIssueIspFields()); + this.issueIspService.modifyIssueIspField(issue, issueForm); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm.getIssueHostingFields()); + this.issueHostingService.modifyIssueHostingField(issue, issueForm); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -663,11 +680,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm.getIssueCompanyFields()); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm.getIssueIspFields()); + this.issueIspService.modifyIssueIspField(issue, issueForm); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm.getIssueHostingFields()); + this.issueHostingService.modifyIssueHostingField(issue, issueForm); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -715,7 +732,7 @@ } // �씠�뒋 �젙蹂대�� �씠硫붿씪 �쟾�넚�뿉 �궗�슜�븯湲� �쐞�빐 Map �삎�깭濡� 蹂��솚�븳�떎. - private void makeIssueMapToIssue(Issue issue, Map<String, Object> issueMap) { + public void makeIssueMapToIssue(Issue issue, Map<String, Object> issueMap) { issueMap.put("title", issue.getTitle()); issueMap.put("issueNumber", issue.getIssueNumber()); issueMap.put("issueTypeName", issue.getIssueType().getName()); @@ -891,7 +908,6 @@ @Override @Transactional(readOnly = true) public List<IssueVo> findIssue(Map<String, Object> resJsonData, IssueCondition issueCondition, Pageable pageable) { - // 寃��깋 議곌굔�쓣 留뚮뱺�떎 if (!this.makeIssueSearchCondition(issueCondition, Lists.newArrayList("01", "02", "03"), pageable)) { // �씠�뒋 紐⑸줉�쓣 李얠� 紐삵븷 寃쎌슦 湲곕낯 �젙蹂대줈 由ы꽩�븳�떎. @@ -925,14 +941,14 @@ Long totalCount = 0L; UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); - if (this.userWorkspaceService.checkWorkspaceManager(user) - || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { - this.SetAllDepartmentId(issueCondition); - } else{ - this.SetMyDepartmentId(issueCondition); - /*results = this.issueMapper.findByDepartment(issueCondition); - totalCount = this.issueMapper.countByDepartment(issueCondition);*/ - } +// if (!this.userWorkspaceService.checkWorkspaceManager(user) +// && !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { //理쒓퀬愿�由ъ옄 & �봽濡쒖젥�듃,�씠�뒋 愿�由ъ옄 �씪 寃쎌슦 紐⑤뱺 �씠�뒋 蹂닿린 +// this.SetMyDepartmentId(issueCondition); + //this.SetAllDepartmentId(issueCondition); +// } /*else{ +// results = this.issueMapper.findByDepartment(issueCondition); +// totalCount = this.issueMapper.countByDepartment(issueCondition); +// }*/ results = this.issueMapper.find(issueCondition); totalCount = this.issueMapper.count(issueCondition); @@ -1239,6 +1255,9 @@ condition.setLoginUserId(this.webAppUtil.getLoginId()); condition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); + User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); + // �봽濡쒖젥�듃 �궎媛� 議댁옱�븷 寃쎌슦 �봽濡쒖젥�듃 �궎�뿉 �빐�떦�븯�뒗 �봽濡쒖젥�듃瑜� 議고쉶�븯怨� 寃��깋 議곌굔�뿉 �뀑�똿�븳�떎. if (!this.getProjectByProjectKey(condition.getProjectKey(), condition)) { return false; @@ -1246,9 +1265,17 @@ // �봽濡쒖젥�듃瑜� �꽑�깮�븯吏� �븡�븯�쑝硫� �빐�떦 �뾽臾� 怨듦컙�뿉�꽌 李몄뿬�븯怨� �엳�뒗 �봽濡쒖젥�듃瑜� 李얜뒗�떎. if (condition.getProjectIds().size() < 1) { - List<Map<String, Object>> projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectStatues, condition.getProjectType()); - List<Long> projectIds = Lists.newArrayList(); + List<Map<String, Object>> projects = Lists.newArrayList(); + if (this.userWorkspaceService.checkWorkspaceManager(user) || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)){ + return true; + }/*else if (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)){ + projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectStatues, condition.getProjectType()); + }*/ + else { + projects = this.projectService.findByWorkspaceIdAndIncludeProject(projectStatues, condition.getProjectType()); + } + List<Long> projectIds = Lists.newArrayList(); for (Map<String, Object> result : projects) { Long projectId = MapUtil.getLong(result, "id"); @@ -1288,7 +1315,8 @@ List<Map<String, Object>> projects = null; UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (this.userWorkspaceService.checkWorkspaceManager(user) - || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { + || (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT) && + MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE))) { projects = this.projectMapper.findByWorkspaceManagerAll(projectCondition); } else { projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectCondition); @@ -1443,13 +1471,19 @@ // �씠�뒋 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎. @Override @Transactional(readOnly = true) - public void detailIssue(Map<String, Object> resJsonData, IssueCondition issueCondition) { + public void detailIssue(Map<String, Object> resJsonData, IssueCondition issueCondition, Pageable relPageable, Pageable downPageable) { IssueVo issueVo = new IssueVo(); if (issueCondition.getId() != null) { Issue issue = this.getIssue(issueCondition.getId()); issueVo = ConvertUtil.copyProperties(issue, IssueVo.class); User user = this.webAppUtil.getLoginUserObject(); + + issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); + issueVo.setRelPageSize(relPageable.getPageSize()); + + issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); + issueVo.setDownPageSize(downPageable.getPageSize()); switch (issueCondition.getDeep()) { case "01": // �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦遺��꽌, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� �뀑�똿�븳�떎. @@ -1466,7 +1500,6 @@ this.setIssueCustomFields(issue, issueVo); // �궗�슜�옄 �젙�쓽 �븘�뱶 媛� �젙蹂� �뀑�똿 this.setRelationIssue(issue, issueVo); //�뿰愿� �씪媛� �뀑�똿 this.setDownIssues(issue, issueVo); //�븯�쐞 �씠�뒋 �꽭�똿 - break; case "02": // �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦�옄, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂�, �뙎湲�, 湲곕줉�쓣 �뀑�똿�븳�떎. @@ -1476,11 +1509,19 @@ break; } } + Long relTotalCount = issueVo.getRelTotalCount(); + int relTotalPage = issueVo.getRelTotalPage(); + Long downTotalCount = issueVo.getDownTotalCount(); + int downTotalPage = issueVo.getDownTotalPage(); // �궗�슜�옄 �떆�뒪�뀥 湲곕뒫 �궗�슜 �젙蹂� �닔吏� log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(this.webAppUtil.getLoginUser(), ElasticSearchConstants.ISSUE_DETAIL)); resJsonData.put(Constants.RES_KEY_CONTENTS, issueVo); + resJsonData.put(Constants.REQ_KEY_RELATION_ISSUE_PAGE_VO, new ResPage(relPageable.getPageNumber(), relPageable.getPageSize(), + relTotalPage, relTotalCount)); + resJsonData.put(Constants.REQ_KEY_DOWN_ISSUE_PAGE_VO, new ResPage(downPageable.getPageNumber(), downPageable.getPageSize(), + downTotalPage, downTotalCount)); } // �뀒�씠釉� �꽕�젙 �뀑�똿 @@ -1505,8 +1546,13 @@ // �븯�쐞 �씠�뒋 �젙蹂대�� �뀑�똿�븳�떎 private void setDownIssues(Issue issue, IssueVo issueVo) { - List<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId()); - if(downIssues != null && downIssues.size()>0){ + //List<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId()); + int startPage = (int) Math.floor(issueVo.getDownPage()/issueVo.getDownPageSize()); + Pageable pageable = PageRequest.of(startPage, issueVo.getDownPageSize()); + Page<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId(), pageable); + issueVo.setDownTotalPage(downIssues.getTotalPages()); + issueVo.setDownTotalCount(downIssues.getTotalElements()); + if(downIssues != null){ List<IssueVo> resultList = new ArrayList<>(); for(Issue downIssue : downIssues){ IssueVo downIssueVo = ConvertUtil.copyProperties(downIssue, IssueVo.class); @@ -1521,6 +1567,10 @@ this.setRegister(downIssue, downIssueVo); // �벑濡앹옄 this.setIssueDepartment(downIssue, downIssueVo); // �떞�떦遺��꽌 �젙蹂� �뀑�똿 this.setIssueCustomFields(downIssue, downIssueVo); // �궗�슜�옄�젙�쓽�븘�뱶 �젙蹂� �꽭�똿 + this.setIssueHistory(downIssue, downIssueVo); // �씠�뒋 湲곕줉 �젙蹂� �뀑�똿 + this.setIssueComments(downIssue, downIssueVo); // �뙎湲� �젙蹂� �뀑�똿 + + downIssueVo.setModifyPermissionCheck(issueVo.getModifyPermissionCheck()); resultList.add(downIssueVo); } @@ -1544,10 +1594,10 @@ this.setIssueDepartment(issue, issueVo); // �떞�떦遺��꽌 �젙蹂� �뀑�똿 this.setAttachedFiles(issue, issueVo); // 泥⑤� �뙆�씪 �젙蹂� �뀑�똿 this.setIssueCustomFields(issue, issueVo); // �궗�슜�옄 �젙�쓽 �븘�뱶 媛� �젙蹂� �뀑�똿 - this.setIssueComments(issue, issueVo); // �뙎湲� �젙蹂� �뀑�똿 - this.setIssueHistory(issue, issueVo); // �씠�뒋 湲곕줉 �젙蹂� �뀑�똿 this.setRelationIssue(issue, issueVo); //�뿰愿� �씪媛� �뀑�똿 this.setDownIssues(issue, issueVo); //�븯�쐞 �씪媛� �꽭�똿 + this.setIssueComments(issue, issueVo); // �뙎湲� �젙蹂� �뀑�똿 + this.setIssueHistory(issue, issueVo); // �씠�뒋 湲곕줉 �젙蹂� �뀑�똿 IssueType issueType = this.issueTypeService.getIssueType(issueVo.getIssueTypeVo().getId()); // �씠�뒋�쓽 �씠�뒋�쑀�삎 媛앹껜 Integer using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; // �씠�뒋�쑀�삎蹂꾨줈 �궗�슜以묒씤 �뾽泥�/ISP/�샇�뒪�똿 媛� @@ -1602,13 +1652,18 @@ // �뿰愿� �씠�뒋 �젙蹂대�� �뀑�똿�븳�떎 private void setRelationIssue(Issue issue, IssueVo issueVo) { - Set<IssueRelation> issueRelations = issue.getIssueRelations(); - if (issue != null && issueVo != null && issueRelations.size() > 0) { - for (IssueRelation issueRelation : issueRelations) { - IssueRelationVo issueRelationVo = ConvertUtil.copyProperties(issueRelation, IssueRelationVo.class); + //Set<IssueRelation> issueRelations = issue.getIssueRelations(); + List<Map<String, Object>> results = this.issueRelationMapper.findByIssueId(issueVo); + Long totalCount = this.issueRelationMapper.count(issueVo); - Issue relationIssue = issueRelation.getRelationIssue(); + int totalPage = (int) Math.ceil((totalCount - 1) / issueVo.getRelPageSize()) + 1; + issueVo.setRelTotalPage(totalPage); + issueVo.setRelTotalCount(totalCount); + if (issue != null && issueVo != null && results.size() > 0) { + for (Map<String, Object> result : results) { + IssueRelationVo issueRelationVo = ConvertUtil.convertMapToClass(result, IssueRelationVo.class); + Issue relationIssue = this.findOne(issueRelationVo.getId()); IssueVo relIssueVo = ConvertUtil.copyProperties(relationIssue, IssueVo.class); Project project = this.projectService.getProject(relationIssue.getProject().getId()); relIssueVo.setProjectId(project.getId()); @@ -1624,6 +1679,8 @@ IssueStatusVo issueStatusVo = ConvertUtil.copyProperties(relationIssue.getIssueStatus(), IssueStatusVo.class, "issueStatusType"); issueStatusVo.setIssueStatusType(relationIssue.getIssueStatus().getIssueStatusType().toString()); issueRelationVo.setIssueStatusVo(issueStatusVo); + + issueRelationVo.setModifyPermissionCheck(issueVo.getModifyPermissionCheck()); this.setRegister(relationIssue, relIssueVo); // �벑濡앹옄 this.setIssueDepartment(relationIssue, relIssueVo); // �떞�떦遺��꽌 �젙蹂� �뀑�똿 @@ -1729,7 +1786,7 @@ // �씠�뒋 湲곕줉 �젙蹂대�� �뀑�똿�븳�떎. private void setIssueHistory(Issue issue, IssueVo issueVo) { - issueVo.setIssueHistoryVos(this.issueHistoryService.findIssueHistory(issue.getId())); + issueVo.setIssueHistoryVos(this.issueHistoryService.findIssueHistory(issue)); } // �궗�슜�옄 �젙�쓽 �븘�뱶 媛믪씠 媛숈� �씠�뒋 李얘린 @@ -1741,10 +1798,15 @@ List<Issue> resultIssueVos = Lists.newArrayList(); String comma = ","; + List<String> userValues = Lists.newArrayList(); if (issueCustomFieldValueForms.size() > 0) { + IssueCustomFieldValueFormComparator comp = new IssueCustomFieldValueFormComparator(); + Collections.sort(issueCustomFieldValueForms, comp); + String concatUseValue = ""; for (int i = 0; i < issueCustomFieldValueForms.size(); i++) { IssueCustomFieldValueForm issueCustomFieldValueForm = issueCustomFieldValueForms.get(i); + userValues.add(issueCustomFieldValueForm.getUseValue()); if (i > 0) { concatUseValue = concatUseValue.concat(comma); } @@ -1753,6 +1815,7 @@ IssueCustomFieldValueCondition issueCustomFieldValueCondition = new IssueCustomFieldValueCondition(); issueCustomFieldValueCondition.setUseValue(concatUseValue); + issueCustomFieldValueCondition.setUseValues(userValues); issueCustomFieldValueCondition.setIssueTypeId(issueApiform.getIssueTypeId()); List<Map<String, Object>> results = this.issueMapper.findByCustomFieldValue(issueCustomFieldValueCondition); if (results != null && results.size() > 0) { @@ -1788,21 +1851,28 @@ List<Issue> issues = Lists.newArrayList(); for (Issue issueVo : issue) { issueForm.setId(issueVo.getId()); + issueForm.setTitle(issueVo.getTitle()); // �옄�룞 醫낅즺 �긽�깭 �꽕�젙�씠 �릺�뼱 �엳吏� �븡�쑝硫� �삤瑜섎컻�깮 Issue modifyIssue = this.modifyIssueForApi(user, issueForm, files); Issue parentIssue = modifyIssue.getParentIssue(); IssueType issueType = modifyIssue.getIssueType(); - IssueStatus issueStatus = issueType.getIssueStatus(); + + Set<IssueTypeApiEndStatus> issueTypeApiEndStatuses = issueType.getIssueTypeApiEndStatuses(); + IssueTypeApiEndStatus issueStatus = null; + if (issueTypeApiEndStatuses != null && issueTypeApiEndStatuses.size() > 0) { + issueStatus = issueTypeApiEndStatuses.iterator().next(); + } else { + throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST)); + } + if (parentIssue != null) { - if (issueStatus == null) { - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST)); - } + IssueCondition issueCondition = new IssueCondition(issueVo.getId(), parentIssue.getId()); List<Map<String, Object>> results = this.issueMapper.findNotCompleteByParentIssueId(issueCondition); // �븯�쐞 �씪媛먯씠 紐⑤몢 醫낅즺 �긽�깭�씪�븣 �긽�쐞 �씪媛먮룄 醫낅즺 泥섎━ if (results == null || results.size() == 0) { - parentIssue.setIssueStatus(issueType.getIssueStatus()); + parentIssue.setIssueStatus(issueStatus.getIssueStatus()); this.issueRepository.saveAndFlush(parentIssue); } } @@ -1869,6 +1939,13 @@ // �씠�뒋 �닔�젙(API�슜) private Issue modifyIssueForApi(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { CheckIssueData checkIssueData = this.checkIssue(user, issueForm); + + if (issueForm.getComment() != null && !issueForm.getComment().equals("")) { //�뙎湲� 異붽� + IssueCommentForm issueCommentForm = new IssueCommentForm(); + issueCommentForm.setDescription(issueForm.getComment()); + issueCommentForm.setIssueId(issueForm.getId()); + this.issueCommentService.addIssueComment(issueCommentForm, user); + } // �씠�뒋 �씠�젰 �궓湲곌린 this.addIssueHistoryModify(user, issueForm, checkIssueData, multipartFiles); @@ -1973,11 +2050,11 @@ log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(userVo, ElasticSearchConstants.ISSUE_MODIFY)); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm.getIssueCompanyFields()); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm.getIssueIspFields()); + this.issueIspService.modifyIssueIspField(issue, issueForm); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm.getIssueHostingFields()); + this.issueHostingService.modifyIssueHostingField(issue, issueForm); return issue; } @@ -2241,6 +2318,19 @@ this.verifyIssueModifyPermission(issue, user); IssueStatus issueStatus = this.issueStatusService.getIssueStatus(issueForm.getIssueStatusId()); + + if (issueStatus.getIssueStatusType().toString().equals("CLOSE")) { + List<String> downIssuesStatus = issueForm.getDownIssuesStatus(); + if (downIssuesStatus != null && downIssuesStatus.size() > 0) { + for (String downIssueStatus : downIssuesStatus) { + if (!downIssueStatus.equals("CLOSE")) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_MODIFY_STATUS)); + } + } + } + } + // �씠�뒋 �긽�깭瑜� 蹂�寃쏀븷 �븣 �꽑�깮�븳 �씠�뒋 �긽�깭濡� 蹂�寃쏀븷 �닔 �엳�뒗吏� �솗�씤�븳�떎. this.issueStatusService.checkNextIssueStatus(issue, issueStatus); // 蹂�寃� �씠�젰 �젙蹂� 異붿텧 @@ -2834,11 +2924,8 @@ excelInfo.setFileName(this.messageAccessor.message("common.registerExcelIssue")); // �뿊��濡� �씠�뒋 �벑濡앺븯湲� excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.title"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �젣紐� excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.content"), 40, ExportExcelAttrVo.ALIGN_CENTER)); // �궡�슜 - excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.projectKey"), 10, ExportExcelAttrVo.ALIGN_LEFT)); // �봽濡쒖젥�듃 �궎 - excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.issueType"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �씠�뒋 ���엯 excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.priority"), 5, ExportExcelAttrVo.ALIGN_CENTER)); // �슦�꽑�닚�쐞 excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.importance"), 5, ExportExcelAttrVo.ALIGN_CENTER)); // 以묒슂�룄 - excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.department"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦遺��꽌 excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.startDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떆�옉�씪 excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.endDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 醫낅즺�씪 // �봽濡쒖젥�듃�뿉 �뿰寃곕맂 �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� 異붿텧�븯�뿬 �뿊�� download �뀥�뵆由우쓣 留뚮뱺�떎. @@ -2862,7 +2949,7 @@ // �뿊�� import 濡� �씠�뒋瑜� �벑濡앺븳�떎. @Override @Transactional - public void importExcel(MultipartFile multipartFile) throws Exception { + public void importExcel(IssueForm issueForm, MultipartFile multipartFile) throws Exception { /*StopWatch serviceStart = new StopWatch(); serviceStart.start();*/ @@ -2873,19 +2960,16 @@ // �뾽濡쒕뱶 �뙆�씪 �솗�옣�옄 泥댄겕 this.verifyMultipartFileExtension(multipartFile); - Map<String, Project> projectMaps = new HashMap<>(); // �봽濡쒖젥�듃 紐⑥쓬 - Map<String, IssueType> issueTypeMaps = new HashMap<>(); // �씠�뒋 ���엯 紐⑥쓬 Map<String, Priority> priorityMaps = new HashMap<>(); // �슦�꽑 �닚�쐞 紐⑥쓬 Map<String, Severity> severityMaps = new HashMap<>(); // 以묒슂�룄 紐⑥쓬 - Map<String, Object> userMaps = new HashMap<>(); // �궗�슜�옄 紐⑥쓬 - Map<String, Object> departmentMaps = new HashMap<>(); // 遺��꽌 紐⑥쓬 + Map<String, DepartmentVo> departmentMaps = new HashMap<>(); // 遺��꽌 紐⑥쓬 Map<String, CustomField> customFieldMaps = new HashMap<>(); - Map<String, IssueStatus> issueStatusReadyMaps = new HashMap<>(); // �긽�깭 �냽�꽦 '��湲�'�씤 �씠�뒋 �긽�깭 Map<Long, Long> issueNumberMaps = new HashMap<>(); // �씠�뒋 踰덊샇 紐⑥쓬 Map<String, Long> issueTypeCustomFieldMaps = new HashMap<>(); // �씠�뒋 ���엯 + �궗�슜�옄 �젙�쓽 �븘�뱶 �뿰寃� �젙蹂� + Workspace workspace = this.workspaceService.getWorkspace(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); // �씠�뒋瑜� �꽔�쑝�젮�뒗 �뾽臾� 怨듦컙 // �씠�뒋�쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�씠�뒋 �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎. - this.IssueAttributeMapToList(projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, departmentMaps, customFieldMaps, issueNumberMaps, issueTypeCustomFieldMaps, issueStatusReadyMaps); + this.IssueAttributeMapToList(priorityMaps, severityMaps, departmentMaps, customFieldMaps, issueTypeCustomFieldMaps); // 0.237 - 0.230 List<IssueForm> issueForms = Lists.newArrayList(); @@ -2928,7 +3012,14 @@ // 1踰� �뿤�뜑遺��꽣 �뜲�씠�꽣 �쁺�뿭 if (rowIndex > 1) { // �씠�뒋濡� �벑濡앺븯湲� �쐞�빐 IssueForm �뿉 �뜲�씠�꽣瑜� �뀑�똿�븳�떎. - issueForms.add(this.setIssueFormToExcelField(row, (rowIndex + 1), issueStatusReadyMaps, projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, customFieldMaps, issueNumberMaps, headers)); + IssueForm newIssueForm = this.setIssueFormToExcelField(row, (rowIndex + 1), priorityMaps, severityMaps, departmentMaps, customFieldMaps, headers); + ConvertUtil.copyProperties(issueForm, newIssueForm); + + + + issueForms.add(newIssueForm); + + } } @@ -2939,7 +3030,46 @@ // �씠�뒋 �벑濡� - this.issueMapper.insertBatch(issueForms); +// this.issueMapper.insertBatch(issueForms); + + for (IssueForm saveIssueForm : issueForms) { + Issue issue = new Issue(); + ConvertUtil.copyProperties(saveIssueForm, issue); + + IssueType issueType = this.issueTypeService.getIssueType(saveIssueForm.getIssueTypeId()); + Workflow workflow = issueType.getWorkflow(); + + Project project = this.projectService.getProject(saveIssueForm.getProjectId()); + Long issueNumber = this.issueNumberGeneratorService.generateIssueNumber(project); + + IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(workflow); + + issue.setPriority(this.priorityService.getPriority(saveIssueForm.getPriorityId())); + issue.setSeverity(this.severityService.getSeverity(saveIssueForm.getSeverityId())); + issue.setIssueStatus(issueStatus); + issue.setIssueType(issueType); + issue.setProject(project); + issue.setIssueNumber(issueNumber); + issue.setParentIssue(this.getIssue(saveIssueForm.getParentIssueId())); + + issue = this.issueRepository.saveAndFlush(issue); + + saveIssueForm.setId(issue.getId()); + + IssueDepartment issueDepartment = new IssueDepartment(); + issueDepartment.setIssue(issue); + issueDepartment.setWorkspace(workspace); + + List<Long> departmentsIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow); + for (Long departmentId : departmentsIds) { + issueDepartment.setDepartment(this.departmentService.getDepartment(departmentId)); + } + issue.addIssueDepartment(issueDepartment); + + saveIssueForm.setIssueStatusId(issueStatus.getId()); + } + + // 0.416 - 0.439 // 1.373 ~ 1.394 @@ -2969,7 +3099,8 @@ // reverse index �뾽�뜲�씠�듃 this.issueMapper.updateBatch(issueForms); // 利앷��맂 �씠�뒋 踰덊샇瑜� �뾽�뜲�씠�듃 �븳�떎. - this.issueNumberGeneratorService.updateIssueNumber(issueNumberMaps); +// issueNumberMaps.put(issueForm.getProjectId(), issueForm.getProjectId()); +// this.issueNumberGeneratorService.updateIssueNumber(issueNumberMaps); } } @@ -3078,51 +3209,8 @@ } // �씠�뒋�쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�씠�뒋 �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎. - private void IssueAttributeMapToList(Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps, - Map<String, Object> userMaps, Map<String, Object> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, Map<String, Long> issueTypeCustomFieldMaps, Map<String, IssueStatus> issueStatusReadyMaps) { - // �봽濡쒖젥�듃 �궎濡� 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮� - List<Project> projects = this.projectService.findByWorkspaceId(); - List<Long> projectIds = Lists.newArrayList(); - - for (Project project : projects) { - projectIds.add(project.getId()); - // �빐�떦 �봽濡쒖젥�듃�뿉�꽌 �깮�꽦�릺�뒗 �떎�쓬 �씠�뒋 踰덊샇瑜� �깮�꽦�빐�삩�떎. - issueNumberMaps.put(project.getId(), this.issueNumberGeneratorService.generateIssueNumber(project)); - projectMaps.put(project.getProjectKey(), project); - - for (IssueTypeCustomField issueTypeCustomField : project.getIssueTypeCustomFields()) { - // 鍮좊Ⅴ寃� 李얘린 �쐞�빐 �씠�뒋 ���엯 �븘�씠�뵒 + �궗�슜�옄 �젙�쓽 �븘�뱶 �븘�씠�뵒瑜� �궎濡� �븳�떎. - String makeKey = issueTypeCustomField.getIssueType().getId().toString() + issueTypeCustomField.getCustomField().getId().toString(); - issueTypeCustomFieldMaps.put(makeKey, issueTypeCustomField.getId()); - } - - // �봽濡쒖젥�듃�뿉 李몄뿬�븯�뒗 �궗�슜�옄 �젙蹂� - List<Map<String, Object>> users = this.userService.findProjectMember(project); - Map<String, Object> userMap = new HashMap<>(); - // �궗�슜�옄 �젙蹂대�� Map �뿉 ���옣 - for (Map<String, Object> user : users) { - userMap.put(CommonUtil.decryptAES128(MapUtil.getString(user, "account")), MapUtil.getLong(user, "userId")); - } - - userMaps.put(project.getProjectKey(), userMap); - - // �봽濡쒖젥�듃�뿉 李몄뿬�븯�뒗 遺��꽌 �젙蹂� - List<Map<String, Object>> departments = this.departmentService.findProjectDepartment(project); - List<Long> departmentList = Lists.newArrayList(); - // 遺��꽌 �젙蹂대�� ���옣 - for (Map<String, Object> department : departments) { - departmentList.add(MapUtil.getLong(department, "departmentId")); - } - } - - // �씠�뒋 �쑀�삎�쓣 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮� - List<IssueType> issueTypes = this.issueTypeService.findByWorkspaceId(); - for (IssueType issueType : issueTypes) { - issueTypeMaps.put(issueType.getName(), issueType); - - IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(issueType.getWorkflow()); - issueStatusReadyMaps.put(issueType.getId().toString(), issueStatus); - } + private void IssueAttributeMapToList(Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps, + Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps,Map<String, Long> issueTypeCustomFieldMaps) { // �슦�꽑�닚�쐞瑜� 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮� List<Priority> priorities = this.priorityService.findByWorkspaceId(); @@ -3144,8 +3232,9 @@ } // �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �씠�뒋 form �쑝濡� �삷湲대떎. - private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, IssueStatus> issueStatusReadyMaps, Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String, - Priority> priorityMaps, Map<String, Severity> severityMaps, Map<String, Object> userMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, List<String> headers) { + private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps, + Map<String, Severity> severityMaps, Map<String, DepartmentVo> departmentMaps, + Map<String, CustomField> customFieldMaps, List<String> headers) { IssueForm issueForm = new IssueForm(); issueForm.setRegisterId(this.webAppUtil.getLoginId()); Project project = null; @@ -3169,40 +3258,33 @@ break; - case 2: // �봽濡쒖젥�듃 �궎�� �씠�뒋 踰덊샇 - project = this.setIssueFormProjectKeyAndIssueNumber(cell, issueForm, projectMaps, issueNumberMaps, rowIndex); - break; - - case 3: - // �씠�뒋 ���엯�쓣 IssueForm �뿉 ���옣�븳�떎. - this.setIssueFormIssueType(cell, issueTypeMaps, issueForm, rowIndex); - // �씠�뒋 ���엯�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦�쓽 �긽�깭 �냽�꽦 '��湲�' �씤 �긽�깭瑜� issueForm �뿉 ���옣�븳�떎. - this.setIssueFormIssueStatus(issueStatusReadyMaps, issueForm, rowIndex); - break; - - case 4: + case 2: // �슦�꽑�닚�쐞瑜� IssueForm �뿉 ���옣�븳�떎. this.setIssueFormPriority(cell, priorityMaps, issueForm, rowIndex); break; - case 5: + case 3: // 以묒슂�룄瑜� IssueForm �뿉 ���옣�븳�떎. this.setIssueFormSeverity(cell, severityMaps, issueForm, rowIndex); break; - case 6: - // �떞�떦遺��꽌瑜� IssueForm �뿉 ���옣�븳�떎. + /*case 6: + // �떞�떦�옄瑜� IssueForm �뿉 ���옣�븳�떎. this.setIssueFormAssignee(cell, userMaps, issueForm, project); - break; - case 7: + break;*/ + case 4: // �떆�옉�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - this.setIssueFormPeriod(cell, issueForm, true, rowIndex); + if (cell != null) { + this.setIssueFormPeriod(cell, issueForm, true, rowIndex); + } break; - case 8: + case 5: // 醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - this.setIssueFormPeriod(cell, issueForm, false, rowIndex); + if (cell != null) { + this.setIssueFormPeriod(cell, issueForm, false, rowIndex); + } break; default: - // 8踰� �씠�긽遺��꽣�뒗 �궗�슜�옄 �젙�쓽 �븘�뱶. �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎. + // 9踰� 遺��꽣�뒗 �궗�슜�옄 �젙�쓽 �븘�뱶. �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎. this.setIssueFormCustomFieldValue(cell, customFieldMaps, issueForm, headers.get(cellIndex), rowIndex); } } @@ -3222,17 +3304,6 @@ // �젣紐� �쑀�슚�꽦 泥댄겕 this.verifyTitle(title); issueForm.setTitle(title); - } - - // �봽濡쒖젥�듃 �궎, �씠�뒋 怨좎쑀 踰덊샇, �떞�떦�옄瑜� IssueForm �뿉 ���옣�븳�떎. - private Project setIssueFormProjectKeyAndIssueNumber(Cell cell, IssueForm issueForm, Map<String, Project> projectMaps, Map<Long, Long> issueNumberMaps, int rowIndex) { - // �봽濡쒖젥�듃 �븘�씠�뵒瑜� IssueForm �뿉 ���옣�븳�떎. - Project project = this.setIssueFormProject(cell, projectMaps, issueForm, rowIndex); - - // �씠�뒋 怨좎쑀 踰덊샇瑜� IssueForm �뿉 ���옣�븳�떎. - this.setIssueFormIssueNumber(issueForm, issueNumberMaps, project, rowIndex); - - return project; } // �봽濡쒖젥�듃 �븘�씠�뵒瑜� IssueForm �뿉 ���옣�븳�떎. @@ -3268,34 +3339,6 @@ issueNumberMaps.put(project.getId(), ++issueNumber); // �씠�뒋 踰덊샇瑜� 1�뵫 利앷� �떆�궓�떎. } - // �씠�뒋 ���엯�쓣 IssueForm �뿉 ���옣�븳�떎. - private void setIssueFormIssueType(Cell cell, Map<String, IssueType> issueTypeMaps, IssueForm issueForm, int rowIndex) { - if (cell == null) { - throw new OwlRuntimeException( - this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TYPE_IS_NULL, rowIndex)); - } - - IssueType issueType = issueTypeMaps.get(CommonUtil.convertExcelStringToCell(cell)); - - if (issueType == null) { - throw new OwlRuntimeException( - this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TYPE_NOT_EXIST, rowIndex)); - } - - issueForm.setIssueTypeId(issueType.getId()); - } - - // �씠�뒋 ���엯�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦�쓽 �긽�깭 �냽�꽦 '��湲�' �씤 �긽�깭瑜� issueForm �뿉 ���옣�븳�떎. - private void setIssueFormIssueStatus(Map<String, IssueStatus> issueStatusReadyMaps, IssueForm issueForm, int rowIndex) { - IssueStatus issueStatus = issueStatusReadyMaps.get(issueForm.getIssueTypeId().toString()); - - if (issueStatus == null) { - throw new OwlRuntimeException( - this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_STATUS_READY_NOT_EXIST, rowIndex)); - } - - issueForm.setIssueStatusId(issueStatus.getId()); - } // �슦�꽑�닚�쐞瑜� IssueForm �뿉 ���옣�븳�떎. private void setIssueFormPriority(Cell cell, Map<String, Priority> priorityMaps, IssueForm issueForm, int rowIndex) { @@ -3331,27 +3374,30 @@ issueForm.setSeverityId(severity.getId()); } - // �떞�떦遺��꽌瑜� IssueForm �뿉 ���옣�븳�떎. private void setIssueFormAssignee(Cell cell, Map<String, Object> userMaps, IssueForm issueForm, Project project) { if (cell != null) { String[] splitAssignee = CommonUtil.convertExcelStringToCell(cell).split("#"); Map<String, Object> userMap = (Map<String, Object>) MapUtil.getObject(userMaps, project.getProjectKey()); - List<Long> departmentIds = Lists.newArrayList(); + List<Long> userIds = Lists.newArrayList(); for (String account : splitAssignee) { if (MapUtil.getLong(userMap, account) != null) { - departmentIds.add(MapUtil.getLong(userMap, account)); + userIds.add(MapUtil.getLong(userMap, account)); } } - - issueForm.setDepartmentIds(departmentIds); + issueForm.setUserIds(userIds); } } - // �떆�옉�씪, 醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎. private void setIssueFormPeriod(Cell cell, IssueForm issueForm, Boolean checkStartDate, int rowIndex) { if (cell != null && !cell.toString().equals("")) { + + // 媛믪씠 怨듬갚�씠硫� 以묒� + String cellValue = CommonUtil.convertExcelStringToCell(cell); + if (StringUtils.isEmpty(cellValue)) { + return; + } Date startDate; @@ -3378,7 +3424,7 @@ } } - // �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎. + // �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎.- private void setIssueFormCustomFieldValue(Cell cell, Map<String, CustomField> customFieldMaps, IssueForm issueForm, String customFieldName, int rowIndex) { if (cell != null) { String cellValue = CommonUtil.convertExcelStringToCell(cell); @@ -3715,28 +3761,31 @@ @Transactional @Override public void modifyParentIssue(IssueForm issueDownForm) { - Issue issue = this.getIssue(issueDownForm.getId()); //�븯�쐞 �씠�뒋 + //Issue issue = this.getIssue(issueDownForm.getId()); //�븯�쐞 �씠�뒋 Long newParentIssueId = issueDownForm.getParentIssueId(); //蹂�寃쏀븷 �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋 - StringBuilder sb = new StringBuilder(); - Issue parentIssue = issue.getParentIssue(); //蹂�寃� �쟾 �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋 - if(parentIssue != null && parentIssue.getId().equals(newParentIssueId)){ //蹂�寃� �쟾 �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋媛� 議댁옱 �븷 寃쎌슦 - this.issueHistoryService.detectDownIssues(IssueHistoryType.DELETE, issue, sb); - this.issueHistoryService.addIssueHistory(parentIssue, IssueHistoryType.MODIFY, sb.toString()); - } + for (Long downId : issueDownForm.getIds()) { + Issue issue = this.getIssue(downId); - if (newParentIssueId != null) { // 異붽� �븷 寃쎌슦 - parentIssue = this.getIssue(newParentIssueId); //�긽�쐞�씠�뒋(myIssue) - issue.setParentIssue(parentIssue); //myIssue瑜� �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋濡� set - this.issueHistoryService.detectDownIssues(IssueHistoryType.ADD, issue, sb); //issue = �븯�쐞�씠�뒋 - } else{ - // �궘�젣 �븷 寃쎌슦 - this.issueHistoryService.detectDownIssues(IssueHistoryType.DELETE, issue, sb); - issue.setParentIssue(null); + Issue parentIssue = issue.getParentIssue(); //蹂�寃� �쟾 �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋 + if(parentIssue != null && parentIssue.getId().equals(newParentIssueId)){ //蹂�寃� �쟾 �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋媛� 議댁옱 �븷 寃쎌슦 + this.issueHistoryService.detectDownIssues(IssueHistoryType.DELETE, issue, sb); + this.issueHistoryService.addIssueHistory(parentIssue, IssueHistoryType.MODIFY, sb.toString()); + } + + if (newParentIssueId != null) { // 異붽� �븷 寃쎌슦 + parentIssue = this.getIssue(newParentIssueId); //�긽�쐞�씠�뒋(myIssue) + issue.setParentIssue(parentIssue); //myIssue瑜� �븯�쐞�씠�뒋�쓽 �긽�쐞�씠�뒋濡� set + this.issueHistoryService.detectDownIssues(IssueHistoryType.ADD, issue, sb); //issue = �븯�쐞�씠�뒋 + } else{ + // �궘�젣 �븷 寃쎌슦 + this.issueHistoryService.detectDownIssues(IssueHistoryType.DELETE, issue, sb); + issue.setParentIssue(null); + } + this.issueHistoryService.addIssueHistory(parentIssue, IssueHistoryType.MODIFY, sb.toString()); //parentIssue = myIssue(湲곕줉�� �쁽�옱 �긽�꽭�럹�씠吏��뿉 �빐�빞�븯�땲源�) + this.issueRepository.saveAndFlush(issue); } - this.issueHistoryService.addIssueHistory(parentIssue, IssueHistoryType.MODIFY, sb.toString()); //parentIssue = myIssue(湲곕줉�� �쁽�옱 �긽�꽭�럹�씠吏��뿉 �빐�빞�븯�땲源�) - this.issueRepository.saveAndFlush(issue); } @Override @@ -3754,4 +3803,17 @@ resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); } } + + @Override + public void findReadyDepartments(Map<String, Object> resJsonData, DepartmentCondition condition, Pageable pageable) { + IssueType issueType = this.issueTypeService.getIssueType(condition.getIssueTypeId()); + if (issueType != null) { + // �씠�뒋 �긽�깭 �쑀�삎�씠 '��湲�' �씤 �씠�뒋 �긽�깭 媛��졇�삤湲� + IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(issueType.getWorkflow()); + condition.setIssueStatusId(issueStatus.getId()); + condition.setWorkflowId(issueType.getWorkflow().getId()); + } + List<Map<String, Object>> departmentVos = this.departmentMapper.findByIssueStatusId(condition); + resJsonData.put(Constants.RES_KEY_CONTENTS, departmentVos); + } } \ No newline at end of file -- Gitblit v1.8.0