package com.njcn.device.pms.controller.ledgerManger;


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.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PowerClient;
import com.njcn.device.pms.pojo.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.vo.PmsMonitorVO;
import com.njcn.device.pms.pojo.vo.PmsPowerTreeMonitorVO;
import com.njcn.device.pms.service.majornetwork.ITerminalEliminateDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
import com.njcn.web.controller.BaseController;

import java.util.List;

/**
 * <p>
 *  台账操作界面
 * </p>
 *
 * @author hongawen
 * @since 2022-10-14
 */
@RestController
@RequestMapping("/pms/terminalEliminateData")
@Slf4j
@RequiredArgsConstructor
@Api(tags = "台账-台账操作界面")
public class TerminalEliminateDataController extends BaseController {

    private final ITerminalEliminateDataService iTerminalEliminateDataService;

    /**
     * 根据组织部门获取自身以及子部门的主网或配网监测点(I类监测点)
     * @author cdf
     * @date 2022/11/23
     */
    @PostMapping("getOneMonitorByOrgId")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation(value = "(I类监测点)根据组织部门获取自身以及子部门的主网或配网监测点")
    @ApiImplicitParam(name = "taiZhangParam",value = "台账查询参数",required = true)
    public HttpResult<Page<Monitor>> getOneMonitorByOrgId(@RequestBody @Validated TaiZhangParam taiZhangParam){
        String methodDescribe = getMethodDescribe("getOneMonitorByOrgId");
        Page<Monitor> page = iTerminalEliminateDataService.getOneMonitorByOrgId(taiZhangParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

    /**
     * 根据组织部门获取自身以及子部门的主网或配网监测点
     * @author cdf
     * @date 2022/11/23
     */
    @PostMapping("getTwoMonitorByOrgId")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation(value = "(II类监测点)根据组织部门获取自身以及子部门的配网监测点")
    @ApiImplicitParam(name = "taiZhangParam",value = "台账查询参数",required = true)
    public HttpResult<Page<PowerDistributionarea>> getTwoMonitorByOrgId(@RequestBody @Validated TaiZhangParam taiZhangParam){
        String methodDescribe = getMethodDescribe("getOneMonitorByOrgId");
        Page<PowerDistributionarea> page = iTerminalEliminateDataService.getTwoMonitorByOrgId(taiZhangParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

    /**
     * (III类监测点用电用户)根据组织部门获取自身以及子部门的主网或配网监测点
     * @author cdf
     * @date 2022/11/25
     */
    @PostMapping("getThreeYongMonitorByOrgId")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation(value = "(III类监测点)根据组织部门获取自身以及子部门的配网监测点")
    @ApiImplicitParam(name = "taiZhangParam",value = "台账查询参数",required = true)
    public HttpResult<Page<PmsPowerTreeMonitorVO>> getThreeYongMonitorByOrgId(@RequestBody @Validated TaiZhangParam taiZhangParam){
        String methodDescribe = getMethodDescribe("getThreeYongMonitorByOrgId");
        Page<PmsPowerTreeMonitorVO> page = iTerminalEliminateDataService.getThreeMonitorByOrgId(taiZhangParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }



}

