| | |
| | | import kr.wisestone.owl.service.*; |
| | | import kr.wisestone.owl.util.*; |
| | | import kr.wisestone.owl.vo.IssueHistoryVo; |
| | | import kr.wisestone.owl.vo.IssueVo; |
| | | import kr.wisestone.owl.web.condition.IssueHistoryCondition; |
| | | import kr.wisestone.owl.web.form.IssueForm; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private DepartmentService departmentService; |
| | | |
| | | @Autowired |
| | | private IssueHistoryMapper issueHistoryMapper; |
| | |
| | | // 이슈 기간 변경 정보를 기록한다. |
| | | this.detectIssuePeriod(issue, issueForm, description); |
| | | // 담당자 변경 정보를 기록한다. |
| | | //this.detectIssueManager(issue, issueForm, description); |
| | | this.detectIssueManager(issue, issueForm, description); |
| | | // 담당부서 변경 정보를 기록한다. |
| | | this.detectIssueDepartment(issue, issueForm, description); |
| | | // 사용자 정의 필드 변경 정보를 기록한다. |
| | | this.detectCustomField(issue, issueForm, description); |
| | | |
| | |
| | | else { |
| | | recodeIssuePeriod.append("<span translate=\"common.unspecified\">미지정</span>"); |
| | | } |
| | | |
| | | return recodeIssuePeriod.toString(); |
| | | } |
| | | |
| | | |
| | | // 연관 일감 변경 정보를 기록한다. |
| | | @Override |
| | |
| | | description.append("<span translate=\"issue.relationIssueRemoveHistory\">연관 일감이 삭제되었습니다. " + issueRelation.getRelationIssue().getTitle() + "</span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueRelation.getRelationIssue().getTitle() + "</span>"); |
| | | } |
| | | } |
| | | |
| | | // 하위 일감 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectDownIssues(IssueHistoryType type, Issue issue, StringBuilder description) { |
| | | if (type == IssueHistoryType.ADD) { |
| | | description.append("<span translate=\"issue.downIssueAddHistory\">하위 일감이 추가되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issue.getTitle() + "</span>"); |
| | | }else { |
| | | description.append("<span translate=\"issue.downIssueRemoveHistory\">하위 일감이 삭제되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issue.getTitle() + "</span>"); |
| | | } |
| | | } |
| | | |
| | | // 업체 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueCompany(IssueHistoryType type, Map<String, Object> param, IssueCompany issueCompany, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | |
| | | if (type == IssueHistoryType.ADD) { //추가 할 경우 |
| | | description.append("<span translate=\"issue.issueCompanyAddHistory\">업체 정보가 추가되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueCompany.getCompanyField().getName() + "</span>"); |
| | | } else if (type == IssueHistoryType.MODIFY) { //수정 할 경우 |
| | | if (id != null && !issueCompany.getId().equals(id)) { |
| | | description.append("<span translate=\"issue.issueCompanyModifyHistory\">업체 정보가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueCompany.getCompanyField().getName() + "</span>"); |
| | | } |
| | | if (param.get("manager") != null && (issueCompany.getManager() == null || !issueCompany.getManager().equals(param.get("manager")))) { |
| | | description.append("<span translate=\"issue.issueCompanyModifyManagerHistory\"> > 업체 정보의 담당자가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("manager") + "</span>"); |
| | | } |
| | | if (param.get("tel") != null && (issueCompany.getTel() == null || !issueCompany.getTel().equals(param.get("tel")))) { |
| | | description.append("<span translate=\"issue.issueCompanyModifyTelHistory\"> > 업체 정보의 전화번호가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("tel") + "</span>"); |
| | | } |
| | | if (param.get("email") != null && (issueCompany.getEmail() == null || !issueCompany.getEmail().equals(param.get("email")))) { |
| | | description.append("<span translate=\"issue.issueCompanyModifyEmailHistory\"> > 업체 정보의 이메일이 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("email") + "</span>"); |
| | | } |
| | | if (param.get("memo") != null && (issueCompany.getMemo() == null || !issueCompany.getMemo().equals(param.get("memo")))) { |
| | | description.append("<span translate=\"issue.issueCompanyModifyMemoHistory\"> > 업체 정보의 비고가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("memo") + "</span>"); |
| | | } |
| | | } else { |
| | | description.append("<span translate=\"issue.issueCompanyRemoveHistory\">업체 정보가 삭제되었습니다. " + issueCompany.getCompanyField().getName() + "</span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueCompany.getCompanyField().getName() + "</span>"); |
| | | } |
| | | } |
| | | |
| | | // ISP 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueIsp(IssueHistoryType type, Map<String, Object> param, IssueIsp issueIsp, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | |
| | | if (type == IssueHistoryType.ADD) { |
| | | description.append("<span translate=\"issue.issueIspAddHistory\">ISP 정보가 추가되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueIsp.getIspField().getName() + "</span>"); |
| | | } else if (type == IssueHistoryType.MODIFY) { |
| | | if (id != null && !issueIsp.getId().equals(id)) { //수정 할 경우 |
| | | description.append("<span translate=\"issue.issueIspModifyHistory\">ISP 정보가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueIsp.getIspField().getName() + "</span>"); |
| | | } |
| | | if (param.get("manager") != null && (issueIsp.getManager() == null || !issueIsp.getManager().equals(param.get("manager")))) { |
| | | description.append("<span translate=\"issue.issueIspModifyManagerHistory\">ISP 정보의 담당자가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("manager") + "</span>"); |
| | | } |
| | | if (param.get("tel") != null && (issueIsp.getTel() == null || !issueIsp.getTel().equals(param.get("tel")))) { |
| | | description.append("<span translate=\"issue.issueIspModifyTelHistory\">ISP 정보의 전화번호가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("tel") + "</span>"); |
| | | } |
| | | if (param.get("email") != null && (issueIsp.getEmail() == null || !issueIsp.getEmail().equals(param.get("email")))) { |
| | | description.append("<span translate=\"issue.issueIspModifyEmailHistory\">ISP 정보의 이메일이 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("email") + "</span>"); |
| | | } |
| | | if (param.get("memo") != null && (issueIsp.getMemo() == null || !issueIsp.getMemo().equals(param.get("memo")))) { |
| | | description.append("<span translate=\"issue.issueIspModifyMemoHistory\">ISP 정보의 비고가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("memo") + "</span>"); |
| | | } |
| | | } else { |
| | | description.append("<span translate=\"issue.issueIspRemoveHistory\">ISP 정보가 삭제되었습니다. " + issueIsp.getIspField().getName() + "</span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueIsp.getIspField().getName() + "</span>"); |
| | | } |
| | | } |
| | | |
| | | // 호스팅 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueHosting(IssueHistoryType type, Map<String, Object> param, IssueHosting issueHosting, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | |
| | | if (type == IssueHistoryType.ADD) { |
| | | description.append("<span translate=\"issue.issueHostingAddHistory\">호스팅 정보가 추가되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueHosting.getHostingField().getName() + "</span>"); |
| | | }else if(type == IssueHistoryType.MODIFY){ |
| | | if(id != null && !issueHosting.getId().equals(id)){ //수정 할 경우 |
| | | description.append("<span translate=\"issue.issueHostingModifyHistory\">호스팅 정보가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueHosting.getHostingField().getName() + "</span>"); |
| | | } |
| | | if(param.get("manager") != null && (issueHosting.getManager() == null || !issueHosting.getManager().equals(param.get("manager")))){ |
| | | description.append("<span translate=\"issue.issueHostingModifyManagerHistory\">호스팅 정보의 담당자가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("manager") + "</span>"); |
| | | } |
| | | if(param.get("tel") != null && (issueHosting.getTel() == null || !issueHosting.getTel().equals(param.get("tel")))){ |
| | | description.append("<span translate=\"issue.issueHostingModifyTelHistory\">호스팅 정보의 전화번호가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("tel") + "</span>"); |
| | | } |
| | | if(param.get("email") != null && (issueHosting.getEmail() == null || !issueHosting.getEmail().equals(param.get("email")))){ |
| | | description.append("<span translate=\"issue.issueHostingModifyEmailHistory\">호스팅 정보의 이메일이 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("email") + "</span>"); |
| | | } |
| | | if(param.get("memo") != null && (issueHosting.getMemo() == null || !issueHosting.getMemo().equals(param.get("memo")))){ |
| | | description.append("<span translate=\"issue.issueHostingModifyMemoHistory\">호스팅 정보의 비고가 변경되었습니다. </span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + param.get("memo") + "</span>"); |
| | | } |
| | | } else { |
| | | description.append("<span translate=\"issue.issueHostingRemoveHistory\">호스팅 정보가 삭제되었습니다. " + issueHosting.getHostingField().getName() + "</span>"); |
| | | description.append("<span class=\"text-primary bold\"> > " + issueHosting.getHostingField().getName() + "</span>"); |
| | | } |
| | | } |
| | | |
| | | // 담당자 변경 정보를 기록한다. |
| | |
| | | this.makeIssueHistoryHtml(description, title, beforeUser.toString(), afterUser.toString()); |
| | | } |
| | | |
| | | // 담당부서 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueDepartment(Issue issue, IssueForm issueForm, StringBuilder description) { |
| | | boolean saveIssueRisk = false; // 이슈 위험 관리에 이중 저장되는 것을 방지하기 위한 구분 값 |
| | | |
| | | // 담당부서 수가 달라졌을 경우 |
| | | if(issue.getIssueDepartments().size() != issueForm.getDepartmentIds().size()){ |
| | | this.recodeIssueDepartment(issue, issueForm, description); |
| | | // 이슈 위험 관리에 담당부서 변경 정보를 업데이트 한다. - 담당부서 변경 |
| | | this.issueRiskService.modifyIssueRisk(issue, false, true, null); |
| | | saveIssueRisk = true; |
| | | } |
| | | |
| | | // 담당부서 수는 같으나 담당부서가 달라졌을 경우 |
| | | if (issue.getIssueDepartments().size() > 0 && issueForm.getDepartmentIds().size() > 0) { |
| | | // 이전 담당자 표시 |
| | | for (IssueDepartment issueDepartment : issue.getIssueDepartments()) { |
| | | boolean change = true; |
| | | Department department = issueDepartment.getDepartment(); |
| | | |
| | | for (Long departmentId : issueForm.getDepartmentIds()) { |
| | | if (department.getId().equals(departmentId)) { |
| | | change = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (change) { |
| | | // 담당부서 변경 정보 기록 |
| | | this.recodeIssueDepartment(issue, issueForm, description); |
| | | // 담당부서 수가 달라졌을 경우에 저장되지 않았다면 여기서 이슈 위험 관리 저장을 한다. |
| | | if (!saveIssueRisk) { |
| | | // 이슈 위험 관리에 담당부서 변경 정보를 업데이트한다. - 담당부서 변경 |
| | | this.issueRiskService.modifyIssueRisk(issue, false, true, null); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 담당부서 변경 정보 기록 |
| | | private void recodeIssueDepartment(Issue issue, IssueForm issueForm, StringBuilder description) { |
| | | String title = "<span translate=\"common.updateDepartment\">담당부서가 변경되었습니다.</span>"; |
| | | StringBuilder beforeDepartment = new StringBuilder(); |
| | | |
| | | // 이전 담당부서 표시 |
| | | for (IssueDepartment issueDepartment : issue.getIssueDepartments()) { |
| | | beforeDepartment.append(issueDepartment.getDepartment().getDepartmentName()); |
| | | beforeDepartment.append(", "); |
| | | } |
| | | // 담당부서가 없었으면 없음으로 표시 |
| | | if (issue.getIssueDepartments().size() < 1) { |
| | | beforeDepartment.append("<span translate=\"common.none\">없음</span>"); |
| | | } |
| | | |
| | | StringBuilder afterDepartment = new StringBuilder(); |
| | | for (Long departmentId : issueForm.getDepartmentIds()) { |
| | | Department department = this.departmentService.getDepartment(departmentId); |
| | | afterDepartment.append(department.getDepartmentName()); |
| | | afterDepartment.append(", "); |
| | | } |
| | | |
| | | // 담당부서가 없었으면 없음으로 표시 |
| | | if (issueForm.getDepartmentIds().size() < 1) { |
| | | afterDepartment.append("<span translate=\"common.none\">없음</span>"); |
| | | } |
| | | |
| | | // 이력 정보를 html 태그로 만들어 준다. |
| | | this.makeIssueHistoryHtml(description, title, beforeDepartment.toString(), afterDepartment.toString()); |
| | | } |
| | | |
| | | // 이슈에 첨부된 파일에 대해 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectAttachedFile(IssueForm issueForm, StringBuilder description, List<MultipartFile> files) { |