新版仿ok交易所-后端
1
zj
2025-09-20 632e1b1eb8b1e088163edd765420934ed2940fde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.yami.trading.admin.controller;
 
import com.yami.trading.admin.dto.HomeViewDto;
import com.yami.trading.admin.dto.WaitCountDto;
import com.yami.trading.bean.user.dto.UserBenefitsDto;
import com.yami.trading.common.domain.Result;
import com.yami.trading.common.util.DateUtil;
import com.yami.trading.service.*;
import com.yami.trading.service.user.UserDataService;
import com.yami.trading.service.user.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Date;
 
@RestController
@RequestMapping("home")
@Api(tags = "首页")
@Slf4j
public class HomeController {
 
    @Autowired
    UserService userService;
 
    @Autowired
    UserDataService userDataService;
 
    @Autowired
    WalletService walletService;
 
 
    @Autowired
    RealNameAuthRecordService realNameAuthRecordService;
 
    @Autowired
    HighLevelAuthRecordService highLevelAuthRecordService;
 
    @Autowired
    RechargeBlockchainOrderService rechargeBlockchainOrderService;
 
 
 
    @Autowired
    WithdrawService withdrawService;
 
 
    @ApiOperation(value = "今日数据统计")
    @PostMapping("view")
    public Result<HomeViewDto> view(){
        HomeViewDto homeViewDto=new HomeViewDto();
        homeViewDto.setAllUserCount(userService.count());
        homeViewDto.setTodayUserCount(userService.countToDay());
        Date date=new Date();
        log.info(DateUtil.formatDate(date,"yyyy-MM-dd HH:mm:ss"));
 
        log.info(DateUtil.formatDate(DateUtil.minDate(date),"yyyy-MM-dd HH:mm:ss"));
        log.info(DateUtil.formatDate(DateUtil.maxDate(date),"yyyy-MM-dd HH:mm:ss"));
 
        UserBenefitsDto userBenefitsDto= userDataService.daySumData(DateUtil.minDate(date),DateUtil.maxDate(date),null);
        homeViewDto.setSumUsdtAmount(walletService.sumMoney());
        homeViewDto.setTodayRechargeUserCount(userDataService.countTodayRechargeUser());
        if (userBenefitsDto!=null){
            homeViewDto.setRecharge(userBenefitsDto.getRechargeUsdt());
            homeViewDto.setWithdraw(userBenefitsDto.getWithdraw());
            homeViewDto.setBalanceAmount(userBenefitsDto.getWithdraw().subtract(userBenefitsDto.getRechargeUsdt()));
            homeViewDto.setTotleIncome(userBenefitsDto.getTotleIncome());
        }
        return  Result.ok(homeViewDto);
    }
 
 
    @ApiOperation(value = "待处理统计数据")
    @PostMapping("waitCount")
    public Result<WaitCountDto> waitCount(){
        WaitCountDto waitCountDto=new WaitCountDto();
        waitCountDto.setHighLevelAuthCount(highLevelAuthRecordService.waitCount());
        waitCountDto.setRealNameAuthCount(realNameAuthRecordService.waitCount());
        waitCountDto.setWithdrawCount(withdrawService.waitCount());
        waitCountDto.setRechargeCount(rechargeBlockchainOrderService.waitCount());
        return  Result.ok(waitCountDto);
    }
 
 
 
}