package cn.com.countrygarden.bi.main.controller.ck.satisfaction;


import cn.com.countrygarden.bi.main.controller.BaseController;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.model.ck.satisfaction.SatisfiedControlProject;
import cn.com.countrygarden.bi.main.service.ck.SatisfiedControlProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * <p>
 *   控制塔满意度-项目模块接口
 * </p>
 *
 * @author
 * @date 2021-08-06
 * @version V1.0
 */
@RestController("SatisfiedControlProjectController")
@RequestMapping("/api/satisfiedControlProject")
public class SatisfiedControlProjectController extends BaseController {
    @Autowired
    private SatisfiedControlProjectService satisfiedControlProjectService;

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

    @PostMapping(value = "/getrevenue")
    public Result getrevenue(HttpServletRequest request) throws IOException {
        return satisfiedControlProjectService.getrevenue(getAccessToken(request),request);
    }

    @PutMapping(value = "/edit")
    public Result edit(SatisfiedControlProject satisfiedControlProject, HttpServletRequest request){
        return  satisfiedControlProjectService.edit(satisfiedControlProject,getAccessToken(request));
    }

    @PutMapping(value="/del")
    public Result del(@RequestParam(value = "id", required = true)String id){
        return  satisfiedControlProjectService.del(id,getAccessToken());
    }
}