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.param.UploadDataParam;
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
import com.njcn.harmonic.service.upload.RUploadCommPointBusService;
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;
import com.njcn.web.controller.BaseController;

/**
 * <p>
 * 公共连接点母线电能质量统计 前端控制器
 * </p>
 *
 * @author cdf
 * @since 2024-08-15
 */
@RestController
@RequestMapping("/upload")
@RequiredArgsConstructor
public class RUploadCommPointBusController extends BaseController {

    private final RUploadCommPointBusService RUploadCommPointBusService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getCommPointBusPage")
    @ApiOperation("分页查询公共连接点")
    @ApiImplicitParam(name = "param", value = "实体参数", required = true)
    public HttpResult<Page<RUploadCommPointBus>> getCommPointBusPage(@RequestBody @Validated UploadDataParam param) {
        String methodDescribe = getMethodDescribe("getCommPointBusPage");
        Page<RUploadCommPointBus> page = RUploadCommPointBusService.getCommPointBusPage(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }


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

}

