Administrator
2025-04-20 c95812b953a54e60c916c8ca375101376f58de57
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
package com.taoke.autopay;
 
import com.taoke.autopay.dao.ClientInfoMapper;
import com.taoke.autopay.dao.KeyOrderMapper;
import com.taoke.autopay.entity.ClientInfo;
import com.taoke.autopay.entity.KeyOrder;
import com.taoke.autopay.service.ClientInfoService;
import com.taoke.autopay.service.KeyOrderService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.AntPathMatcher;
 
import javax.annotation.Resource;
import java.util.*;
 
/**
 * @author hxh
 * @title: ClientTest
 * @description: TODO
 * @date 2024/7/26 16:11
 */
@SpringBootTest
public class ClientTest {
 
    @Resource
    private ClientInfoService clientInfoService;
 
    @Resource
    private KeyOrderService keyOrderService;
 
    @Test
    public void add(){
        ClientInfoMapper.DaoQuery query = new ClientInfoMapper.DaoQuery();
        query.sortList = Arrays.asList(new String[]{"id desc"});
        query.count = 1;
        List<ClientInfo> list = clientInfoService.list(query);
 
    }
 
    private Long getTargetClientId() {
        List<Long> clientIds = clientInfoService.getRePayClientIds();
        if (clientIds != null && clientIds.size() > 0) {
            // 查询设备未执行的数量
            List<List<Long>> clist=new ArrayList<>();
            for (Long cuid : clientIds) {
                KeyOrderMapper.DaoQuery daoQuery = new KeyOrderMapper.DaoQuery();
                daoQuery.distributeClientUid =cuid;
                daoQuery.state =  KeyOrder.STATE_NOT_PAY;
                daoQuery.minCreateTime=new Date(System.currentTimeMillis() - 1000*60*30L);
                long count =  keyOrderService.count(daoQuery);
                clist.add(Arrays.asList(new Long[]{cuid,count}));
            }
            clist.sort(new Comparator<List<Long>>() {
                @Override
                public int compare(List<Long> o1, List<Long> o2) {
                    return (int)(o1.get(1)-o2.get(1));
                }
            });
            if(clist.size()>1) {
                for (int i = 1; i < clist.size(); i++) {
                    if (clist.get(i).get(1).longValue() != clist.get(i - 1).get(1)) {
                        clist = clist.subList(0, i);
                        break;
                    }
                }
            }
            Collections.shuffle(clist);
            return clist.get(0).get(0);
        }
        return null;
    }
 
    @Test
    public void testTargetUid(){
        getTargetClientId();
 
    }
 
    public static void main(String[] args){
        AntPathMatcher pathMatcher = new AntPathMatcher();
      System.out.println(  pathMatcher.match("四川/广元", "四川/广元"));
    }
}