|
|
@@ -4229,7 +4229,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
FsStoreOrderDeliveryNoteExportVO vo = voList.get(i);
|
|
|
FsOrderDeliveryNoteDTO dto = new FsOrderDeliveryNoteDTO();
|
|
|
int rowNum = i + 2;
|
|
|
-
|
|
|
+
|
|
|
// 基础字段校验
|
|
|
if (StringUtils.isEmpty(vo.getOrderNumber())) {
|
|
|
result.addFailure(rowNum, "", vo.getDeliveryId(), "系统订单号为空");
|
|
|
@@ -4243,7 +4243,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
result.addFailure(rowNum, vo.getOrderNumber(), "", "快递单号为空");
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//处理订单ID信息
|
|
|
String originalOrderNumber = vo.getOrderNumber();
|
|
|
String processedOrderNumber = extractNumbers(originalOrderNumber);
|
|
|
@@ -4299,6 +4299,30 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
.computeIfAbsent(vo.getId(), k -> new ArrayList<>())
|
|
|
.add(vo);
|
|
|
}
|
|
|
+
|
|
|
+ // 自动从支付记录中获取appId
|
|
|
+ if (appId == null || appId.isEmpty()) {
|
|
|
+ // 从第一个订单的支付记录中获取appId
|
|
|
+ if (!orderCodeOpenIdVoList.isEmpty()) {
|
|
|
+ FsStoreOrderCodeOpenIdVo firstOrder = orderCodeOpenIdVoList.get(0);
|
|
|
+ // 通过订单号查询订单ID
|
|
|
+ FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(firstOrder.getOrderCode());
|
|
|
+ if (order != null) {
|
|
|
+ // 查询订单的支付记录
|
|
|
+ List<FsStorePaymentScrm> paymentList = fsStorePaymentMapper.selectFsStorePaymentByOrderId(order.getId());
|
|
|
+ if (!paymentList.isEmpty() && paymentList.get(0).getAppId() != null) {
|
|
|
+ appId = paymentList.get(0).getAppId();
|
|
|
+ log.info("自动从订单支付记录中获取到appId: {}", appId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果还是没有获取到appId,返回错误
|
|
|
+ if (appId == null || appId.isEmpty()) {
|
|
|
+ return R.error("无法获取订单对应的小程序appId,请确保订单已支付");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
final WxMaService wxService = WxMaConfiguration.getMaService(appId);
|
|
|
String uploadTime = ZonedDateTime.now(ZoneId.of("Asia/Shanghai"))
|
|
|
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
|
|
@@ -5341,6 +5365,25 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
.computeIfAbsent(vo.getId(), k -> new ArrayList<>())
|
|
|
.add(vo);
|
|
|
}
|
|
|
+
|
|
|
+ if (appId == null || appId.isEmpty()) {
|
|
|
+ if (!orderCodeOpenIdVoList.isEmpty()) {
|
|
|
+ FsStoreOrderCodeOpenIdVo firstOrder = orderCodeOpenIdVoList.get(0);
|
|
|
+ FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(firstOrder.getId());
|
|
|
+ if (order != null) {
|
|
|
+ List<FsStorePaymentScrm> paymentList = fsStorePaymentMapper.selectFsStorePaymentByOrderId(order.getId());
|
|
|
+ if (!paymentList.isEmpty() && paymentList.get(0).getAppId() != null) {
|
|
|
+ appId = paymentList.get(0).getAppId();
|
|
|
+ log.info("自动从订单支付记录中获取到appId: {}", appId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (appId == null || appId.isEmpty()) {
|
|
|
+ return R.error("无法获取订单对应的小程序appId,请确保订单已支付");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
final WxMaService wxService = WxMaConfiguration.getMaService(appId);
|
|
|
String uploadTime = ZonedDateTime.now(ZoneId.of("Asia/Shanghai"))
|
|
|
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|