更新商户首页统计
This commit is contained in:
parent
b49fee00a2
commit
547661d0e8
|
@ -15,14 +15,17 @@ public class MchRevenueVO {
|
|||
@ApiModelProperty("今日收入")
|
||||
private BigDecimal todayIncome;
|
||||
|
||||
@ApiModelProperty("昨日收入")
|
||||
private BigDecimal yesterdayIncome;
|
||||
@ApiModelProperty("总收入")
|
||||
private BigDecimal totalIncome;
|
||||
|
||||
@ApiModelProperty("今日订单")
|
||||
private Integer todayOrder;
|
||||
|
||||
@ApiModelProperty("昨日订单")
|
||||
private Integer yesterdayOrder;
|
||||
@ApiModelProperty("总订单")
|
||||
private Integer totalOrder;
|
||||
|
||||
@ApiModelProperty("余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty("设备总数")
|
||||
private Integer deviceCount;
|
||||
|
|
|
@ -40,6 +40,8 @@ import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
|
|||
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
|
||||
import com.ruoyi.ss.transactionBill.domain.vo.TransactionAmountVO;
|
||||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||
import com.ruoyi.ss.user.domain.SmUserVO;
|
||||
import com.ruoyi.ss.user.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -85,6 +87,9 @@ public class DashboardService {
|
|||
@Autowired
|
||||
private BonusService bonusService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private RiskInfoService riskInfoService;
|
||||
|
||||
|
@ -255,13 +260,22 @@ public class DashboardService {
|
|||
public MchRevenueVO mchRevenue(Long mchId) {
|
||||
MchRevenueVO vo = new MchRevenueVO();
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate yesterday = today.plusDays(-1);
|
||||
|
||||
// 余额
|
||||
SmUserVO mch = userService.selectSmUserByUserId(mchId);
|
||||
vo.setBalance(mch.getBalance());
|
||||
|
||||
// 营业额统计
|
||||
BonusQuery bonusQuery = new BonusQuery();
|
||||
bonusQuery.setArrivalId(mchId);
|
||||
bonusQuery.setArrivalTypes(BonusArrivalType.userList());
|
||||
bonusQuery.setStatus(BonusStatus.DIVIDEND.getStatus());
|
||||
// 总营业额
|
||||
BigDecimal totalIncome = bonusService.selectSumOfPayedAmount(bonusQuery);
|
||||
if (totalIncome == null) {
|
||||
totalIncome = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setTotalIncome(totalIncome);
|
||||
// 今日营业额
|
||||
bonusQuery.setPayDate(today);
|
||||
BigDecimal todayIncome = bonusService.selectSumOfPayedAmount(bonusQuery);
|
||||
|
@ -269,29 +283,19 @@ public class DashboardService {
|
|||
todayIncome = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setTodayIncome(todayIncome);
|
||||
// 昨日营业额
|
||||
bonusQuery.setPayDate(yesterday);
|
||||
BigDecimal yesterdayIncome = bonusService.selectSumOfPayedAmount(bonusQuery);
|
||||
if (yesterdayIncome == null) {
|
||||
yesterdayIncome = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setYesterdayIncome(yesterdayIncome);
|
||||
|
||||
|
||||
// 订单数统计
|
||||
TransactionBillQuery billQuery = new TransactionBillQuery();
|
||||
billQuery.setType(TransactionBillType.RECHARGE.getType());
|
||||
billQuery.setStatusList(TransactionBillStatus.payedOrder());
|
||||
billQuery.setMchId(mchId);
|
||||
// 总订单数
|
||||
int totalOrder = transactionBillService.selectSimpleCount(billQuery);
|
||||
vo.setTotalOrder(totalOrder);
|
||||
// 今日订单数
|
||||
billQuery.setCreateDate(today);
|
||||
int todayOrder = transactionBillService.selectSimpleCount(billQuery);
|
||||
vo.setTodayOrder(todayOrder);
|
||||
// 昨日订单数
|
||||
billQuery.setCreateDate(yesterday);
|
||||
int yesterdayOrder = transactionBillService.selectSimpleCount(billQuery);
|
||||
vo.setYesterdayOrder(yesterdayOrder);
|
||||
|
||||
|
||||
// 设备统计
|
||||
DeviceQuery deviceQuery = new DeviceQuery();
|
||||
|
|
Loading…
Reference in New Issue
Block a user