This commit is contained in:
雷欧(林平凡)
2025-06-19 15:45:54 +08:00
parent 245f90901c
commit 13c9d0350c

View File

@@ -1768,6 +1768,17 @@ public class JDUtil {
wxUtil.sendTextMessage(fromWxid, "订单数量格式错误,请输入正确的数字", 1, fromWxid, false);
return;
}
// 需要做一个强校验如果24小时内解析出来的地址已经存在则不允许继续生成订单并返回错误信息给用户。
// 思路是将地址解析出来,保存到 Redis 中,并设置过期时间为 24 小时。
String address = split[5].trim();
String addressKey = "address:" + address;
if (redisTemplate.opsForValue().get(addressKey) != null) {
for (int i = 0; i < 5; i++) {
wxUtil.sendTextMessage(fromWxid, "[炸弹] [炸弹] [炸弹] 此地址已经存在,请勿重复生成订单 [炸弹] [炸弹] [炸弹] ", 1, fromWxid, false);
}
return;
}
redisTemplate.opsForValue().set(addressKey, "1", 1, TimeUnit.DAYS);
// 先一次性增加计数器,并设置到 Redis原子性操作
int startCount = count + 1;
@@ -2069,6 +2080,7 @@ public class JDUtil {
private Date orderDate;
}
public List<LocalDate> getDateFromLD(String dateStr) {
ArrayList<LocalDate> dateArrayList = new ArrayList<>();
logger.info("开始解析日期 {}", dateStr);
@@ -2106,6 +2118,7 @@ public class JDUtil {
return dateArrayList;
}
public static LocalDateTime getEffectiveToday() {
LocalDateTime now = LocalDateTime.now();
if (now.getHour() < 8) {