1
This commit is contained in:
@@ -421,19 +421,20 @@ public class JDUtils {
|
||||
|
||||
}
|
||||
case "违规排行": {
|
||||
content.append("违规排行(前十):");
|
||||
|
||||
List<OrderRow> oneYearOrders = filterOrdersByDate(orderRows, 365);
|
||||
// 计算出skuId 违规的前7个排行
|
||||
Map<String, Long> skuIdViolationCountMap = oneYearOrders.stream().filter(orderRow -> orderRow.getValidCode() == 27
|
||||
|| orderRow.getValidCode() == 28
|
||||
|| orderRow.getValidCode() == 2).filter(orderRow -> orderRow.getSkuId() != null).collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting()));
|
||||
|| orderRow.getValidCode() == 2).filter(orderRow -> orderRow.getSkuName() != null).collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting()));
|
||||
List<Map.Entry<String, Long>> sortedViolationCounts = skuIdViolationCountMap.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(7).collect(Collectors.toList());
|
||||
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(10).collect(Collectors.toList());
|
||||
for (Map.Entry<String, Long> entry : sortedViolationCounts) {
|
||||
String skuName = entry.getKey();
|
||||
Long count = entry.getValue();
|
||||
content.append("商品:").append(skuName).append(" 违规次数:").append(count).append("\r");
|
||||
}
|
||||
content.append("违规排行:");
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user