package cn.com.countrygarden.bi.main.controller.advise;

import cn.com.countrygarden.bi.main.controller.BaseController;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.model.advise.AfAdviseProcess;
import cn.com.countrygarden.bi.main.service.advise.IAfAdviseProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 建言处理节点-控制层实现
 *
 * @author 木木子
 * @email 944528607@qq.com
 * @url 
 * @date 2019-04-15
 */
@RestController("AfAdviseProcessController")
@RequestMapping("/api/afAdviseProcess")
public class AfAdviseProcessController extends BaseController{
    @Autowired
    private IAfAdviseProcessService afAdviseProcessService;


    @GetMapping(value = "/list", produces = "application/json;charset=utf-8")
    public Result list(AfAdviseProcess afAdviseProcess,
                       @RequestParam(value = "size", required = false, defaultValue = "10") int size,
                       @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                       HttpServletRequest request){
        return  afAdviseProcessService.queryPageList(afAdviseProcess,page,size);
    }

    @GetMapping(value = "/one", produces = "application/json;charset=utf-8")
    public Result queryById(@RequestParam(value = "id", required = true)Integer id,
                            HttpServletRequest request){
        return  afAdviseProcessService.queryById(id);
    }

    @PostMapping(value = "/addOrEdit")
    public Result addOrEdit(@RequestParam(value = "data", required = true)String data,
                      HttpServletRequest request){
        return  afAdviseProcessService.addOrEdit(data,getAccessToken(request));
    }


    @DeleteMapping(value="/del")
    public Result del(@RequestParam(value = "id", required = true)Integer id){
        return  afAdviseProcessService.del(id);
    }
    @GetMapping(value="/rejdect")
    public Result rejdect(@RequestParam(value = "feedbackId", required = true)Integer feedbackId,@RequestParam(value = "isPrivate", required = true)Integer isPrivate){
        return  afAdviseProcessService.rejdectProcess(feedbackId,isPrivate);
    }

}