package com.project.zcustom.controller.engineering;

import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.controller.core.BaseController;
import com.project.zcustom.domain.addional.LargeIssue;
import com.project.zcustom.service.unit.ILargeIssueService;
import com.project.zcustom.service.unit.ILargeProjectService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/large/three")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PlatProjectCheckController extends BaseController {

    private final ILargeProjectService largeProjectService;

    private final ILargeIssueService largeIssueService;

    /**
     * 问题数量
     */
    @GetMapping("/getIssueNum")
    public AjaxResult getIssueNum() {
        return AjaxResult.success("查询成功", largeIssueService.getIssueNum());
    }

    /**
     * 已整改问题数量
     */
    @GetMapping("/getOverIssueNum")
    public AjaxResult getOverIssueNum() {
        return AjaxResult.success("查询成功", largeIssueService.getOverIssueNum());
    }

    /**
     * 本周检查项目数量
     */
    @GetMapping("/getProjectNumThisWeek")
    public AjaxResult getProjectNumThisWeek() {
        return AjaxResult.success("查询成功", largeProjectService.getProjectNumThisWeek());
    }

    /**
     * 近一周问题列表
     */
    @GetMapping("/getIssueListLastWeek")
    public AjaxResult getIssueListLastWeek() {
        return AjaxResult.success("查询成功", largeIssueService.getIssueListLastWeek());
    }

    /**
     * 问题列表
     * */
    @GetMapping("/issueList")
    public AjaxResult issueList(LargeIssue entity) {
        return AjaxResult.success("查询成功", largeIssueService.selectList(entity));
    }

    /**
     * 更改问题状态
     * */
    @PostMapping("changeIssueStatus")
    public AjaxResult changeIssueStatus(@RequestBody LargeIssue entity) {
        return toAjax(largeIssueService.updateById(entity));
    }
}
