mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 青海平台Service
This commit is contained in:
@@ -252,11 +252,10 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
|
||||
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||
String dataSecret = "YPFVz1OvAS4nSwLW"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式:NHsBDtTanA60vTIu pJahbxk8wG79CMDB
|
||||
String dataSecretIV = "5tLoP60aR9QUB5Mx"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式:2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
|
||||
String dataSecret = "1234567890abcdef"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式:NHsBDtTanA60vTIu pJahbxk8wG79CMDB
|
||||
String dataSecretIV = "1234567890abcdef"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式:2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
|
||||
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
|
||||
String dataString = "XGsQOWT30eM0JPCGRkT6DQrmXQyvH+0klPcXN+kQ2vK5/7m5dTELoDjiT7AY9h8dCrjcRf7kx07\n" +
|
||||
"5MitXO8CzoHerSke1nYGjtvGcL/zUMbs=";
|
||||
String dataString = "P1/F/NR6fTmwF0jBZ5zzSsuMBwkBgCaVRX1wnGuAtVDmbCJq5P4dAqw6hBh3l/c/nhYb+G32jZKwiWrfvAjY875/1wiGnygxHtUOniX9kXPwXmzRLVGVMAZ+YVnZOJmxX7TBN6Aq2rO6bKqRlRO+9brn0jXiFP7gtpKaaWjE14d/vc9xJoK2TP1rWTESLXyJvViIx5peI60c16c/93l7QZgAOZ5gUYeoL56UvQ9keiufBFHrgFmlTfDQdamlxD6S8QguDw7yV5/UoFvM3zMNcrIz68NdsagMaiKSU+jqGyfdLWa/iokmogbRqm12Cfi4CQClhv6rYii5o1fVyc0+TD3Fl2MDAESDJAUdzV9xr4M=";
|
||||
|
||||
// 解密data
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||
|
||||
@@ -24,6 +24,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.BillingPriceVO;
|
||||
@@ -38,10 +39,8 @@ import com.jsowell.thirdparty.platform.common.ChargeOrderInfo;
|
||||
import com.jsowell.thirdparty.platform.common.ConnectorChargeStatusInfo;
|
||||
import com.jsowell.thirdparty.platform.common.SupStationPowerInfo;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
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 org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -50,6 +49,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -79,6 +79,9 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@@ -149,14 +152,35 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), dataSecret, dataSecretIv);
|
||||
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);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String data = "P1/F/NR6fTmwF0jBZ5zzSsuMBwkBgCaVRX1wnGuAtVDmbCJq5P4dAqw6hBh3l/c/nhYb+G32jZKwiWrfvAjY8/hUmOJHouHqfTfifQ2wMC5vZ+5OagGyU435iliW76oKx4O7jcmY9bLwFnHsuOoGRke6YuhhwVP5Q0hLXNuKu5vEGfVgMH8rccg4BOBe8WK0moV03pf9X+tWdNQC2kO/1IhiACDl/hst/doNLtyDI0plAekJHBYVFunAAWTUzKDzBdXBy4+r3rieOW/h5GHkPWbKiQOuptsjB1scURAFIQg5CtuQjhrRsSy/LoA8HkhWIlcvUhmf9MOYzgDDEjjeC3xwS/V2aroZ4KqVxyICH3E=";
|
||||
String signSecret = "1234567890abcdef";
|
||||
String sig = "E02F0364E6D842301C5093105BAF4BF4";
|
||||
|
||||
Map<String, String> map = Maps.newLinkedHashMap();
|
||||
map.put("OperatorID", "MA1X78KH5");
|
||||
map.put("Data", data);
|
||||
map.put("TimeStamp", "1713925616685");
|
||||
map.put("Seq", "1043");
|
||||
String sign = GBSignUtils.sign(map, signSecret);
|
||||
|
||||
// 验证签名 得到请求方传过来的签名sig->自己拿到请求体后,再按双方约定的协议生成一个sig->对比两个sig是否一致
|
||||
System.out.println(StringUtils.equals(sign, sig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点信息 query_stations_info
|
||||
* @param dto 查询站点信息dto
|
||||
@@ -647,7 +671,8 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user