This commit is contained in:
雷欧(林平凡)
2024-11-15 15:43:40 +08:00
parent d37de52072
commit b24fc32bc5

View File

@@ -242,7 +242,9 @@ public class JDUtils {
content.append("昨日订单\r");
content.append("刷新三天\r");
content.append("刷新两个月\r");
content.append("违规\r");
content.append("高级菜单::::::\r");
content.append("菜单:京+高级+命令 \n 如: 京高级违规30\r");
content.append("京高级违规+整数\r");
break;
case "今日统计": {
List<OrderRow> todayOrders = filterOrdersByDate(orderRows, 0);
@@ -274,6 +276,19 @@ public class JDUtils {
content.append("\r" + "违规佣金:").append(getStreamForWeiGui(yesterdayOrders).mapToDouble(orderRow -> orderRow.getEstimateCosPrice() * orderRow.getCommissionRate() * 0.01).sum());
break;
}
case "三日统计":{
List<OrderRow> last3DaysOrders = filterOrdersByDate(orderRows, 3);
content.append("三日统计:");
content.append("订单总数:").append(last3DaysOrders.size()).append("\r");
content.append("已付款:").append(last3DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() == 16).count()).append("\r");
content.append("已取消:").append(last3DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() != 16 && orderRow.getValidCode() != 17).count()).append("\r");
content.append("已完成:").append(last3DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() == 17).count()).append("\r");
content.append("违规:").append(getStreamForWeiGui(last3DaysOrders).count()).append("\r");
content.append("已付款佣金:").append(last3DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() == 16).mapToDouble(OrderRow::getEstimateFee).sum()).append("\r");
content.append("已完成佣金:").append(last3DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() == 17).mapToDouble(OrderRow::getEstimateFee).sum());
content.append("\r" + "违规佣金:").append(getStreamForWeiGui(last3DaysOrders).mapToDouble(orderRow -> orderRow.getEstimateCosPrice() * orderRow.getCommissionRate() * 0.01).sum());
break;
}
case "七日统计": {
List<OrderRow> last7DaysOrders = filterOrdersByDate(orderRows, 7);
content.append("七日统计:");
@@ -399,12 +414,38 @@ public class JDUtils {
content.append("刷新两个月,耗时").append((System.currentTimeMillis() - start) / 1000).append("\r");
}
case "违规": {
content.append("违规排行:");
List<OrderRow> oneYearOrders = filterOrdersByDate(orderRows, 365);
// 计算出skuId 违规的前7个排行
Map<String, Long> skuIdViolationCountMap = oneYearOrders.stream().filter(orderRow -> orderRow.getValidCode() == 27
break;
default:
sendOrderToWxByOrderJDAdvanced(order);
}
if (content.length() > 0) {
wxUtil.sendTextMessage(WXUtil.super_admin_wxid, content.toString(), 1, WXUtil.super_admin_wxid);
}
}
/**
* 高级菜单
* */
public void sendOrderToWxByOrderJDAdvanced (String order) throws Exception {
int[] parm = {-1};
List<OrderRow> orderRows = orderRowRepository.findByValidCodeNotInOrderByOrderTimeDesc(parm);
StringBuilder content = new StringBuilder();
if (order.startsWith("高级")) {
order = order.replace("高级", "");
if (order.startsWith("违规")) {
String days = order.replace("违规", "");
Integer daysInt = 365;
if (Util.isNotEmpty(days)) {
daysInt = Integer.parseInt(days);
}
List<OrderRow> filterOrdersByDays = filterOrdersByDate(orderRows, daysInt);
content.append("违规排行:");
content.append(daysInt).append("");
Map<String, Long> skuIdViolationCountMap = filterOrdersByDays.stream().filter(orderRow -> orderRow.getValidCode() == 27
|| orderRow.getValidCode() == 28
|| orderRow.getValidCode() == 2).filter(orderRow -> orderRow.getSkuName() != null).collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting()));
List<Map.Entry<String, Long>> sortedViolationCounts = skuIdViolationCountMap.entrySet().stream()
@@ -418,16 +459,20 @@ public class JDUtils {
}
}
break;
default:
} else {
try {
sendOrderToWxByOrderJD("菜单");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
if (content.length() > 0) {
wxUtil.sendTextMessage(WXUtil.super_admin_wxid, content.toString(), 1, WXUtil.super_admin_wxid);
}
}
private void orderToWx(OrderRow orderRow, Boolean isAutoFlush) {
// 查询订单状态
Integer newValidCode = orderRow.getValidCode();