update 新电途Controller

This commit is contained in:
Lemon
2025-02-20 16:18:29 +08:00
parent 5d9204137c
commit 31d44174e0

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
@@ -13,10 +14,12 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.*;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.xindiantu.service.XDTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -33,10 +36,18 @@ import java.util.Map;
@Anonymous
@RestController
@RequestMapping("/xindiantu")
public class XDTController extends BaseController {
public class XDTController extends ThirdPartyBaseController {
private final String platformName = "新电途平台";
private final String platformType = ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode();
@Autowired
private XDTService xdtService;
@Qualifier("xinDiantuPlatfromServiceImpl")
private ThirdPartyPlatformService platformLogic;
// @Autowired
// private XDTService xdtService;
/**
* 获取token接口
@@ -44,13 +55,12 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_token")
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
logger.info("新电途平台请求令牌 params:{}", JSON.toJSONString(dto));
try {
Map<String, String> map = xdtService.generateToken(dto);
logger.info("新电途平台请求令牌 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
} catch (UnsupportedEncodingException e) {
logger.error("获取token接口 异常");
Map<String, String> map = platformLogic.queryToken(dto);
logger.info("{}-请求令牌, params:{}, result:{}", platformName, JSON.toJSONString(dto), JSON.toJSONString(map));
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("{}-获取token接口, 异常, params:{}", platformName, JSON.toJSONString(dto), e);
return CommonResult.failed("获取token发生异常");
}
}
@@ -61,26 +71,26 @@ public class XDTController extends BaseController {
* @param dto
* @return
*/
@PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
logger.info("推送新电途平台充电站信息 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
xdtService.pushStationInfo(dto);
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;
}
// @PostMapping("/pushStationInfo")
// public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
// logger.info("推送新电途平台充电站信息 params:{}", JSON.toJSONString(dto));
// RestApiResponse<?> response = null;
// try {
// if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
// }
// xdtService.pushStationInfo(dto);
// 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;
// }
/**
* 查询充电站信息
@@ -88,36 +98,32 @@ public class XDTController extends BaseController {
*/
@RequestMapping("/v1/query_stations_info")
public CommonResult<?> query_stations_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台查询充电站信息 params:{}", JSON.toJSONString(dto));
logger.info("{}-查询充电站信息 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = xdtService.queryStationsInfo(queryStationInfoDTO);
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
// 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("新电途平台查询充电站信息 error", e);
logger.info("{}-查询充电站信息 error:", platformName, e);
}
return CommonResult.failed("查询充电站信息异常");
return CommonResult.failed("查询充电站信息发生异常");
}
/**
@@ -128,39 +134,32 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_station_status")
public CommonResult<?> queryStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台查询统计信息 params:{}", JSON.toJSONString(dto));
logger.info("{}-查询充电站状态信息 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
// 签名错误
return CommonResult.failed("签名校验错误");
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
dto.setPlatformType(platformType);
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = xdtService.queryStationStatus(queryStationInfoDTO);
logger.info("新电途平台查询统计信息 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "查询统计信息成功!", map.get("Data"), map.get("Sig"));
// 校验签名
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.info("新电途平台查询统计信息 error:", e);
e.printStackTrace();
logger.error("{}-查询充电站状态信息 error:", platformName, e);
}
return CommonResult.failed("查询统计信息发生异常");
return CommonResult.failed("查询充电站状态信息发生异常");
}
/**
@@ -171,40 +170,32 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_equip_business_policy")
public CommonResult<?> queryEquipBusinessPolicy(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台查询业务策略信息 params:{}", JSON.toJSONString(dto));
logger.info("{}-查询业务策略信息结果 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = xdtService.queryEquipBusinessPolicy(queryStartChargeDTO);
logger.info("新电途平台查询业务策略信息 result:{}", JSON.toJSONString(map));
// 解析入参
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
return CommonResult.success(0, "查询业务策略信息成功!", map.get("Data"), map.get("Sig"));
// 执行逻辑
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.info("新电途平台查询业务策略信息 error:", e);
e.printStackTrace();
logger.error("{}-查询业务策略信息结果 error:", platformName, e);
}
return CommonResult.failed("查询业务策略信息发生异常");
return CommonResult.failed("查询业务策略信息结果发生异常");
}
/**
@@ -215,36 +206,30 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_equip_auth")
public CommonResult<?> query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台请求设备认证 param:{}", JSON.toJSONString(dto));
logger.info("{}-请求设备认证 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class);
queryEquipmentDTO.setOperatorID(dto.getOperatorID());
Map<String, String> map = xdtService.queryEquipAuth(queryEquipmentDTO);
logger.info("新电途平台请求设备认证 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
// 解析入参
QueryEquipmentDTO queryEquipmentDTO = parseParamsDTO(dto, QueryEquipmentDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryEquipAuth(queryEquipmentDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.info("新电途平台请求设备认证 error:", e);
e.printStackTrace();
logger.error("{}-请求设备认证 error:", platformName, e);
}
return CommonResult.failed("请求设备认证发生异常");
}
@@ -257,35 +242,30 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_start_charge")
public CommonResult<?> query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台请求启动充电 params :{}", JSON.toJSONString(dto));
logger.info("{}-请求启动充电 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = xdtService.queryStartCharge(queryStartChargeDTO);
logger.info("新电途平台请求启动充电 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
// 解析入参
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", e);
logger.error("{}-请求启动充电 error:", platformName, e);
}
return CommonResult.failed("请求启动充电发生异常");
}
@@ -298,37 +278,32 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_equip_charge_status")
public CommonResult<?> query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台查询充电状态 params :{}", JSON.toJSONString(dto));
logger.info("{}-查询充电状态 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID());
Map<String, String> map = xdtService.queryEquipChargeStatus(queryEquipChargeStatusDTO);
logger.info("新电途平台查询充电状态 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
// 解析入参
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = parseParamsDTO(dto, QueryEquipChargeStatusDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryEquipChargeStatus(queryEquipChargeStatusDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("新电途平台查询充电状态 error", e);
logger.error("{}-查询充电状态 error:", platformName, e);
}
return CommonResult.failed("新电途平台查询充电状态发生异常");
return CommonResult.failed("查询充电状态发生异常");
}
/**
@@ -339,37 +314,32 @@ public class XDTController extends BaseController {
*/
@PostMapping("/v1/query_stop_charge")
public CommonResult<?> query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("新电途平台请求停止充电 params :{}", JSON.toJSONString(dto));
logger.info("{}-请求停止充电 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed("令牌校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
Map<String, String> resultMap = xdtService.checkoutSign(dto);
if (resultMap == null) {
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed("签名校验错误");
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data");
String dataSecret = resultMap.get("DataSecret");
String dataSecretIV = resultMap.get("DataSecretIV");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = xdtService.queryStopCharge(queryStartChargeDTO);
logger.info("新电途平台请求停止充电 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
// 解析入参
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryStopCharge(queryStartChargeDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("新电途平台请求停止充电 error", e);
logger.error("{}-请求停止充电 error:", platformName, e);
}
return CommonResult.failed("新电途平台请求停止充电发生异常");
return CommonResult.failed("请求停止充电发生异常");
}
/**
@@ -378,23 +348,23 @@ public class XDTController extends BaseController {
* @param orderCode
* @return
*/
@GetMapping("/pushStopChargeResult/{orderCode}")
public RestApiResponse<?> pushStopChargeResult(@PathVariable("orderCode") String orderCode) {
logger.info("新电途平台推送停止充电结果 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
String result = xdtService.notificationStopChargeResult(orderCode);
response = new RestApiResponse<>(result);
}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;
}
// @GetMapping("/pushStopChargeResult/{orderCode}")
// public RestApiResponse<?> pushStopChargeResult(@PathVariable("orderCode") String orderCode) {
// logger.info("新电途平台推送停止充电结果 params:{}", orderCode);
// RestApiResponse<?> response = null;
// try {
// String result = xdtService.notificationStopChargeResult(orderCode);
// response = new RestApiResponse<>(result);
// }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;
// }
/**
* 新电途推送充电订单信息
@@ -402,23 +372,23 @@ public class XDTController extends BaseController {
* @param orderCode
* @return
*/
@GetMapping("/pushChargeOrderInfo/{orderCode}")
public RestApiResponse<?> pushChargeOrderInfo(@PathVariable("orderCode") String orderCode) {
logger.info("新电途平台推送充电订单信息 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
String result = xdtService.pushChargeOrderInfo(orderCode);
response = new RestApiResponse<>(result);
}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;
}
// @GetMapping("/pushChargeOrderInfo/{orderCode}")
// public RestApiResponse<?> pushChargeOrderInfo(@PathVariable("orderCode") String orderCode) {
// logger.info("新电途平台推送充电订单信息 params:{}", orderCode);
// RestApiResponse<?> response = null;
// try {
// String result = xdtService.pushChargeOrderInfo(orderCode);
// response = new RestApiResponse<>(result);
// }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;
// }
/**
* 新电途推送充电状态
@@ -426,23 +396,23 @@ public class XDTController extends BaseController {
* @param orderCode
* @return
*/
@GetMapping("/pushChargeStatus/{orderCode}")
public RestApiResponse<?> pushChargeStatus(@PathVariable("orderCode") String orderCode) {
logger.info("新电途平台推送充电状态 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
String result = xdtService.notificationEquipChargeStatus(orderCode);
response = new RestApiResponse<>(result);
}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;
}
// @GetMapping("/pushChargeStatus/{orderCode}")
// public RestApiResponse<?> pushChargeStatus(@PathVariable("orderCode") String orderCode) {
// logger.info("新电途平台推送充电状态 params:{}", orderCode);
// RestApiResponse<?> response = null;
// try {
// String result = xdtService.notificationEquipChargeStatus(orderCode);
// response = new RestApiResponse<>(result);
// }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;
// }
/**
* 新电途推送启动充电结果
@@ -450,23 +420,23 @@ public class XDTController extends BaseController {
* @param orderCode
* @return
*/
@GetMapping("/pushStartChargeResult/{orderCode}")
public RestApiResponse<?> pushStartChargeResult(@PathVariable("orderCode") String orderCode) {
logger.info("新电途平台推送启动充电结果 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
String result = xdtService.notificationStartChargeResult(orderCode);
response = new RestApiResponse<>(result);
}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;
}
// @GetMapping("/pushStartChargeResult/{orderCode}")
// public RestApiResponse<?> pushStartChargeResult(@PathVariable("orderCode") String orderCode) {
// logger.info("新电途平台推送启动充电结果 params:{}", orderCode);
// RestApiResponse<?> response = null;
// try {
// String result = xdtService.notificationStartChargeResult(orderCode);
// response = new RestApiResponse<>(result);
// }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;
// }
/**
* 新电途平台设备状态变化推送
@@ -474,30 +444,30 @@ public class XDTController extends BaseController {
* @param dto
* @return
*/
@PostMapping("/pushStationStatus")
public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
logger.info("新电途平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
PushRealTimeInfoDTO pushRealTimeInfoDTO = new PushRealTimeInfoDTO();
pushRealTimeInfoDTO.setStatus(dto.getStatus());
pushRealTimeInfoDTO.setPileConnectorCode(dto.getPileConnectorCode());
pushRealTimeInfoDTO.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode());
String result = xdtService.notificationStationStatus(pushRealTimeInfoDTO);
response = new RestApiResponse<>(result);
}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;
}
// @PostMapping("/pushStationStatus")
// public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
// logger.info("新电途平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
// RestApiResponse<?> response = null;
// try {
// if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
// StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
// }
// PushRealTimeInfoDTO pushRealTimeInfoDTO = new PushRealTimeInfoDTO();
// pushRealTimeInfoDTO.setStatus(dto.getStatus());
// pushRealTimeInfoDTO.setPileConnectorCode(dto.getPileConnectorCode());
// pushRealTimeInfoDTO.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode());
// String result = xdtService.notificationStationStatus(pushRealTimeInfoDTO);
// response = new RestApiResponse<>(result);
// }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;
// }
}