zj
2025-01-06 0e7b38c2b3af72ea2a7f8a2fcbaad4d78e2c1977
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package com.gear.admin.Biz.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gear.admin.Biz.SwxStatisticsBiz;
import com.gear.common.constant.SwxConstons;
import com.gear.swx.domain.*;
import com.gear.swx.service.*;
import com.gear.swx.service.impl.SwxUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
 
@Component
public class SwxStatisticsBizImpl implements SwxStatisticsBiz {
 
    @Autowired
    private ISwxRechargeRecordService swxRechargeRecordService;
 
    @Autowired
    private ISwxWithdrawalRecordService swxWithdrawalRecordService;
 
    @Autowired
    private ISwxLoanRecordService swxLoanRecordService;
 
    @Autowired
    private ISwxOptionsOrderService swxOptionsOrderService;
 
    @Autowired
    private ISwxSmartOrderService swxSmartOrderService;
 
    @Autowired
    private ISwxNftService swxNftService;
 
    @Autowired
    private ISwxIdentificationService swxIdentificationService;
 
    @Autowired
    private ISwxUserService swxUserService;
    @Override
    public Map<String, Object> getTop() {
 
        Map<String,Object> result = new HashMap<>();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String dateNow = simpleDateFormat.format(new Date());
 
        //获取今天开始时间
        String startTime = dateNow + " 00:00:00";
        //获取今天结束时间
        String endTime = dateNow + " 23:59:59";
 
        //今日充值
        QueryWrapper<SwxRechargeRecord> swxRechargeRecordQueryWrapper = new QueryWrapper<>();
        swxRechargeRecordQueryWrapper.lambda().ge(SwxRechargeRecord::getCreateTime,startTime);
        swxRechargeRecordQueryWrapper.lambda().le(SwxRechargeRecord::getCreateTime,endTime);
        swxRechargeRecordQueryWrapper.lambda().eq(SwxRechargeRecord::getStatus, SwxConstons.SWX_EXAMINE_STATUS_REVIEW);
        Long rechargeCount = swxRechargeRecordService.count(swxRechargeRecordQueryWrapper);
        result.put("rechargeCount",rechargeCount);
 
        //今日提现
        QueryWrapper<SwxWithdrawalRecord> swxWithdrawalRecordQueryWrapper = new QueryWrapper<>();
        swxWithdrawalRecordQueryWrapper.lambda().ge(SwxWithdrawalRecord::getCreateTime,startTime);
        swxWithdrawalRecordQueryWrapper.lambda().le(SwxWithdrawalRecord::getCreateTime,endTime);
        swxWithdrawalRecordQueryWrapper.lambda().eq(SwxWithdrawalRecord::getStatus, SwxConstons.SWX_EXAMINE_STATUS_REVIEW);
        Long withdrawalCount = swxWithdrawalRecordService.count(swxWithdrawalRecordQueryWrapper);
        result.put("withdrawalCount",withdrawalCount);
 
        //今日贷款
        QueryWrapper<SwxLoanRecord> swxLoanRecordQueryWrapper = new QueryWrapper<>();
        swxLoanRecordQueryWrapper.lambda().ge(SwxLoanRecord::getCreateTime,startTime);
        swxLoanRecordQueryWrapper.lambda().le(SwxLoanRecord::getCreateTime,endTime);
        swxLoanRecordQueryWrapper.lambda().eq(SwxLoanRecord::getStatus, SwxConstons.SWX_EXAMINE_STATUS_REVIEW);
        Long loanCount = swxLoanRecordService.count(swxLoanRecordQueryWrapper);
        result.put("loanCount",loanCount);
 
 
        //今日期权
        QueryWrapper<SwxOptionsOrder> swxOptionsOrderQueryWrapper = new QueryWrapper<>();
        swxOptionsOrderQueryWrapper.lambda().ge(SwxOptionsOrder::getCreateTime,startTime);
        swxOptionsOrderQueryWrapper.lambda().le(SwxOptionsOrder::getCreateTime,endTime);
        Long optionsCount = swxOptionsOrderService.count(swxOptionsOrderQueryWrapper);
        result.put("optionsCount",optionsCount);
 
        //今日实名
        QueryWrapper<SwxIdentification> swxIdentificationQueryWrapper = new QueryWrapper<>();
        swxIdentificationQueryWrapper.lambda().ge(SwxIdentification::getCreateTime,startTime);
        swxIdentificationQueryWrapper.lambda().le(SwxIdentification::getCreateTime,endTime);
        Long identification = swxIdentificationService.count(swxIdentificationQueryWrapper);
        result.put("identificationCount",identification);
 
        return result;
    }
 
