|
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
-@Tag(name = "充电业务相关接口")
|
|
|
|
|
|
|
+@Tag(name = "充电业务相关接口_第三方")
|
|
|
@RequestMapping("/dev/v1/linkData")
|
|
@RequestMapping("/dev/v1/linkData")
|
|
|
public class LinkDataController {
|
|
public class LinkDataController {
|
|
|
|
|
|
|
@@ -30,10 +30,11 @@ public class LinkDataController {
|
|
|
private final JwtTokenUtil jwtTokenUtil;
|
|
private final JwtTokenUtil jwtTokenUtil;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 获取token
|
|
|
|
|
- * @author SheepHy
|
|
|
|
|
|
|
+ * 获取Token
|
|
|
|
|
+ * Token作为全局唯一凭证,调用各接口时均需要使用,该接口作为双方获取Token的接口,双方均需要实现。
|
|
|
|
|
+ * @author wzq
|
|
|
* @param request,参数为类则包含{@link RequestParmsEntity}
|
|
* @param request,参数为类则包含{@link RequestParmsEntity}
|
|
|
- * @return 获取tokenVO
|
|
|
|
|
|
|
+ * @return ResponseParmsEntity{@link ResponseParmsEntity}
|
|
|
*/
|
|
*/
|
|
|
@Operation(summary = "获取token")
|
|
@Operation(summary = "获取token")
|
|
|
@PostMapping("/query_token")
|
|
@PostMapping("/query_token")
|
|
@@ -44,22 +45,22 @@ public class LinkDataController {
|
|
|
//验证签名
|
|
//验证签名
|
|
|
if (!HmacMD5Util.verify(request.getOperatorID() + request.getData() + request.getTimeStamp() + request.getSeq(),
|
|
if (!HmacMD5Util.verify(request.getOperatorID() + request.getData() + request.getTimeStamp() + request.getSeq(),
|
|
|
ConnectivityConstants.SIG_SECRET, request.getSig())) {
|
|
ConnectivityConstants.SIG_SECRET, request.getSig())) {
|
|
|
- return responseParmsEntity
|
|
|
|
|
- .setRet(4001)
|
|
|
|
|
- .setMsg("签名验证失败")
|
|
|
|
|
- .setData("")
|
|
|
|
|
- .setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
|
|
|
|
+ responseParmsEntity.setRet(4001);
|
|
|
|
|
+ responseParmsEntity.setMsg("签名验证失败");
|
|
|
|
|
+ responseParmsEntity.setData("");
|
|
|
|
|
+ responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
ConnectivityConstants.SIG_SECRET));
|
|
ConnectivityConstants.SIG_SECRET));
|
|
|
|
|
+ return responseParmsEntity;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String data = request.getData();
|
|
String data = request.getData();
|
|
|
String string = AESCryptoUtils.decrypt(data, ConnectivityConstants.DATA_SECRET, ConnectivityConstants.DATA_SECRET_IV);
|
|
String string = AESCryptoUtils.decrypt(data, ConnectivityConstants.DATA_SECRET, ConnectivityConstants.DATA_SECRET_IV);
|
|
|
QueryTokenRequestParms queryTokenRequestParms = new Gson().fromJson(string, QueryTokenRequestParms.class);
|
|
QueryTokenRequestParms queryTokenRequestParms = new Gson().fromJson(string, QueryTokenRequestParms.class);
|
|
|
if (queryTokenRequestParms == null || queryTokenRequestParms.getOperatorID() == null || queryTokenRequestParms.getOperatorSecret() == null) {
|
|
if (queryTokenRequestParms == null || queryTokenRequestParms.getOperatorID() == null || queryTokenRequestParms.getOperatorSecret() == null) {
|
|
|
- responseParmsEntity
|
|
|
|
|
- .setRet(4003)
|
|
|
|
|
- .setMsg("参数错误")
|
|
|
|
|
- .setData("");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ responseParmsEntity.setRet(4003);
|
|
|
|
|
+ responseParmsEntity.setMsg("参数错误");
|
|
|
|
|
+ responseParmsEntity.setData("");
|
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
ConnectivityConstants.SIG_SECRET));
|
|
ConnectivityConstants.SIG_SECRET));
|
|
|
return responseParmsEntity;
|
|
return responseParmsEntity;
|
|
@@ -67,10 +68,9 @@ public class LinkDataController {
|
|
|
|
|
|
|
|
//判断运营商ID与密钥是否正确
|
|
//判断运营商ID与密钥是否正确
|
|
|
if (!queryTokenRequestParms.getOperatorID().equals(ConnectivityConstants.PLATFORM_OPERATOR_ID) && !queryTokenRequestParms.getOperatorSecret().equals(ConnectivityConstants.PLATFORM_OPERATOR_SECRET)) {
|
|
if (!queryTokenRequestParms.getOperatorID().equals(ConnectivityConstants.PLATFORM_OPERATOR_ID) && !queryTokenRequestParms.getOperatorSecret().equals(ConnectivityConstants.PLATFORM_OPERATOR_SECRET)) {
|
|
|
- responseParmsEntity
|
|
|
|
|
- .setRet(4004)
|
|
|
|
|
- .setMsg("OperatorID或OperatorSecret错误!")
|
|
|
|
|
- .setData("");
|
|
|
|
|
|
|
+ responseParmsEntity .setRet(4004);
|
|
|
|
|
+ responseParmsEntity.setMsg("OperatorID或OperatorSecret错误!");
|
|
|
|
|
+ responseParmsEntity .setData("");
|
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
ConnectivityConstants.SIG_SECRET));
|
|
ConnectivityConstants.SIG_SECRET));
|
|
|
}
|
|
}
|
|
@@ -88,22 +88,20 @@ public class LinkDataController {
|
|
|
|
|
|
|
|
log.info("生成token信息:{}", new Gson().toJson(queryTokenResponseData));
|
|
log.info("生成token信息:{}", new Gson().toJson(queryTokenResponseData));
|
|
|
|
|
|
|
|
- String encodeData = AESCryptoUtils.encrypt(new Gson().toJson(queryTokenResponseData), ConnectivityConstants.PLATFORM_DATA_SECRET,
|
|
|
|
|
- ConnectivityConstants.PLATFORM_DATA_SECRET_IV);
|
|
|
|
|
|
|
+ String encodeData = AESCryptoUtils.encrypt(new Gson().toJson(queryTokenResponseData), ConnectivityConstants.DATA_SECRET,
|
|
|
|
|
+ ConnectivityConstants.DATA_SECRET_IV);
|
|
|
|
|
|
|
|
- responseParmsEntity
|
|
|
|
|
- .setRet(0)
|
|
|
|
|
- .setMsg("成功")
|
|
|
|
|
- .setData(encodeData)
|
|
|
|
|
- .setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
|
|
|
|
+ responseParmsEntity.setRet(0);
|
|
|
|
|
+ responseParmsEntity.setMsg("成功");
|
|
|
|
|
+ responseParmsEntity .setData(encodeData);
|
|
|
|
|
+ responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
ConnectivityConstants.SIG_SECRET));
|
|
ConnectivityConstants.SIG_SECRET));
|
|
|
return responseParmsEntity;
|
|
return responseParmsEntity;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("系统错误:{}", e.getMessage());
|
|
log.error("系统错误:{}", e.getMessage());
|
|
|
- responseParmsEntity
|
|
|
|
|
- .setRet(500)
|
|
|
|
|
- .setMsg("系统错误")
|
|
|
|
|
- .setData("");
|
|
|
|
|
|
|
+ responseParmsEntity .setRet(500);
|
|
|
|
|
+ responseParmsEntity.setMsg("系统错误");
|
|
|
|
|
+ responseParmsEntity.setData("");
|
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
responseParmsEntity.setSig(HmacMD5Util.genSign(responseParmsEntity.getRet(), responseParmsEntity.getMsg(), responseParmsEntity.getData(),
|
|
|
ConnectivityConstants.SIG_SECRET));
|
|
ConnectivityConstants.SIG_SECRET));
|
|
|
return responseParmsEntity;
|
|
return responseParmsEntity;
|
|
@@ -115,7 +113,7 @@ public class LinkDataController {
|
|
|
* <p>2.4 推送启动充电结果</p>
|
|
* <p>2.4 推送启动充电结果</p>
|
|
|
* @author SheepHy
|
|
* @author SheepHy
|
|
|
* @param requestDTO,参数为类则包含{@link RequestParmsEntity}
|
|
* @param requestDTO,参数为类则包含{@link RequestParmsEntity}
|
|
|
- * @return 停推送启动充电结果VO
|
|
|
|
|
|
|
+ * @return 推送启动充电结果VO
|
|
|
*/
|
|
*/
|
|
|
@Operation(summary = "推送启动充电结果")
|
|
@Operation(summary = "推送启动充电结果")
|
|
|
@PostMapping("/notification_start_charge_result")
|
|
@PostMapping("/notification_start_charge_result")
|
|
@@ -156,7 +154,9 @@ public class LinkDataController {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 3.2 设备状态变化推送
|
|
* 3.2 设备状态变化推送
|
|
|
- * */
|
|
|
|
|
|
|
+ * @param requestDTO
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
@Operation(summary = "设备状态变化推送")
|
|
@Operation(summary = "设备状态变化推送")
|
|
|
@PostMapping("/notification_stationStatus")
|
|
@PostMapping("/notification_stationStatus")
|
|
|
@Log(value = "设备状态变化推送", module = LogModuleEnum.PARKING, params = true, result = true)
|
|
@Log(value = "设备状态变化推送", module = LogModuleEnum.PARKING, params = true, result = true)
|