master
commit
dd87fe12b8
|
@ -28,6 +28,7 @@ public class ManyJob {
|
|||
@Autowired
|
||||
private EntinfoServiceImpl entinfoService;
|
||||
|
||||
|
||||
// @Scheduled(cron = "*/10 * * * * *") // 每10分钟执行一次
|
||||
public void manyJob(){
|
||||
redisService.deleteObject("entinfo");
|
||||
|
|
|
@ -160,6 +160,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
|||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* http URL 链接
|
||||
* @param business
|
||||
|
@ -196,12 +197,12 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
|||
new InputStreamReader(httpConn.getInputStream()));
|
||||
String resultData = br.readLine();
|
||||
System.out.println("从服务端返回结果: " + resultData);
|
||||
|
||||
// 7.关闭HttpURLConnection连接
|
||||
httpConn.disconnect();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Entinfo build = Entinfo.builder()
|
||||
.entCode("test_" + business.getId())
|
||||
.ip("192.168.120.128")
|
||||
|
|
|
@ -73,7 +73,6 @@ public class GenController extends BaseController {
|
|||
List<GenTable> list = genTableService.selectDbTableList(genTable);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据表字段列表
|
||||
*/
|
||||
|
|
|
@ -67,13 +67,6 @@ public class ManyDataSource {
|
|||
@RabbitListener(queuesToDeclare = {@Queue(name = "zhiLian-vehicle-exchange")})
|
||||
public void smsConfig(String msg, Message message, Channel channel){
|
||||
//获取消息的ID
|
||||
// new Thread(() -> {
|
||||
// try {
|
||||
// Thread.sleep(10000);
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }).start();
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
try {
|
||||
//添加消息id到redis set集合中 添加成功返回1 表示未消费 添加失败返回0 表示已消费
|
||||
|
@ -103,7 +96,6 @@ public class ManyDataSource {
|
|||
private void druidData(String msg) {
|
||||
Entinfo entinfo1 = JSON.parseObject(msg, Entinfo.class);
|
||||
log.info("消息为:{}",entinfo1);
|
||||
|
||||
DruidDataSourceFactory druidDataSourceFactory = SpringUtils.getBean(DruidDataSourceFactory.class);
|
||||
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
|
||||
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(entinfo1.getEntCode(), entinfo1.getIp(), entinfo1.getPort());
|
||||
|
@ -123,7 +115,6 @@ public class ManyDataSource {
|
|||
// List<com.zhiLian.common.core.domain.Entinfo> entinfos = remoteFileService.listAll();
|
||||
// databaseNameList.a(entinfos)
|
||||
List<String> entinfo = redisTemplate.opsForList().range("entinfo", 0, -1);
|
||||
|
||||
entinfo.forEach(string -> {
|
||||
Entinfo entInfo = JSON.parseObject(string, Entinfo.class);
|
||||
databaseNameList.add(entInfo);
|
||||
|
|
|
@ -27,6 +27,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource {
|
|||
*/
|
||||
private Map<Object, Object> defineTargetDataSources;
|
||||
|
||||
|
||||
/**
|
||||
* 决定当前线程使用哪个数据源
|
||||
*/
|
||||
|
@ -35,6 +36,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource {
|
|||
return DynamicDataSourceHolder.getDynamicDataSourceKey();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加数据库
|
||||
* @param key 键
|
||||
|
|
Loading…
Reference in New Issue