OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2021-11-23 b2bf222751b9bba2315f861c2c5a2511dad86626
src/main/java/kr/wisestone/owl/service/impl/IssueHostingServiceImpl.java
@@ -1,6 +1,7 @@
package kr.wisestone.owl.service.impl;
import kr.wisestone.owl.domain.*;
import kr.wisestone.owl.domain.enumType.IssueHistoryType;
import kr.wisestone.owl.mapper.HostingFieldMapper;
import kr.wisestone.owl.mapper.IssueHostingMapper;
import kr.wisestone.owl.repository.IssueHostingRepository;
@@ -30,6 +31,9 @@
    private HostingFieldService hostingFieldService;
    @Autowired
    private IssueHistoryService issueHistoryService;
    @Autowired
    private IssueHostingMapper issueHostingMapper;
    @Override
@@ -49,8 +53,14 @@
                    HostingField hostingField = this.hostingFieldService.getHosting(MapUtil.getLong(param, "hostingId"));
                    Set<IssueHosting> issueHostings = issue.getIssueHostingFields();
                    if (issueHostings != null && issueHostings.size() >0){
                        IssueHosting issueHosting = issueHostings.iterator().next();
                    IssueHosting issueHosting = null;
                    if (issueHostings != null && issueHostings.size() >0){//수정 할 경우
                        issueHosting = issueHostings.iterator().next();
                        // 변경 이력
                        StringBuilder sb = new StringBuilder();
                        issueHistoryService.detectIssueHosting(IssueHistoryType.MODIFY, param, issueHosting, sb);
                        issueHistoryService.addIssueHistory(issue, IssueHistoryType.MODIFY, sb.toString());
                        issueHosting.setHostingField(hostingField);
                        issueHosting.setName(MapUtil.getString(param, "name"));
@@ -59,16 +69,16 @@
                        issueHosting.setManager(MapUtil.getString(param, "manager"));
                        issueHosting.setTel(MapUtil.getString(param, "tel"));
                        issueHosting.setMemo(MapUtil.getString(param, "memo"));
                        this.issueHostingRepository.saveAndFlush(issueHosting);
                    }else{
                        IssueHosting newIssueHosting = ConvertUtil.convertMapToClass(param, IssueHosting.class);
                        newIssueHosting.setIssue(issue);
                        newIssueHosting.setHostingField(hostingField);
                        this.issueHostingRepository.saveAndFlush(newIssueHosting);
                    }else{//추가 할 경우
                        issueHosting = ConvertUtil.convertMapToClass(param, IssueHosting.class);
                        issueHosting.setIssue(issue);
                        issueHosting.setHostingField(hostingField);
                        // 추가 이력
                        StringBuilder sb = new StringBuilder();
                        issueHistoryService.detectIssueHosting(IssueHistoryType.ADD, param, issueHosting, sb);
                        issueHistoryService.addIssueHistory(issue, IssueHistoryType.MODIFY, sb.toString());
                    }
                    this.issueHostingRepository.saveAndFlush(issueHosting);
                }
            }
        }