1
This commit is contained in:
@@ -5,7 +5,6 @@ import cn.van.business.model.jd.ProductOrder;
|
||||
import cn.van.business.mq.MessageProducerService;
|
||||
import cn.van.business.repository.ProductOrderRepository;
|
||||
import cn.van.business.util.JDUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.van.business.util.WXUtil.getRemarkFromJdid;
|
||||
import static cn.van.business.util.WXUtil.getWxidFromJdid;
|
||||
|
||||
|
||||
@@ -73,7 +74,7 @@ public class OrderUtil {
|
||||
String wxId = getWxidFromJdid(orderRowList.get(0).getUnionId().toString());
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("批量订单:\n\r ").append(" 共 ").append(orderRowList.size()).append("单 \r");
|
||||
List<OrderRow> filterList = orderRowList.stream().filter(orderRow -> orderRow.getValidCode() !=2
|
||||
List<OrderRow> filterList = orderRowList.stream().filter(orderRow -> orderRow.getValidCode() != 2
|
||||
&& orderRow.getValidCode() != 3).toList();
|
||||
content.append("移除 拆单或者取消 的订单, 共 ").append(filterList.size()).append("单: \n\r");
|
||||
for (OrderRow orderRow : filterList) {
|
||||
@@ -94,43 +95,45 @@ public class OrderUtil {
|
||||
/**
|
||||
* 将数据库订单转化成微信所需要文本
|
||||
*/
|
||||
public String getFormattedOrderInfo(OrderRow orderRow, Integer oldValidCode) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
ValidCodeConverter converter = new ValidCodeConverter();
|
||||
public String getFormattedOrderInfo(OrderRow orderRow, Integer oldValidCode) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
ValidCodeConverter converter = new ValidCodeConverter();
|
||||
Long unionId = orderRow.getUnionId();
|
||||
String remarkFromJdid = getRemarkFromJdid(String.valueOf(unionId));
|
||||
StringBuilder orderInfo = new StringBuilder()
|
||||
.append(" ").append(getEmjoy(orderRow.getValidCode())).append(" ")
|
||||
.append(converter.getCodeDescription(orderRow.getValidCode())).append("\r");
|
||||
|
||||
StringBuilder orderInfo = new StringBuilder()
|
||||
.append(" ").append(getEmjoy(orderRow.getValidCode())).append(" ")
|
||||
.append(converter.getCodeDescription(orderRow.getValidCode())).append("\r");
|
||||
//if (oldValidCode != -100 && !oldValidCode.equals(orderRow.getValidCode())) {
|
||||
// orderInfo.insert(0, "从 :" + getEmjoy(oldValidCode) + " "
|
||||
// + converter.getCodeDescription(oldValidCode) + "\r变成 "
|
||||
// + getEmjoy(orderRow.getValidCode()) + " "
|
||||
// + converter.getCodeDescription(orderRow.getValidCode()) + "\r\n");
|
||||
//}
|
||||
|
||||
//if (oldValidCode != -100 && !oldValidCode.equals(orderRow.getValidCode())) {
|
||||
// orderInfo.insert(0, "从 :" + getEmjoy(oldValidCode) + " "
|
||||
// + converter.getCodeDescription(oldValidCode) + "\r变成 "
|
||||
// + getEmjoy(orderRow.getValidCode()) + " "
|
||||
// + converter.getCodeDescription(orderRow.getValidCode()) + "\r\n");
|
||||
//}
|
||||
orderInfo
|
||||
//+ "订单+sku:" + orderRow.getId() + "\r"
|
||||
.append("京粉备注:").append(remarkFromJdid).append("\r")
|
||||
.append("订单:").append(orderRow.getOrderId()).append(" (")
|
||||
.append(orderRow.getPlus() == 1 ? "plus" : "非plus").append(")\r")
|
||||
.append("名称:").append(orderRow.getSkuName()).append("\r\n")
|
||||
//+ "商品单价:" + orderRow.getPrice() + "\r"
|
||||
//+ "商品数量:" + orderRow.getSkuNum() + "\r"
|
||||
//+ "商品总价:" + (orderRow.getPrice() * orderRow.getSkuNum()) + "\r"
|
||||
.append("计佣金额:").append(orderRow.getEstimateCosPrice()).append("\r")
|
||||
//+ "金额:" + orderRow.getActualCosPrice() + "\r"
|
||||
.append("比例:").append(orderRow.getCommissionRate()).append("\r")
|
||||
.append("[Packet] 佣金:").append(orderRow.getEstimateFee()).append("\r\n")
|
||||
.append("下单:").append(formatter.format(orderRow.getOrderTime())).append("\r")
|
||||
.append("完成:").append(orderRow.getFinishTime() != null
|
||||
? formatter.format(orderRow.getFinishTime())
|
||||
: "未完成").append("\r");
|
||||
|
||||
orderInfo
|
||||
//+ "订单+sku:" + orderRow.getId() + "\r"
|
||||
.append("订单:").append(orderRow.getOrderId()).append(" (")
|
||||
.append(orderRow.getPlus() == 1 ? "plus" : "非plus").append(")\r")
|
||||
.append("名称:").append(orderRow.getSkuName()).append("\r\n")
|
||||
//+ "商品单价:" + orderRow.getPrice() + "\r"
|
||||
//+ "商品数量:" + orderRow.getSkuNum() + "\r"
|
||||
//+ "商品总价:" + (orderRow.getPrice() * orderRow.getSkuNum()) + "\r"
|
||||
.append("计佣金额:").append(orderRow.getEstimateCosPrice()).append("\r")
|
||||
//+ "金额:" + orderRow.getActualCosPrice() + "\r"
|
||||
.append("比例:").append(orderRow.getCommissionRate()).append("\r")
|
||||
.append("[Packet] 佣金:").append(orderRow.getEstimateFee()).append("\r\n")
|
||||
.append("下单:").append(formatter.format(orderRow.getOrderTime())).append("\r")
|
||||
.append("完成:").append(orderRow.getFinishTime() != null
|
||||
? formatter.format(orderRow.getFinishTime())
|
||||
: "未完成").append("\r");
|
||||
|
||||
return orderInfo.toString();
|
||||
}
|
||||
return orderInfo.toString();
|
||||
}
|
||||
|
||||
|
||||
public String getEmjoy(Integer status){
|
||||
public String getEmjoy(Integer status) {
|
||||
return switch (status) {
|
||||
//[爱心]已付款
|
||||
case 16 -> "[爱心]";
|
||||
@@ -139,8 +142,7 @@ public String getFormattedOrderInfo(OrderRow orderRow, Integer oldValidCode) {
|
||||
//[心碎]已取消
|
||||
case 2, 3 -> "[心碎]";
|
||||
//[亲亲] 已完成
|
||||
case 17 ->
|
||||
"[亲亲]";
|
||||
case 17 -> "[亲亲]";
|
||||
//[Broken] 违规
|
||||
case 27, 28 -> "[Broken]";
|
||||
default -> "";
|
||||
@@ -148,7 +150,6 @@ public String getFormattedOrderInfo(OrderRow orderRow, Integer oldValidCode) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将数据库订单转化成微信所需要文本 简洁版
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,8 @@ public class WXUtil {
|
||||
public static String default_bot_wxid = "wxid_kr145nk7l0an31";
|
||||
public static Map<String, SuperAdmin> super_admins = new HashMap<>();
|
||||
public static Map<String, String> jdidToWxidMap = new HashMap<>();
|
||||
public static Map<String, String> jdidToRemarkMap = new HashMap<>();
|
||||
|
||||
public static List<String> chatRoomList = new ArrayList<>();
|
||||
//玩乐买
|
||||
public static String chatRoom_WLM = "23143922156@chatroom";
|
||||
@@ -89,6 +91,9 @@ public class WXUtil {
|
||||
public static String getWxidFromJdid(String jdid) {
|
||||
return jdidToWxidMap.get(jdid);
|
||||
}
|
||||
public static String getRemarkFromJdid(String jdid) {
|
||||
return jdidToRemarkMap.get(jdid);
|
||||
}
|
||||
|
||||
public static List<String> splitStringByLength(String input, int length) {
|
||||
List<String> result = new ArrayList<>();
|
||||
@@ -106,10 +111,28 @@ public class WXUtil {
|
||||
SuperAdmin admin1 = new SuperAdmin("wxid_ytpc72mdoskt22", "凡", "2014264913", "98e21c89ae5610240ec3f5f575f86a59", "3dcb6b23a1104639ac433fd07adb6dfb");
|
||||
super_admins.put(admin1.getWxid(), admin1);
|
||||
jdidToWxidMap.put(admin1.getUnionId(), admin1.getWxid());
|
||||
jdidToRemarkMap.put(admin1.getUnionId(), admin1.getName());
|
||||
|
||||
SuperAdmin admin2 = new SuperAdmin("wxid_yneqf1implxu12", "源", "2025353364", "e3c161242c8a1416fada5b5564d7ee70", "41ae9aabf03b41e6ba309682e36b323e");
|
||||
super_admins.put(admin2.getWxid(), admin2);
|
||||
jdidToWxidMap.put(admin2.getUnionId(), admin2.getWxid());
|
||||
jdidToRemarkMap.put(admin2.getUnionId(), admin2.getName());
|
||||
|
||||
SuperAdmin admin3 = new SuperAdmin("wxid_ytpc72mdoskt22", "林琳", "2035096657", "9c2011409f0fc906b73432dd3687599d", "3ceddff403e544a8a2eacc727cf05dab");
|
||||
super_admins.put(admin3.getWxid(), admin3);
|
||||
jdidToWxidMap.put(admin3.getUnionId(), admin3.getWxid());
|
||||
jdidToRemarkMap.put(admin3.getUnionId(), admin3.getName());
|
||||
|
||||
SuperAdmin admin4 = new SuperAdmin("wxid_ytpc72mdoskt22", "淑玲", "2036678559", "4dbc8edd74fbb24d537ee64930527e30", "27ee9b5871e547eb83e19027a4ff7e18");
|
||||
super_admins.put(admin4.getWxid(), admin4);
|
||||
jdidToWxidMap.put(admin4.getUnionId(), admin4.getWxid());
|
||||
jdidToRemarkMap.put(admin4.getUnionId(), admin4.getName());
|
||||
|
||||
SuperAdmin admin5 = new SuperAdmin("wxid_ytpc72mdoskt22", "老妈", "2035140236", "5cc8da6a55842330775fad4ee9ebf47a", "c4aebcd408924143a75463781f6acd7c");
|
||||
super_admins.put(admin5.getWxid(), admin5);
|
||||
jdidToWxidMap.put(admin5.getUnionId(), admin5.getWxid());
|
||||
jdidToRemarkMap.put(admin5.getUnionId(), admin5.getName());
|
||||
|
||||
|
||||
// 方案
|
||||
chatRoomList.add("50400969285@chatroom");
|
||||
|
||||
Reference in New Issue
Block a user