package com.njcn.harmonic.controller.specialanalysis;

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.StreamReverseParam;
import com.njcn.harmonic.pojo.vo.StreamReverseCountyVO;
import com.njcn.harmonic.pojo.vo.StreamReverseOrgVO;
import com.njcn.harmonic.service.specialanalysis.StreamReverseService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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 jianghaifei
 * @Date 2022-11-25 10:19
 * @Version V1.0
 */
@RestController
@Api(tags = "专项分析-分布式光伏")
@RequiredArgsConstructor
@RequestMapping("/streamReverse")
public class StreamReverseController extends BaseController {

    private final StreamReverseService streamReverseService;

    @PostMapping("/streamReverseByOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("潮流倒送分析-单位")
    public HttpResult<Page<StreamReverseOrgVO>> streamReverseByOrg(@RequestBody StreamReverseParam streamReverseParam) {
        String methodDescribe = getMethodDescribe("streamReverseByOrg");

        Page<StreamReverseOrgVO> resultList = streamReverseService.streamReverseByOrg(streamReverseParam);

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

    @PostMapping("/streamReverseByCounty")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("潮流倒送分析-整县(不可用)")
    public HttpResult<Page<StreamReverseCountyVO>> streamReverseByCounty(@RequestBody StreamReverseParam streamReverseParam) {
        String methodDescribe = getMethodDescribe("streamReverseByCounty");

        Page<StreamReverseCountyVO> resultList = streamReverseService.streamReverseByCounty(streamReverseParam);

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