OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2022-01-06 47c5ce77b114324effdce5b3735ed0e661846108
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package kr.wisestone.owl.web.controller;
 
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.domain.Issue;
import kr.wisestone.owl.service.GanttService;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.web.condition.IssueCondition;
import kr.wisestone.owl.web.condition.ProjectCondition;
import kr.wisestone.owl.web.form.IssueForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
 
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
 
/**
 * Created by maprex on 2021-03-25.
 */
@Controller
public class GanttController extends BaseController {
 
    private static final Logger log = LoggerFactory.getLogger(GanttController.class);
 
    @Autowired
    private GanttService ganttServiceService;
 
    //  이슈 생성
    @RequestMapping(value = "/gantt/add", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> add(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        //  이슈 생성
        Issue issue = this.ganttServiceService.addIssue(IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
        //  버전 생성
        this.ganttServiceService.addIssueVersion(issue.getId());
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  타임라인용 이슈 조회
    @RequestMapping(value = "/gantt/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> find(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
 
        this.ganttServiceService.findIssue(resJsonData, IssueCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  타임라인용 이슈 조회(프로젝트용)
    @RequestMapping(value = "/gantt/findProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> findProjectIssues(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
 
        this.ganttServiceService.findIssue(resJsonData, ProjectCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  이슈 상세 조회
    @RequestMapping(value = "/gantt/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<>();
        Pageable relPageable = this.pageUtil.convertRelPageable(this.getPageVo(params));
        Pageable downPageable = this.pageUtil.convertDownPageable(this.getPageVo(params));
 
        this.ganttServiceService.detailIssue(resJsonData, IssueCondition.make(params.get(Constants.REQ_KEY_CONTENT)), relPageable, downPageable);
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  이슈 수정
    @RequestMapping(value = "/gantt/modify", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> modify(MultipartHttpServletRequest request) {
        Map<String, Object> resJsonData = new HashMap<>();
        //  이슈 수정
        Issue issue = this.ganttServiceService.modifyIssue(IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFiles("file"));
        //  버전 생성
        this.ganttServiceService.addIssueVersion(issue.getId());
 
        return this.setSuccessMessage(resJsonData);
    }
 
    //  이슈 삭제
    @RequestMapping(value = "/gantt/remove", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> removes(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        this.ganttServiceService.removeIssues(IssueForm.make(params.get(Constants.REQ_KEY_CONTENT)));
 
        return this.setSuccessMessage(resJsonData);
    }
}