mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 新电途实现类接口
This commit is contained in:
@@ -55,31 +55,6 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送充电站信息 notification_stationInfo
|
||||
* http://localhost:8080/xindiantu/v1/pushStationInfo
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/notification_station_detail")
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送新电途平台充电站信息 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
platformLogic.notificationStationInfo(String.valueOf(dto.getStationId()));
|
||||
response = new RestApiResponse<>();
|
||||
}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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站信息
|
||||
* @param dto
|
||||
@@ -115,21 +90,46 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新电途平台查询统计信息
|
||||
* http://localhost:8080/xindiantu/v1/query_stations_stats
|
||||
* 推送充电站信息 notification_stationInfo
|
||||
* http://localhost:8080/xindiantu/v1/pushStationInfo
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/notification_station_detail")
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送新电途平台充电站信息 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
platformLogic.notificationStationInfo(String.valueOf(dto.getStationId()));
|
||||
response = new RestApiResponse<>();
|
||||
}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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备接口状态查询 query_station_status
|
||||
*
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/query_station_status")
|
||||
public CommonResult<?> queryStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询充电站状态信息 params:{}", platformName, JSON.toJSONString(dto));
|
||||
public CommonResult<?> query_stations_status(HttpServletRequest request , @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-设备接口状态查询 params:{}" , platformName , JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
// 校验失败
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
|
||||
}
|
||||
dto.setPlatformType(platformType);
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
@@ -138,27 +138,25 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
|
||||
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
|
||||
|
||||
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
|
||||
logger.info("{}-设备接口状态查询 result:{}" , platformName , map);
|
||||
return CommonResult.success(0 , "设备接口状态查询成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-查询充电站状态信息 error:", platformName, e);
|
||||
logger.info("{}-设备接口状态查询 error:" , platformName , e);
|
||||
}
|
||||
return CommonResult.failed("查询充电站状态信息发生异常");
|
||||
return CommonResult.failed("设备接口状态查询发生异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新电途平台查询业务策略信息结果
|
||||
* http://localhost:8080/xindiantu/v1/query_equip_business_policy
|
||||
* @param dto
|
||||
* @return
|
||||
* 二维码解析接口 query_qrcode_data
|
||||
*/
|
||||
@PostMapping("/v1/query_equip_business_policy")
|
||||
public CommonResult<?> queryEquipBusinessPolicy(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询业务策略信息结果 params:{}", platformName, JSON.toJSONString(dto));
|
||||
@PostMapping("/v1/query_qrcode_data")
|
||||
public CommonResult<?> queryQrcodeData(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-二维码解析接口 params:{}", platformName, JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
@@ -174,16 +172,16 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
|
||||
QueryStartChargeDTO queryQrcodeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryEquipBusinessPolicy(queryStartChargeDTO);
|
||||
Map<String, String> map = platformLogic.queryQrcodeData(queryQrcodeDTO);
|
||||
|
||||
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-查询业务策略信息结果 error:", platformName, e);
|
||||
logger.error("{}-二维码解析接口 error:", platformName, e);
|
||||
}
|
||||
return CommonResult.failed("查询业务策略信息结果发生异常");
|
||||
return CommonResult.failed("二维码解析接口发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,15 +220,16 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
return CommonResult.failed("请求设备认证发生异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param request
|
||||
* 新电途平台查询业务策略信息结果
|
||||
* http://localhost:8080/xindiantu/v1/query_equip_business_policy
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/query_start_charge")
|
||||
public CommonResult<?> query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-请求启动充电 params:{}", platformName, JSON.toJSONString(dto));
|
||||
@PostMapping("/v1/query_equip_business_policy")
|
||||
public CommonResult<?> queryEquipBusinessPolicy(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询业务策略信息结果 params:{}", platformName, JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
@@ -249,15 +248,16 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryStartCharge(queryStartChargeDTO);
|
||||
Map<String, String> map = platformLogic.queryEquipBusinessPolicy(queryStartChargeDTO);
|
||||
|
||||
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-请求启动充电 error:", platformName, e);
|
||||
logger.error("{}-查询业务策略信息结果 error:", platformName, e);
|
||||
}
|
||||
return CommonResult.failed("请求启动充电发生异常");
|
||||
return CommonResult.failed("查询业务策略信息结果发生异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* http://localhost:8080/xindiantu/query_equip_charge_status/{startChargeSeq}
|
||||
@@ -294,6 +294,86 @@ public class XDTController extends ThirdPartyBaseController {
|
||||
return CommonResult.failed("查询充电状态发生异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新电途平台查询统计信息
|
||||
* http://localhost:8080/xindiantu/v1/query_stations_stats
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/query_station_status")
|
||||
public CommonResult<?> queryStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询充电站状态信息 params:{}", platformName, JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
// 校验失败
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
|
||||
}
|
||||
dto.setPlatformType(platformType);
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
// 签名错误
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
|
||||
|
||||
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-查询充电站状态信息 error:", platformName, e);
|
||||
}
|
||||
return CommonResult.failed("查询充电站状态信息发生异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/query_start_charge")
|
||||
public CommonResult<?> query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-请求启动充电 params:{}", platformName, JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
// 校验失败
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
|
||||
}
|
||||
dto.setPlatformType(platformType);
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
// 签名错误
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryStartCharge(queryStartChargeDTO);
|
||||
|
||||
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-请求启动充电 error:", platformName, e);
|
||||
}
|
||||
return CommonResult.failed("请求启动充电发生异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param request
|
||||
|
||||
Reference in New Issue
Block a user