修改bug

20230922-ljl-fixBug
ljl 1 year ago
parent f398970f54
commit d082e462d7

@ -324,11 +324,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
HashMap<String, HashMap<Long, String>> orderIdAndSkuIdAndSkuSubNameMap = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(orderIds, skuIds);
System.out.println("orderIdAndSkuIdAndSkuSubNameMap" + orderIdAndSkuIdAndSkuSubNameMap);
System.out.println("platformOrders" + platformOrders);
log.info("orderIdAndSkuIdAndSkuSubNameMap:" + orderIdAndSkuIdAndSkuSubNameMap);
log.info("platformOrders:" + platformOrders);
for (PlatformOrderDTO platformOrder: platformOrders) {
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getSourceSkuId()));
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getPlatformSkuId()));
}
}
}

@ -76,14 +76,14 @@ public class OpOrderChildServiceImpl implements OpOrderChildService{
HashMap<String, HashMap<Long, String>> map = new HashMap<>();
for (OpOrderChild child: children) {
if (map.containsKey(child.getOrderId())) {
map.get(child.getOrderId()).put(child.getSkuId(), child.getSpecDesc());
map.get(child.getOrderId()).put(child.getSkuId(), child.getSkuSubName());
} else {
HashMap<Long, String> skuIdAndSkuSubNameMap = new HashMap<>();
skuIdAndSkuSubNameMap.put(child.getSkuId(), child.getSpecDesc());
skuIdAndSkuSubNameMap.put(child.getSkuId(), child.getSkuSubName());
map.put(child.getOrderId(), skuIdAndSkuSubNameMap);
}
}
return map;
return map;
}
public List<Long> getHistorySkuIdsByOrderId(String orderId) {

@ -1023,4 +1023,34 @@ public class CommonTool {
public static boolean isMatch(String regex, String str) {
return Pattern.compile(regex).matcher(str).find();
}
public static String mbSubString(String s, int length) throws Exception {
byte[] bytes = s.getBytes("Unicode");
int n = 0; // 表示当前的字节数
int i = 2; // 要截取的字节数从第3个字节开始
for (; i < bytes.length && n < length; i++)
{
// 奇数位置如3、5、7等为UCS2编码中两个字节的第二个字节
if (i % 2 == 1) {
n++; // 在UCS2第二个字节时n加1
} else {
// 当UCS2编码的第一个字节不等于0时该UCS2字符为汉字一个汉字算两个字节
if (bytes[i] != 0)
{
n++;
}
}
}
// 如果i为奇数时处理成偶数
if (i % 2 == 1) {
// 该UCS2字符是汉字时去掉这个截一半的汉字
if (bytes[i - 1] != 0) {
i = i - 1;
} else {
// 该UCS2字符是字母或数字则保留该字符
i = i + 1;
}
}
return new String(bytes, 0, i, "Unicode");
}
}

@ -227,6 +227,33 @@ public class OpOrderChild implements Serializable {
private String oldSkuSubName;
private JSONObject afterSaleInfo;
private List<Spec> specList;
public List<Spec> getSpecList() {
if (specList == null) {
if (specDesc == null || specDesc.isEmpty()) {
specList = new ArrayList<>();
}
specList = JSONObject.parseArray(specDesc, Spec.class);
}
return specList;
}
public String getSkuSubName() {
List<Spec> specs = getSpecList();
List<String> skuSubNames = new ArrayList<>();
for (Spec spec: specs) {
skuSubNames.add(spec.getValue());
}
return String.join(" ", skuSubNames);
}
@Data
public static class Spec implements Serializable {
private String name;
private String value;
}
}

@ -71,6 +71,9 @@ public class Test {
@Autowired
private OutstorageService outstorageService;
@Autowired
private OpOrderChildService opOrderChildService;
@GetMapping("/hello")
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format("Hello %s!", name);
@ -110,10 +113,11 @@ public class Test {
@GetMapping("/test-api")
public String testApi() {
HashMap<String, HashMap<Long, String>> data = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(Arrays.asList("6921789682161751044"), Arrays.asList(1777095601448988L));
Map<String, String> result = outstorageService.matchPurchaseLogisticsInfo("1688DS", "顺丰速运", "SF1610042925672", null);
System.out.println(result);
// opOrderDsService.updateOpOrderDsFilterStatus("6921789682161751044", "1688DS");
return "haha";
return data.toString();
}
class Aes
@ -158,6 +162,12 @@ public class Test {
}
public static void main(String[] args) throws ParseException {
try {
System.out.println(CommonTool.mbSubString("你12324好是的3423423发生45345率的4353发生3453率胜453多负少", 10));
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
Pattern p = Pattern.compile("^([T|W])(JT\\d+)$");
Matcher m = p.matcher("WJT23242342342342");
if (m.find()) {

Loading…
Cancel
Save