提交 697a1c0d 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ibz-ou,统一组织单位]

上级 d3c588c0
......@@ -68,6 +68,22 @@ public class SysDepartmentSearchContext extends QueryWrapperContext<SysDepartmen
if(!ObjectUtils.isEmpty(this.n_pdeptid_eq)){
this.getSearchCond().eq("pdeptid", n_pdeptid_eq);
}
}
private String n_pdeptid_in;//[上级部门]
public void setN_pdeptid_in(String n_pdeptid_in) {
this.n_pdeptid_in = n_pdeptid_in;
if(!ObjectUtils.isEmpty(this.n_pdeptid_in)){
this.getSearchCond().in("pdeptid",this.n_pdeptid_in.split(";"));
}
}
private String n_pdeptid_isnull;//[上级部门]
public void setN_pdeptid_isnull(String n_pdeptid_isnull) {
this.n_pdeptid_isnull = n_pdeptid_isnull;
if(!ObjectUtils.isEmpty(this.n_pdeptid_isnull)){
if(this.n_pdeptid_isnull.equals("1")){
this.getSearchCond().isNull("pdeptid");
}
}
}
private String n_bcode_like;//[业务编码]
public void setN_bcode_like(String n_bcode_like) {
......
......@@ -47,6 +47,13 @@ public class SysOrganizationSearchContext extends QueryWrapperContext<SysOrganiz
if(!ObjectUtils.isEmpty(this.n_orgcode_leftlike)){
this.getSearchCond().likeRight("orgcode", n_orgcode_leftlike);
}
}
private String n_orgcode_like;//[单位代码]
public void setN_orgcode_like(String n_orgcode_like) {
this.n_orgcode_like = n_orgcode_like;
if(!ObjectUtils.isEmpty(this.n_orgcode_like)){
this.getSearchCond().like("orgcode", n_orgcode_like);
}
}
private String n_orgname_like;//[名称]
public void setN_orgname_like(String n_orgname_like) {
......@@ -61,6 +68,22 @@ public class SysOrganizationSearchContext extends QueryWrapperContext<SysOrganiz
if(!ObjectUtils.isEmpty(this.n_porgid_eq)){
this.getSearchCond().eq("porgid", n_porgid_eq);
}
}
private String n_porgid_in;//[上级单位]
public void setN_porgid_in(String n_porgid_in) {
this.n_porgid_in = n_porgid_in;
if(!ObjectUtils.isEmpty(this.n_porgid_in)){
this.getSearchCond().in("porgid",this.n_porgid_in.split(";"));
}
}
private String n_porgid_isnull;//[上级单位]
public void setN_porgid_isnull(String n_porgid_isnull) {
this.n_porgid_isnull = n_porgid_isnull;
if(!ObjectUtils.isEmpty(this.n_porgid_isnull)){
if(this.n_porgid_isnull.equals("1")){
this.getSearchCond().isNull("porgid");
}
}
}
private String n_shortname_like;//[单位简称]
public void setN_shortname_like(String n_shortname_like) {
......
package cn.ibizlab.core.util.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import com.alibaba.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.common.message.MessageExt;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
@Slf4j
@Configuration
@ConditionalOnExpression("${ibiz.rocketmq.producer.isOnOff:'off'}.equals('on')")
public class RocketMQConfig {
@Bean("SysEmployeedeleteSysUserproducer")
public DefaultMQProducer sysEmployeedeleteSysUserproducer(){
DefaultMQProducer producer = null;
try{
producer= new DefaultMQProducer();
producer.setSendMsgTimeout(6000);
producer.setNamesrvAddr("127.0.0.1:9876");
producer.setInstanceName("rmq-instance");
}
catch(Exception e){
log.error("初始化消息发送对象异常!");
}
return producer;
}
@Bean("SysEmployeesaveSysUserproducer")
public DefaultMQProducer sysEmployeesaveSysUserproducer(){
DefaultMQProducer producer = null;
try{
producer= new DefaultMQProducer();
producer.setSendMsgTimeout(6000);
producer.setNamesrvAddr("127.0.0.1:9876");
producer.setInstanceName("rmq-instance");
}
catch(Exception e){
log.error("初始化消息发送对象异常!");
}
@Value("${ibiz.rocketmq.producer.groupName:default}")
private String groupName;
@Value("${ibiz.rocketmq.producer.namesrvAddr:127.0.0.1:9876}")
private String namesrvAddr;
// 消息最大值
@Value("${ibiz.rocketmq.producer.maxMessageSize:409600}")
private Integer maxMessageSize;
// 消息发送超时时间
@Value("${ibiz.rocketmq.producer.sendMsgTimeOut:3000}")
private Integer sendMsgTimeOut;
// 失败重试次数
@Value("${ibiz.rocketmq.producer.retryTimesWhenSendFailed:2}")
private Integer retryTimesWhenSendFailed;
/**
* mq 生成者配置
*
* @return
* @throws MQClientException
*/
@Bean
public DefaultMQProducer defaultProducer() throws MQClientException {
log.info("rocketmq defaultProducer 正在创建---------------------------------------");
DefaultMQProducer producer = new DefaultMQProducer(groupName);
producer.setNamesrvAddr(namesrvAddr);
producer.setVipChannelEnabled(false);
producer.setMaxMessageSize(maxMessageSize);
producer.setSendMsgTimeout(sendMsgTimeOut);
producer.setRetryTimesWhenSendAsyncFailed(retryTimesWhenSendFailed);
producer.start();
log.info("rocketmq producer server 开启成功----------------------------------");
return producer;
}
// 消费者线程数据量
@Value("${ibiz.rocketmq.consumer.consumeThreadMin:1}")
private Integer consumeThreadMin;
@Value("${ibiz.rocketmq.consumer.consumeThreadMax:1}")
private Integer consumeThreadMax;
@Value("${ibiz.rocketmq.consumer.consumeMessageBatchMaxSize:1}")
private Integer consumeMessageBatchMaxSize;
@Value("${ibiz.rocketmq.topic:default}")
private String topic;
@Autowired
@Lazy
cn.ibizlab.core.ou.service.ISysDeptMemberService SysDeptMemberService;
private RocketMQListenerProcessor listenerProcessor;
@Bean("SysDeptMembersaveDeptMemberconsumer")
public DefaultMQPushConsumer sysDeptMembersaveDeptMemberconsumer(){
DefaultMQPushConsumer consumer = null;
/**
* mq 消费者配置
*
* @return
* @throws MQClientException
*/
@Bean
public DefaultMQPushConsumer defaultConsumer() {
log.info("defaultConsumer 正在创建---------------------------------------");
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(groupName);
consumer.setNamesrvAddr(namesrvAddr);
consumer.setConsumeThreadMin(consumeThreadMin);
consumer.setConsumeThreadMax(consumeThreadMax);
consumer.setConsumeMessageBatchMaxSize(consumeMessageBatchMaxSize);
// 设置监听
consumer.registerMessageListener(listenerProcessor);
/**
* 设置consumer第一次启动是从队列头部开始还是队列尾部开始
* 如果不是第一次启动,那么按照上次消费的位置继续消费
*/
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
/**
* 设置消费模型,集群还是广播,默认为集群
*/
// consumer.setMessageModel(MessageModel.CLUSTERING);
try {
consumer = new DefaultMQPushConsumer();
consumer.setNamesrvAddr("127.0.0.1:9876");
consumer.setInstanceName("rmq-instance");
consumer.subscribe("saveSysUser", "saveSysUser");
consumer.registerMessageListener(new MessageListenerConcurrently() {
public ConsumeConcurrentlyStatus consumeMessage(
List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
for (MessageExt msg : msgs) {
cn.ibizlab.core.ou.domain.SysDeptMember domain = JSON.parseObject(new String(msg.getBody()),cn.ibizlab.core.ou.domain.SysDeptMember.class);
SysDeptMemberService.saveDeptMember(domain);
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
consumer.subscribe(topic, "savesysuser");
consumer.start();
}catch (Exception e){
log.error("初始化消息接收对象异常!");
log.info("rocketmq consumer 创建成功 groupName={}, topics={}, namesrvAddr={}", groupName, topic, namesrvAddr);
} catch (MQClientException e) {
log.error("rocketmq consumer 创建失败!" + e);
}
return consumer;
}
}
package cn.ibizlab.core.util.config;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* MQ订阅消息处理
*/
@Slf4j
@Component
@ConditionalOnExpression("${ibiz.rocketmq.producer.isOnOff:'off'}.equals('on')")
public class RocketMQListenerProcessor implements MessageListenerOrderly {
@Autowired
@Lazy
cn.ibizlab.core.ou.service.ISysDeptMemberService SysDeptMemberService;
@Override
public ConsumeOrderlyStatus consumeMessage(List<MessageExt> list, ConsumeOrderlyContext consumeOrderlyContext) {
if (CollectionUtils.isEmpty(list)) {
log.info("MQ接收消息为空,直接返回成功");
return ConsumeOrderlyStatus.SUCCESS;
}
for (MessageExt messageExt : list) {
log.info("MQ接收到的消息为:" + messageExt.toString());
try {
String topic = messageExt.getTopic();
String tags = messageExt.getTags();
String body = new String(messageExt.getBody(), "utf-8");
log.info("MQ消息topic={}, tags={}, 消息内容={}", topic, tags, body);
if ("savesysuser".equalsIgnoreCase(tags)) {
cn.ibizlab.core.ou.domain.SysDeptMember domain = JSON.parseObject(new String(body),cn.ibizlab.core.ou.domain.SysDeptMember.class);
SysDeptMemberService.saveDeptMember(domain);
}
} catch (Exception e) {
log.error("获取MQ消息内容异常{}", e);
}
}
return ConsumeOrderlyStatus.SUCCESS;
}
}
......@@ -4,7 +4,7 @@
<!--输出实体[SYS_DEPT]数据结构 -->
<changeSet author="root" id="tab-sys_dept-62-1">
<changeSet author="a_A_5d9d78509" id="tab-sys_dept-64-1">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPT_DEPTID"/>
......@@ -42,7 +42,7 @@
<!--输出实体[SYS_DEPTMEMBER]数据结构 -->
<changeSet author="root" id="tab-sys_deptmember-33-2">
<changeSet author="a_A_5d9d78509" id="tab-sys_deptmember-34-2">
<createTable tableName="IBZDEPTMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPTMEMBER_MEMBERID"/>
......@@ -60,7 +60,7 @@
<!--输出实体[SYS_EMP]数据结构 -->
<changeSet author="root" id="tab-sys_emp-83-3">
<changeSet author="a_A_5d9d78509" id="tab-sys_emp-83-3">
<createTable tableName="IBZEMP">
<column name="USERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_EMP_USERID"/>
......@@ -140,7 +140,7 @@
<!--输出实体[SYS_ORG]数据结构 -->
<changeSet author="root" id="tab-sys_org-36-4">
<changeSet author="a_A_5d9d78509" id="tab-sys_org-39-4">
<createTable tableName="IBZORG">
<column name="ORGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ORG_ORGID"/>
......@@ -170,7 +170,7 @@
<!--输出实体[SYS_POST]数据结构 -->
<changeSet author="root" id="tab-sys_post-23-5">
<changeSet author="a_A_5d9d78509" id="tab-sys_post-23-5">
<createTable tableName="IBZPOST">
<column name="POSTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_POST_POSTID"/>
......@@ -188,7 +188,7 @@
<!--输出实体[SYS_TEAM]数据结构 -->
<changeSet author="root" id="tab-sys_team-23-6">
<changeSet author="a_A_5d9d78509" id="tab-sys_team-23-6">
<createTable tableName="IBZTEAM">
<column name="TEAMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_TEAM_TEAMID"/>
......@@ -204,7 +204,7 @@
<!--输出实体[SYS_TEAMMEMBER]数据结构 -->
<changeSet author="root" id="tab-sys_teammember-29-7">
<changeSet author="a_A_5d9d78509" id="tab-sys_teammember-29-7">
<createTable tableName="IBZTEAMMEMBER">
<column name="TEAMMEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_TEAMMEMBER_TEAMMEMBERID"/>
......@@ -221,46 +221,46 @@
</changeSet>
<!--输出实体[SYS_DEPT]外键关系 -->
<changeSet author="root" id="fk-sys_dept-62-8">
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-64-8">
<addForeignKeyConstraint baseColumnNames="PDEPTID" baseTableName="IBZDEPT" constraintName="DER1N_SYS_DEPT_SYS_DEPT_PDEPTI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_dept-62-9">
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-64-9">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZDEPT" constraintName="DER1N_SYS_DEPT_SYS_ORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[SYS_DEPTMEMBER]外键关系 -->
<changeSet author="root" id="fk-sys_deptmember-33-10">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-34-10">
<addForeignKeyConstraint baseColumnNames="DEPTID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_DEPT_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_deptmember-33-11">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-34-11">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_EMP_U" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZEMP" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_deptmember-33-12">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-34-12">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_POST_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<!--输出实体[SYS_EMP]外键关系 -->
<changeSet author="root" id="fk-sys_emp-83-13">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-13">
<addForeignKeyConstraint baseColumnNames="MDEPTID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_DEPT_MDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_emp-83-14">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-14">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_ORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_emp-83-15">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-15">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_POST_POSTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<!--输出实体[SYS_ORG]外键关系 -->
<changeSet author="root" id="fk-sys_org-36-16">
<changeSet author="a_A_5d9d78509" id="fk-sys_org-39-16">
<addForeignKeyConstraint baseColumnNames="PORGID" baseTableName="IBZORG" constraintName="DER1N_SYS_ORG_SYS_ORG_PORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[SYS_POST]外键关系 -->
<!--输出实体[SYS_TEAM]外键关系 -->
<!--输出实体[SYS_TEAMMEMBER]外键关系 -->
<changeSet author="root" id="fk-sys_teammember-29-17">
<changeSet author="a_A_5d9d78509" id="fk-sys_teammember-29-17">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_SYS_EMP_U" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZEMP" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_teammember-29-18">
<changeSet author="a_A_5d9d78509" id="fk-sys_teammember-29-18">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_SYS_POST_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<changeSet author="root" id="fk-sys_teammember-29-19">
<changeSet author="a_A_5d9d78509" id="fk-sys_teammember-29-19">
<addForeignKeyConstraint baseColumnNames="TEAMID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_SYS_TEAM_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TEAMID" referencedTableName="IBZTEAM" validate="true"/>
</changeSet>
......
......@@ -262,11 +262,7 @@
<version>${baomidou-jobs.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......@@ -350,13 +346,16 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mp动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
</dependencies>
......
package cn.ibizlab.util.aspect;
import com.alibaba.fastjson.JSON;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.common.message.Message;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.domain.EntityBase;
import com.alibaba.fastjson.JSON;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -25,31 +27,30 @@ import java.util.List;
/**
* rocketMQ消息切面
*/
@Slf4j
@Aspect
@Component
@Slf4j
@ConditionalOnExpression("${ibiz.rocketmq.producer.isOnOff:'off'}.equals('on')")
public class RocketMQAspect
{
private final ExpressionParser parser = new SpelExpressionParser();
@Autowired
@Qualifier("SysEmployeedeleteSysUserproducer")
@Lazy
DefaultMQProducer SysEmployeedeleteSysUserproducer;
DefaultMQProducer defaultMQProducer;
@Value("${ibiz.rocketmq.topic:default}")
private String topic;
@AfterReturning(value = "(execution(* cn.ibizlab.core.*.service.*SysEmployee*.create*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.update*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.save*(..)) ||execution(* cn.ibizlab.core.*.service.*SysEmployee*.remove*(..))) && !execution(* cn.ibizlab.core.es.service.*.create*(..)) && !execution(* cn.ibizlab.core.es.service.*.update*(..)) && !execution(* cn.ibizlab.core.es.service.*.save*(..)) && !execution(* cn.ibizlab.core.es.service.*.remove*(..))")
@Async
public void sysEmployeedeleteSysUserproducer(JoinPoint point) {
sendMsg(SysEmployeedeleteSysUserproducer, "deleteSysUser", "deleteSysUser", getEntity(point));
public void sysEmployeedeleteSysUser(JoinPoint point) {
sendMsg(topic, "deletesysuser", getEntity(point));
}
@Autowired
@Qualifier("SysEmployeesaveSysUserproducer")
@Lazy
DefaultMQProducer SysEmployeesaveSysUserproducer;
@AfterReturning(value = "(execution(* cn.ibizlab.core.*.service.*SysEmployee*.create*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.update*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.save*(..)) ||execution(* cn.ibizlab.core.*.service.*SysEmployee*.remove*(..))) && !execution(* cn.ibizlab.core.es.service.*.create*(..)) && !execution(* cn.ibizlab.core.es.service.*.update*(..)) && !execution(* cn.ibizlab.core.es.service.*.save*(..)) && !execution(* cn.ibizlab.core.es.service.*.remove*(..))")
@Async
public void sysEmployeesaveSysUserproducer(JoinPoint point) {
sendMsg(SysEmployeesaveSysUserproducer, "saveSysUser", "saveSysUser", getEntity(point));
public void sysEmployeesaveSysUser(JoinPoint point) {
sendMsg(topic, "savesysuser", getEntity(point));
}
/**
......@@ -94,21 +95,19 @@ public class RocketMQAspect
/**
* 发送消息
* @param producer
* @param topic
* @param tag
* @param body
*/
private void sendMsg(DefaultMQProducer producer, String topic, String tag, Object body) {
private void sendMsg(String topic, String tag, Object body) {
if(ObjectUtils.isEmpty(body)) {
log.error("发送消息失败,无法获取到要发送的消息内容!");
log.error("消息内容为空,[{}]消息将被忽略!",tag);
return;
}
try {
producer.start();
Message message = new Message(topic, tag, JSON.toJSONString(body).getBytes());
producer.send(message);
producer.shutdown();
SendResult sendResult = defaultMQProducer.send(message);
log.info("消息发送响应:" + sendResult.toString());
} catch (Exception e) {
log.error("消息发送异常,"+e);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册