mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -211,23 +211,23 @@ public class LianLianController extends BaseController {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_station_stats")
|
||||
public RestApiResponse<?> query_station_stats(@RequestBody QueryStationInfoDTO dto) {
|
||||
logger.info("联联平台查询统计信息 params :{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
|
||||
response = new RestApiResponse<>(stationStatsInfo);
|
||||
}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;
|
||||
}
|
||||
// @PostMapping("/query_station_stats")
|
||||
// public RestApiResponse<?> query_station_stats(@RequestBody QueryStationInfoDTO dto) {
|
||||
// logger.info("联联平台查询统计信息 params :{}", JSONObject.toJSONString(dto));
|
||||
// RestApiResponse<?> response;
|
||||
// try {
|
||||
// StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
|
||||
// response = new RestApiResponse<>(stationStatsInfo);
|
||||
// }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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
@@ -404,4 +404,36 @@ public class LianLianController extends BaseController {
|
||||
}
|
||||
return CommonResult.failed("查询充电站状态信息发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询统计信息
|
||||
* http://localhost:8080/LianLian/query_station_stats
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_station_stats")
|
||||
public CommonResult<?> query_station_stats(@RequestBody CommonParamsDTO dto) {
|
||||
try {
|
||||
// 校验签名
|
||||
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");
|
||||
// 转换成相应对象
|
||||
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
|
||||
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = lianLianService.query_station_stats(queryStationInfoDTO);
|
||||
return CommonResult.success(0, "查询统计信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return CommonResult.failed("查询统计信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,11 @@ public class SpringBootTestController {
|
||||
// String dataJson = JSONUtil.toJsonStr(data);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StationIDs", com.google.common.collect.Lists.newArrayList("1", "2"));
|
||||
// json.put("StationIDs", com.google.common.collect.Lists.newArrayList("1", "2"));
|
||||
json.put("StationID", "2");
|
||||
json.put("StartTime", "2023-02-01");
|
||||
json.put("EndTime", "2023-06-01");
|
||||
|
||||
String dataJson = JSONObject.toJSONString(json);
|
||||
// 加密
|
||||
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
|
||||
|
||||
Reference in New Issue
Block a user