2021与蓝度共同重构项目,服务端
liuhaonan
2022-03-22 55f49e493396d14689103f1912cb77fd653461cc
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
package com.sandu.ximon.admin.security.order;
 
import com.sandu.ximon.admin.utils.SpringContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
 
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
@Component("OrderQueryListener")
public class OrderQueryListener {
 
    @Autowired
    public ApplicationEventPublisher publisher;
 
    private static final ExecutorService orderEventPool = Executors.newFixedThreadPool(5);
 
    public static OrderQueryListener getBean(){
        return (OrderQueryListener) SpringContextUtil.getBean("OrderQueryListener");
    }
 
    /**
     * 启动订单扫描
     * @param type  0:C3充电桩扫描启动
     */
    public void startScan (Integer type) {
        //  载入订单扫描
        orderEventPool.submit(new OrderQueryTask(type));
    }
 
 
//    @Scheduled(cron = "0/10 * *  * * ? ")
//    public void orderScan () {
//        if(isQuery) {
//            /**
//             * 获取所有订单,根据订单类型不同进行不同的Query
//             */
//            //  C3充电桩部分
//            Set<String> keys = redisUtils.keys(C3mRedisConstant.C3_NO_PAY_ORDER.getCode() + "*");
//            for (String key : keys) {
//                C3mOrderEntity c3mOrderEntity = JSON.parseObject(redisUtils.get(key), C3mOrderEntity.class);
//                LogUtils.error("查询订单:" + JSON.toJSONString(c3mOrderEntity));
//                publisher.publishEvent(new C3mOrderQueryEvent(this, c3mOrderEntity));
//            }
//        }
//    }
 
}