package com.jsowell.thirdparty.nanrui; import com.alibaba.fastjson2.JSON; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.domain.nanrui.NROrderInfo; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO; import com.jsowell.thirdparty.nanrui.service.NRService; import org.springframework.beans.factory.annotation.Autowired; 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; import java.util.Map; /** * 南瑞平台 controller * * @author Lemon * @Date 2023/10/11 13:26 */ @Anonymous @RestController @RequestMapping("/nanrui") public class NRController extends BaseController { @Autowired private NRService nrService; /** * 查询充电站信息 * @param dto */ @RequestMapping("/v1/query_stations_info") public RestApiResponse query_stations_info(@RequestBody QueryStationInfoDTO dto) { logger.info("南瑞平台查询充电站信息 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { Map map = nrService.query_stations_info(dto); response = new RestApiResponse<>(map); } catch (Exception e) { logger.error("南瑞平台查询充电站信息 error", e); response = new RestApiResponse<>(e); } logger.info("南瑞平台查询充电站信息 result:{}", response); return response; } /** * 查询设备接口状态 * @param dto */ @RequestMapping("/v1/query_station_status") public RestApiResponse query_station_status(@RequestBody QueryStationInfoDTO dto) { logger.info("南瑞平台查询设备接口状态 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { Map map = nrService.query_station_status(dto.getStationIds()); response = new RestApiResponse<>(map); } catch (Exception e) { logger.error("南瑞平台查询设备接口状态 error", e); response = new RestApiResponse<>(e); } logger.info("南瑞平台查询设备接口状态 result:{}", response); return response; } /** * 查询充电电量信息 * @param dto */ @RequestMapping("/v1/query_order_info") public RestApiResponse query_order_info(@RequestBody NRQueryOrderDTO dto) { logger.info("南瑞平台查询充电电量信息 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { List nrOrderInfos = nrService.query_order_info(dto); response = new RestApiResponse<>(nrOrderInfos); } catch (Exception e) { logger.error("南瑞平台查询充电电量信息 error", e); response = new RestApiResponse<>(e); } logger.info("南瑞平台查询充电电量信息 result:{}", response); return response; } }