mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 南瑞平台接口做加密处理
This commit is contained in:
@@ -59,7 +59,7 @@ public interface NRService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> query_stations_info(QueryStationInfoDTO dto);
|
||||
Map<String, String> query_stations_info(QueryStationInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 推送告警信息
|
||||
@@ -82,10 +82,10 @@ public interface NRService {
|
||||
* 查询设备接口状态
|
||||
* 此接口用于批量查询设备实时状态
|
||||
* 由充电运营商方实现此接口,省、市两级监管平台调用。
|
||||
* @param stationIds
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> query_station_status(List<String> stationIds);
|
||||
Map<String, String> query_station_status(QueryStationInfoDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
@@ -102,5 +102,5 @@ public interface NRService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<NROrderInfo> query_order_info(NRQueryOrderDTO dto);
|
||||
Map<String, String> query_order_info(NRQueryOrderDTO dto);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
@@ -79,6 +80,9 @@ public class NRServiceImpl implements NRService {
|
||||
@Autowired
|
||||
private IThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private IThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private LianLianService lianLianService;
|
||||
|
||||
@@ -202,7 +206,7 @@ public class NRServiceImpl implements NRService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> query_stations_info(QueryStationInfoDTO dto) {
|
||||
public Map<String, String> query_stations_info(QueryStationInfoDTO dto) {
|
||||
List<NRStationInfo> resultList = new ArrayList<>();
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
@@ -213,6 +217,10 @@ public class NRServiceImpl implements NRService {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
PageInfo<PileStationInfo> pageInfo = new PageInfo<>(stationInfos);
|
||||
for (PileStationInfo pileStationInfo : pageInfo.getList()) {
|
||||
// 拼装参数
|
||||
@@ -273,7 +281,19 @@ public class NRServiceImpl implements NRService {
|
||||
map.put("ItemSize", resultList.size());
|
||||
map.put("StationInfos", resultList);
|
||||
|
||||
return map;
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -404,22 +424,26 @@ public class NRServiceImpl implements NRService {
|
||||
* 查询设备接口状态
|
||||
* 此接口用于批量查询设备实时状态
|
||||
* 由充电运营商方实现此接口,省、市两级监管平台调用。
|
||||
* @param stationIds
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> query_station_status(List<String> stationIds) {
|
||||
public Map<String, String> query_station_status(QueryStationInfoDTO dto) {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<NRStationStatusInfo> resultList = new ArrayList<>();
|
||||
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 将 stationIdList 转换成 List<Long>
|
||||
List<Long> stationLongList = stationIds.stream()
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
QueryConnectorListDTO dto = QueryConnectorListDTO.builder()
|
||||
QueryConnectorListDTO queryConnectorListDTO = QueryConnectorListDTO.builder()
|
||||
.stationIdList(stationLongList)
|
||||
.build();
|
||||
List<PileConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||
List<PileConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.getConnectorInfoListByParams(queryConnectorListDTO);
|
||||
if (CollectionUtils.isEmpty(connectorInfoVOS)) {
|
||||
return new LinkedHashMap<>();
|
||||
}
|
||||
@@ -469,7 +493,19 @@ public class NRServiceImpl implements NRService {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("StationStatusInfos", resultList);
|
||||
|
||||
return map;
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -523,17 +559,33 @@ public class NRServiceImpl implements NRService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NROrderInfo> query_order_info(NRQueryOrderDTO dto) {
|
||||
public Map<String, String> query_order_info(NRQueryOrderDTO dto) {
|
||||
List<NROrderInfo> resultList = new ArrayList<>();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
List<NROrderInfoVO> nrOrderInfos = orderBasicInfoService.getNROrderInfos(dto);
|
||||
if (CollectionUtils.isEmpty(nrOrderInfos)) {
|
||||
return new ArrayList<>();
|
||||
return Maps.newLinkedHashMap();
|
||||
}
|
||||
for (NROrderInfoVO nrOrderInfoVO : nrOrderInfos) {
|
||||
NROrderInfo nrOrderInfo = formatNROrderInfo(nrOrderInfoVO);
|
||||
resultList.add(nrOrderInfo);
|
||||
}
|
||||
return resultList;
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(resultList).getBytes(),
|
||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user