mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -47,14 +47,14 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
*/
|
||||
@PostMapping("/v1/query_token")
|
||||
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("宁波平台请求令牌 params:{}", JSON.toJSONString(dto));
|
||||
logger.info("微网快电请求令牌 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
// Map<String, String> map = zdlService.generateToken(dto);
|
||||
Map<String, String> map = platformLogic.queryToken(dto);
|
||||
logger.info("宁波平台请求令牌 result:{}", JSON.toJSONString(map));
|
||||
logger.info("微网快电请求令牌 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("宁波平台 请求令牌接口 异常");
|
||||
logger.error("微网快电请求令牌接口 异常");
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
@@ -99,35 +99,26 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
* 设备状态推送
|
||||
* notification_stationStatus
|
||||
* @param request
|
||||
* @param dto
|
||||
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/notification_stationStatus")
|
||||
public CommonResult<?> notification_stationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-设备状态推送 params:{}", platformName, JSON.toJSONString(dto));
|
||||
public RestApiResponse<?> notification_stationStatus(@RequestBody PushRealTimeInfoDTO pushRealTimeInfoDTO, HttpServletRequest request) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 校验令牌
|
||||
if (!verifyToken(request.getHeader("Authorization"))) {
|
||||
// 校验失败
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
|
||||
}
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
// 签名错误
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
PushRealTimeInfoDTO pushRealTimeInfoDTO = parseParamsDTO(dto, PushRealTimeInfoDTO.class);
|
||||
// 执行逻辑
|
||||
String result = platformLogic.notificationStationStatus(pushRealTimeInfoDTO);
|
||||
logger.info("{}-设备状态推送 result:{}", platformName, result);
|
||||
return CommonResult.success(Integer.parseInt(result.split(",")[0]), result.split(",")[1], result.split(",")[2], result.split(",")[3]);
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-设备状态推送 error:", platformName, e);
|
||||
logger.info("【{}】推送设备状态 result:{}", this.getClass().getSimpleName(), result);
|
||||
response = new RestApiResponse<>(result);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("【{}】推送设备状态 error:{}", this.getClass().getSimpleName(), e.getMessage());
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("【{}】推送设备状态 error:{}", this.getClass().getSimpleName(), e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
return CommonResult.failed("设备状态推送发生异常");
|
||||
logger.info("【{}】推送设备状态 response:{}", this.getClass().getSimpleName(), response);
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -309,7 +300,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/notification_start_charge_result")
|
||||
@GetMapping("/v1/notification_start_charge_result/{orderCode}")
|
||||
public RestApiResponse<?> notification_start_charge_result(@RequestParam("orderCode") String orderCode) {
|
||||
logger.info("【{}】推送启动充电结果 params:{}", this.getClass().getSimpleName(), orderCode);
|
||||
RestApiResponse<?> response = null;
|
||||
@@ -372,7 +363,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/notification_equip_charge_status")
|
||||
@GetMapping("/v1/notification_equip_charge_status/{orderCode}")
|
||||
public RestApiResponse<?> notification_equip_charge_status(@PathVariable("orderCode") String orderCode) {
|
||||
logger.info("推送充电状态 params:{}", orderCode);
|
||||
RestApiResponse<?> response = null;
|
||||
@@ -436,7 +427,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/notification_stop_charge_result/{orderCode}")
|
||||
public RestApiResponse<?> notificationStopChargeResult(@PathVariable("orderCode") String orderCode) {
|
||||
public RestApiResponse<?> notification_stop_charge_result(@PathVariable("orderCode") String orderCode) {
|
||||
logger.info("推送停止充电结果 params:{}", orderCode);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
@@ -458,20 +449,20 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController {
|
||||
* 充电订单信息推送
|
||||
*/
|
||||
@PostMapping("/v1/notification_charge_order_info")
|
||||
public AjaxResult notificationChargeOrderInfo(@RequestBody NotificationDTO dto) {
|
||||
AjaxResult result;
|
||||
public RestApiResponse<?> notification_charge_order_info(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
notificationService.notificationChargeOrderInfo(dto);
|
||||
logger.info("充电订单信息推送成功");
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("充电订单信息推送失败", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("充电订单信息推送失败", e);
|
||||
result = AjaxResult.error();
|
||||
String result = platformLogic.pushOrderInfo(dto);
|
||||
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);
|
||||
}
|
||||
return result;
|
||||
logger.info("推送充电订单信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user