package com.njcn.process.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.service.ISupvReportMService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;

import java.time.LocalDate;

/**
 * pqs
 * 月度统计
 * @author cdf
 * @date 2023/6/26
 */
@RestController
@RequestMapping("/supv/report")
@Api(tags = "技术监督月统计控制器")
@RequiredArgsConstructor
public class SupvMonthStatisController extends BaseController {

    private final ISupvReportMService iSupvReportMService;


    /**
     *
     * @author cdf
     * @date 2023/6/27
     */
    @PostMapping("statisticReport")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
    @ApiOperation("监督月报统计")
    public HttpResult<Boolean> statisticReport(@RequestParam("timeId") String timeId){
        String methodDescribe = getMethodDescribe("statisticReport");
        LocalDate localDate = LocalDate.parse(timeId);
        iSupvReportMService.statisticSuperviseReport(localDate);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
    }

    /**
     * 查询阅读监督报告
     * @author cdf
     * @date 2023/6/27
     */
    @PostMapping("statisticReportPage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询监督月报")
    public HttpResult<Page<SupvReportM>> statisticReportPage(BaseParam baseParam){
        String methodDescribe = getMethodDescribe("statisticReportPage");
        Page<SupvReportM> page = iSupvReportMService.statisticReportPage(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }
}
