| | |
| | | private final StudyRecordMapper studyRecordMapper; |
| | | private final StudyRecordService studyRecordService; |
| | | |
| | | @Scheduled(fixedRate = 1200000) // 20分钟执行一次 |
| | | @Scheduled(fixedRate = 120000) // 2分钟执行一次 |
| | | private void updateStudyRecord() { |
| | | log.info("开始存学习时长"); |
| | | List<StudyRecord> cacheList = new ArrayList<>(); |
| | |
| | | private ConnectionFactory connectionFactory; |
| | | |
| | | @Bean |
| | | public DirectExchange examExchange() { |
| | | return new DirectExchange("examExchange"); |
| | | public DirectExchange jxkgExchange() { |
| | | return new DirectExchange("jxkgExchange"); |
| | | } |
| | | |
| | | // 创建普通队列 |
| | | // 创建考试普通队列 |
| | | @Bean |
| | | public Queue examQueue() { |
| | | Map<String, Object> args = new HashMap<>(); |
| | |
| | | return new Queue("jxkg", true, false, false, args); |
| | | } |
| | | |
| | | // 普通信队列到交换机 |
| | | // 创建会议普通队列 |
| | | @Bean |
| | | public Binding binding(Queue examQueue, DirectExchange examExchange) { |
| | | return BindingBuilder.bind(examQueue).to(examExchange).with("exam"); |
| | | public Queue meetQueue() { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | // 设置死信交换机 |
| | | args.put("x-dead-letter-exchange", "dlxExchange"); |
| | | return new Queue("meet", true, false, false, args); |
| | | } |
| | | |
| | | // 考试普通信队列到交换机 |
| | | @Bean |
| | | public Binding binding(Queue examQueue, DirectExchange jxkgExchange) { |
| | | return BindingBuilder.bind(examQueue).to(jxkgExchange).with("exam"); |
| | | } |
| | | |
| | | // 会议普通信队列到交换机 |
| | | @Bean |
| | | public Binding binding2(Queue meetQueue, DirectExchange jxkgExchange) { |
| | | return BindingBuilder.bind(meetQueue).to(jxkgExchange).with("meet"); |
| | | } |
| | | // 创建死信交换机 |
| | | @Bean |
| | | public DirectExchange dlxExchange() { |
| | |
| | | Message message = MessageBuilder.withBody(jsonMsg.getBytes()).andProperties(messageProperties).build(); |
| | | // 设置消息的关联数据,以便发送确认回调、未路由成功消息的处理 |
| | | MyCorrelationData msgCorrelationData = new MyCorrelationData(examId + "", RabbitMqMsgTypeEnum.EXAM); |
| | | rabbitTemplate.convertAndSend("examExchange", "exam", message, msgCorrelationData); |
| | | rabbitTemplate.convertAndSend("jxkgExchange", "exam", message, msgCorrelationData); |
| | | } |
| | | |
| | | public void meetMsg(Integer meetId, String jsonMsg, Long delayTime) { |
| | |
| | | Message message = MessageBuilder.withBody(jsonMsg.getBytes()).andProperties(messageProperties).build(); |
| | | // 设置消息的关联数据,以便发送确认回调、未路由成功消息的处理 |
| | | MyCorrelationData msgCorrelationData = new MyCorrelationData(meetId + "", RabbitMqMsgTypeEnum.MEET); |
| | | rabbitTemplate.convertAndSend("meetExchange", "meet", message, msgCorrelationData); |
| | | rabbitTemplate.convertAndSend("jxkgExchange", "meet", message, msgCorrelationData); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ycl.jxkg.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.entity.Meet; |
| | | import com.ycl.jxkg.domain.form.MeetForm; |
| | | import com.ycl.jxkg.domain.query.MeetQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 首页 服务类 |