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;
|
2023-04-29 10:33:16 +08:00
|
|
|
import com.jsowell.common.exception.BusinessException;
|
2023-04-14 16:50:49 +08:00
|
|
|
import com.jsowell.common.response.RestApiResponse;
|
2023-04-24 13:55:33 +08:00
|
|
|
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
2023-04-25 14:03:09 +08:00
|
|
|
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
2023-04-17 15:48:12 +08:00
|
|
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
2023-04-18 16:45:49 +08:00
|
|
|
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
2023-04-14 16:50:49 +08:00
|
|
|
import com.jsowell.thirdparty.service.LianLianService;
|
2023-04-29 10:33:16 +08:00
|
|
|
import com.jsowell.thirdparty.vo.*;
|
2023-04-14 16:50:49 +08:00
|
|
|
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);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台查询充电站信息 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-14 16:50:49 +08:00
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询充电站信息 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询充电站信息 result:{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-04-18 16:45:49 +08:00
|
|
|
* 联联平台查询充电站状态信息
|
|
|
|
|
* @param StationIDs
|
2023-04-14 16:50:49 +08:00
|
|
|
* @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);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台查询充电站状态信息 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-14 16:50:49 +08:00
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询充电站状态信息 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询充电站状态信息 result:{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-04-18 16:45:49 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询统计信息
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_station_stats")
|
|
|
|
|
public RestApiResponse<?> query_station_stats(@RequestBody QueryStationInfoDTO dto) {
|
|
|
|
|
logger.info("联联平台查询统计信息 params :{}", JSONObject.toJSONString(dto));
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
|
|
|
|
|
response = new RestApiResponse<>(stationStatsInfo);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台查询统计信息 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-18 16:45:49 +08:00
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询统计信息 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询统计信息 result :{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-04-24 13:55:33 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请求设备认证
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_equip_auth")
|
|
|
|
|
public RestApiResponse<?> query_equip_auth(@RequestBody QueryEquipmentDTO dto) {
|
|
|
|
|
logger.info("联联平台请求设备认证 params :{}", JSONObject.toJSONString(dto));
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
|
|
|
|
|
response = new RestApiResponse<>(equipmentAuthVO);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台请求设备认证 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-24 13:55:33 +08:00
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("联联平台请求设备认证 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台请求设备认证 result :{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-04-25 11:20:43 +08:00
|
|
|
|
2023-04-29 10:33:16 +08:00
|
|
|
/**
|
|
|
|
|
* 请求启动充电
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_start_charge")
|
|
|
|
|
public RestApiResponse<?> query_start_charge(@RequestBody QueryStartChargeDTO dto) {
|
|
|
|
|
logger.info("联联平台请求启动充电 params :{}", JSONObject.toJSONString(dto));
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
QueryStartChargeVO queryStartChargeVO = lianLianService.query_start_charge(dto);
|
|
|
|
|
response = new RestApiResponse<>(queryStartChargeVO);
|
|
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台请求启动充电 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("联联平台请求启动充电 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台请求启动充电 result :{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-04-25 11:20:43 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询充电状态
|
|
|
|
|
* @param startChargeSeq
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/query_equip_charge_status/{startChargeSeq}")
|
|
|
|
|
public RestApiResponse<?> query_equip_charge_status(@PathVariable("startChargeSeq") String startChargeSeq) {
|
|
|
|
|
logger.info("联联平台查询充电状态 params :{}", startChargeSeq);
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
QueryChargingStatusVO vo = lianLianService.query_equip_charge_status(startChargeSeq);
|
|
|
|
|
response = new RestApiResponse<>(vo);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台查询充电状态 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-25 11:20:43 +08:00
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("联联平台查询充电状态 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台查询充电状态 result :{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-04-25 14:03:09 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请求停止充电
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/query_stop_charge")
|
|
|
|
|
public RestApiResponse<?> query_stop_charge(@RequestBody QueryStartChargeDTO dto) {
|
|
|
|
|
logger.info("联联平台请求停止充电 params :{}", JSONObject.toJSONString(dto));
|
|
|
|
|
RestApiResponse<?> response;
|
|
|
|
|
try {
|
|
|
|
|
QueryStopChargeVO queryStopChargeVO = lianLianService.query_stop_charge(dto);
|
|
|
|
|
response = new RestApiResponse<>(queryStopChargeVO);
|
2023-04-29 13:40:15 +08:00
|
|
|
}catch (BusinessException e) {
|
|
|
|
|
logger.error("联联平台请求停止充电 error",e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2023-04-25 14:03:09 +08:00
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("联联平台请求停止充电 error", e);
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
}
|
|
|
|
|
logger.info("联联平台请求停止充电 result :{}", response);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-04-14 16:50:49 +08:00
|
|
|
}
|