整理代码

20230922-ljl-fixBug
qiushengjie 2 years ago
parent a0fcdabfdf
commit b9cff38e43

@ -30,30 +30,30 @@ public class TestSignService implements ExtensionServiceHandler<ItemDTO, String>
// arrayString.add("arrayString1");
// arrayString.add("arrayString2");
// params.put("arrayString", arrayString);
//
////
// HashMap<String, String> mapStringString = new HashMap<>();
// mapStringString.put("A","mapStringString1");
// mapStringString.put("B","mapStringString2");
// params.put("mapStringString", mapStringString);
//
////
// List<Integer> arrayInt64 = new ArrayList<>();
// arrayInt64.add(10000);
// arrayInt64.add(10000);
// params.put("arrayInt64", arrayInt64);
//
////
// params.put("int16", 10000);
// params.put("int32", 10000);
// params.put("int64", 10000);
// params.put("double", 10.1);
params.put("string", "test");
// params.put("string", "test");
// params.put("struct", new GetCurrentShopMoveSettingRequestDTO());
//
// List<Object> arrayStruct = new LinkedList<>();
// arrayStruct.add(new GetCurrentShopMoveSettingRequestDTO());
// arrayStruct.add(new GetMoveHistoryProductListRequestDTO());
// arrayStruct.add(new SaveBatchMoveTaskRequestDTO());
// params.put("arrayStruct", arrayStruct);
List<Object> arrayStruct = new LinkedList<>();
arrayStruct.add(new GetCurrentShopMoveSettingRequestDTO());
arrayStruct.add(new GetMoveHistoryProductListRequestDTO());
arrayStruct.add(new SaveBatchMoveTaskRequestDTO());
params.put("arrayStruct", arrayStruct);
//
// Map<String,Object> mapStringStruct = new HashMap<>();
// mapStringStruct.put("mapstruct1", new GetCurrentShopMoveSettingRequestDTO());

@ -279,6 +279,13 @@ public class CommonTool {
return price == 0 ? 0 : Math.round((price / 100) * 100.0) / 100.0;
}
public static String removeQuotes(String input) {
if (input.startsWith("\"") && input.endsWith("\"")) {
return input.substring(1, input.length() - 1);
}
return input;
}
public static void main(String[] args) {
System.out.println(smd5Value("abc"));
}

@ -67,8 +67,9 @@ public class DsJsonRequestTemplate {
StringBuilder sb = new StringBuilder();
sb.append(dsToken);
for (String s : keyArray) {
sb.append(s).append(JSON.toJSONString(params.get(s)));
// sb.append(s).append(params.get(s));
String value = JSON.toJSONString(params.get(s));
value = CommonTool.removeQuotes(value);
sb.append(s).append(value);
}
sb.append(dsToken);
log.info("row sign sb:" + sb);

@ -4,10 +4,19 @@ import com.ms.api.tool.SecurityTool;
public class SecurityTest {
public static void main(String[] args) {
String word = SecurityTool.encodeByAES("78327");
System.out.println(word);
// String word = SecurityTool.encodeByAES("78327");
// System.out.println(word);
// String ss = SecurityTool.decodeByAES("hX6MUVmfPM5hG4CZb6xl9g==");
// System.out.println(ss);
String php = "";
String java = "dighgfghf^&)l3sedi&(.D@BCarrayInt64[10000,10000]arrayString[\"arrayString1\",\"arrayString2\"]arrayStruct[{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},{},{}]double10.1int1610000int3210000int6410000mapStringString{\"A\":\"mapStringString1\",\"B\":\"mapStringString2\"}mapStringStruct{\"mapstruct3\":{},\"mapstruct1\":{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},\"mapstruct2\":{}}stringteststruct{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0}dighgfghf^&)l3sedi&(.D@BC";
if(php.equals(java)){
}
}
}

@ -0,0 +1,56 @@
package com.ms.test;
import java.util.ArrayList;
import java.util.List;
public class StringDifferencesTest {
public static void main(String[] args) {
String str1 = "dighgfghf^&)l3sedi&(.D@BCarrayInt64[10000,10000]arrayString[\"arrayString1\",\"arrayString2\"]arrayStruct[{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},[],[]]double10.1int1610000int3210000int6410000mapStringString{\"A\":\"mapStringString1\",\"B\":\"mapStringString2\"}mapStringStruct{\"mapstruct3\":[],\"mapstruct1\":{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},\"mapstruct2\":[]}stringteststruct{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0}dighgfghf^&)l3sedi&(.D@BC";
String str2 = "dighgfghf^&)l3sedi&(.D@BCarrayInt64[10000,10000]arrayString[\"arrayString1\",\"arrayString2\"]arrayStruct[{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},{},{}]double10.1int1610000int3210000int6410000mapStringString{\"A\":\"mapStringString1\",\"B\":\"mapStringString2\"}mapStringStruct{\"mapstruct3\":{},\"mapstruct1\":{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0},\"mapstruct2\":{}}stringteststruct{\"deliveryDelayDay\":0,\"freightTemplateId\":0,\"moveOnsaleType\":0,\"moveShopConfigId\":0,\"noConsignPriceType\":0,\"priceTail\":0,\"reduceType\":0,\"supply7dayReturn\":0}dighgfghf^&)l3sedi&(.D@BC";
List<Difference> differences = findDifferences(str1, str2);
for (Difference diff : differences) {
System.out.println(diff);
}
}
public static List<Difference> findDifferences(String str1, String str2) {
List<Difference> differences = new ArrayList<>();
int len = Math.min(str1.length(), str2.length());
for (int i = 0; i < len; i++) {
if (str1.charAt(i) != str2.charAt(i)) {
differences.add(new Difference(i, str1.charAt(i), str2.charAt(i)));
}
}
// Handle case where one string is longer than the other
for (int i = len; i < str1.length(); i++) {
differences.add(new Difference(i, str1.charAt(i), null));
}
for (int i = len; i < str2.length(); i++) {
differences.add(new Difference(i, null, str2.charAt(i)));
}
return differences;
}
static class Difference {
int position;
Character charInStr1;
Character charInStr2;
Difference(int position, Character charInStr1, Character charInStr2) {
this.position = position;
this.charInStr1 = charInStr1;
this.charInStr2 = charInStr2;
}
@Override
public String toString() {
return "Position: " + position + ", str1: " + charInStr1 + ", str2: " + charInStr2;
}
}
}
Loading…
Cancel
Save