mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-04 05:58:00 +08:00
update 对接第三方平台
This commit is contained in:
@@ -4,8 +4,13 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.jsowell.common.annotation.Anonymous;
|
import com.jsowell.common.annotation.Anonymous;
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
|
import com.jsowell.common.exception.BusinessException;
|
||||||
|
import com.jsowell.common.response.RestApiResponse;
|
||||||
import com.jsowell.common.util.JWTUtils;
|
import com.jsowell.common.util.JWTUtils;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||||
|
import com.jsowell.pile.dto.PushInfoParamDTO;
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
||||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||||
@@ -15,10 +20,7 @@ import com.jsowell.thirdparty.platform.util.Cryptos;
|
|||||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -217,84 +219,134 @@ public class LianLianController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联联平台设备状态变化推送
|
* 充电站信息变化推送 notificationStationInfo
|
||||||
* http://localhost:8080/LianLian/pushStationStatus
|
*/
|
||||||
|
@PostMapping("/notificationStationInfo")
|
||||||
|
public RestApiResponse<?> notificationStationInfo(@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);
|
||||||
|
}
|
||||||
|
String result = lianLianService.notificationStationInfo(dto.getStationId());
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联联平台设备状态变化推送 notification_stationStatus
|
||||||
|
* http://localhost:8080/LianLian/notificationStationStatus
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// @PostMapping("/pushStationStatus")
|
@PostMapping("/notificationStationStatus")
|
||||||
// public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
|
public RestApiResponse<?> notificationStationStatus(@RequestBody PushInfoParamDTO dto) {
|
||||||
// logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
|
logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
|
||||||
// RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
// try {
|
try {
|
||||||
// if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
|
if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
|
||||||
// StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
|
StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
// }
|
}
|
||||||
// String result = lianLianService.notificationStationStatus(dto.getPileConnectorCode(), dto.getStatus());
|
String result = lianLianService.notificationStationStatus(dto.getPileConnectorCode(), dto.getStatus());
|
||||||
// response = new RestApiResponse<>(result);
|
response = new RestApiResponse<>(result);
|
||||||
// }catch (BusinessException e) {
|
}catch (BusinessException e) {
|
||||||
// logger.error("联联平台设备状态变化推送 error",e);
|
logger.error("联联平台设备状态变化推送 error",e);
|
||||||
// response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
// }catch (Exception e) {
|
}catch (Exception e) {
|
||||||
// logger.error("联联平台设备状态变化推送 error", e);
|
logger.error("联联平台设备状态变化推送 error", e);
|
||||||
// response = new RestApiResponse<>(e);
|
response = new RestApiResponse<>(e);
|
||||||
// }
|
}
|
||||||
// logger.info("联联平台设备状态变化推送 result:{}", response);
|
logger.info("联联平台设备状态变化推送 result:{}", response);
|
||||||
// return response;
|
return response;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送订单信息
|
* 站点费率变化推送 notification_stationFee
|
||||||
|
*/
|
||||||
|
@PostMapping("/notificationStationFee")
|
||||||
|
public RestApiResponse<?> notificationStationFee(@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);
|
||||||
|
}
|
||||||
|
String result = lianLianService.notificationStationFee(dto.getStationId());
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充电中状态变化推送 notification_connector_charge_status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/notificationConnectorChargeStatus/{orderCode}")
|
||||||
|
public RestApiResponse<?> notificationConnectorChargeStatus(@PathVariable("orderCode")String orderCode) {
|
||||||
|
logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode);
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
if (StringUtils.isBlank(orderCode)) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
|
}
|
||||||
|
// String result = lianLianService.pushPileChargeStatusChange(orderCode);
|
||||||
|
String result = lianLianService.notificationConnectorChargeStatus(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送订单信息 notification_orderInfo
|
||||||
* @param orderCode
|
* @param orderCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// @GetMapping("/pushOrderInfo/{orderCode}")
|
@GetMapping("/notificationOrderInfo/{orderCode}")
|
||||||
// public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode")String orderCode) {
|
public RestApiResponse<?> notificationOrderInfo(@PathVariable("orderCode")String orderCode) {
|
||||||
// logger.info("联联平台推送订单信息 params:{}", orderCode);
|
logger.info("联联平台推送订单信息 params:{}", orderCode);
|
||||||
// RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
// try {
|
try {
|
||||||
// if (StringUtils.isBlank(orderCode)) {
|
if (StringUtils.isBlank(orderCode)) {
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
// }
|
}
|
||||||
// String result = lianLianService.notificationOrderInfo(orderCode);
|
String result = lianLianService.notificationOrderInfo(orderCode);
|
||||||
// response = new RestApiResponse<>(result);
|
response = new RestApiResponse<>(result);
|
||||||
// }catch (BusinessException e) {
|
}catch (BusinessException e) {
|
||||||
// logger.error("联联平台推送订单信息 error",e);
|
logger.error("联联平台推送订单信息 error",e);
|
||||||
// response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
// }catch (Exception e) {
|
}catch (Exception e) {
|
||||||
// logger.error("联联平台推送订单信息 error", e);
|
logger.error("联联平台推送订单信息 error", e);
|
||||||
// response = new RestApiResponse<>(e);
|
response = new RestApiResponse<>(e);
|
||||||
// }
|
}
|
||||||
// logger.info("联联平台推送订单信息 result:{}", response);
|
logger.info("联联平台推送订单信息 result:{}", response);
|
||||||
// return response;
|
return response;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备充电中状态变化推送
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// @GetMapping("/pushPileChargeStatusChange/{orderCode}")
|
|
||||||
// public RestApiResponse<?> pushPileChargeStatusChange(@PathVariable("orderCode")String orderCode) {
|
|
||||||
// logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode);
|
|
||||||
// RestApiResponse<?> response = null;
|
|
||||||
// try {
|
|
||||||
// if (StringUtils.isBlank(orderCode)) {
|
|
||||||
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
|
||||||
// }
|
|
||||||
// // String result = lianLianService.pushPileChargeStatusChange(orderCode);
|
|
||||||
// String result = lianLianService.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;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求设备认证
|
* 请求设备认证
|
||||||
|
|||||||
@@ -13,4 +13,6 @@ public class PushInfoParamDTO {
|
|||||||
private String pileConnectorCode;
|
private String pileConnectorCode;
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
private String stationId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user