注释rabbitmq listener注解,使用时开启

segment2.0
linrf 2 years ago
parent cff770689d
commit eaae10844c

@ -17,7 +17,7 @@ import java.util.List;
@Component("httpTBasicCollectorImpl")
public class HttpTBasicCollectorImpl implements IHttpCollector<TBasicDTO> {
@Override
public List<TBasicDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
TBasicDTO deptDTO = new TBasicDTO();
TBasicDTO deptDTO1 = new TBasicDTO();

@ -1,10 +1,6 @@
package com.docus.server.collect.basic.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -18,7 +14,7 @@ import javax.annotation.Resource;
* @RabbitListener(queues = "direct.queue")
* <p>
* <p>
* rabbitmq basic consumer
* rabbitmq basic consumer 使@RabbitListener
*
* @author linruifeng
* @see com.docus.server.collect.basic.mq.impl.BasicRabbitMqCollectServiceImpl#addTBasic(String)
@ -31,24 +27,24 @@ public class RabbitMqBasicConsumer {
private IBasicMqCollectService basicMqCollectService;
/**
* topic n:1 ()
* topic n:1
*/
@RabbitListener(
/*@RabbitListener(
bindings = {@QueueBinding(value = @Queue(value = "topic.queue.01"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.reg.msg"})})
key = {"*.reg.msg"})})*/
public void addTBasic(String message) {
log.info("rabbitmq message:{}", message);
basicMqCollectService.addTBasic(message);
}
/**
* topic n:1 ()
* topic n:1
*/
@RabbitListener(bindings = {
/* @RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = "topic.queue.02"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.*.reg.msg.#"})})
key = {"*.*.reg.msg.#"})})*/
public void updateTBasic(String message) {
log.info("rabbitmq message:{}", message);
basicMqCollectService.updateTBasic(message);

@ -14,7 +14,7 @@ import java.util.List;
@Component("wsBasicCollectorImpl")
public class WsBasicCollectorImpl implements IWsCollector<TBasicDTO> {
@Override
public List<TBasicDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
TBasicDTO deptDTO = new TBasicDTO();
deptDTO.setAdmissDate("1");
deptDTO.setAdmissDays("admin");

@ -12,7 +12,7 @@ import java.util.List;
public class HttpDeptCollectorImpl implements IHttpCollector<DeptDTO> {
@Override
public List<DeptDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<DeptDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
DeptDTO deptDTO = new DeptDTO();
deptDTO.setAuthorId("1");
deptDTO.setAuthorName("admin");

@ -1,10 +1,6 @@
package com.docus.server.collect.dept.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -32,10 +28,10 @@ public class RabbitMqDeptConsumer {
/**
* topic n:1 ()
*/
@RabbitListener(
/* @RabbitListener(
bindings = {@QueueBinding(value = @Queue(value = "topic.queue.01"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.reg.msg"})})
key = {"*.reg.msg"})})*/
public void addDept(String message) {
log.info("rabbitmq message:{}", message);
deptMqCollectService.addDept(message);
@ -44,10 +40,10 @@ public class RabbitMqDeptConsumer {
/**
* topic n:1 ()
*/
@RabbitListener(bindings = {
/*@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = "topic.queue.02"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.*.reg.msg.#"})})
key = {"*.*.reg.msg.#"})})*/
public void updateDept(String message) {
log.info("rabbitmq message:{}", message);
deptMqCollectService.updateDept(message);

@ -14,7 +14,7 @@ import java.util.List;
@Component("wsDeptCollectorImpl")
public class WsDeptCollectorImpl implements IWsCollector<DeptDTO> {
@Override
public List<DeptDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<DeptDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
DeptDTO deptDTO = new DeptDTO();
deptDTO.setAuthorId("1");
deptDTO.setAuthorName("admin");

@ -14,7 +14,7 @@ import java.util.List;
@Component("httpUserCollectorImpl")
public class HttpUserCollectorImpl implements IHttpCollector<UserDTO> {
@Override
public List<UserDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
UserDTO deptDTO = new UserDTO();
deptDTO.setAuthorId("1");
deptDTO.setAuthorName("admin");

@ -1,10 +1,6 @@
package com.docus.server.collect.user.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -32,10 +28,10 @@ public class RabbitMqUserConsumer {
/**
* topic n:1 ()
*/
@RabbitListener(
/*@RabbitListener(
bindings = {@QueueBinding(value = @Queue(value = "topic.queue.01"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.reg.msg"})})
key = {"*.reg.msg"})})*/
public void addUser(String message) {
log.info("rabbitmq message:{}", message);
userMqCollectService.addUser(message);
@ -44,10 +40,10 @@ public class RabbitMqUserConsumer {
/**
* topic n:1 ()
*/
@RabbitListener(bindings = {
/* @RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = "topic.queue.02"),
exchange = @Exchange(value = "topic.exchange", type = "topic"),
key = {"*.*.reg.msg.#"})})
key = {"*.*.reg.msg.#"})})*/
public void updateUser(String message) {
log.info("rabbitmq message:{}", message);
userMqCollectService.updateUser(message);

@ -1,16 +1,8 @@
package com.docus.server.collect.user.mq.test;
import com.docus.server.collect.web.domain.TaskConfig;
import com.docus.server.collect.web.service.impl.TaskConfigServiceImpl;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.inject.Inject;
import java.util.List;
/**
* @Description
* @Author jxb
@ -20,41 +12,41 @@ import java.util.List;
@RequestMapping("mqProducer")
public class RabbitMQProducer {
@Autowired
public RabbitTemplate rabbitTemplate;
@Inject
private TaskConfigServiceImpl userService;
/**
* @Description topic n:1 (3)
* @Author jxb
* @Date 2019-03-09 09:56:45
*/
@RequestMapping(value = "/topicMQ01", method = {RequestMethod.GET})
public List<TaskConfig> topicMQ01() {
List<TaskConfig> users = userService.list(null);
for (TaskConfig user : users) {
rabbitTemplate.convertAndSend("topic.exchange", "jd.reg.msg", user.getName());
}
return users;
}
@RequestMapping(value = "/topicMQ02", method = {RequestMethod.GET})
public List<TaskConfig> topicMQ02() {
List<TaskConfig> users = userService.list(null);
for (TaskConfig user : users) {
rabbitTemplate.convertAndSend("topic.exchange", "tm.reg.msg", user.getName());
}
return users;
}
@RequestMapping(value = "/topicMQ03", method = {RequestMethod.GET})
public List<TaskConfig> topicMQ03() {
List<TaskConfig> users = userService.list(null);
for (TaskConfig user : users) {
rabbitTemplate.convertAndSend("topic.exchange", "super.fzb.reg.msg", user.getName());
}
return users;
}
// @Autowired
// public RabbitTemplate rabbitTemplate;
// @Inject
// private TaskConfigServiceImpl userService;
//
// /**
// * @Description topic n:1 类型 交换器队列 生产(3个)
// * @Author jxb
// * @Date 2019-03-09 09:56:45
// */
// @RequestMapping(value = "/topicMQ01", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ01() {
// List<TaskConfig> users = userService.list(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "jd.reg.msg", user.getName());
// }
// return users;
// }
//
// @RequestMapping(value = "/topicMQ02", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ02() {
// List<TaskConfig> users = userService.list(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "tm.reg.msg", user.getName());
// }
// return users;
// }
//
// @RequestMapping(value = "/topicMQ03", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ03() {
// List<TaskConfig> users = userService.list(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "super.fzb.reg.msg", user.getName());
// }
// return users;
// }
}

@ -14,7 +14,7 @@ import java.util.List;
@Component("wsUserCollectorImpl")
public class WsUserCollectorImpl implements IWsCollector<UserDTO> {
@Override
public List<UserDTO> get(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> list(Date startDate, Date endDate, int pageNum, int pageSize) {
UserDTO deptDTO = new UserDTO();
deptDTO.setAuthorId("1");
deptDTO.setAuthorName("admin");

@ -12,14 +12,14 @@ spring:
datasource:
master:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_archivefile?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
username: docus
password: docus702
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
his:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: docus
password: docus702
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
# rabbitmq:
@ -27,9 +27,10 @@ spring:
# port: 5672
# username: guest
# password: guest
redis:
host: redis.docus.cn
# password: JSdocus@702
password: JSdocus@702
cloud:
nacos:
discovery:
@ -44,6 +45,9 @@ spring:
docus:
dbtype: mysql
user:
# 用户默认密码
defpwd: fd29cd53ec12616e5f36b77d4afffbff
mybatis-plus:
configuration:
@ -53,12 +57,10 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
update-strategy: ignored
field-strategy: NOT_EMPTY
db-type: MYSQL
mapper-locations: classpath*:/mapper/*Mapper.xml
type-enums-package: com.docus.server.collect.web.enums
xxl:
job:
accessToken:
@ -72,16 +74,21 @@ xxl:
logretentiondays: 30
logpath: D:/xxl-job/inspection
api:
soft-delete-column-name=state
soft-delete-column-value=1
logging:
level:
com:
baomidou:
mybatisplus: DEBUG
#
#ibm:
# mq:
# queueManager: MqManager01
# channel: chl_server01
# connName: 10.222.23.130(1414)
# ackUrl: 10.222.23.159:7800/ack
# domain: CDR
# key: cdr-0012-adef
# replica:
# queueManager: MqManager02
# channel: chl_server02
# connName: 10.222.23.131(1414)
#rocketmq:
# name-server: 127.0.01:9876
# producer:
# group: ta-cipher-encode
# group: ta-cipher-encode

@ -5,7 +5,7 @@ import java.util.List;
public interface ICollector<T> {
/**
*
*
*/
List<T> get(Date startDate, Date endDate, long pageNum, long pageSize);
List<T> list(Date startDate, Date endDate, int pageNum, int pageSize);
}

@ -48,8 +48,8 @@ public class TBasicHttpCollectJob extends AbstractCollectJob<TBasicDTO> {
@SuppressWarnings("unchecked")
@Override
public List<TBasicDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//需要根据不同医院去解析不同的内容。使用接口实现的方式。
return collector.get(startDate, endDate, pageNum, pageSize);
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -46,7 +46,7 @@ public class TBasicViewCollectJob extends AbstractCollectJob<TBasicDTO> {
@SuppressWarnings("unchecked")
@Override
public List<TBasicDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//每家医院按照固定的格式写sql不同医院需要替换不同的sql即可。
return hisService.getTBasicListView(startDate, endDate, pageNum, pageSize);
}

@ -46,8 +46,8 @@ public class TBasicWsCollectJob extends AbstractCollectJob<UserDTO> {
@SuppressWarnings("unchecked")
@Override
public List<UserDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//需要根据不同医院去解析不同的内容。使用接口实现的方式。
return collector.get(startDate, endDate, pageNum, pageSize);
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -47,7 +47,7 @@ public class DeptHttpCollectJob extends AbstractCollectJob<DeptDTO> {
@SuppressWarnings("unchecked")
@Override
public List<DeptDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
return collector.get(startDate, endDate, pageNum, pageSize);
public List<DeptDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -46,7 +46,7 @@ public class DeptViewCollectJob extends AbstractCollectJob<DeptDTO> {
@SuppressWarnings("unchecked")
@Override
public List<DeptDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<DeptDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//每家医院按照固定的格式写sql不同医院需要替换不同的sql即可。
return hisService.getDeptListView(startDate, endDate, pageNum, pageSize);
}

@ -46,8 +46,8 @@ public class DeptWsCollectJob extends AbstractCollectJob<UserDTO> {
@SuppressWarnings("unchecked")
@Override
public List<UserDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//需要根据不同医院去解析不同的内容。使用接口实现的方式。
return collector.get(startDate, endDate, pageNum, pageSize);
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -46,8 +46,8 @@ public class UserHttpCollectJob extends AbstractCollectJob<UserDTO> {
@SuppressWarnings("unchecked")
@Override
public List<UserDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//需要根据不同医院去解析不同的内容。使用接口实现的方式。
return collector.get(startDate, endDate, pageNum, pageSize);
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -46,7 +46,7 @@ public class UserViewCollectJob extends AbstractCollectJob<UserDTO> {
}
@Override
public List<UserDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//每家医院按照固定的格式写sql不同医院需要替换不同的sql即可。
return hisService.getUserListView(startDate, endDate, pageNum, pageSize);
}

@ -46,8 +46,8 @@ public class UserWsCollectJob extends AbstractCollectJob<UserDTO> {
@SuppressWarnings("unchecked")
@Override
public List<UserDTO> execute(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//需要根据不同医院去解析不同的内容。使用接口实现的方式。
return collector.get(startDate, endDate, pageNum, pageSize);
return collector.list(startDate, endDate, pageNum, pageSize);
}
}

@ -45,7 +45,7 @@ public class TaskConfig {
/**
*
*/
private Long pageSize;
private int pageSize;
/**
*

@ -74,5 +74,5 @@ public abstract class AbstractCollectJob<T> implements IJob<T> {
public abstract void batchInsertOrUpdate(List<T> t);
public abstract List<T> execute(Date startDate, Date endDate, long pageNum, long pageSize);
public abstract List<T> execute(Date startDate, Date endDate, int pageNum, int pageSize);
}

@ -16,18 +16,17 @@ import java.util.List;
@AllArgsConstructor
public class HisSysDao {
private final HisDeptMapper hisDeptMapper;
private final HisUserMapper hisUserMapper;
private final HisTBasicMapper hisTBasicMapper;
public List<DeptDTO> getDeptListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<DeptDTO> getDeptListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisDeptMapper.getDeptListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
}
public List<UserDTO> getUserListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> getUserListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisUserMapper.getUserListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
}
@ -35,7 +34,7 @@ public class HisSysDao {
}
public List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisTBasicMapper.getTBasicListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
}
}

@ -8,9 +8,9 @@ import java.util.Date;
import java.util.List;
public interface IHisService {
List<DeptDTO> getDeptListView(Date startDate, Date endDate, long pageNum, long pageSize);
List<DeptDTO> getDeptListView(Date startDate, Date endDate, int pageNum, int pageSize);
List<UserDTO> getUserListView(Date startDate, Date endDate, long pageNum, long pageSize);
List<UserDTO> getUserListView(Date startDate, Date endDate, int pageNum, int pageSize);
List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, long pageNum, long pageSize);
List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, int pageNum, int pageSize);
}

@ -18,17 +18,17 @@ public class HisService implements IHisService {
private final HisSysDao hisSysDao;
@Override
public List<DeptDTO> getDeptListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<DeptDTO> getDeptListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisSysDao.getDeptListView(startDate, endDate, pageNum, pageSize);
}
@Override
public List<UserDTO> getUserListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<UserDTO> getUserListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisSysDao.getUserListView(startDate, endDate, pageNum, pageSize);
}
@Override
public List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, long pageNum, long pageSize) {
public List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisSysDao.getTBasicListView(startDate, endDate, pageNum, pageSize);
}

Loading…
Cancel
Save