package com.njcn.device.pq.controller;

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.LineDTO;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.line.service.LineService;
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 LineService lineService;

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

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @GetMapping("/getPollutionLineInfo")
    @ApiOperation("获取污区值监测点相关信息")
    public HttpResult<List<PollutionLineInfoDTO>> getPollutionLineInfo(@RequestParam("id") List<String> id) {
        String methodDescribe = getMethodDescribe("getPollutionLineInfo");
        List<PollutionLineInfoDTO> result = lineService.getPollutionLineInfo(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 = lineService.getLineAllDetail(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @GetMapping("/getLineAllDetailList")
    @ApiOperation("获取多监测点id取超标监测点信息")
    public HttpResult<List<LineALLInfoDTO>> getLineAllDetailList(@RequestParam("ids") List<String> ids) {
        String methodDescribe = getMethodDescribe("getLineAllDetailList");
        List<LineALLInfoDTO> result = lineService.getLineAllDetailList(ids);
        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 = lineService.getLineDetailBatch(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
