package com.njcn.advance.controller;

import com.njcn.advance.pojo.dto.BalanceInfo;
import com.njcn.advance.pojo.param.AdvanceBaseParam;
import com.njcn.advance.service.BalanceService;
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.common.utils.PubUtils;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
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 java.util.List;

/**
 * pqs
 *
 * @author cdf
 * @date 2023/6/19
 */
@RestController
@RequestMapping("balance")
@Api(tags = "暂降区域评估高级算法")
@RequiredArgsConstructor
public class BalanceController extends BaseController {

    private final BalanceService balanceService;


    @PostMapping("getBalanceInfo")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂降区域评估")
    @ApiImplicitParam(name = "advanceBaseParam", value = "查询参数", required = true)
    public HttpResult<List<BalanceInfo>> getBalanceInfo(@RequestBody @Validated AdvanceBaseParam advanceBaseParam){
        String methodDescribe = getMethodDescribe("getBalanceInfo");
        List<BalanceInfo> balanceInfoList = balanceService.getBalanceInfo(advanceBaseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, balanceInfoList, methodDescribe);
    }
}
