mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-24 04:55:08 +08:00
update 接口格式
This commit is contained in:
75
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java
vendored
Normal file
75
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.jsowell.api.thirdparty;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.pile.dto.QueryPileDTO;
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
import com.jsowell.thirdparty.amap.common.AMapCommonResult;
|
||||
import com.jsowell.thirdparty.amap.domain.AMapStationInfo;
|
||||
import com.jsowell.thirdparty.amap.service.AMapService;
|
||||
import com.jsowell.thirdparty.amap.util.AMapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/6/16 13:56
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/charging")
|
||||
public class AMapController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AMapService aMapService;
|
||||
|
||||
@PostMapping("/queryStationInfo")
|
||||
public AMapCommonResult queryStationInfo(@RequestParam Map<String, String> requestMap) {
|
||||
AMapCommonResult result = new AMapCommonResult();
|
||||
String paramString = JSON.toJSONString(requestMap);
|
||||
logger.info("高德拉取充电站静态数据 params:{}", paramString);
|
||||
try {
|
||||
// Map map = JSON.parseObject(paramString, Map.class);
|
||||
// Map<String, String> paramMap = (Map<String, String>)JSON.parse(paramString);
|
||||
if (AMapUtils.checkSign(requestMap)) {
|
||||
// true 验签成功
|
||||
String bizContent = requestMap.get("biz_content");
|
||||
GetStationInfoDTO dto = JSON.parseObject(bizContent, GetStationInfoDTO.class);
|
||||
// List<AMapStationInfo> stationInfos = aMapService.getStationInfos(dto);
|
||||
List<AMapStationInfo> stationInfos = aMapService.getStationInfosV2(dto);
|
||||
result = result.successResponse(stationInfos);
|
||||
// logger.info("高德拉取充电站静态数据 success 业务参数:{}", JSON.toJSONString(stationInfos));
|
||||
logger.info("高德拉取充电站静态数据 success result:{}", JSON.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("高德拉取充电站静态数据 error", e);
|
||||
return result.failedResponse();
|
||||
}
|
||||
logger.error("高德拉取充电站静态数据验签失败");
|
||||
return result.checkSignFailed();
|
||||
// logger.info("高德拉取充电站静态数据 result:{}", );
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/pushStationStatus")
|
||||
public AMapCommonResult pushStationStatus(@RequestBody QueryPileDTO dto) {
|
||||
AMapCommonResult result = new AMapCommonResult();
|
||||
logger.info("商家推送充电设备动态数据 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
String pushResult = aMapService.pushChargingDeviceDynamics(dto.getStationId());
|
||||
return result.successResponse(pushResult);
|
||||
} catch (Exception e) {
|
||||
logger.error("商家推送充电设备动态数据 error", e);
|
||||
}
|
||||
return result.failedResponse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user