    @Override
    public Map<String, Object> getIndexTop() {
        Map<String,Object> result = new HashMap<>();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String dateNow = simpleDateFormat.format(new Date());
 
        //获取今天开始时间
        String startTime = dateNow + " 00:00:00";
        //获取今天结束时间
        String endTime = dateNow + " 23:59:59";
        //查询累计充值
        QueryWrapper<SwxRechargeRecord> swxRechargeRecordQueryWrapper = Wrappers.query();
        swxRechargeRecordQueryWrapper.select("SUM(amount) AS total");
        swxRechargeRecordQueryWrapper.lambda().eq(SwxRechargeRecord::getStatus,1);
        Map<String,Object> allRechargeMap = swxRechargeRecordService.getMap(swxRechargeRecordQueryWrapper);
        result.put("allRecharge",allRechargeMap == null ? 0:allRechargeMap.get("total"));
 
        //查询累计提现
        QueryWrapper<SwxWithdrawalRecord> swxWithdrawalRecordQueryWrapper = new QueryWrapper<>();
        swxWithdrawalRecordQueryWrapper.select("SUM(amount) AS total");
        swxWithdrawalRecordQueryWrapper.lambda().eq(SwxWithdrawalRecord::getStatus,1);
        Map<String,Object> allWithdrawalMap = swxWithdrawalRecordService.getMap(swxWithdrawalRecordQueryWrapper);
        result.put("allWithdrawal",allWithdrawalMap == null ? 0:allWithdrawalMap.get("total"));
 
        //查询今日充值
        swxRechargeRecordQueryWrapper.lambda().ge(SwxRechargeRecord::getCreateTime,startTime);
        swxRechargeRecordQueryWrapper.lambda().le(SwxRechargeRecord::getCreateTime,endTime);
        Map<String,Object> todayRechargeMap = swxRechargeRecordService.getMap(swxRechargeRecordQueryWrapper);
        result.put("todayRecharge",todayRechargeMap == null ? 0:todayRechargeMap.get("total"));
 
        //查询今日提现
        swxWithdrawalRecordQueryWrapper.lambda().ge(SwxWithdrawalRecord::getCreateTime,startTime);
        swxWithdrawalRecordQueryWrapper.lambda().le(SwxWithdrawalRecord::getCreateTime,endTime);
        Map<String,Object> todayWithdarwalMap = swxWithdrawalRecordService.getMap(swxWithdrawalRecordQueryWrapper);
        result.put("todayWithdarwal",todayWithdarwalMap == null ? 0:todayWithdarwalMap.get("total"));
 
        //查询贷款总额
        QueryWrapper<SwxLoanRecord> swxLoanRecordQueryWrapper = new QueryWrapper<>();
        swxLoanRecordQueryWrapper.select("SUM(amount) AS total");
        swxLoanRecordQueryWrapper.lambda().ge(SwxLoanRecord::getStatus,1);
        Map<String,Object> allLoanMap = swxLoanRecordService.getMap(swxLoanRecordQueryWrapper);
        result.put("allLoan",allLoanMap == null ? 0 : allLoanMap.get("total"));
 
 
        //获取总期权交易
        QueryWrapper<SwxOptionsOrder> swxOptionsOrderQueryWrapper = new QueryWrapper<>();
        swxOptionsOrderQueryWrapper.select("SUM(amount) as total");
        swxOptionsOrderQueryWrapper.lambda().eq(SwxOptionsOrder::getStatus,1);
        Map<String,Object> allOptions = swxOptionsOrderService.getMap(swxOptionsOrderQueryWrapper);
        result.put("allOptions",allOptions == null ? 0 : allOptions.get("total"));
 
 
        //获取总用户数
        result.put("allUser",swxUserService.count());
 
        //获取总合约数
        result.put("allContracts",0);
        return result;
    }
 
 
}