Compare commits
2 Commits
e91a336d35
...
5c8998fb3a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c8998fb3a | ||
|
|
eadfdb02a8 |
@@ -1687,6 +1687,25 @@ public class JDUtil {
|
||||
|
||||
public void sendOrderToWxByOrderD(String order, String fromWxid) {
|
||||
|
||||
if (order.equals("单-1")) {
|
||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd "));
|
||||
String redisKey = "order_count:" + today;
|
||||
int count;
|
||||
|
||||
try {
|
||||
// 从 Redis 获取当前日期的订单计数器
|
||||
String s = redisTemplate.opsForValue().get(redisKey);
|
||||
count = s != null ? Integer.parseInt(s) : 0;
|
||||
if (count > 0) {
|
||||
redisTemplate.opsForValue().set(redisKey, String.valueOf(count - 1), 1, TimeUnit.DAYS);
|
||||
}
|
||||
wxUtil.sendTextMessage(fromWxid, "今日剩余单数:" + count, 1, fromWxid, false);
|
||||
} catch (Exception e) {
|
||||
logger.error("Redis操作失败: {}", e.getMessage(), e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (order == null || order.trim().isEmpty()) {
|
||||
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n分销标记\n型号\n转链链接\n数量\n地址", 1, fromWxid, false);
|
||||
return;
|
||||
@@ -2218,11 +2237,14 @@ public class JDUtil {
|
||||
1
|
||||
张林 17530176250 湖北省 武汉市 东西湖区 径河街道 径河街道临空港小区二期 8栋2单元2204联系15783450649转6316
|
||||
* */
|
||||
String[] parts = input.replaceAll("TF|\n", "").split("\t"); // 使用制表符分割
|
||||
String[] parts = input.replace("TF", "").split("\t"); // 使用制表符分割
|
||||
if (parts.length >= 3) {
|
||||
String modelNumber = parts[0]; // 型号
|
||||
String modelNumber = parts[0].replace("\n", ""); // 型号
|
||||
String quantityStr = parts[1]; // 数量
|
||||
String address = parts[2]; // 地址
|
||||
String address = "";
|
||||
for (int i = 2; i < parts.length; i++) {
|
||||
address += parts[i];
|
||||
}
|
||||
// 使用正则表达式提取中文字符
|
||||
Pattern pattern = Pattern.compile("[\\u4E00-\\u9FA5]+");
|
||||
Matcher matcher = pattern.matcher(input);
|
||||
|
||||
Reference in New Issue
Block a user