我想准备一个简单的报告,按月显示订购产品的数量,如下所示(降序):
Month Number of products
2018-10 8
2018-11 3
我的数据:
class Orders {
private List<Order> orders = new ArrayList<>();
public void prepareData() {
Product socks = new ProductBuilder()
.setPrice(new BigDecimal("23"))
.setCategory(Category.C)
.setName("SOCKS")
.build();
Product jacket = new ProductBuilder()
.setPrice(new BigDecimal("199"))
.setCategory(Category.A)
.setName("JACKET")
.build();
Product watch = new ProductBuilder()
.setPrice(new BigDecimal("100"))
.setCategory(Category.B)
.setName("WATCH CASIO")
.build();
Customer john = new CustomerBuilder()
.setAge(18)
.setName("JOHN")
.setSurname("JOHNSON")
.setEmail("john@johnson.com")
.build();
Customer mike = new CustomerBuilder()
.setAge(20)
.setName("MIKE")
.setSurname("MAX")
.setEmail("mike@max.com")
.build();
Order orderJohn = new OrderBuilder()
.setQuantity(2)
.setCustomer(john)
.setProduct(watch)
.setOrderDate(LocalDate.now())
.build();
Order orderJohn2 = new OrderBuilder()
.setQuantity(4)
.setCustomer(john)
.setProduct(socks)
.setOrderDate(LocalDate.now())
.build();
慕妹3146593
桃花长相依
相关分类