update 联联

This commit is contained in:
Lemon
2023-05-30 14:22:34 +08:00
parent ce6661c206
commit 94506744aa
3 changed files with 59 additions and 28 deletions

View File

@@ -16,6 +16,7 @@ import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.common.util.http.HttpUtils;
import com.jsowell.common.util.id.SnUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.common.util.ip.AddressUtils;
@@ -36,6 +37,7 @@ import com.jsowell.service.MemberService;
import com.jsowell.service.OrderService;
import com.jsowell.service.PileRemoteService;
import com.jsowell.service.PileService;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
@@ -230,21 +232,21 @@ public class SpringBootTestController {
// String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp");
// System.out.println("token:" + token);
String operatorId = "I4XLPQPV";
String operatorId = "425010765";
String operatorSecret = "3DSBTWHVIC6KVCKI";
// 请求data
Map<String, String> data = new HashMap<>();
data.put("OperatorID", operatorId);
data.put("OperatorSecret", operatorSecret);
String dataJson = JSONUtil.toJsonStr(data);
// Map<String, String> data = new HashMap<>();
// data.put("OperatorID", operatorId);
// data.put("OperatorSecret", operatorSecret);
// String dataJson = JSONUtil.toJsonStr(data);
// JSONObject json = new JSONObject();
JSONObject json = new JSONObject();
// 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");
json.put("LastQueryTime", "2023-05-29 10:00:00");
json.put("PageNo", 1);
json.put("PageSize", 10);
// String dataJson = JSONObject.toJSONString(json);
String dataJson = JSONObject.toJSONString(json);
// 加密
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
operatorSecret.getBytes(), operatorSecret.getBytes());
@@ -268,17 +270,21 @@ public class SpringBootTestController {
// dto.setSeq("0001");
// dto.setSig(sig);
// Map<String, String> map = lianLianService.generateToken(dto);
QueryStationInfoDTO dto = new QueryStationInfoDTO();
dto.setOperatorId(operatorId);
Map<String, String> map = lianLianService.query_stations_info(dto);
// String data1 = map.get("Data");
// // 解密data
// String data1 = "JudlP17tnYuQc2zwOzmjJAb9hgghIymefG5v3ZzSOlOzRL6QcXMa5C5dy8acL2ZWEw5DOc0D3G2qSLsqBCZ9ft/8akGVLL0N4keLV9ipS2REJx1dvm1m4l9ONIP9czNeDTxUsS0b1aCkkxgn7OVYD+ch+yLH/3dMATb32aEjggGY31lu/S2vB+f2aO+icJ2EyAkakB8Huowb3ancZVs/sxCFbVZUmUyo6WEyLtfcn3moKwD52CWoECRgK7lUjBs3F8VKcMT/dTeSKEgZM3Z7/wrEzljKL4519XKyL2lYgJ3h/ewFDRZcnTIJAWskfiKnacZF7yZUTYj13h+sI9wrYmgT2ScqDCQVUI40gDnpewU=";
// 解密data
// String data1 = "JudlP17tnYuQc2zwOzmjJAb9hgghIymefG5v3ZzSOlPDh5+bJHIedsYzKMD56tHlmlg6Cb7vG+o6KjMSSpn1fyqBH3UVaEFF7uEc+lOuEc9c1vUzq20vBQ7N3EpDKqVBKjZbOezMsKYaCX7Br8XTsCYT8VCQui/np3cn+phi3VC+0s1coNxBX7xoEDZ7iuPjPoSWL7g3J0uOw2SoGaIdBQG3eTxaZJ5L+vBmuDF0pEXgazTMnuKml1mx1QHkig2F7h/ILT0VEKVXWMmmogYgiBk5ItO0DyzRl+ASb184gOhYGo82GJmWRiXrAXmceCiSNvTGg6aL26imIGKkJNfOx9/9mTqjGvy6kzxvWJ29PBU=";
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
// operatorSecret.getBytes(), operatorSecret.getBytes());
// String dataStr = new String(plainText, "UTF-8");
// Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
//
// String token = resultMap.get("AccessToken");
//
// System.out.println("解密后token" + token);
// LianLianPushStationInfoDTO dto1 = LianLianPushStationInfoDTO.builder()
// .OperatorID("MA1JLFUU8")
// .DataSecret("HVicnbRZbhPdIdpF")
@@ -322,6 +328,23 @@ public class SpringBootTestController {
// String token = JWTUtils.createToken(operatorId, operatorSecret, ttlMillis);
// System.out.println(JWTUtils.checkThirdPartyToken(token));
JSONObject jsonObject1 = new JSONObject(map);
jsonObject1.put("OperatorID", "425010765");
jsonObject1.put("Data", "Ntu99RpveEOm2VUNq6RpD7OuOPXRbNxMOPmaBl67nkLk0nD/VmhipdSpq/Qfswhe1o55YMT+3Z7e6xe3fiJA3cZcvetxOEUF6sjvKLRq2rU=");
jsonObject1.put("TimeStamp", "20230530090132");
jsonObject1.put("Seq", "0001");
jsonObject1.put("Sig", "1568D2D35B245A0205B33D0EF92E7981");
String jsonString = JSONObject.toJSONString(jsonObject1);
String result = HttpUtils.sendPostContentType("http://localhost:8080/LianLian/v1/query_stations_info", jsonString, "application/json");
JSONObject object = JSONObject.parseObject(result);
String data1 = (String) object.get("data");
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
operatorSecret.getBytes(), operatorSecret.getBytes());
String dataStr = new String(plainText, "UTF-8");
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
}