| | |
| | | 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.payment.OrderStatusCountDTO; |
| | | import com.mzl.flower.dto.response.statistics.FlowerStatisticsDTO; |
| | | import com.mzl.flower.dto.response.statistics.OrderStatisticsDTO; |
| | | import com.mzl.flower.dto.response.statistics.RateStatisticsDTO; |
| | | import com.mzl.flower.dto.response.statistics.SaleStatisticsDTO; |
| | | import com.mzl.flower.dto.response.wallet.WalletWithdrawVO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.ip.UserAccess; |
| | | import com.mzl.flower.entity.payment.Order; |
| | |
| | | import com.mzl.flower.mapper.ip.UserAccessMapper; |
| | | import com.mzl.flower.mapper.payment.*; |
| | | import com.mzl.flower.mapper.supplier.SupplierMapper; |
| | | import com.mzl.flower.mapper.wallet.WalletMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.utils.IpUtil; |
| | | import io.micrometer.core.instrument.util.StringUtils; |
| | |
| | | @Autowired |
| | | private UserAccessMapper userAccessMapper; |
| | | |
| | | @Autowired |
| | | private WalletMapper walletMapper; |
| | | |
| | | public SaleStatisticsDTO getSaleStatistics(String date){ |
| | | if(StringUtils.isEmpty(date)){ |
| | | throw new ValidationException("日期不能为空"); |
| | |
| | | .eq("is_enabled", 1) |
| | | .eq("status", "P") |
| | | .eq("deleted", 0)); |
| | | dto.setSupplierCount(sc.longValue());//用户管理:统计商户列表已启用的全部用户(点击跳转到商户列表) |
| | | dto.setSupplierCount(sc.longValue()); |
| | | |
| | | Integer oc = orderMapper.selectCount(new QueryWrapper<Order>() |
| | | .eq("deleted", 0) |
| | | .isNotNull("payment_time") |
| | | .isNull("cancel_time") |
| | | .isNull("refund_time")); |
| | | dto.setOrderCount(oc.longValue());//订单管理:全部订单数量-待付款-已取消-已退款(点击跳转到订单列表) |
| | | Integer cc = customerMapper.selectCount(new QueryWrapper<Customer>() |
| | | .eq("is_enabled", 1) |
| | | .eq("deleted", 0)); |
| | | dto.setCustomerCount(cc.longValue());//用户管理:统计商户列表已启用的全部用户(点击跳转到商户列表) |
| | | |
| | | //订单管理:全部订单数量-待付款-已取消-已退款(点击跳转到订单列表) |
| | | List<OrderStatusCountDTO> ll = orderMapper.getOrderStatusCount(new OrderQueryDTO()); |
| | | Integer oc = 0; |
| | | if (ll != null && ll.size() > 0) { |
| | | for (OrderStatusCountDTO c : ll) { |
| | | if(Constants.ORDER_STATUS_BACKEND.PENDING.name().equals(c.getValue()) |
| | | || Constants.ORDER_STATUS_BACKEND.CANCEL.name().equals(c.getValue()) |
| | | || Constants.ORDER_STATUS_BACKEND.REFUND.name().equals(c.getValue())){ |
| | | continue; |
| | | } |
| | | oc += c.getOrderCount(); |
| | | } |
| | | } |
| | | dto.setOrderCount(oc.longValue()); |
| | | |
| | | page = new Page(1, 1); |
| | | OrderQueryDTO oq = new OrderQueryDTO(); |
| | |
| | | dto.setTotalSaleAmount(a); |
| | | dto.setTotalSaleFlowerCount(c == null ? 0 : c.longValue()); |
| | | |
| | | dto.setSupplierPendingAmount(new BigDecimal(0));//TODO 供应商待提现:结算列表待结算(供应商)+供应商钱包余额 |
| | | dto.setSupplierCompleteAmount(new BigDecimal(0));//TODO 供应商已提现:结算列表已结算(供应商)+供应商钱包已提现金额 |
| | | WalletWithdrawVO withdrawTotal = walletMapper.getSumWithdrawTotal(); |
| | | BigDecimal sumHistoryWithdrawTotal = walletMapper.getSumHistoryWithdrawTotal(); |
| | | dto.setSupplierPendingAmount(withdrawTotal.getSupplierPendingAmount().add(sumHistoryWithdrawTotal)); |
| | | dto.setSupplierCompleteAmount(withdrawTotal.getSupplierCompleteAmount().add(sumHistoryWithdrawTotal)); |
| | | |
| | | // dto.setSupplierPendingAmount(new BigDecimal(0));//TODO 供应商待提现:结算列表待结算(供应商)+供应商钱包余额 |
| | | // dto.setSupplierCompleteAmount(new BigDecimal(0));//TODO 供应商已提现:结算列表已结算(供应商)+供应商钱包已提现金额 |
| | | |
| | | return dto; |
| | | } |
| | |
| | | LocalDateTime beginY = begin.plusDays(-1); |
| | | |
| | | RateStatisticsDTO dto = new RateStatisticsDTO(); |
| | | //TODO 用户访问量:点击到交易大厅或者商品详情页面计算,同一个用户,每天只计算一次(包含游客)(并计算新增量,计算日环比) |
| | | //用户访问量:点击到交易大厅或者商品详情页面计算,同一个用户,每天只计算一次(包含游客)(并计算新增量,计算日环比) |
| | | |
| | | Integer c = userAccessMapper.selectCount(new QueryWrapper<UserAccess>()); |
| | | dto.setCount(c.longValue()); |
| | | |
| | | Integer cT = userAccessMapper.selectCount(new QueryWrapper<UserAccess>() |
| | | .gt("create_time", begin) |
| | | .le("create_time", end) |
| | |
| | | sq = new OrderItemSalesQueryDTO(); |
| | | sq.setStatusList(statusList); |
| | | sq.setSalesStartDate(begin); |
| | | sq.setSalesStartDate(end); |
| | | sq.setSalesEndDate(end); |
| | | orderItemSalesMapper.selectItemSalesList(page, sq); |
| | | dto.setCountToday(page.getTotal()); |
| | | |
| | |
| | | sq = new OrderItemSalesQueryDTO(); |
| | | sq.setStatusList(statusList); |
| | | sq.setSalesStartDate(beginY); |
| | | sq.setSalesStartDate(endY); |
| | | sq.setSalesEndDate(endY); |
| | | orderItemSalesMapper.selectItemSalesList(page, sq); |
| | | dto.setCountRate(getRate(dto.getCountToday().intValue(), (int)page.getTotal())); |
| | | |
| | |
| | | BigDecimal yy = BigDecimal.valueOf(yesterday); |
| | | BigDecimal rate = ttyy.divide(yy, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | return rate.doubleValue(); |
| | | } else if (today <= 0) { |
| | | return 0D; |
| | | } |
| | | |
| | | return 100D; |