| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.flower.FlowerQueryDTO; |
| | | import com.mzl.flower.dto.request.payment.OrderItemSalesQueryDTO; |
| | | import com.mzl.flower.dto.request.payment.OrderQueryDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerListDTO; |
| | | import com.mzl.flower.dto.response.statistics.FlowerStatisticsDTO; |
| | | import com.mzl.flower.dto.response.statistics.SaleStatisticsDTO; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | |
| | | @Autowired |
| | | private SupplierMapper supplierMapper; |
| | | |
| | | @Autowired |
| | | private OrderItemSalesMapper orderItemSalesMapper; |
| | | |
| | | public SaleStatisticsDTO getSaleStatistics(String date){ |
| | | if(StringUtils.isEmpty(date)){ |
| | |
| | | |
| | | Page page = new Page(1, 1); |
| | | FlowerQueryDTO q = new FlowerQueryDTO(); |
| | | List<String> statusList = new ArrayList<>(); |
| | | statusList.add(Constants.FLOWER_STATUS.PENDING.name()); |
| | | statusList.add(Constants.FLOWER_STATUS.UP.name()); |
| | | statusList.add(Constants.FLOWER_STATUS.OFF.name()); |
| | | statusList.add(Constants.FLOWER_STATUS.FORCE_OFF.name()); |
| | | q.setStatusList(statusList); |
| | | flowerMapper.selectFlowerList(page, q); |
| | | dto.setFlowerCount((int)page.getTotal()); |
| | | |
| | |
| | | .isNull("refund_time")); |
| | | dto.setOrderCount(oc); |
| | | |
| | | page = new Page(1, 1); |
| | | OrderQueryDTO oq = new OrderQueryDTO(); |
| | | oq.setStatusBackend(Constants.ORDER_STATUS_BACKEND.SEND.name()); |
| | | orderMapper.selectOrderList(page, oq); |
| | | dto.setOrderSendCount((int)page.getTotal()); |
| | | |
| | | page = new Page(1, 1); |
| | | q = new FlowerQueryDTO(); |
| | | statusList = new ArrayList<>(); |
| | | statusList.add(Constants.FLOWER_STATUS.UP.name()); |
| | | q.setStatusList(statusList); |
| | | flowerMapper.selectFlowerList(page, q); |
| | | dto.setFlowerUpCount((int)page.getTotal()); |
| | | |
| | | page = new Page(1, 1); |
| | | q = new FlowerQueryDTO(); |
| | | statusList = new ArrayList<>(); |
| | | statusList.add(Constants.FLOWER_STATUS.PENDING.name()); |
| | | q.setStatusList(statusList); |
| | | flowerMapper.selectFlowerList(page, q); |
| | | dto.setFlowerPendingCount((int)page.getTotal()); |
| | | |
| | | page = new Page(1, 1); |
| | | OrderItemSalesQueryDTO sq = new OrderItemSalesQueryDTO(); |
| | | sq.setStatus(Constants.ORDER_SALES_STATUS.PENDING.name()); |
| | | orderItemSalesMapper.selectItemSalesList(page, sq); |
| | | dto.setOrderSalesCount((int)page.getTotal()); |
| | | |
| | | return dto; |
| | | } |
| | | } |