| | |
| | | import kr.wisestone.owl.util.MapUtil; |
| | | import kr.wisestone.owl.vo.IssueHostingVo; |
| | | import kr.wisestone.owl.web.condition.IssueCondition; |
| | | import kr.wisestone.owl.web.form.HostingFieldForm; |
| | | import kr.wisestone.owl.web.form.IssueForm; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | // 이슈에서 사용되는 업체 값을 업데이트한다. |
| | | @Override |
| | | @Transactional |
| | | public void modifyIssueHostingField(Issue issue, List<Map<String, Object>> issueIspFields) { |
| | | public void modifyIssueHostingField(Issue issue, IssueForm issueForm) { |
| | | if (issue != null) { |
| | | if (issueIspFields != null && issueIspFields.size() > 0) { |
| | | Map<String, Object> param = issueIspFields.get(0); |
| | | List<Map<String, Object>> issueHostingFields = issueForm.getIssueHostingFields(); |
| | | if (issueHostingFields != null && issueHostingFields.size() > 0) { |
| | | Map<String, Object> param = issueHostingFields.get(0); |
| | | |
| | | if (param != null && param.get("hostingId") != null && param.get("hostingId") != "") { |
| | | HostingField hostingField = this.hostingFieldService.getHosting(MapUtil.getLong(param, "hostingId")); |
| | |
| | | issueHosting = issueHostings.iterator().next(); |
| | | // 변경 이력 |
| | | StringBuilder sb = new StringBuilder(); |
| | | issueHistoryService.detectIssueHosting(IssueHistoryType.MODIFY, param, issueHosting, sb); |
| | | issueHistoryService.detectIssueHosting(IssueHistoryType.MODIFY, param, null, issueHosting, sb); |
| | | issueHistoryService.addIssueHistory(issue, IssueHistoryType.MODIFY, sb.toString()); |
| | | |
| | | issueHosting.setHostingField(hostingField); |
| | |
| | | } |
| | | // 추가 이력 |
| | | StringBuilder sb = new StringBuilder(); |
| | | issueHistoryService.detectIssueHosting(IssueHistoryType.ADD, param, issueHosting, sb); |
| | | issueHistoryService.detectIssueHosting(IssueHistoryType.ADD, param, null, issueHosting, sb); |
| | | issueHistoryService.addIssueHistory(issue, IssueHistoryType.MODIFY, sb.toString()); |
| | | } |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | }else { |
| | | this.issueHostingRepository.deleteById(MapUtil.getLong(param, "id")); |
| | | } |
| | | } else if(issueForm.getHostingName() != null && !issueForm.getHostingName().equals("")) { |
| | | HostingFieldForm hostingFieldForm = new HostingFieldForm(); |
| | | hostingFieldForm.setName(issueForm.getHostingName()); |
| | | hostingFieldForm.setCode(issueForm.getHostingCode()); |
| | | hostingFieldForm.setEmail(issueForm.getHostingEmail()); |
| | | hostingFieldForm.setUrl(issueForm.getHostingUrl()); |
| | | hostingFieldForm.setManager(issueForm.getHostingManager()); |
| | | hostingFieldForm.setTel(issueForm.getHostingTel()); |
| | | hostingFieldForm.setMemo(issueForm.getHostingMemo()); |
| | | |
| | | HostingField hostingField = this.hostingFieldService.add(hostingFieldForm); |
| | | IssueHosting issueHosting = ConvertUtil.copyProperties(hostingFieldForm, IssueHosting.class); |
| | | issueHosting.setIssue(issue); |
| | | if (hostingField != null) { |
| | | issueHosting.setHostingField(hostingField); |
| | | } |
| | | // 추가 이력 |
| | | StringBuilder sb = new StringBuilder(); |
| | | issueHistoryService.detectIssueHosting(IssueHistoryType.ADD, null, hostingField, issueHosting, sb); |
| | | issueHistoryService.addIssueHistory(issue, IssueHistoryType.MODIFY, sb.toString()); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |