OWL ITS + 탐지시스템(인터넷 진흥원)
박지현
2022-02-22 1dad4d94cc415d2f8092aff0368744289337f504
src/main/java/kr/wisestone/owl/web/controller/IssueController.java
@@ -5,7 +5,10 @@
import kr.wisestone.owl.service.IssueService;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.web.condition.ApiMonitorCondition;
import kr.wisestone.owl.web.condition.DepartmentCondition;
import kr.wisestone.owl.web.condition.IssueCondition;
import kr.wisestone.owl.web.form.EmailCommonForm;
import kr.wisestone.owl.web.form.EmailTemplateForm;
import kr.wisestone.owl.web.form.IssueForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,8 +34,7 @@
@Controller
public class IssueController extends BaseController {
    private static final Logger
            log = LoggerFactory.getLogger(IssueController.class);
    private static final Logger log = LoggerFactory.getLogger(IssueController.class);
    @Autowired
    private IssueService issueService;
@@ -59,6 +61,21 @@
        Map<String, Object> resJsonData = new HashMap<>();
        //  이슈 생성
        Issue issue = this.issueService.addRelIssue(IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
        //  버전 생성
        this.issueService.addIssueVersion(issue.getId());
        resJsonData.put(Constants.RES_KEY_CONTENTS, issue.getId()); //연관이슈 ID
        return this.setSuccessMessage(resJsonData);
    }
    //  하위이슈 생성
    @RequestMapping(value = "/issue/downIssueAdd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> downIssueAdd(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        //  이슈 생성
        Issue issue = this.issueService.addDownIssue(resJsonData, IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
        //  버전 생성
        this.issueService.addIssueVersion(issue.getId());
@@ -90,12 +107,26 @@
        return this.setSuccessMessage(resJsonData);
    }
    //  파트너 목록 조회
    @RequestMapping(value = "/issue/findReadyDepartments", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> findReadyDepartments(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
        this.issueService.findReadyDepartments(resJsonData, DepartmentCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
        return this.setSuccessMessage(resJsonData);
    }
    //  이슈 상세 조회
    @RequestMapping(value = "/issue/detail", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> detail(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.detailIssue(resJsonData, IssueCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
@@ -137,6 +168,30 @@
        return this.setSuccessMessage(resJsonData);
    }
    //  하위이슈 삭제
    @RequestMapping(value = "/issue/removeAll", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> removesAll(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.removeAllIssues(IssueForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }
    //  하위이슈 삭제
    /*@RequestMapping(value = "/issue/removeDown", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> removesDown(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.removeDownIssues(IssueForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }*/
    //  이슈 다중 상태 변경
    @RequestMapping(value = "/issue/modifyMultiIssueStatus", produces = MediaType.APPLICATION_JSON_VALUE)
    public
@@ -164,7 +219,7 @@
    public @ResponseBody Map<String, Object> importExcel(MultipartHttpServletRequest request) throws Exception {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.importExcel(request.getFile("file"));
        this.issueService.importExcel(IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFile("file"));
        return this.setSuccessMessage(resJsonData);
    }
@@ -180,15 +235,26 @@
    }
    //  이슈 메일 파트너 담당자에게 발송 (템플릿 추가)
    @RequestMapping(value = "/issue/sendEmailPartners", produces = MediaType.APPLICATION_JSON_VALUE)
    @RequestMapping(value = "/issue/sendEmailPartners", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> sendEmailPartners(@RequestBody Map<String, Map<String, Object>> params) {
    Map<String, Object> sendEmailPartners(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.sendIssueEmailPartners(IssueForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        this.issueService.sendIssueEmailPartners(EmailTemplateForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
//        this.issueService.sendIssueEmailPartners(IssueForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }
    // 일반 메일 발송 (사용자 직접 작성)
    @RequestMapping(value = "/issue/sendCommonEmail", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> sendCommonEmail(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.issueService.sendCommonEmail(EmailCommonForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
        return this.setSuccessMessage(resJsonData);
    }
    //  api 기록 조회
    @RequestMapping(value = "/api/findHistory", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -199,5 +265,4 @@
        this.issueService.findApiIssue(ApiMonitorCondition.make(params.get(Constants.REQ_KEY_CONTENT)), resJsonData);
        return this.setSuccessMessage(resJsonData);
    }
}