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

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
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.biz.commApi.fallback.CommTerminalGeneralClientFallbackFactory;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pms.service.majornetwork.IMonitorService;
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.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * pqs
 *
 * @author cdf
 * @date 2023/9/14
 */
@RestController
@RequestMapping("/commLine")
@RequiredArgsConstructor
@Slf4j
@Api(tags = "通用台账查询")
public class CommLineController extends BaseController {

    private final IMonitorService monitorService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @GetMapping("/getLineDetail")
    @ApiOperation("获取监测点id取监测点信息")
    public HttpResult<LineDTO> getLineDetail(@RequestParam("id") String id) {
        String methodDescribe = getMethodDescribe("getLineDetail");
        LineDTO result = monitorService.getLineDetail(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLineDetailBatch")
    @ApiOperation("批量获取监测点信息")
    public HttpResult<List<LineDTO>> getLineDetailBatch(@RequestParam("ids") List<String> ids) {
        String methodDescribe = getMethodDescribe("getLineDetailBatch");
        List<LineDTO> result = monitorService.getLineDetailBatch(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
