package kr.wisestone.owl.web.controller;
|
|
import kr.wisestone.owl.constant.Constants;
|
import kr.wisestone.owl.service.WorkflowService;
|
import kr.wisestone.owl.util.ConvertUtil;
|
import kr.wisestone.owl.vo.AttachedFileVo;
|
import kr.wisestone.owl.web.condition.WorkflowCondition;
|
import kr.wisestone.owl.web.form.WorkflowForm;
|
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 wisestone on 2018-05-10.
|
*/
|
@Controller
|
public class WorkflowController extends BaseController {
|
|
@Autowired
|
private WorkflowService workflowService;
|
|
// 워크플로우 생성
|
@RequestMapping(value = "/workflow/add", produces = MediaType.APPLICATION_JSON_VALUE)
|
public
|
@ResponseBody
|
Map<String, Object> add(@RequestBody Map<String, Map<String, Object>> params) {
|
Map<String, Object> resJsonData = new HashMap<>();
|
|
this.workflowService.addWorkflow(WorkflowForm.make(params.get(Constants.REQ_KEY_CONTENT)));
|
|
return this.setSuccessMessage(resJsonData);
|
}
|
|
// 워크플로우 조회
|
@RequestMapping(value = "/workflow/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.workflowService.findWorkflow(resJsonData, WorkflowCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
|
|
return this.setSuccessMessage(resJsonData);
|
}
|
|
// 워크플로우 상세 조회
|
@RequestMapping(value = "/workflow/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.workflowService.detailWorkflow(resJsonData, WorkflowCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
|
|
return this.setSuccessMessage(resJsonData);
|
}
|
|
// 워크플로우 수정
|
@RequestMapping(value = "/workflow/modify", produces = MediaType.APPLICATION_JSON_VALUE)
|
public
|
@ResponseBody
|
Map<String, Object> modify(@RequestBody Map<String, Map<String, Object>> params) {
|
Map<String, Object> resJsonData = new HashMap<>();
|
|
this.workflowService.modifyWorkflow(WorkflowForm.make(params.get(Constants.REQ_KEY_CONTENT)));
|
|
return this.setSuccessMessage(resJsonData);
|
}
|
|
// 워크플로우 삭제
|
@SuppressWarnings("unchecked")
|
@RequestMapping(value = "/workflow/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.workflowService.removeWorkflows(WorkflowForm.make(params.get(Constants.REQ_KEY_CONTENT)));
|
|
return this.setSuccessMessage(resJsonData);
|
}
|
|
// 워크플로우 엑셀 다운로드
|
@RequestMapping(value = "/workflow/downloadExcel", method = RequestMethod.POST)
|
public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
|
return this.workflowService.downloadExcel(request, model);
|
}
|
}
|