mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 联联查询统计信息接口
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("查询统计信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user