From 6159dc58f50d3e4680779b7989bbd4d49a76bad5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 09 五月 2025 19:13:35 +0800 Subject: [PATCH] 添加日志 --- src/test/java/com/taoke/autopay/ClientTest.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/taoke/autopay/ClientTest.java b/src/test/java/com/taoke/autopay/ClientTest.java index 5aa4a84..f54a922 100644 --- a/src/test/java/com/taoke/autopay/ClientTest.java +++ b/src/test/java/com/taoke/autopay/ClientTest.java @@ -1,14 +1,17 @@ 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.Arrays; -import java.util.List; +import java.util.*; /** * @author hxh @@ -22,6 +25,9 @@ @Resource private ClientInfoService clientInfoService; + @Resource + private KeyOrderService keyOrderService; + @Test public void add(){ ClientInfoMapper.DaoQuery query = new ClientInfoMapper.DaoQuery(); @@ -30,4 +36,48 @@ 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("鍥涘窛/骞垮厓", "鍥涘窛/骞垮厓")); + } } -- Gitblit v1.8.0