版本迭代

This commit is contained in:
fengchunyu 2024-11-18 15:13:03 +08:00
parent 900343db26
commit e3d52ffd3c
2 changed files with 12 additions and 7 deletions

View File

@ -10,6 +10,8 @@ import com.bootdo.datasend.dianxin.service.BaseHighThrowRecordService;
import com.bootdo.util.Base64Util;
import com.bootdo.util.StringKit;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -20,6 +22,7 @@ import java.util.List;
@Component
@RequiredArgsConstructor
public class StandardTask {
private static final Logger logger = LoggerFactory.getLogger(StandardTask.class);
private final RabbitTemplate rabbitTemplate;
private final BaseHighThrowRecordService highThrowRecordService;
@ -32,10 +35,10 @@ public class StandardTask {
//获取高抛记录
List<BaseHighThrowRecord> highThrowRecords = highThrowRecordService.list(new QueryWrapper<BaseHighThrowRecord>()
.eq("is_send","0")
.eq("is_send", "0")
);
for (BaseHighThrowRecord h:highThrowRecords){
for (BaseHighThrowRecord h : highThrowRecords) {
HighThrowDto dto = new HighThrowDto();
@ -56,18 +59,19 @@ public class StandardTask {
dto.setRequestData(dataDTO);
//循环发送mq
boolean b=sendHighThrowMq(dto);
if(b){
boolean b = sendHighThrowMq(dto);
if (b) {
h.setIsSend(1);
highThrowRecordService.saveOrUpdate(h);
logger.info("高抛记录发送成功:" + h.getId());
}
}
}
public boolean sendHighThrowMq(HighThrowDto bean) {
try {
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString( bean));
}catch (Exception e){
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
} catch (Exception e) {
return false;
}
return true;

View File

@ -3,7 +3,8 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: '1qaz!QAZ'
url: jdbc:mysql://221.229.107.118:30519/multidimensional_box?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT
# url: jdbc:mysql://221.229.107.118:30519/multidimensional_box?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT
url: jdbc:mysql://127.0.0.1:30519/multidimensional_box?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5 # 配置初始化大小、最小、最大
minIdle: 5