diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java index 23ac7fcd..9e950b68 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java @@ -385,7 +385,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { continue; } for (Map.Entry entry: sourceOrderIdAndPayRetMap.entrySet()) { - if (!entry.getValue().getReason().isEmpty()) { + if (entry.getValue().getReason() != null && !entry.getValue().getReason().isEmpty()) { continue; } sourceOrderIdAndPayFailReasonMap.put(entry.getKey(), entry.getValue().getReason()); @@ -448,11 +448,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { OpOrder opOrder = orderIdAndOrderMap.get(platformOrder.getPlatformOrderId()); if (purchaseSetting.getIsAutoFillRemark() >= 1) { String autoFillRemarkTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillRemarkTpl()); - platformOrder.setSourceOrderBuyerRemark(buildSourceOrderRemarkAndMemo(shop, autoFillRemarkTpl, opOrder)); + String sourceOrderBuyerRemark = buildSourceOrderRemarkAndMemo(shop, autoFillRemarkTpl, opOrder); + if (sourceOrderBuyerRemark.length() > 500) { + sourceOrderBuyerRemark = sourceOrderBuyerRemark.substring(0, 500); + } + platformOrder.setSourceOrderBuyerRemark(sourceOrderBuyerRemark); } if (purchaseSetting.getIsAutoFillOrderMemo() >= 1) { String autoFillOrderMemoTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillOrderMemoTpl()); - platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, autoFillOrderMemoTpl, opOrder)); + String sourceOrderSellerMemo = buildSourceOrderRemarkAndMemo(shop, autoFillOrderMemoTpl, opOrder); + if (sourceOrderSellerMemo.length() > 500) { + sourceOrderSellerMemo = sourceOrderSellerMemo.substring(0, 500); + } + platformOrder.setSourceOrderSellerMemo(sourceOrderSellerMemo); } } } @@ -543,6 +551,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return newSellerWords; } log.info("shopRemarkFlag: " + shopRemarkFlag); + if (newSellerWords.length() > 500) { + newSellerWords = newSellerWords.substring(0, 500); + } opOrderService.updateOpOrderSellerRemarkToDb(shopBO, opOrder.getOrderId(), newSellerWords, shopRemarkFlag, false, OrderPrintConst.UPDATE_SELLER_WORD_SOURCE_SINGLE, purchaseOrderRemark); return newSellerWords; } @@ -570,6 +581,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return newShopNote; } newShopNote = newShopNote.replaceAll(AppConst.appChineseName, "0.0"); + if (newShopNote.length() > 500) { + newShopNote = newShopNote.substring(0, 500); + } opOrderExtService.updateOpOrderShopNote(shopId, orderId, newShopNote); return newShopNote; } diff --git a/ms-biz/src/main/java/com/ms/api/tool/CloudRequestTemplate.java b/ms-biz/src/main/java/com/ms/api/tool/CloudRequestTemplate.java index bd0b12f6..5fb18be3 100644 --- a/ms-biz/src/main/java/com/ms/api/tool/CloudRequestTemplate.java +++ b/ms-biz/src/main/java/com/ms/api/tool/CloudRequestTemplate.java @@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.*; +import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; @@ -117,6 +118,10 @@ public class CloudRequestTemplate { } // 发起请求 +// SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); +// requestFactory.setConnectTimeout(10000); // 设置连接超时时间为5秒 +// requestFactory.setReadTimeout(20000); // 设置读取超时时间为5秒 + final ResponseEntity responseEntity = restTemplate.exchange(reqeustUrl, HttpMethod.POST, requestEntity, byte[].class); log.info("#executePost responseEntity: {}", JSON.toJSONString(responseEntity)); if (Objects.isNull(responseEntity) || responseEntity.getStatusCodeValue() != 200 || StringUtils.isEmpty(responseEntity.getBody())) { diff --git a/ms-web/src/main/java/com/ms/web/Test.java b/ms-web/src/main/java/com/ms/web/Test.java index b2c39649..d321032c 100644 --- a/ms-web/src/main/java/com/ms/web/Test.java +++ b/ms-web/src/main/java/com/ms/web/Test.java @@ -162,6 +162,8 @@ public class Test { } public static void main(String[] args) throws ParseException { + System.out.println("ni号顺11".length()); + System.out.println("ni号顺11".substring(0, 6)); try { System.out.println(CommonTool.mbSubString("你12324好是的3423423发生45345率的4353发生3453率胜453多负少", 10)); } catch (Exception e) {