| | |
| | | @Resource |
| | | private AgentProducer agentProducer; |
| | | |
| | | public static void main(String[] args) { |
| | | for(int i = 0; i< 10 ;i++){ |
| | | int randomInt = RandomUtil.randomInt(1, 5); |
| | | System.out.println(randomInt); |
| | | try { |
| | | Thread.sleep(randomInt * 1000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.out.println(i); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自动发送红包定时器 |
| | | */ |
| | | @Scheduled(cron = "0 0/1 * * * ? ") |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | // @Scheduled(cron = "0 0/1 * * * ? ") |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | // @Scheduled(cron = "0/30 * * * * ? ") |
| | | public void profitJob() { |
| | | int randomInt = RandomUtil.randomInt(1, 10); |
| | | try { |
| | | Thread.sleep(randomInt * 1000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | QueryWrapper<ChatGroup> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("auto_send", 1); |
| | | List<ChatGroup> chatGroups = chatGroupMapper.selectList(objectQueryWrapper); |