1
This commit is contained in:
@@ -16,6 +16,8 @@ import com.jd.open.api.sdk.request.kplunion.UnionOpenOrderRowQueryRequest;
|
||||
import com.jd.open.api.sdk.request.kplunion.UnionOpenPromotionBysubunionidGetRequest;
|
||||
import com.jd.open.api.sdk.response.kplunion.UnionOpenOrderRowQueryResponse;
|
||||
import com.jd.open.api.sdk.response.kplunion.UnionOpenPromotionCommonGetResponse;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -789,14 +791,38 @@ public class JDUtils {
|
||||
content.append("违规排行:");
|
||||
content.append(daysInt).append("天").append("\r\n");
|
||||
|
||||
Map<String, Long> skuIdViolationCountMap = filterOrdersByDays.stream().filter(orderRow -> orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28).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())).collect(Collectors.toList());
|
||||
Map<String, Long> skuIdViolationCountMap = filterOrdersByDays.stream()
|
||||
.filter(orderRow -> orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28)
|
||||
.filter(orderRow -> orderRow.getSkuName() != null)
|
||||
.collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting()));
|
||||
|
||||
Map<String, List<OrderInfo>> orderInfoMap = filterOrdersByDays.stream()
|
||||
.filter(orderRow -> orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28)
|
||||
.filter(orderRow -> orderRow.getSkuName() != null)
|
||||
.map(orderRow -> {
|
||||
OrderInfo info = new OrderInfo();
|
||||
info.setSkuName(orderRow.getSkuName());
|
||||
info.setOrderId(orderRow.getOrderId());
|
||||
info.setOrderDate(orderRow.getOrderTime());
|
||||
return info;
|
||||
})
|
||||
.collect(Collectors.groupingBy(OrderInfo::getSkuName));
|
||||
|
||||
List<Map.Entry<String, Long>> sortedViolationCounts = skuIdViolationCountMap.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
|
||||
Integer num = 0;
|
||||
for (Map.Entry<String, Long> entry : sortedViolationCounts) {
|
||||
num++;
|
||||
String skuName = entry.getKey();
|
||||
Long count = entry.getValue();
|
||||
content.append(num).append(",商品:").append(skuName).append("\r\r").append(" 违规次数:").append(count).append("\r");
|
||||
List<OrderInfo> infos = orderInfoMap.get(skuName);
|
||||
if (infos != null) {
|
||||
for (OrderInfo info : infos) {
|
||||
content.append("商品:").append(info.getSkuName()).append(",订单号:").append(info.getOrderId()).append(",下单日期:").append(info.getOrderDate()).append("\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -936,4 +962,12 @@ public class JDUtils {
|
||||
// return response.getGetResult().getData().getClickURL();
|
||||
//}
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public static class OrderInfo {
|
||||
private String skuName;
|
||||
private Long count;
|
||||
private Long orderId;
|
||||
private Date orderDate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user