合并 订单附带京粉每日统计
This commit is contained in:
@@ -5,8 +5,6 @@ import cn.van.business.model.jd.OrderRow;
|
||||
import cn.van.business.repository.OrderRowRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -94,10 +92,13 @@ public class OrderUtil {
|
||||
String unionId = entry.getKey();
|
||||
List<OrderRow> orderRows2 = entry.getValue();
|
||||
OrderStats stats = calculateStats(orderRows2);
|
||||
resultContent.append(buildStatsContent("京粉 :" + getRemarkFromJdid(unionId) , stats));
|
||||
resultContent.append(buildStatsContent("京粉 : " + getRemarkFromJdid(unionId) , stats));
|
||||
}
|
||||
wxUtil.sendTextMessage(wxId, resultContent.toString(), 1, wxId, true);
|
||||
|
||||
OrderStats orderStats = calculateStats(orderRows);
|
||||
wxUtil.sendTextMessage(wxId, buildStatsContent("今日订单统计 : ", orderStats), 1, wxId, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ public class OrderUtil {
|
||||
|
||||
orderInfo
|
||||
//+ "订单+sku:" + orderRow.getId() + "\r"
|
||||
.append("京粉备注:").append(remarkFromJdid).append("\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")
|
||||
@@ -258,7 +259,7 @@ public class OrderUtil {
|
||||
|
||||
return new OrderStats(orders.size(), orders.size() - canceled, paid, orders.stream().filter(o -> o.getValidCode() == 16).mapToDouble(OrderRow::getEstimateFee).sum(), pending, orders.stream().filter(o -> o.getValidCode() == 15).mapToDouble(OrderRow::getEstimateFee).sum(), canceled, completed, orders.stream().filter(o -> o.getValidCode() == 17).mapToDouble(OrderRow::getEstimateFee).sum(), getStreamForWeiGui(orders).count(), getStreamForWeiGui(orders).mapToDouble(o -> o.getEstimateCosPrice() * o.getCommissionRate() * 0.01).sum());
|
||||
}
|
||||
private StringBuilder buildStatsContent(String title, OrderStats stats) {
|
||||
private String buildStatsContent(String title, OrderStats stats) {
|
||||
StringBuilder content = new StringBuilder();
|
||||
content//[爱心][Wow][Packet][Party][Broken][心碎][亲亲][色]
|
||||
.append(title).append(" \n").append("[爱心] 订单总数:").append(stats.getTotalOrders()).append("\n") // [文件]
|
||||
@@ -268,7 +269,7 @@ public class OrderUtil {
|
||||
.append("[Packet] 已付款佣金:").append(String.format("%.2f", stats.getPaidCommission())).append("\n") // [钞票]
|
||||
.append("[Wow] 待付款:").append(stats.getPendingOrders()).append("\n") // [时钟]
|
||||
.append("[Packet] 待付款佣金:").append(String.format("%.2f", stats.getPendingCommission())).append("\n").append("━━━━━━━━━━━━\n");
|
||||
return content;
|
||||
return content.toString();
|
||||
}
|
||||
private Stream<OrderRow> getStreamForWeiGui(List<OrderRow> todayOrders) {
|
||||
return todayOrders.stream().filter(orderRow -> orderRow.getValidCode() == 13 || orderRow.getValidCode() == 25 || orderRow.getValidCode() == 26 || orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28 || orderRow.getValidCode() == 29);
|
||||
|
||||
Reference in New Issue
Block a user