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<>();
|
|
this.ganttServiceService.detailIssue(resJsonData, IssueCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
|
|
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);
|
}
|
}
|