KKSU
2024-09-10 f52cfc92db48d9a215d7f728ce4000de1cdd6ae2
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
package cc.mrbird.febs.mall.quartz;
 
import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.mall.chain.ChainEnum;
import cc.mrbird.febs.mall.chain.ChainService;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.entity.MallMember;
import cc.mrbird.febs.mall.entity.MallMoneyFlow;
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.mapper.MallMemberMapper;
import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper;
import cc.mrbird.febs.mall.service.IAgentService;
import cc.mrbird.febs.mall.service.IApiMallMemberService;
import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
import cc.mrbird.febs.mall.service.IMemberProfitService;
import cc.mrbird.febs.mall.service.impl.CommonService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
 
/**
 * @author wzy
 * @date 2021-09-28
 **/
@Slf4j
@Component
public class ProfitJob {
 
    @Autowired
    private IMemberProfitService memberProfitService;
    @Autowired
    private IAgentService agentService;
    @Autowired
    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
    @Autowired
    private CommonService commonService;
 
    /**
     * 代理分红
     */
//    @Scheduled(cron = "0 30 0 * * ?")
//    public void profitJob() {
//        memberProfitService.agentProfit(null);
//    }
 
//    @Scheduled(cron = "0 30 1 * * ?")
//    public void storeAndDirectorJob() {
//        memberProfitService.storeAndDirectorProfit(null);
//    }
 
//    /**
//     * 线下服务中心补贴
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void thankfulJob() {
//        memberProfitService.thankfulProfit(null);
//    }
 
//    /**
//     * 代理商补贴 TODO 需要去掉注释
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void agentPerkJob() {
//        memberProfitService.agentPerkJob(null);
//    }
//
//    /**
//     * 线下服务中心补贴
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void offLinePerkJob() {
//        memberProfitService.offLinePerkJob(null);
//    }
//
//    /**
//     * 平级奖励补贴
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void teamEqualsPerkJob() {
//        memberProfitService.teamEqualsPerkJob(null);
//    }
//
//    /**
//     * 补贴消息--重试
//     *  一个小时运行一次
//     */
//    @Scheduled(cron = "0 0/5 * * * ?")
//    public void mqPerkRetryJob() {
//        memberProfitService.mqPerkRetryJob();
//    }
//    /**
//     * 联创、合伙人的每日绿色凭证释放
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void scoreRecordReleaseJob() {
//        memberProfitService.scoreRecordReleaseJob();
//    }
//
//    /**
//     * 业绩产生凭证
//     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void achieveReleaseJob() {
//        memberProfitService.achieveReleaseJob();
//    }
//
//    /**
//     * 代理星级补贴
//     */
//    @Scheduled(cron = "0 0 0 * * ?")
//    public void perkAgentAchieveJob() {
//        agentService.perkAgent();
//    }
 
    /**
     * 更新代币价格
     */
//    @Scheduled(cron = "0 0/1 * * * ? ")
//    public void gfaPrice() {
//        /**
//         * 定时器循环计算每个时间跨度内增加的滑点数量
//         */
//        log.info("更新代币价格");
//        //获取滑点钱包的余额
//        BigDecimal coinPrice = ChainService.getInstance(ChainEnum.BSC_GFA.name()).getPrice("0x1Ea392645f816BF15f1Fc87728eA010585bAAE7D").setScale(8,BigDecimal.ROUND_DOWN);
//        //获取上一时刻的数据
//        //更新价格
//        commonService.updateDataDic(
//                DataDictionaryEnum.FCM_PRICE.getType(),
//                DataDictionaryEnum.FCM_PRICE.getCode(),
//                coinPrice.toString());
//    }
 
    /**
     * 用户预约完成之后,根据产品周期,将用户买单变成买单 todo 0411 停止
     */
    @Scheduled(cron = "0 0 2 * * ?")
    public void BuyToSell() {
//        agentService.BuyToSell();
        agentService.BuyToSellV2();
    }
 
    /**
     * 用户预约完成之后,根据产品周期,将用户买单变成买单
     */
    @Scheduled(cron = "0 0 3 * * ?")
    public void memberLevelDown() {
        agentService.memberLevelDown();
    }
 
 
    /**
     * 用户等级升级
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void memberLevelUp() {
        agentService.memberLevelUp();
    }
 
    /**
     * 买单
     * 看是否是开始显示订单的时间段,超出结束时间的买单,全部超时失败
     */
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void timeGetOrderBuy() {
        agentService.timeGetOrderBuy();
    }
 
    /**
     * 买单
     * 看是否是开始显示订单的时间段,超出结束时间的买单,全部超时返还令牌
     */
//    @Scheduled(cron = "0 0/2 * * * ? ")
//    public void timeGetOrderBuyCancel() {
//        agentService.timeGetOrderBuyCancel();
//    }
 
 
    /**
     * 直推奖励
     * 从冻结到可用 todo 0411 停止
     */
    @Scheduled(cron = "0 0 0/3 * * ? ")
    public void basicMemberPerk() {
        agentService.basicMemberPerk();
    }
 
    /**
     * 团队奖励 todo 0411 停止
     */
    @Scheduled(cron = "0 0 0/3 * * ? ")
    public void teamMemberPerk() {
        agentService.teamMemberPerk();
    }
 
    /**
     * 平级奖励 todo 0411 停止
     */
    @Scheduled(cron = "0 0 0/3 * * ? ")
    public void equalsMemberPerk() {
        agentService.equalsMemberPerk();
    }
 
//    /**
//     * 卖单
//     * 看是否是开始显示订单的时间段,超出结束时间的卖单,全部超时失败
//     */
//    @Scheduled(cron = "0 0/30 * * * ? ")
//    public void timeGetOrderSell() {
//        agentService.timeGetOrderSell();
//    }
 
 
 
 
    /**
     * 静态分红
     */
//    @Scheduled(cron = "0 0 0 * * ?")
//    public void staticProfitJob() {
//        memberProfitService.staticProfit(null);
//    }
 
    /**
     * 排名奖 每月1号
     */
//    @Scheduled(cron = "0 30 0 1 * ?")
//    public void rankJob() {
//        memberProfitService.rankProfit();
//    }
 
    /**
     * 积分池,所有消费拿出10%放到积分池,然后按1%每天释放加权平分
     */
//    @Scheduled(cron = "0 0 2 * * ?")
//    @Scheduled(cron = "0 0/5 * * * ? ")
//    public void scorePool() {
//        memberProfitService.scorePool();
//    }
}