2023-04-14 16:50:49 +08:00
|
|
|
package com.jsowell.lianlian;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.jsowell.common.annotation.Anonymous;
|
|
|
|
|
import com.jsowell.common.core.controller.BaseController;
|
|
|
|
|
import com.jsowell.common.response.RestApiResponse;
|
2023-04-17 15:48:12 +08:00
|
|
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
2023-04-14 16:50:49 +08:00
|
|
|
import com.jsowell.thirdparty.service.LianLianService;
|
|
|
|
|
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对接联联平台controller
|
|
|
|
|
*
|
|
|
|
|
* @author JS-ZZA
|
|
|
|
|
* @date 2023/4/10 14:58
|
|
|
|
|
*/
|
|
|
|
|
@Anonymous
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/LianLian")
|
|
|
|
|
public class LianLianController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private LianLianService lianLianService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 联联平台查询充电站信息
|
|
|
|
|
* http://localhost:8080/LianLian/query_stations_info
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_stations_info")
|
|
|
|
|
public RestApiResponse<?> query_stations_info(@RequestBody QueryStationInfoDTO dto) {
|
|
|
|
|
logger.info("联联平台查询充电站信息 params:{}", JSONObject.toJSONString(dto));
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
try {
|
|
|
|
|
LianLianPageResponse pageResponse = lianLianService.query_stations_info(dto);
|
|
|
|
|
response = new RestApiResponse<>(pageResponse);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询充电站信息 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询充电站信息 result:{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询充电站状态信息
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_station_status")
|
|
|
|
|
public RestApiResponse<?> query_station_status(@RequestBody ArrayList<String> StationIDs) {
|
|
|
|
|
logger.info("联联平台查询充电站状态信息 params:{}", StationIDs);
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
if (CollectionUtils.isEmpty(StationIDs)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
LianLianPageResponse pageResponse = lianLianService.query_station_status(StationIDs);
|
|
|
|
|
response = new RestApiResponse<>(pageResponse);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询充电站状态信息 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询充电站状态信息 result:{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
}
|