From dea4bb128425e06684bf95e8e97613a20cf3bcfa Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 월, 24 1월 2022 18:10:31 +0900 Subject: [PATCH] 이슈 테이블 표시 설정 10 이상 정렬 오류 해결 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 234 +++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 164 insertions(+), 70 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 935974a..a772639 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java @@ -11,6 +11,8 @@ import kr.wisestone.owl.domain.enumType.EmailType; import kr.wisestone.owl.domain.enumType.IssueHistoryType; import kr.wisestone.owl.domain.enumType.IssueStatusType; +import kr.wisestone.owl.exception.ApiAuthException; +import kr.wisestone.owl.exception.ApiParameterException; import kr.wisestone.owl.exception.OwlRuntimeException; import kr.wisestone.owl.mapper.DepartmentMapper; import kr.wisestone.owl.mapper.IssueMapper; @@ -44,7 +46,11 @@ import javax.servlet.http.HttpServletRequest; import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.*; + +import static kr.wisestone.owl.domain.enumType.CustomFieldType.DATETIME; +import static kr.wisestone.owl.domain.enumType.CustomFieldType.INPUT; @Service public class IssueServiceImpl extends AbstractServiceImpl<Issue, Long, JpaRepository<Issue, Long>> implements IssueService { @@ -83,6 +89,9 @@ @Autowired private CompanyFieldService companyFieldService; + + @Autowired + private CompanyFieldCategoryService companyFieldCategoryService; @Autowired private IspFieldService ispFieldService; @@ -207,6 +216,9 @@ @Autowired private IssueRelationMapper issueRelationMapper; + @Autowired + private WorkflowTransitionService workflowTransitionService; + @Override protected JpaRepository<Issue, Long> getRepository() { return this.issueRepository; @@ -235,14 +247,14 @@ private IssueForm convertToIssueForm(IssueApiForm issueApiForm, User user) { if (issueApiForm.getIssueTypeId() == null) { - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); + throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); } IssueForm issueForm = ConvertUtil.copyProperties(issueApiForm, IssueForm.class); // issueForm.setFiles(issueApiForm.getFiles()); IssueType issueType = this.issueTypeService.getIssueType(issueApiForm.getIssueTypeId()); if (issueType == null){ - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); + throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); } Workflow workflow = issueType.getWorkflow(); @@ -256,13 +268,16 @@ } } } else if (issueApiForm.getIssueStatusId() == null){ - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST)); + 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)); } // �봽濡쒖젥�듃 �엯�젰 Project project = issueType.getProject(); if (project == null){ - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_PROJECT_ERROR)); + throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_PROJECT_ERROR)); } issueForm.setProjectId(project.getId()); @@ -321,7 +336,7 @@ return issueForm; } else { - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); + throw new ApiAuthException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); } } @@ -367,6 +382,7 @@ issueForm.setIssueHostingFields(issueHostingFields); } } + return issueForm; } @@ -474,6 +490,8 @@ @Override @Transactional public Issue addIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { + StringBuilder detectIssueChange = new StringBuilder(); + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); // �봽濡쒖젥�듃 �쑀�슚�꽦 泥댄겕 @@ -516,11 +534,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm); + this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm); + this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -567,6 +585,8 @@ @Override @Transactional public Issue addDownIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { + StringBuilder detectIssueChange = new StringBuilder(); + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); // �봽濡쒖젥�듃 �쑀�슚�꽦 泥댄겕 @@ -609,11 +629,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm); + this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm); + this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -644,6 +664,7 @@ @Override @Transactional public Issue addRelIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { + StringBuilder detectIssueChange = new StringBuilder(); // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); // �봽濡쒖젥�듃 �쑀�슚�꽦 泥댄겕 @@ -686,11 +707,11 @@ // �떞�떦遺��꽌 吏��젙 this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm); + this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm); + this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); // 泥⑤� �뙆�씪 ���옣 // multipartFile �쓣 file Map List 媛앹껜濡� 蹂�寃쏀븳�떎. @@ -792,7 +813,7 @@ useValues.add(issueCustomFieldValueVo.getUseValue()); customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), useValues); } else { - if (issueCustomFieldValueVo.getCustomFieldVo().getCustomFieldType().equals(CustomFieldType.INPUT.toString())) { + if (issueCustomFieldValueVo.getCustomFieldVo().getCustomFieldType().equals(INPUT.toString())) { customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), issueCustomFieldValueVo.getUseValue()); } else { customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), Lists.newArrayList(issueCustomFieldValueVo.getUseValue())); @@ -930,22 +951,19 @@ return Lists.newArrayList(); } - // �뒠�떇 �쟾 - 1.3 / 1.2 / 1.1 - // �뒠�떇 �썑 (�떒�씪/�떎以� 寃��깋 議곌굔 3媛� 湲곗�) - 0.49 / 0.41 / 0.47 / 0.41 - List<IssueVo> issueVos = Lists.newArrayList(); // �씠�뒋 紐⑸줉 �뜲�씠�꽣 ���옣 而щ젆�뀡 // �궗�슜�옄 �젙�쓽 �븘�뱶濡� 寃��깋�븳 �씠�뒋 �븘�씠�뵒 媛� List<String> issueKeys = Lists.newArrayList(issueIds); issueCondition.setIssueIds(issueKeys); - - issueCondition.setLoginUserId(this.webAppUtil.getLoginId()); - issueCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); User user = this.webAppUtil.getLoginUserObject(); + + issueCondition.setLoginUserId(user.getId()); + issueCondition.setWorkspaceId(user.getLastWorkspaceId()); List<Map<String, Object>> results = Lists.newArrayList(); Long totalCount = 0L; - UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); +// UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); // if (!this.userWorkspaceService.checkWorkspaceManager(user) // && !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { //理쒓퀬愿�由ъ옄 & �봽濡쒖젥�듃,�씠�뒋 愿�由ъ옄 �씪 寃쎌슦 紐⑤뱺 �씠�뒋 蹂닿린 @@ -955,17 +973,18 @@ // results = this.issueMapper.findByDepartment(issueCondition); // totalCount = this.issueMapper.countByDepartment(issueCondition); // }*/ +// StopWatch serviceStart = new StopWatch(); +// serviceStart.start(); results = this.issueMapper.find(issueCondition); +// serviceStart.stop(); +// log.error("result : " + serviceStart.toString()); + +// serviceStart = new StopWatch(); +// serviceStart.start(); totalCount = this.issueMapper.count(issueCondition); - - // �뒠�떇 �쟾 - 0.8, 0.9, 0.9, 0.9, 0.9 - /*StopWatch serviceStart = new StopWatch(); - serviceStart.start();*/ - // �뒠�떇 �쟾 - 1.1, 1.1, 1.3, 1.2 - - /*serviceStart.stop(); - log.debug("serviceENd1 : " + serviceStart.getTime());*/ +// serviceStart.stop(); +// log.error("totalCount : " + serviceStart.toString()); int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1; // �씠�뒋 �븘�씠�뵒 珥덇린�솕 @@ -981,8 +1000,8 @@ this.setDownIssues(user, issueVos); this.setRelationIssues(issueVos); } - this.setCountDownIssues(issueVos); + this.setCountDownIssues(issueVos); this.SetWorkflowDepartment(issueVos); //�썙�겕�뵆濡쒖슦�뿉 �꽕�젙�븳 �떞�떦遺��꽌 媛��졇�삤湲� resJsonData.put(Constants.RES_KEY_CONTENTS, issueVos); @@ -1487,14 +1506,16 @@ issueVo = ConvertUtil.copyProperties(issue, IssueVo.class); User user = this.webAppUtil.getLoginUserObject(); - - issueVo.setRelPageNumber(relPageable.getPageNumber()); - issueVo.setRelPageSize(relPageable.getPageSize()); - issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); - - issueVo.setDownPageNumber(downPageable.getPageNumber()); - issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); - issueVo.setDownPageSize(downPageable.getPageSize()); + if (relPageable != null) { + issueVo.setRelPageNumber(relPageable.getPageNumber()); + issueVo.setRelPageSize(relPageable.getPageSize()); + issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); + } + if (downPageable != null) { + issueVo.setDownPageNumber(downPageable.getPageNumber()); + issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); + issueVo.setDownPageSize(downPageable.getPageSize()); + } switch (issueCondition.getDeep()) { case "01": // �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦遺��꽌, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� �뀑�똿�븳�떎. @@ -1515,7 +1536,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; } @@ -1527,8 +1548,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) { @@ -1552,7 +1574,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); } @@ -1576,6 +1601,9 @@ this.setIssueCustomFields(downIssue, downIssueVo); // �궗�슜�옄�젙�쓽�븘�뱶 �젙蹂� �꽭�똿 this.setIssueHistory(downIssue, downIssueVo); // �씠�뒋 湲곕줉 �젙蹂� �뀑�똿 this.setIssueComments(downIssue, downIssueVo); // �뙎湲� �젙蹂� �뀑�똿 + this.setIssueCompanyField(downIssue, downIssueVo); //�뾽泥� �젙蹂� �꽭�똿 + this.setIssueIspField(downIssue, downIssueVo); //ISP �젙蹂� �꽭�똿 + this.setIssueHostingField(downIssue, downIssueVo); //HOSTING �젙蹂� �꽭�똿 downIssueVo.setModifyPermissionCheck(issueVo.getModifyPermissionCheck()); @@ -1589,6 +1617,11 @@ @Override @Transactional(readOnly = true) public void setIssueDetail(IssueVo issueVo, Issue issue, User user) { + // �씠�뒋 �닔�젙 沅뚰븳�쓣 媛뽮퀬 �엳�뒗吏� �솗�씤 + if (this.checkHasPermission(issueVo, issueVo.getUserVos(), user, issueVo.getDepartmentVos())) { + issueVo.setModifyPermissionCheck(Boolean.TRUE); + } + issueVo.setProjectVo(ConvertUtil.copyProperties(issue.getProject(), ProjectVo.class)); issueVo.setIssueTypeVo(ConvertUtil.copyProperties(issue.getIssueType(), IssueTypeVo.class)); IssueStatusVo issueStatusVo = ConvertUtil.copyProperties(issue.getIssueStatus(), IssueStatusVo.class, "issueStatusType"); @@ -1624,11 +1657,6 @@ this.setIssueIspField(issue, issueVo); //ISP �젙蹂� �꽭�똿 this.setIssueHostingField(issue, issueVo); //HOSTING �젙蹂� �꽭�똿 this.setParentIssue(issue,issueVo); //�긽�쐞 �씠�뒋 �젙蹂� �꽭�똿 - - // �씠�뒋 �닔�젙 沅뚰븳�쓣 媛뽮퀬 �엳�뒗吏� �솗�씤 - if (this.checkHasPermission(issueVo, issueVo.getUserVos(), user, issueVo.getDepartmentVos())) { - issueVo.setModifyPermissionCheck(Boolean.TRUE); - } } // �긽�쐞�씪媛� �젙蹂� 異붽� @@ -1670,7 +1698,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()); @@ -1692,6 +1720,25 @@ this.setRegister(relationIssue, relIssueVo); // �벑濡앹옄 this.setIssueDepartment(relationIssue, relIssueVo); // �떞�떦遺��꽌 �젙蹂� �뀑�똿 this.setIssueCustomFields(relationIssue, relIssueVo); // �궗�슜�옄�젙�쓽�븘�뱶 �젙蹂� �꽭�똿 + + Set<IssueCompany> issueCompanies = relationIssue.getIssueCompanies(); + Iterator<IssueCompany> itrCompany = issueCompanies.iterator(); + while (itrCompany.hasNext()) { + issueRelationVo.addIssueCompanyVo(ConvertUtil.copyProperties(itrCompany.next(), IssueCompanyVo.class)); + } + + Set<IssueIsp> issueIsps = relationIssue.getIssueIspFields(); + Iterator<IssueIsp> itrIsp = issueIsps.iterator(); + while (itrIsp.hasNext()) { + issueRelationVo.addIssueIspVo(ConvertUtil.copyProperties(itrIsp.next(), IssueIspVo.class)); + } + + Set<IssueHosting> issueHostings = relationIssue.getIssueHostingFields(); + Iterator<IssueHosting> itrHosting = issueHostings.iterator(); + while (itrHosting.hasNext()) { + issueRelationVo.addIssueHostingVo(ConvertUtil.copyProperties(itrHosting.next(), IssueHostingVo.class)); + } + issueVo.addIssueRelationVo(issueRelationVo); } } else { @@ -1824,6 +1871,7 @@ issueCustomFieldValueCondition.setUseValue(concatUseValue); issueCustomFieldValueCondition.setUseValues(userValues); issueCustomFieldValueCondition.setIssueTypeId(issueApiform.getIssueTypeId()); + issueCustomFieldValueCondition.setIssueStatusType("CLOSE"); List<Map<String, Object>> results = this.issueMapper.findByCustomFieldValue(issueCustomFieldValueCondition); if (results != null && results.size() > 0) { for (Map<String, Object> result : results) { @@ -2048,20 +2096,21 @@ this.checkNotHaveIssueIdAttachedFile(issue, issueForm); // �궗�슜�옄 �젙�쓽 �븘�뱶 ���옣 this.issueCustomFieldValueService.modifyIssueCustomFieldValue(issue, issueForm.getIssueCustomFields()); - // �씠�뒋 �씠�젰 �벑濡� - if (!StringUtils.isEmpty(detectIssueChange.toString())) { - this.issueHistoryService.addIssueHistory(issue, user, IssueHistoryType.MODIFY, detectIssueChange.toString()); - } // �궗�슜�옄 �떆�뒪�뀥 湲곕뒫 �궗�슜 �젙蹂� �닔吏� UserVo userVo = ConvertUtil.copyProperties(user, UserVo.class); log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(userVo, ElasticSearchConstants.ISSUE_MODIFY)); // �뾽泥� �젙蹂� ���옣 - this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); + this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); // ISP �젙蹂� ���옣 - this.issueIspService.modifyIssueIspField(issue, issueForm); + this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); // HOSTING �젙蹂� ���옣 - this.issueHostingService.modifyIssueHostingField(issue, issueForm); + this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); + + // �씠�뒋 �씠�젰 �벑濡� + if (!StringUtils.isEmpty(detectIssueChange.toString())) { + this.issueHistoryService.addIssueHistory(issue, user, IssueHistoryType.MODIFY, detectIssueChange.toString()); + } return issue; } @@ -2789,6 +2838,26 @@ CompanyField companyField = issueCompany.getCompanyField(); if (companyField != null) { issueCompanyVo.setCompanyId(issueCompany.getCompanyField().getId()); + if (issueCompany.getCompanyTypeId() != null && issueCompany.getCompanyTypeId() != -1) { + CompanyFieldCategory companyType = this.companyFieldCategoryService.find(issueCompany.getCompanyTypeId()); + issueCompanyVo.setCompanyTypeName(companyType.getUseValue()); + } + if (issueCompany.getParentSectorId() != null && issueCompany.getParentSectorId() != -1) { + CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(issueCompany.getParentSectorId()); + issueCompanyVo.setParentSectorName(parentSector.getUseValue()); + } + if (issueCompany.getChildSectorId() != null && issueCompany.getChildSectorId() != -1) { + CompanyFieldCategory childSector = this.companyFieldCategoryService.find(issueCompany.getChildSectorId()); + issueCompanyVo.setChildSectorName(childSector.getUseValue()); + } + if (issueCompany.getRegionId() != null && issueCompany.getRegionId() != -1) { + CompanyFieldCategory region = this.companyFieldCategoryService.find(issueCompany.getRegionId()); + issueCompanyVo.setRegionName(region.getUseValue()); + } + if (issueCompany.getStatusId() != null && issueCompany.getStatusId() != -1) { + CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId()); + issueCompanyVo.setStatusName(status.getUseValue()); + } } issueCompanyVos.add(issueCompanyVo); } @@ -3271,6 +3340,15 @@ } } + /** + * cell NULL 泥댄겕 �븿�닔 + * @param cell Cell + * @return boolean + */ + private Boolean cellNullCheck (Cell cell) { + return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK; + } + // �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �씠�뒋 form �쑝濡� �삷湲대떎. private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps, Map<String, DepartmentVo> departmentMaps, @@ -3289,7 +3367,7 @@ break; case 1: // �궡�슜 - if (cell != null) { + if (cellNullCheck(cell)) { issueForm.setDescription(CommonUtil.convertExcelStringToCell(cell)); } else { // null �엯�젰 諛⑹� @@ -3313,13 +3391,13 @@ break;*/ case 4: // �떆�옉�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setIssueFormPeriod(cell, issueForm, true, rowIndex); } break; case 5: // 醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setIssueFormPeriod(cell, issueForm, false, rowIndex); } break; @@ -3490,9 +3568,14 @@ case EMAIL: case SITE: case TEL: - if (cellValue.length() > 100) { + if (customField.getCustomFieldType() != INPUT && cellValue.length() > 100) { //INPUT ���엯�� 100�옄 �젣�븳 �뾾�쓬 throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.CUSTOM_FIELD_TEXT_TYPE_MAX_LENGTH_OUT)); + } + + if (customField.getCustomFieldType() == DATETIME) { //DATETIME�씪 寃쎌슦 format 蹂�寃� + Date date = cell.getDateCellValue(); + cellValue = new SimpleDateFormat("yyyy-MM-dd H:mm:ss").format(date); } issueCustomFieldMap.put("customFieldId", customField.getId()); @@ -3638,12 +3721,12 @@ if (emailCommonForm.getSendEmails().size() < 1) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SEND_USER)); - } else if (emailCommonForm.getIssueId() == null) { - throw new OwlRuntimeException( - this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_EXIST)); } - Issue issue = this.getIssue(emailCommonForm.getIssueId()); + Issue issue = null; + if(emailCommonForm.getIssueId() != null) { + issue = this.getIssue(emailCommonForm.getIssueId()); + } // 諛쒖떊�옄 �몴�떆 User user = this.webAppUtil.getLoginUserObject(); @@ -3660,8 +3743,10 @@ } this.systemEmailService.sendEmail(emailCommonForm.getTitle(), emailCommonForm.getDescription(), sendMails, null); - this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, emailCommonForm.getSendEmails(), sb); - this.issueHistoryService.addIssueHistory(issue, IssueHistoryType.SEND, sb.toString()); + if (issue != null) { + this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, emailCommonForm.getSendEmails(), sb); + this.issueHistoryService.addIssueHistory(issue, IssueHistoryType.SEND, sb.toString()); + } } // �삁�빟 諛쒖깮 �씠�뒋瑜� �떎�뻾�븳�떎 @@ -3862,17 +3947,26 @@ @Override public void findPartner(Map<String, Object> resJsonData, Map<String, Object> params) { Long issueTypeId = MapUtil.getLong(params, "issueTypeId"); - IssueType issueType = this.issueTypeService.getIssueType(issueTypeId); // �씠�뒋�쓽 �씠�뒋�쑀�삎 媛앹껜 - Integer using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; // �씠�뒋�쑀�삎蹂꾨줈 �궗�슜以묒씤 �뾽泥�/ISP/�샇�뒪�똿 媛� - List<UsePartnerVo> usePartnerVos = Lists.newArrayList(); + Integer using = 0; + + if (issueTypeId != null) { + IssueType issueType = this.issueTypeService.getIssueType(issueTypeId); // �씠�뒋�쓽 �씠�뒋�쑀�삎 媛앹껜 + using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; // �씠�뒋�쑀�삎蹂꾨줈 �궗�슜以묒씤 �뾽泥�/ISP/�샇�뒪�똿 媛� + } else { + for (int partner : UsePartner.partners) { + using += partner; + } + } + for (Integer usePartner : UsePartner.partners) { //1(�뾽泥�), 2(ISP), 4(�샇�뒪�똿) UsePartnerVo usePartnerVo = UsePartner.checkUsePartner(using, usePartner); if (usePartnerVo != null) { usePartnerVos.add(usePartnerVo); } - resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); } + + resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); } @Override -- Gitblit v1.8.0