修改bug

20230922-ljl-fixBug
ljl 1 year ago
parent 99396a1c2d
commit 29692860d0

@ -171,7 +171,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
throw new RuntimeException(dsResponse.getReason()); throw new RuntimeException(dsResponse.getReason());
} }
for (DsSuccessRetDTO successRet: dsResponse.getSuccessList()) { List<DsSuccessRetDTO> successList = dsResponse.getSuccessList();
if (successList == null) {
successList = new ArrayList<>();
}
for (DsSuccessRetDTO successRet: successList) {
List<PurchaseOrderRequestDTO> relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos(); List<PurchaseOrderRequestDTO> relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos();
boolean isUseManualConsignee = useManualConsigneeOrderIds.contains(successRet.getPlatformOrderId()); boolean isUseManualConsignee = useManualConsigneeOrderIds.contains(successRet.getPlatformOrderId());
@ -365,7 +370,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
continue; continue;
} }
PurchaseOrderDsEncrypt log = new PurchaseOrderDsEncrypt(); PurchaseOrderDsEncrypt log = new PurchaseOrderDsEncrypt();
log.setShopId(); // log.setShopId();
log.setOrderId(errorItem.getPlatformOrderId()); log.setOrderId(errorItem.getPlatformOrderId());
log.setIsEncryptOrder(errorItem.getIsEncryptOrder()); log.setIsEncryptOrder(errorItem.getIsEncryptOrder());
log.setIsSupportEncryptOrder(errorItem.getIsSupportEncryptOrder()); log.setIsSupportEncryptOrder(errorItem.getIsSupportEncryptOrder());
@ -632,7 +637,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
StringBuffer newShopNoteBuffer = new StringBuffer(oldSellerWords.length()); StringBuffer newShopNoteBuffer = new StringBuffer(oldSellerWords.length());
while (m.find()) { while (m.find()) {
hasMatch = true; hasMatch = true;
m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); // m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
} }
m.appendTail(newShopNoteBuffer); m.appendTail(newShopNoteBuffer);
newSellerWords = newShopNoteBuffer.toString(); newSellerWords = newShopNoteBuffer.toString();
@ -674,7 +679,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
StringBuffer newShopNoteBuffer = new StringBuffer(oldShopNote.length()); StringBuffer newShopNoteBuffer = new StringBuffer(oldShopNote.length());
while (m.find()) { while (m.find()) {
hasMatch = true; hasMatch = true;
m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); // m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
} }
m.appendTail(newShopNoteBuffer); m.appendTail(newShopNoteBuffer);
newShopNote = newShopNoteBuffer.toString(); newShopNote = newShopNoteBuffer.toString();
@ -693,6 +698,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
} }
public String buildPurchaseOrderRemark(Long shopId, String appendRemarkTpl, List<PurchaseOrder> purchaseOrders) { public String buildPurchaseOrderRemark(Long shopId, String appendRemarkTpl, List<PurchaseOrder> purchaseOrders) {
if (purchaseOrders.isEmpty()) {
return "";
}
appendRemarkTpl = buildRemarkTplHtml(appendRemarkTpl); appendRemarkTpl = buildRemarkTplHtml(appendRemarkTpl);
Shop shop = shopService.getDetailById(shopId); Shop shop = shopService.getDetailById(shopId);
List<String> purchaseOrderRemarks = new ArrayList<>(); List<String> purchaseOrderRemarks = new ArrayList<>();
@ -1383,8 +1391,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
PurchaseOrder purchaseOrder = purchaseOrders.iterator().next(); PurchaseOrder purchaseOrder = purchaseOrders.iterator().next();
// TODO 加事务 // TODO 加事务
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
opOrderExtService.updateFieldByOrderId(shopId, orderId, "filter_purchase_status", PurchaseOrderConst.FILTER_PURCHASE_STATUS_WAIT_PURCHASE); opOrderExtService.updateFieldByOrderId(shopId, orderId, "filter_purchase_status", PurchaseOrderConst.FILTER_PURCHASE_STATUS_WAIT_PURCHASE);
if (opOrderDs != null) { if (opOrderDs != null) {
opOrderDsService.updateDsStatusByOrderId(shopId, orderId, DsOrderConst.DS_PURCHASE_STATUS_WAIT_PURCHASE, null); opOrderDsService.updateDsStatusByOrderId(shopId, orderId, DsOrderConst.DS_PURCHASE_STATUS_WAIT_PURCHASE, null);
@ -1418,7 +1426,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
for (PurchaseOrder purchaseOrder: purchaseOrders) { for (PurchaseOrder purchaseOrder: purchaseOrders) {
int cancelPurchaseOrderItemCount = 0; int cancelPurchaseOrderItemCount = 0;
for (PurchaseOrderItem item: purchaseOrder.getItems()) { for (PurchaseOrderItem item: purchaseOrder.getItems()) {
if (Objects.equals(item.getStatus(), StatusConst.normal)) { if (Objects.equals(item.getStatus(), StatusConst.cancel)) {
cancelPurchaseOrderItemCount ++; cancelPurchaseOrderItemCount ++;
} }
if (!skuIds.contains(item.getSkuId())) { if (!skuIds.contains(item.getSkuId())) {
@ -1447,11 +1455,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
if (needCancelPurchaseOrderItemIds.isEmpty()) { if (needCancelPurchaseOrderItemIds.isEmpty()) {
throw new RuntimeException("该商品没有关联外部订单"); throw new RuntimeException("该商品没有关联外部订单");
} }
// TODO 加事务 // TODO 加事务
if (!needCancelPurchaseOrderIds.isEmpty()) { if (!needCancelPurchaseOrderIds.isEmpty()) {
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
} }
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
updateOpOrderFilterPurchaseStatus(orderId, null); updateOpOrderFilterPurchaseStatus(orderId, null);
for (PurchaseOrderCancelLog log: logs) { for (PurchaseOrderCancelLog log: logs) {
purchaseOrderCancelLogService.insertSelective(log); purchaseOrderCancelLogService.insertSelective(log);

Loading…
Cancel
Save