package kr.wisestone.owl.web.controller; import kr.wisestone.owl.constant.Constants; import kr.wisestone.owl.service.UserService; import kr.wisestone.owl.service.WidgetService; import kr.wisestone.owl.web.condition.ProjectCondition; import kr.wisestone.owl.web.condition.WidgetCondition; 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.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; /** * Created by wisestone on 2018-10-30. */ @Controller public class WidgetController extends BaseController { @Autowired private WidgetService widgetService; // 위젯 전체 조회 @RequestMapping(value = "/widget/findAllWidget", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findAllWidget() { Map resJsonData = new HashMap<>(); this.widgetService.findAllWidget(resJsonData); return this.setSuccessMessage(resJsonData); } // 나에게 할당된 이슈 목록 조회 @RequestMapping(value = "/widget/findMyAssigneeIssue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findMyAssigneeIssue(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); this.widgetService.findMyAssigneeIssue(resJsonData, this.widgetService.makeWidgetCondition(), pageable); return this.setSuccessMessage(resJsonData); } // 지연중인 이슈 목록 조회 @RequestMapping(value = "/widget/findDelayIssue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findDelayIssue(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); WidgetCondition condition = WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)); this.widgetService.findDelayIssue(resJsonData, this.widgetService.makeWidgetCondition(), pageable); return this.setSuccessMessage(resJsonData); } // 내가 등록한 이슈 목록 조회 @RequestMapping(value = "/widget/findRegisterIssue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findRegisterIssue(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); WidgetCondition condition = WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)); this.widgetService.findRegisterIssue(resJsonData, this.widgetService.makeWidgetCondition(), pageable); return this.setSuccessMessage(resJsonData); } // 멤버별 진행률 조회 @RequestMapping(value = "/widget/findMemberProgress", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findMemberProgress(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.widgetService.findMemberProgress(resJsonData, WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)), true); return this.setSuccessMessage(resJsonData); } // 위험 관리 조회 @RequestMapping(value = "/widget/findRiskIssue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findRiskIssue(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); WidgetCondition condition = WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)); this.widgetService.findRiskIssue(resJsonData, this.widgetService.makeWidgetCondition(), pageable); return this.setSuccessMessage(resJsonData); } // 전체 이슈 처리현황 조회 @RequestMapping(value = "/widget/findIssueComplete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findIssueComplete(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); WidgetCondition condition = WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)); this.widgetService.findIssueComplete(resJsonData, this.widgetService.makeWidgetCondition(), WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)).getSearchPeriod()); return this.setSuccessMessage(resJsonData); } // 이슈 타입 별 이슈 정보 조회 @RequestMapping(value = "/widget/findByStandIssueType", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findByStandIssueType(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.widgetService.findByStandIssueType(resJsonData, WidgetCondition.make(params.get(Constants.REQ_KEY_CONTENT)), true); return this.setSuccessMessage(resJsonData); } //중요도 별 이슈 정보 조회 @RequestMapping(value = "/widget/findSeverityIssueWidget", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map findSeverityIssueWidget(@RequestBody Map> params){ Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); this.widgetService.findSeverityIssueWidget(resJsonData, this.widgetService.makeWidgetCondition(), params.get(Constants.REQ_KEY_CONTENT), pageable); return this.setSuccessMessage(resJsonData); } // 위젯 테이블 엑셀로 다운로드 @RequestMapping(value = "/widget/downloadExcel", method = RequestMethod.POST) public ModelAndView downloadExcel(HttpServletRequest request, Model model) { return this.widgetService.downloadExcel(request, model); } }