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.harmonic.pojo.dto.upload.RUploadMainMonitorDataDTO;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.service.upload.RUploadMainMonitorService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;

/**
 * <p>
 *
 * </p>
 *
 * @author cdf
 * @since 2024-08-15
 */
@RestController
@RequestMapping("/upload")
@RequiredArgsConstructor
public class RUploadMainMonitorController extends BaseController {

    private final RUploadMainMonitorService rUploadMainMonitorService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMainMonitorPage")
    @ApiOperation("分页查询主网监测点")
    @ApiImplicitParam(name = "param", value = "实体参数", required = true)
    public HttpResult<Page<RUploadMainMonitorDataDTO>> getMainMonitorPage(@RequestBody @Validated UploadDataParam param) {
        String methodDescribe = getMethodDescribe("getMainMonitorPage");
        Page<RUploadMainMonitorDataDTO> page = rUploadMainMonitorService.getMainMonitorPage(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/upGwMainMonitor")
    @ApiOperation("上送国网")
    @ApiImplicitParam(name = "param", value = "实体参数", required = true)
    public HttpResult<Boolean> upGwMainMonitor(@RequestBody UploadDataParam param) {
        String methodDescribe = getMethodDescribe("upGwMainMonitor");
        rUploadMainMonitorService.upGwMainMonitor(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
    }

}

