fix
Helius
2022-03-09 b77274cb4cf252a29d4eb3c1dd3bda02c7fbe6f6
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
package com.xcong.excoin.utils;
 
import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
import com.xcong.excoin.utils.dingtalk.DingTalkUtils;
 
import java.math.BigDecimal;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
/**
 * @author wzy
 * @date 2020-06-01
 **/
public class ThreadPoolUtils {
 
    public static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(20);
 
    /**
     * 计算佣金
     *
     * @param id     用户ID
     * @param price  手续费
     * @param entity 订单实体
     * @param type   订单类型
     */
    public static void calReturnMoney(Long id, BigDecimal price, ContractOrderEntity entity, int type) {
        OrderWebsocketServiceImpl orderWebsocketService = SpringContextHolder.getBean(OrderWebsocketServiceImpl.class);
        EXECUTOR.execute(new Runnable() {
            @Override
            public void run() {
                orderWebsocketService.calYj(id, price, entity, type);
            }
        });
    }
 
    /**
     * 发送钉钉消息
     *
     * @param type 类型
     */
    public static void sendDingTalk(int type) {
        EXECUTOR.execute(new Runnable() {
            @Override
            public void run() {
//                DingTalkUtils.sendActionCard(type);
            }
        });
    }
 
    public static void sendOrderMsg() {
        EXECUTOR.execute(new Runnable() {
            @Override
            public void run() {
                DingTalkUtils.sendOrderMsg();
            }
        });
    }
}