package com.njcn.harmonic.controller.upload;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
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.common.utils.LogUtil;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.param.UploadParam;
import com.njcn.harmonic.pojo.vo.upload.UploadEvaluationDataVo;
import com.njcn.harmonic.service.upload.IEvaluationDataService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * 类的介绍：国网指标数据上送
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/12/7 9:05
 */
@Slf4j
@RestController
@RequestMapping("/upload")
@Api(tags = "国网指标数据上送")
@AllArgsConstructor
public class EvaluationDataController extends BaseController {
    private final IEvaluationDataService evaluationDataService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEvaluationData")
    @ApiOperation("查询母线基准水平评估数据")
    @ApiImplicitParam(name = "param", value = "实体参数", required = true)
    public HttpResult<Page<UploadEvaluationDataVo>> getEvaluationData(@RequestBody @Validated UploadDataParam param) {
        String methodDescribe = getMethodDescribe("getEvaluationData");
        LogUtil.njcnDebug(log, "{}，实体参数：{}", methodDescribe, param);
        Page<UploadEvaluationDataVo> list = evaluationDataService.getEvaluationData(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/uploadEvaluationData")
    @ApiOperation("国网上送-母线基准水平评估数据")
    @ApiImplicitParam(name = "param", value = "实体参数", required = true)
    public HttpResult<String> uploadEvaluationData(@RequestBody @Validated UploadParam param) {
        String methodDescribe = getMethodDescribe("uploadEvaluationData");
        LogUtil.njcnDebug(log, "{}，实体参数：{}", methodDescribe, param);
        String result = evaluationDataService.uploadEvaluationData(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }




}
