12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package com.bowintek.practice.controller;
- import com.alibaba.fastjson.JSONObject;
- import com.bowintek.practice.filter.exception.BaseResponse;
- import com.bowintek.practice.filter.exception.RespGenerstor;
- import com.bowintek.practice.model.CfApplyFormReviewer;
- import com.bowintek.practice.model.CfApplyFormWellFile;
- import com.bowintek.practice.services.service.AccountService;
- import com.bowintek.practice.services.service.ApplyFormService;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.HashMap;
- import java.util.List;
- @RestController
- @RequestMapping("/api/applyForm")
- public class ApplyFormController {
- @Autowired
- private AccountService accountService;
- @Autowired
- private ApplyFormService applyFormService;
- @GetMapping("getApplyFormList")
- public BaseResponse<PageInfo<HashMap<String, Object>>> getApplyFormList(@RequestParam("page") int page, @RequestParam("rows") int rows,
- @RequestParam(required = false) String beginDate,
- @RequestParam(required = false) String endDate) {
- return RespGenerstor.success(applyFormService.selectApplyFormList(page, rows, accountService.getLoginUserID(), null, null, beginDate, endDate));
- }
- @GetMapping("getReviewerFormList")
- public BaseResponse<PageInfo<HashMap<String, Object>>> getReviewerFormList(@RequestParam("page") int page, @RequestParam("rows") int rows,
- @RequestParam(required = false) String applyUserName,
- @RequestParam(required = false) String beginDate,
- @RequestParam(required = false) String endDate) {
- return RespGenerstor.success(applyFormService.selectApplyFormList(page, rows, null, applyUserName, accountService.getLoginUserID(), beginDate, endDate));
- }
- @GetMapping("getApplyFormFileList")
- public BaseResponse<List<HashMap<String, Object>>> getApplyFormFileList(@RequestParam(required = false) String applyId) {
- return RespGenerstor.success(applyFormService.selectApplyFormFileList(applyId,null,null));
- }
- @ResponseBody
- @PostMapping("/submit")
- public BaseResponse submit(@RequestBody JSONObject reqMap) {
- int count = 0;
- try {
- String reason = reqMap.getString("reason");
- List<CfApplyFormWellFile> docList = reqMap.getJSONArray("docList").toJavaList(CfApplyFormWellFile.class);
- count = applyFormService.submit(reason, docList, accountService.getLoginUserID(), accountService.getUserByUserID(accountService.getLoginUserID()).name);
- } catch (Exception e) {
- return RespGenerstor.fail("-1", "程序异常:" + e.getMessage());
- }
- return RespGenerstor.success(count);
- }
- @ResponseBody
- @PostMapping("/approve")
- public BaseResponse approve(@RequestBody CfApplyFormReviewer reviewer) {
- int count = 0;
- try {
- count = applyFormService.approve(reviewer, accountService.getLoginUserID());
- } catch (Exception e) {
- return RespGenerstor.fail("-1", "程序异常:" + e.getMessage());
- }
- return RespGenerstor.success(count);
- }
- }
|