This commit is contained in:
Van0313
2025-04-26 12:11:55 +08:00
parent 2b15a40f75
commit e7f312ec50

View File

@@ -1531,25 +1531,28 @@ public class JDUtil {
num = Integer.parseInt(split[2]);
} catch (NumberFormatException ignored) {
}
if (s != null) {
count = Integer.parseInt(s) + num; // 递增计数器
for (int i = 0; i < num; i++){
if (s != null) {
count = Integer.parseInt(s) + 1; // 递增计数器
}
// 将新的计数器值保存回 Redis
redisTemplate.opsForValue().set(redisKey, String.valueOf(count), 1, TimeUnit.DAYS);
// 生成订单号
String orderID = today + String.format("%03d", count); // 格式化为 3 位数字,不足补零
// 替换模板中的占位符
temp = temp.replace("{单号}", orderID);
temp = temp.replace("{地址}", split[3]);
temp = temp.replace("{型号}", split[1]);
temp = temp.replaceAll("[|]", "");
// 发送订单信息到微信
wxUtil.sendTextMessage(fromWxid, temp, 1, fromWxid, true);
}
// 将新的计数器值保存回 Redis
redisTemplate.opsForValue().set(redisKey, String.valueOf(count), 1, TimeUnit.DAYS);
// 生成订单号
String orderID = today + String.format("%03d", count); // 格式化为 3 位数字,不足补零
// 替换模板中的占位符
temp = temp.replace("{单号}", orderID);
temp = temp.replace("{地址}", split[3]);
temp = temp.replace("{型号}", split[1]);
temp = temp.replaceAll("[|]", "");
// 发送订单信息到微信
wxUtil.sendTextMessage(fromWxid, temp, 1, fromWxid, true);
} catch (Exception e) {
logger.error("生成订单号时发生异常 - 用户: {}, 日期: {}", fromWxid, today, e);