mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 联联接口
This commit is contained in:
@@ -495,6 +495,46 @@ public class LianLianController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送订单结算信息 (联联推给我们)
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/notification_order_settlement_info")
|
||||
public CommonResult<?> notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("联联平台推送订单结算信息 params:{}", JSONObject.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
// 解密data
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), operatorSecret.getBytes(), operatorSecret.getBytes());
|
||||
String dataStr = new String(plainText, "UTF-8");
|
||||
// 转换成相应对象
|
||||
PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class);
|
||||
pushOrderSettlementDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = lianLianService.pushOrderSettlementInfo(pushOrderSettlementDTO);
|
||||
|
||||
return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("联联平台推送订单结算信息 error:", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return CommonResult.failed("推送订单结算信息发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 联联平台查询充电站信息
|
||||
* http://localhost:8080/LianLian/query_stations_info
|
||||
|
||||
Reference in New Issue
Block a user