package com.ningdatech.carapi.report.controller;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.report.manage.BulkCementDirectSystemManage;
import com.ningdatech.carapi.report.model.po.ReqDataAuditPO;
import com.ningdatech.carapi.report.model.po.ReqDataQueryModifyPO;
import com.ningdatech.carapi.report.model.po.ReqDataUploadDetailPO;
import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO;
import com.ningdatech.carapi.report.model.vo.ResDataQueryDetailVO;
import com.ningdatech.carapi.report.model.vo.ResDataQueryListVO;
import com.ningdatech.carapi.report.model.vo.ResDataUploadDetailVO;
import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO;
import com.ningdatech.log.annotation.WebLog;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
 * <p>
 * 散装水泥直报系统 前端控制器
 * </p>
 *
 * @author CMM
 * @since 2023-09-27
 */
@RequestMapping("/api/v1/direct/report/system")
@RestController
@Api(tags = "数据上报-公用接口")
@Validated
@RequiredArgsConstructor
public class BulkCementDirectSystemController {

    private final BulkCementDirectSystemManage bulkCementDirectSystemManage;

    @PostMapping("/upload/data/detail")
    @ApiOperation("散装水泥直报系统上报数据详情")
    public ResDataUploadDetailVO uploadDataDetail(@Valid @RequestBody ReqDataUploadDetailPO po) {
        return bulkCementDirectSystemManage.uploadDataDetail(po);
    }

    @PostMapping("/data/query/list")
    @ApiOperation("散装水泥直报系统数据查询列表")
    public PageVo<ResDataQueryListVO> dataQueryList(@Valid @RequestBody ReqDataUploadListPO po) {
        return bulkCementDirectSystemManage.dataQueryList(po);
    }

    @PostMapping("/data/query/detail")
    @ApiOperation("散装水泥直报系统数据查询详情")
    public ResDataQueryDetailVO uploadDataQueryDetail(@Valid @RequestBody ReqDataUploadListPO po) {
        return bulkCementDirectSystemManage.uploadDataQueryDetail(po);
    }

    @PostMapping("/data/query/modify")
    @ApiOperation("12月份数据查询编辑")
    @WebLog(value = "12月份数据查询编辑", modular = "数据上报-12月份数据查询编辑")
    public String uploadDataQueryModify(@Valid @RequestBody ReqDataQueryModifyPO po) {
        return bulkCementDirectSystemManage.uploadDataQueryModify(po);
    }

    @PostMapping("/data/audit/list")
    @ApiOperation("散装水泥直报系统数据审核列表")
    public PageVo<ResDataUploadListVO> dataAuditList(@Valid @RequestBody ReqDataUploadListPO po) {
        return bulkCementDirectSystemManage.dataAuditList(po);
    }

    @PostMapping("/data/audit")
    @ApiOperation("散装水泥直报系统数据审核")
    @WebLog(value = "散装水泥直报系统数据审核", modular = "数据上报-散装水泥直报系统数据审核")
    public String dataAudit(@Valid @RequestBody ReqDataAuditPO po) {
        return bulkCementDirectSystemManage.dataAudit(po);
    }

    @PostMapping("/upload/data/query/export")
    @ApiOperation("散装水泥直报系统数据查询导出")
    @WebLog(value = "散装水泥供应量上报数据查询导出", modular = "数据上报-散装水泥供应量上报数据查询导出")
    public void uploadDataQueryExport(@Valid @RequestBody ReqDataUploadListPO po, HttpServletResponse response) {
        bulkCementDirectSystemManage.exportQueryData(po,response);
    }
}
