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.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
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.*;

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)
    @GetMapping("/getLineAllDetail")
    @ApiOperation("获取监测点id取超标监测点信息")
    public HttpResult<LineALLInfoDTO> getLineAllDetail(@RequestParam("id") String id) {
        String methodDescribe = getMethodDescribe("getLineAllDetail");
        LineALLInfoDTO result = monitorService.getLineAllDetail(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

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

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


}
