mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-29 11:38:04 +08:00
update 联联
This commit is contained in:
@@ -16,6 +16,7 @@ import com.jsowell.common.core.redis.RedisCache;
|
|||||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.*;
|
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.SnUtils;
|
||||||
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||||||
import com.jsowell.common.util.ip.AddressUtils;
|
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.OrderService;
|
||||||
import com.jsowell.service.PileRemoteService;
|
import com.jsowell.service.PileRemoteService;
|
||||||
import com.jsowell.service.PileService;
|
import com.jsowell.service.PileService;
|
||||||
|
import com.jsowell.thirdparty.lianlian.common.CommonResult;
|
||||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||||
@@ -230,21 +232,21 @@ public class SpringBootTestController {
|
|||||||
// String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp");
|
// String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp");
|
||||||
// System.out.println("token:" + token);
|
// System.out.println("token:" + token);
|
||||||
|
|
||||||
String operatorId = "I4XLPQPV";
|
String operatorId = "425010765";
|
||||||
String operatorSecret = "3DSBTWHVIC6KVCKI";
|
String operatorSecret = "3DSBTWHVIC6KVCKI";
|
||||||
// 请求data
|
// 请求data
|
||||||
Map<String, String> data = new HashMap<>();
|
// Map<String, String> data = new HashMap<>();
|
||||||
data.put("OperatorID", operatorId);
|
// data.put("OperatorID", operatorId);
|
||||||
data.put("OperatorSecret", operatorSecret);
|
// data.put("OperatorSecret", operatorSecret);
|
||||||
String dataJson = JSONUtil.toJsonStr(data);
|
// 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("StationIDs", com.google.common.collect.Lists.newArrayList("1", "2"));
|
||||||
// json.put("StationID", "2");
|
json.put("LastQueryTime", "2023-05-29 10:00:00");
|
||||||
// json.put("StartTime", "2023-02-01");
|
json.put("PageNo", 1);
|
||||||
// json.put("EndTime", "2023-06-01");
|
json.put("PageSize", 10);
|
||||||
|
|
||||||
// String dataJson = JSONObject.toJSONString(json);
|
String dataJson = JSONObject.toJSONString(json);
|
||||||
// 加密
|
// 加密
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
|
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
|
||||||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
operatorSecret.getBytes(), operatorSecret.getBytes());
|
||||||
@@ -268,17 +270,21 @@ public class SpringBootTestController {
|
|||||||
// dto.setSeq("0001");
|
// dto.setSeq("0001");
|
||||||
// dto.setSig(sig);
|
// dto.setSig(sig);
|
||||||
// Map<String, String> map = lianLianService.generateToken(dto);
|
// 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");
|
// String data1 = map.get("Data");
|
||||||
// // 解密data
|
// 解密data
|
||||||
// String data1 = "JudlP17tnYuQc2zwOzmjJAb9hgghIymefG5v3ZzSOlOzRL6QcXMa5C5dy8acL2ZWEw5DOc0D3G2qSLsqBCZ9ft/8akGVLL0N4keLV9ipS2REJx1dvm1m4l9ONIP9czNeDTxUsS0b1aCkkxgn7OVYD+ch+yLH/3dMATb32aEjggGY31lu/S2vB+f2aO+icJ2EyAkakB8Huowb3ancZVs/sxCFbVZUmUyo6WEyLtfcn3moKwD52CWoECRgK7lUjBs3F8VKcMT/dTeSKEgZM3Z7/wrEzljKL4519XKyL2lYgJ3h/ewFDRZcnTIJAWskfiKnacZF7yZUTYj13h+sI9wrYmgT2ScqDCQVUI40gDnpewU=";
|
// String data1 = "JudlP17tnYuQc2zwOzmjJAb9hgghIymefG5v3ZzSOlPDh5+bJHIedsYzKMD56tHlmlg6Cb7vG+o6KjMSSpn1fyqBH3UVaEFF7uEc+lOuEc9c1vUzq20vBQ7N3EpDKqVBKjZbOezMsKYaCX7Br8XTsCYT8VCQui/np3cn+phi3VC+0s1coNxBX7xoEDZ7iuPjPoSWL7g3J0uOw2SoGaIdBQG3eTxaZJ5L+vBmuDF0pEXgazTMnuKml1mx1QHkig2F7h/ILT0VEKVXWMmmogYgiBk5ItO0DyzRl+ASb184gOhYGo82GJmWRiXrAXmceCiSNvTGg6aL26imIGKkJNfOx9/9mTqjGvy6kzxvWJ29PBU=";
|
||||||
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
|
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
|
||||||
// operatorSecret.getBytes(), operatorSecret.getBytes());
|
// operatorSecret.getBytes(), operatorSecret.getBytes());
|
||||||
// String dataStr = new String(plainText, "UTF-8");
|
// String dataStr = new String(plainText, "UTF-8");
|
||||||
// Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
// Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
||||||
|
//
|
||||||
// String token = resultMap.get("AccessToken");
|
// String token = resultMap.get("AccessToken");
|
||||||
|
//
|
||||||
// System.out.println("解密后token:" + token);
|
// System.out.println("解密后token:" + token);
|
||||||
|
|
||||||
|
|
||||||
// LianLianPushStationInfoDTO dto1 = LianLianPushStationInfoDTO.builder()
|
// LianLianPushStationInfoDTO dto1 = LianLianPushStationInfoDTO.builder()
|
||||||
// .OperatorID("MA1JLFUU8")
|
// .OperatorID("MA1JLFUU8")
|
||||||
// .DataSecret("HVicnbRZbhPdIdpF")
|
// .DataSecret("HVicnbRZbhPdIdpF")
|
||||||
@@ -322,6 +328,23 @@ public class SpringBootTestController {
|
|||||||
// String token = JWTUtils.createToken(operatorId, operatorSecret, ttlMillis);
|
// String token = JWTUtils.createToken(operatorId, operatorSecret, ttlMillis);
|
||||||
// System.out.println(JWTUtils.checkThirdPartyToken(token));
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class HttpUtils {
|
|||||||
conn.setRequestProperty("connection", "Keep-Alive");
|
conn.setRequestProperty("connection", "Keep-Alive");
|
||||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||||
|
// conn.setRequestProperty("Authorization", "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI0MjUwMTA3NjUiLCJpYXQiOjE2ODU0MjM3ODMsInN1YiI6IjNEU0JUV0hWSUM2S1ZDS0kiLCJleHAiOjY4Njk0MjM3ODN9.nU-6QNNBp0dcz65_lT-yVAoESZFUHmOwZpoqsKVNspQ");
|
||||||
conn.setRequestProperty("Content-Type", contentType);
|
conn.setRequestProperty("Content-Type", contentType);
|
||||||
conn.setDoOutput(true);
|
conn.setDoOutput(true);
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
|
|||||||
@@ -269,17 +269,21 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
|
|
||||||
resultList.add(stationInfo);
|
resultList.add(stationInfo);
|
||||||
}
|
}
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
LianLianPageResponse pageResponse = LianLianPageResponse.builder()
|
map.put("PageNo", pageInfo.getPageNum());
|
||||||
.PageNo(pageInfo.getPageNum())
|
map.put("PageCount", pageInfo.getPages());
|
||||||
.PageCount(pageInfo.getPages())
|
map.put("ItemSize", resultList.size());
|
||||||
.ItemSize(resultList.size())
|
map.put("StationInfos", resultList);
|
||||||
.list(resultList)
|
// LianLianPageResponse pageResponse = LianLianPageResponse.builder()
|
||||||
.build();
|
// .PageNo(pageInfo.getPageNum())
|
||||||
|
// .PageCount(pageInfo.getPages())
|
||||||
|
// .ItemSize(resultList.size())
|
||||||
|
// .list(resultList)
|
||||||
|
// .build();
|
||||||
// 加密
|
// 加密
|
||||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||||
// 加密数据
|
// 加密数据
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(pageResponse).getBytes(),
|
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||||
String encryptData = Encodes.encodeBase64(encryptText);
|
String encryptData = Encodes.encodeBase64(encryptText);
|
||||||
|
|
||||||
@@ -361,16 +365,19 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
int total = StationStatusInfos.size();
|
int total = StationStatusInfos.size();
|
||||||
int pages = PageUtil.totalPage(total, pageSize);
|
int pages = PageUtil.totalPage(total, pageSize);
|
||||||
|
|
||||||
LianLianPageResponse response = LianLianPageResponse.builder()
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
.PageCount(pages)
|
map.put("Total", total);
|
||||||
.PageNo(pageNum)
|
map.put("StationStatusInfos", collect);
|
||||||
.list(collect)
|
// LianLianPageResponse response = LianLianPageResponse.builder()
|
||||||
.ItemSize(total)
|
// .PageCount(pages)
|
||||||
.build();
|
// .PageNo(pageNum)
|
||||||
|
// .list(collect)
|
||||||
|
// .ItemSize(total)
|
||||||
|
// .build();
|
||||||
// 加密
|
// 加密
|
||||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||||
// 加密数据
|
// 加密数据
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(response).getBytes(),
|
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||||
String encryptData = Encodes.encodeBase64(encryptText);
|
String encryptData = Encodes.encodeBase64(encryptText);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user