bug fix
This commit is contained in:
@@ -96,7 +96,7 @@ public class JDUtil {
|
|||||||
* <p>
|
* <p>
|
||||||
* 订单号:
|
* 订单号:
|
||||||
*/
|
*/
|
||||||
private static final String WENAN_D = "单:\n" + "{单号} \n" + "分销标记(标记用,勿改):\n" + "型号:\n" + "\n" + "链接:\n" + "\n" + "下单付款:\n" + "\n" + "后返金额:\n" + "\n" + "地址:\n" + "{地址}" + "\n" + "物流链接:\n" + "\n" + "订单号:\n" + "\n" + "下单人:\n" + "\n";
|
private static final String WENAN_D = "单:\n" + "{单号} \n" + "分销标记(标记用,勿改):\n" + "型号:\n" + "{型号}"+"\n" + "链接:\n" + "\n" + "下单付款:\n" + "\n" + "后返金额:\n" + "\n" + "地址:\n" + "{地址}" + "\n" + "物流链接:\n" + "\n" + "订单号:\n" + "\n" + "下单人:\n" + "\n";
|
||||||
|
|
||||||
final WXUtil wxUtil;
|
final WXUtil wxUtil;
|
||||||
private final StringRedisTemplate redisTemplate;
|
private final StringRedisTemplate redisTemplate;
|
||||||
@@ -1507,6 +1507,16 @@ public class JDUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendOrderToWxByOrderD(String order, String fromWxid) {
|
public void sendOrderToWxByOrderD(String order, String fromWxid) {
|
||||||
|
|
||||||
|
if (order == null || order.trim().isEmpty()) {
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n型号\n数量\n地址", 1, fromWxid, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] split = order.split("\n");
|
||||||
|
if (split.length != 3) {
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n型号\n数量\n地址", 1, fromWxid, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
String temp = WENAN_D;
|
String temp = WENAN_D;
|
||||||
// 今天的日期
|
// 今天的日期
|
||||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd "));
|
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd "));
|
||||||
@@ -1516,8 +1526,13 @@ public class JDUtil {
|
|||||||
try {
|
try {
|
||||||
// 从 Redis 获取当前日期的订单计数器
|
// 从 Redis 获取当前日期的订单计数器
|
||||||
String s = redisTemplate.opsForValue().get(redisKey);
|
String s = redisTemplate.opsForValue().get(redisKey);
|
||||||
|
int num = 1;
|
||||||
|
try {
|
||||||
|
num = Integer.parseInt(split[2]);
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
count = Integer.parseInt(s) + 1; // 递增计数器
|
count = Integer.parseInt(s) + num; // 递增计数器
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将新的计数器值保存回 Redis
|
// 将新的计数器值保存回 Redis
|
||||||
@@ -1528,7 +1543,8 @@ public class JDUtil {
|
|||||||
|
|
||||||
// 替换模板中的占位符
|
// 替换模板中的占位符
|
||||||
temp = temp.replace("{单号}", orderID);
|
temp = temp.replace("{单号}", orderID);
|
||||||
temp = temp.replace("{地址}", order);
|
temp = temp.replace("{地址}", split[3]);
|
||||||
|
temp = temp.replace("{型号}", split[1]);
|
||||||
temp = temp.replaceAll("[|]", "");
|
temp = temp.replaceAll("[|]", "");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user