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

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.PmsSummaryStatisticsParam;
import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO;
import com.njcn.device.pms.service.majornetwork.PmsSummaryStatisticsService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;


/**
 * <台账-台账汇总统计>
 *
 * @author wr
 * @createTime: 2023-02-17
 */
@RestController
@RequestMapping("/pms/summaryStatistics")
@Slf4j
@Api(tags = "台账-台账汇总统计")
@RequiredArgsConstructor
public class PmsSummaryStatisticsController extends BaseController {

    private final PmsSummaryStatisticsService pmsSummaryStatisticsService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMainnetPoint")
    @ApiOperation("主网台账统计")
    public HttpResult<List<PmsSummaryStatisticsVO.SummaryVO>> getMainnetPoint(@RequestBody PmsSummaryStatisticsParam param) {
        String methodDescribe = getMethodDescribe("getMainnetPoint");
        List<PmsSummaryStatisticsVO.SummaryVO> mainnetPoint = pmsSummaryStatisticsService.getSeparate(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, mainnetPoint, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getDistributionPoint")
    @ApiOperation("配网台账统计")
    public HttpResult<List<PmsSummaryStatisticsVO.SummaryVO>> getDistributionPoint(@RequestBody PmsSummaryStatisticsParam.PwSummaryStatisticsParam param) {
        String methodDescribe = getMethodDescribe("getDistributionPoint");
        List<PmsSummaryStatisticsVO.SummaryVO> distributionPoint = pmsSummaryStatisticsService.getDistributionPoint(param);

        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, distributionPoint, methodDescribe);
    }


}
