mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
update 联联平台接口校验令牌
This commit is contained in:
@@ -6,6 +6,7 @@ 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.StringUtils;
|
||||
import com.jsowell.pile.domain.DockingPlatformConfig;
|
||||
import com.jsowell.pile.dto.*;
|
||||
@@ -22,6 +23,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -335,7 +337,7 @@ public class LianLianController extends BaseController {
|
||||
try {
|
||||
Map<String, String> map = lianLianService.generateToken(dto);
|
||||
logger.info("联联平台请求令牌 result:{}", JSONObject.toJSONString(map));
|
||||
return CommonResult.success(0, "", map.get("data"), map.get("sig"));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("获取token接口 异常");
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
@@ -348,10 +350,16 @@ public class LianLianController extends BaseController {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_stations_info")
|
||||
public CommonResult<?> query_stations_info(@RequestBody CommonParamsDTO dto) {
|
||||
@PostMapping("/v1/query_stations_info")
|
||||
public CommonResult<?> query_stations_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) {
|
||||
@@ -383,10 +391,16 @@ public class LianLianController extends BaseController {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_station_status")
|
||||
public CommonResult<?> query_station_status(@RequestBody CommonParamsDTO dto) {
|
||||
@PostMapping("/v1/query_station_status")
|
||||
public CommonResult<?> query_station_status(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) {
|
||||
@@ -418,10 +432,16 @@ public class LianLianController extends BaseController {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_station_stats")
|
||||
public CommonResult<?> query_station_stats(@RequestBody CommonParamsDTO dto) {
|
||||
@PostMapping("/v1/query_station_stats")
|
||||
public CommonResult<?> query_station_stats(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) {
|
||||
|
||||
Reference in New Issue
Block a user