mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-02 17:10:03 +08:00
update 第三方平台相关方法
This commit is contained in:
@@ -13,6 +13,8 @@ import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
@@ -37,10 +39,8 @@ import com.jsowell.thirdparty.lianlian.vo.QueryStopChargeVO;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.platform.domain.HNStationInfo;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||||
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
||||
import com.jsowell.thirdparty.platform.util.*;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -89,10 +89,7 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
@Resource
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
@@ -146,10 +143,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<HNStationInfo> resultList = new ArrayList<>();
|
||||
HNStationInfo stationInfo = null;
|
||||
@@ -211,13 +206,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
map.put("ItemSize", resultList.size());
|
||||
map.put("StationInfos", resultList);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -415,10 +405,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||
List<Object> ConnectorStatusInfos = new ArrayList<>();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||
@@ -481,13 +469,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
map.put("Total", total);
|
||||
map.put("StationStatusInfos", collect);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -499,10 +482,7 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
@Override
|
||||
public Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
|
||||
// 查询信息
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
// 根据站点id 查出这段时间的充电量
|
||||
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -575,13 +555,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("StationStats", stationStatsInfo);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -598,10 +573,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
// 先查询配置密钥相关信息
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
|
||||
// 根据桩编号查询数据
|
||||
// String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -628,13 +601,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
vo.setFailReason(2); // 设备检测失败
|
||||
vo.setFailReasonMsg("未查到该桩的数据");
|
||||
}
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -647,10 +615,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
||||
List<EquipBusinessPolicyVO.PolicyInfo> policyInfoList = new ArrayList<>();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
|
||||
// 截取桩号
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
String pileSn = YKCUtils.getPileSn(pileConnectorCode);
|
||||
@@ -686,13 +652,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
.policyInfos(policyInfoList)
|
||||
.build();
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -769,10 +730,7 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 平台已存在订单
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
// 生成订单
|
||||
Map<String, Object> map = orderBasicInfoService.generateOrderForThirdParty(dto);
|
||||
String orderCode = (String) map.get("orderCode");
|
||||
@@ -805,13 +763,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
vo.setStartChargeSeqStat(1);
|
||||
}
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -831,11 +784,7 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID);
|
||||
// logger.info(operatorName + "查询密钥信息 configInfo:{}", configInfo);
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
// 通过订单号查询实时数据
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
@@ -884,13 +833,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
.build();
|
||||
}
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -931,9 +875,9 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
String data = map.get("Data");
|
||||
// 解密data (此处解密需用 thirdparty_platform_config 的密钥配置)
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorIdByType);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
thirdPartySecretInfoVO.getOurDataSecret().getBytes(), thirdPartySecretInfoVO.getOurDataSecretIv().getBytes());
|
||||
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
||||
// 转成对应的对象
|
||||
QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class);
|
||||
@@ -962,10 +906,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getHaiNanPlatformSecretInfo();
|
||||
|
||||
// 若状态为充电中,则发送停机指令
|
||||
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
|
||||
// 充电中
|
||||
@@ -986,13 +928,8 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中
|
||||
vo.setStartChargeSeqStat(3);
|
||||
}
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -1042,5 +979,18 @@ public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取海南省平台配置密钥信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ThirdPartySecretInfoVO getHaiNanPlatformSecretInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode());
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||
return thirdPartySecretInfoVO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.pile.domain.*;
|
||||
@@ -86,12 +87,6 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Resource
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@@ -201,10 +196,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<StationInfo> resultList = new ArrayList<>();
|
||||
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||
@@ -256,13 +249,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
map.put("ItemSize", resultList.size());
|
||||
map.put("StationInfos", resultList);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -277,10 +265,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||
List<Object> ConnectorStatusInfos = new ArrayList<>();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||
@@ -343,13 +329,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
map.put("Total", total);
|
||||
map.put("StationStatusInfos", collect);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -361,10 +342,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
// 根据站点id 查出这段时间的充电量
|
||||
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -437,13 +416,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("StationStats", stationStatsInfo);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -462,14 +436,14 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 通过第三方配置类型查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = new ThirdPartySettingInfo();
|
||||
settingInfo.setType(thirdPlatformType);
|
||||
ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.selectSettingInfo(settingInfo);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySettingInfo.getOperatorId();
|
||||
String operatorSecret = thirdPartySettingInfo.getOperatorSecret();
|
||||
String signSecret = thirdPartySettingInfo.getSignSecret();
|
||||
String dataSecret = thirdPartySettingInfo.getDataSecret();
|
||||
String dataSecretIv = thirdPartySettingInfo.getDataSecretIv();
|
||||
String urlAddress = thirdPartySettingInfo.getUrlAddress();
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 组装联联平台所需要的数据格式
|
||||
StationInfo info = StationInfo.builder()
|
||||
@@ -1103,10 +1077,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return null;
|
||||
}
|
||||
// 通过operatorID 查出 operatorSecret
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (platformConfig == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
// orderInfo 和 orderDetail 都不为空,再根据传过来的数据进行修改数据库信息
|
||||
confirmResult = Constants.zero;
|
||||
orderDetail.setTotalUsedElectricity(dto.getTotalPower()); // 累计充电量
|
||||
@@ -1116,10 +1088,10 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encrypt = Cryptos.encrypt(JSON.toJSONString(map), platformConfig.getDataSecret(), platformConfig.getDataSecretIv());
|
||||
String encrypt = Cryptos.encrypt(JSON.toJSONString(map), thirdPartySecretInfoVO.getOurDataSecret(), thirdPartySecretInfoVO.getOurDataSecretIv());
|
||||
resultMap.put("Data", encrypt);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, platformConfig.getSignSecret());
|
||||
String resultSign = GBSignUtils.sign(resultMap, thirdPartySecretInfoVO.getOurSigSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
return resultMap;
|
||||
}
|
||||
@@ -1132,16 +1104,13 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||
|
||||
String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732
|
||||
String pileConnectorCode = ThirdPartyPlatformUtils.extractConnectorID(dto.getConnectorID());
|
||||
// 先查询配置密钥相关信息
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
// 根据桩编号查询数据
|
||||
// String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -1176,15 +1145,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
vo.setFailReason(failReason); // 设备检测失败
|
||||
vo.setFailReasonMsg(failReasonMsg);
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -1281,10 +1243,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
// 若状态为充电中,则发送停机指令
|
||||
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
|
||||
// 充电中
|
||||
@@ -1306,17 +1266,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
vo.setStartChargeSeqStat(3);
|
||||
}
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -1336,11 +1287,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID);
|
||||
// logger.info(operatorName + "查询密钥信息 configInfo:{}", configInfo);
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
// 通过订单号查询实时数据
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
@@ -1391,18 +1339,23 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取联联平台配置密钥信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ThirdPartySecretInfoVO getLianLianPlatformSecretInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode());
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||
return thirdPartySecretInfoVO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
String operatorId = dto.getPlatformID();
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByOperatorId(operatorId);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
@@ -187,7 +187,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
operatorInfos.add(supOperatorInfo);
|
||||
}
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
// 组装结果集
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
@@ -225,10 +225,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<SupStationInfo> resultList = new ArrayList<>();
|
||||
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||
@@ -346,10 +344,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||
List<Object> connectorStatusInfos = new ArrayList<>();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||
@@ -417,10 +413,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<SupStationStatusInfo> stationStatusInfos = Lists.newArrayList();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
for (String stationId : stationIds) {
|
||||
// 查询站点的运营商信息
|
||||
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId);
|
||||
@@ -482,17 +476,15 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
String pileSn = YKCUtils.getPileSn(pileConnectorCode);
|
||||
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(stationVO.getId());
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
// 查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
|
||||
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
|
||||
@@ -571,18 +563,15 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 根据订单号查询订单详情
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
@@ -696,38 +685,28 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public String notificationEquipChargeStatus(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
||||
relation.setThirdPartyType(orderInfo.getThirdPartyType());
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
String thirdPartyType = relationInfo.getThirdPartyType();
|
||||
// 查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 调用 查询充电状态方法
|
||||
QueryEquipChargeStatusDTO dto = new QueryEquipChargeStatusDTO();
|
||||
dto.setStartChargeSeq(orderCode);
|
||||
// 根据type获取operatorId
|
||||
String operatorIdByType = ThirdPartyOperatorIdEnum.getOperatorIdByType(thirdPartyType);
|
||||
dto.setOperatorID(operatorIdByType);
|
||||
dto.setOperatorID(thirdPartySecretInfoVO.getTheirOperatorId());
|
||||
Map<String, String> map = queryEquipChargeStatus(dto);
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
String data = map.get("Data");
|
||||
// 解密data (此处解密需用 thirdparty_platform_config 的密钥配置)
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorIdByType);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
thirdPartySecretInfoVO.getOurDataSecret().getBytes(), thirdPartySecretInfoVO.getOurDataSecretIv().getBytes());
|
||||
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
||||
// 转成对应的对象
|
||||
QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class);
|
||||
@@ -763,20 +742,17 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public String notificationChargeOrderInfoHistory(String orderCode) {
|
||||
// 根据订单号查询出信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
// 查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + "supervise_notification_charge_order_info_history";
|
||||
|
||||
@@ -898,5 +874,19 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内蒙古平台配置密钥信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ThirdPartySecretInfoVO getNeiMengGuPlatformSecretInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode());
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||
return thirdPartySecretInfoVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
@@ -21,6 +22,7 @@ import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.thirdparty.ZDLEquipmentInfo;
|
||||
import com.jsowell.pile.thirdparty.ZDLStationInfo;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
@@ -50,6 +52,7 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -86,7 +89,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
private RedisCache redisCache;
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(QingHaiPlatformServiceImpl.class);
|
||||
|
||||
@@ -111,55 +114,56 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||
AccessTokenVO vo = new AccessTokenVO();
|
||||
// 0:成功;1:失败
|
||||
int succStat = 0;
|
||||
// 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义
|
||||
int failReason = 0;
|
||||
|
||||
String operatorId = dto.getOperatorID();
|
||||
// token缓存key值
|
||||
String redisKey = operatorId + "_token:";
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
if (platformConfig == null) {
|
||||
throw new BusinessException("1", "无此对接平台");
|
||||
}
|
||||
|
||||
String operatorSecret = platformConfig.getOperatorSecret();
|
||||
String dataSecret = platformConfig.getDataSecret();
|
||||
String dataSecretIv = platformConfig.getDataSecretIv();
|
||||
String signSecret = platformConfig.getSignSecret();
|
||||
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
try {
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
String ourOperatorSecret = thirdPartySecretInfoVO.getOurOperatorSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getOurDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getOurDataSecretIv();
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
String inputOperatorSecret = null;
|
||||
if (StringUtils.isNotBlank(decrypt)) {
|
||||
inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret");
|
||||
}
|
||||
if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) {
|
||||
throw new RuntimeException("密钥不一致");
|
||||
// 对比密钥
|
||||
if (!StringUtils.equals(ourOperatorSecret, inputOperatorSecret)) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
// 先查缓存中是否有已生成的token
|
||||
String token = redisCache.getCacheObject(redisKey);
|
||||
int expiredTime = (int) redisCache.getExpire(redisKey);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
// 生成token
|
||||
token = JWTUtils.createToken(operatorId, ourOperatorSecret, JWTUtils.ttlMillis);
|
||||
expiredTime = (int) (JWTUtils.ttlMillis / 1000);
|
||||
}
|
||||
vo.setAccessToken(token);
|
||||
vo.setTokenAvailableTime(expiredTime);
|
||||
// 设置缓存
|
||||
redisCache.setCacheObject(redisKey, token, expiredTime, TimeUnit.SECONDS);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
throw new BusinessException("2", "密钥错误");
|
||||
}
|
||||
|
||||
// 生成token
|
||||
String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis);
|
||||
|
||||
// 组装返回参数
|
||||
AccessTokenVO vo = new AccessTokenVO();
|
||||
vo.setAccessToken(token);
|
||||
vo.setOperatorID(operatorId);
|
||||
vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||
vo.setFailReason(0);
|
||||
vo.setSuccStat(0);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
dataSecret.getBytes(), dataSecretIv.getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText); // data
|
||||
resultMap.put("Ret", "0");
|
||||
resultMap.put("Msg", "请求令牌成功!");
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, signSecret);
|
||||
resultMap.put("Sig", resultSign);
|
||||
vo.setFailReason(failReason);
|
||||
vo.setSuccStat(succStat);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -279,9 +283,10 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
jsonObject.put("ItemSize", resultList.size());
|
||||
jsonObject.put("StationInfos", resultList);
|
||||
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
// 加密
|
||||
Map<String, String> resultMap = getResultMap(jsonObject);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(jsonObject, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -294,20 +299,17 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public String notificationStationStatus(PushRealTimeInfoDTO dto) {
|
||||
String thirdPartyType = dto.getThirdPartyType();
|
||||
String status = dto.getStatus();
|
||||
String pileConnectorCode = dto.getPileConnectorCode();
|
||||
|
||||
ThirdPartyStationRelationVO settingInfo = getQingHaiSettingInfo();
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
String urlAddress = settingInfo.getUrlAddress();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
|
||||
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
|
||||
.connectorID(pileConnectorCode)
|
||||
@@ -331,16 +333,14 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public String notificationEquipChargeStatus(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
ThirdPartyStationRelationVO settingInfo = getQingHaiSettingInfo();
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
String urlAddress = settingInfo.getUrlAddress();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + "notification_equip_charge_status";
|
||||
|
||||
@@ -490,16 +490,14 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
list.add(supStationPowerInfo);
|
||||
|
||||
// 获取推送配置密钥信息
|
||||
ThirdPartyStationRelationVO settingInfo = getQingHaiSettingInfo();
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
String urlAddress = settingInfo.getUrlAddress();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + "supervise_notification_realtime_power_info";
|
||||
// 获取令牌
|
||||
@@ -526,10 +524,8 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
||||
List<EquipBusinessPolicyVO.PolicyInfo> policyInfoList = new ArrayList<>();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
|
||||
// 截取桩号
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
String pileSn = YKCUtils.getPileSn(pileConnectorCode);
|
||||
@@ -574,7 +570,8 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
jsonObject.put("PolicyInfos", policyInfoList);
|
||||
|
||||
// 加密
|
||||
Map<String, String> resultMap = getResultMap(jsonObject);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(jsonObject, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -633,16 +630,14 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
|
||||
// 获取推送配置密钥信息
|
||||
ThirdPartyStationRelationVO settingInfo = getQingHaiSettingInfo();
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
String urlAddress = settingInfo.getUrlAddress();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getQingHaiPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getTheirOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + "notification_charge_order_info";
|
||||
// 获取令牌
|
||||
@@ -657,42 +652,19 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 获取青海平台配置密钥信息
|
||||
private ThirdPartyStationRelationVO getQingHaiSettingInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
||||
relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||
return relationInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将需要发送至对接平台的的返回参数加密返回
|
||||
* 获取青海省平台配置密钥信息
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getResultMap(JSONObject jsonObject) {
|
||||
String operatorId = ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getOperatorId();
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
if (platformConfig == null) {
|
||||
return null;
|
||||
private ThirdPartySecretInfoVO getQingHaiPlatformSecretInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(jsonObject.toJSONString().getBytes(),
|
||||
platformConfig.getDataSecret().getBytes(), platformConfig.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
resultMap.put("Ret", "0");
|
||||
resultMap.put("Msg", "请求令牌成功!");
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, platformConfig.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||
return thirdPartySecretInfoVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -313,16 +313,13 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||
|
||||
String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732
|
||||
String pileConnectorCode = ThirdPartyPlatformUtils.extractConnectorID(dto.getConnectorID());
|
||||
// 先查询配置密钥相关信息
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinDiantuPlatformSecretInfo();
|
||||
|
||||
// 根据桩编号查询数据
|
||||
// String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -356,16 +353,9 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
||||
vo.setSuccStat(succStat);
|
||||
vo.setFailReason(failReason); // 设备检测失败
|
||||
vo.setFailReasonMsg(failReasonMsg);
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,9 +73,6 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@@ -88,9 +85,6 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ThirdPartyPlatformFactory.register(thirdPlatformType, this);
|
||||
@@ -142,7 +136,8 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
vo.setFailReason(failReason);
|
||||
vo.setSuccStat(succStat);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, thirdPartySecretInfoVO);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -215,7 +210,8 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
map.put("PageCount", pageInfo.getPages());
|
||||
map.put("ItemSize", pageInfo.getTotal());
|
||||
map.put("StationInfos", resultList);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -230,10 +226,8 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||
List<Object> ConnectorStatusInfos = new ArrayList<>();
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||
@@ -296,13 +290,8 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
map.put("Total", total);
|
||||
map.put("StationStatusInfos", collect);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -357,7 +346,7 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
||||
List<EquipBusinessPolicyVO.PolicyInfo> policyInfoList = new ArrayList<>();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
ThirdPartySecretInfoVO yongChengbochePlatformSecretInfo = getYongChengbochePlatformSecretInfo();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
|
||||
// 截取桩号
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -394,7 +383,9 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
.policyInfos(policyInfoList)
|
||||
|
||||
.build();
|
||||
return ThirdPartyPlatformUtils.generateResultMap(vo, yongChengbochePlatformSecretInfo);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -405,16 +396,12 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||
|
||||
String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732
|
||||
String pileConnectorCode = ThirdPartyPlatformUtils.extractConnectorID(dto.getConnectorID());
|
||||
// 先查询配置密钥相关信息
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
// 根据桩编号查询数据
|
||||
// String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -449,15 +436,8 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
vo.setFailReason(failReason); // 设备检测失败
|
||||
vo.setFailReasonMsg(failReasonMsg);
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -476,7 +456,7 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
// 平台已存在订单
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO yongChengbochePlatformSecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
// 生成订单
|
||||
Map<String, Object> map = orderBasicInfoService.generateOrderForThirdParty(dto);
|
||||
String orderCode = (String) map.get("orderCode");
|
||||
@@ -503,7 +483,9 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
.failReason(0)
|
||||
|
||||
.build();
|
||||
return ThirdPartyPlatformUtils.generateResultMap(vo, yongChengbochePlatformSecretInfoVO);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -560,7 +542,7 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO yongChengbochePlatformSecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
// 通过订单号查询实时数据
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
@@ -609,7 +591,9 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
|
||||
.build();
|
||||
}
|
||||
return ThirdPartyPlatformUtils.generateResultMap(vo, yongChengbochePlatformSecretInfoVO);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -687,7 +671,7 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
QueryStopChargeVO vo = new QueryStopChargeVO();
|
||||
String orderCode = dto.getStartChargeSeq();
|
||||
|
||||
ThirdPartySecretInfoVO yongChengbochePlatformSecretInfo = getYongChengbochePlatformSecretInfo();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYongChengbochePlatformSecretInfo();
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfo == null) {
|
||||
@@ -703,7 +687,9 @@ public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformServ
|
||||
vo.setSuccStat(0);
|
||||
vo.setFailReason(0);
|
||||
|
||||
return ThirdPartyPlatformUtils.generateResultMap(vo, yongChengbochePlatformSecretInfo);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user