飞书事件变更,mq更新
This commit is contained in:
@@ -27,91 +27,10 @@ public enum RocketMqGroupEnum {
|
|||||||
* 服务A中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagA
|
* 服务A中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagA
|
||||||
* 服务B中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagB
|
* 服务B中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域门店数量计算队列
|
* 事件消息监听
|
||||||
*/
|
*/
|
||||||
CAL_REGION_STORE_NUM("cal_region_store_num", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.CAL_REGION_STORE_NUM,RocketMqTagEnum.REGION_STORE_NUM_UPDATE))),
|
FEI_SHU_EVENT_LISTENER("fei_shu_event_listener", new ArrayList<>(Arrays.asList(RocketMqTagEnum.USER_EVENT, RocketMqTagEnum.AUTH_SCOPE_CHANGE))),
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业开通
|
|
||||||
*/
|
|
||||||
ENTERPRISE_OPEN("enterprise_open", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业开通平台库脚本
|
|
||||||
*/
|
|
||||||
ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT("enterprise_open_config_run_script", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业开通企业库脚本
|
|
||||||
*/
|
|
||||||
ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT("enterprise_open_enterprise_run_script", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业开通数据同步
|
|
||||||
*/
|
|
||||||
ENTERPRISE_OPEN_DATA_SYNC("enterprise_open_data_sync", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_DATA_SYNC))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业购买事件
|
|
||||||
*/
|
|
||||||
PAY_MARKET_BUY("pay_market_buy","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PAY_MARKET_BUY))),
|
|
||||||
/**
|
|
||||||
* 钉钉消息监听
|
|
||||||
*/
|
|
||||||
DING_MSG_DEAL("ding_msg_deal","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DING_STORE_ADDRESS_BOOK, RocketMqTagEnum.DING_SINGLE_USER_SYNC))),
|
|
||||||
/**
|
|
||||||
* 授权队列
|
|
||||||
*/
|
|
||||||
AUTH_QUEUE("auth_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.AUTH_QUEUE))),
|
|
||||||
/**
|
|
||||||
* 企微消息监听
|
|
||||||
*/
|
|
||||||
QW_MSG_DEAL("qw_msg_deal","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QW_CHANGE_ORDER_QUEUE,RocketMqTagEnum.QW_OPEN_ORDER_CHANGE_QUEUE))),
|
|
||||||
/**
|
|
||||||
* 钉钉同步
|
|
||||||
*/
|
|
||||||
DING_SYNC_ALL_DATA_QUEUE("ding_sync_all_data_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DING_SYNC_ALL_DATA_QUEUE))),
|
|
||||||
|
|
||||||
STORE_DING_QUEUE("store_ding_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_DING_QUEUE))),
|
|
||||||
/**
|
|
||||||
* 待办任务名称
|
|
||||||
*/
|
|
||||||
STORE_BACK_LOG("store_back_log","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_BACK_LOG,RocketMqTagEnum.STORE_BACK_LOG_UPDATE))),
|
|
||||||
/**
|
|
||||||
* 待办消息结束队列
|
|
||||||
*/
|
|
||||||
UPCOMING_FINISH("upcoming_finish","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.UPCOMING_FINISH))),
|
|
||||||
/**
|
|
||||||
* 发送开通成功消息
|
|
||||||
*/
|
|
||||||
OPEN_SUCCEEDED_MSG_QUEUE("open_succeeded_msg_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.OPEN_SUCCEEDED_MSG_QUEUE))),
|
|
||||||
/**
|
|
||||||
* 发送成员授权模式下模板消息
|
|
||||||
*/
|
|
||||||
QW_MEMBER_TEMPLE_MSG_QUEUE("qw_member_temple_msg_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QW_MEMBER_TEMPLE_MSG_QUEUE))),
|
|
||||||
/**
|
|
||||||
* app推送队列
|
|
||||||
*/
|
|
||||||
APP_PUSH_QUEUE("app_push_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.APP_PUSH_QUEUE))),
|
|
||||||
/**
|
|
||||||
* 解除应用
|
|
||||||
*/
|
|
||||||
REMOVE_APPLICATION("remove_application","coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.REMOVE_APPLICATION))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 全量企微用户同步
|
|
||||||
*/
|
|
||||||
QW_SYNC_FULL_USER("qw_sync_full_user_msg_queue", "coolcollege-intelligent", new ArrayList(Arrays.asList(RocketMqTagEnum.QW_SYNC_FULL_USER))),
|
|
||||||
|
|
||||||
|
|
||||||
SHOP_STORE_GROUP_SYNC("shop_store_group_sync","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.SHOP_STORE_GROUP_SYNC))),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* test
|
|
||||||
*/
|
|
||||||
TEST("test", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.TEST))),
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -119,12 +38,9 @@ public enum RocketMqGroupEnum {
|
|||||||
|
|
||||||
private final List<RocketMqTagEnum> tagList;
|
private final List<RocketMqTagEnum> tagList;
|
||||||
|
|
||||||
private final String listener;
|
|
||||||
|
|
||||||
|
RocketMqGroupEnum(String group,List<RocketMqTagEnum> tagList) {
|
||||||
RocketMqGroupEnum(String group,String listener,List<RocketMqTagEnum> tagList) {
|
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.listener = listener;
|
|
||||||
this.tagList = tagList;
|
this.tagList = tagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,43 +11,8 @@ import com.cool.store.utils.CommonContextUtil;
|
|||||||
*/
|
*/
|
||||||
public enum RocketMqTagEnum {
|
public enum RocketMqTagEnum {
|
||||||
|
|
||||||
TEST("test","测试"),
|
AUTH_SCOPE_CHANGE("auth_scope_change","授权范围变更"),
|
||||||
EXPORT_IMPORT_MESSAGE("export_import_message","导入导出消息"),
|
USER_EVENT("user_event","钉钉通讯录变更事件"),
|
||||||
CAL_REGION_STORE_NUM("cal_region_store_num","计算门店区域数量"),
|
|
||||||
REGION_STORE_NUM_UPDATE("region_store_num_update","计算门店区域数量"),
|
|
||||||
|
|
||||||
ENTERPRISE_OPEN("enterprise_open","企业开通"),
|
|
||||||
ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT("enterprise_open_config_run_script","企业开通平台库脚本执行"),
|
|
||||||
ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT("enterprise_open_enterprise_run_script","企业开通企业库脚本执行"),
|
|
||||||
ENTERPRISE_OPEN_DATA_SYNC("enterprise_open_data_sync","企业开通数据同步"),
|
|
||||||
|
|
||||||
AUTH_QUEUE("auth_queue","授权队列"),
|
|
||||||
DING_STORE_ADDRESS_BOOK("ding_store_address_book","钉钉通讯录变更事件"),
|
|
||||||
PAY_MARKET_BUY("pay_market_buy","企业购买队列"),
|
|
||||||
|
|
||||||
QW_OPEN_ORDER_CHANGE_QUEUE("qw_openorder_change_queue","企业微信付费监听"),
|
|
||||||
QW_CHANGE_ORDER_QUEUE("qw_change_order_queue","企业微信改单事件,因涉及到两个订单,和普通的订单事件分开"),
|
|
||||||
|
|
||||||
DING_SYNC_ALL_DATA_QUEUE("ding_sync_all_data_queue","钉钉全量同步"),
|
|
||||||
DING_SYNC_ALL_DATA_QUEUE_BAILI("ding_sync_all_data_queue_baili","百丽全量同步"),
|
|
||||||
DING_SYNC_ALL_DATA_OA_QUEUE("ding_sync_all_data_oa_queue","第三方同步"),
|
|
||||||
THIRD_OA_SYNC_SINGLE_QUEUE("third_oa_sync_single_queue","第三方单个用户同步"),
|
|
||||||
STORE_DING_QUEUE("store_ding_queue", "微应用钉钉消息发送"),
|
|
||||||
STORE_BACK_LOG("store_back_log", "待办任务名称"),
|
|
||||||
STORE_BACK_LOG_UPDATE("store_back_log_update", "更新待办任务名称"),
|
|
||||||
UPCOMING_FINISH("upcoming_finish", "待办消息结束队列"),
|
|
||||||
OPEN_SUCCEEDED_MSG_QUEUE("open_succeeded_msg_queue", "发送开通成功消息"),
|
|
||||||
QW_MEMBER_TEMPLE_MSG_QUEUE("qw_member_temple_msg_queue", "发送成员授权模式下模板消息"),
|
|
||||||
APP_PUSH_QUEUE("app_push_queue", "app推送队列"),
|
|
||||||
REMOVE_APPLICATION("remove_application", "解除应用"),
|
|
||||||
COLLEGE_SYNC_USER_DELAY("college_sync_user_delay", "同步人与延迟推送"),
|
|
||||||
COOL_STORE_DATA_CHANGE("cool_store_data_change", "门店端的部门,人员,职位,发生变化后的推送消息队列"),
|
|
||||||
QW_SYNC_FULL_USER("qw_sync_full_user_msg_queue", "企微全量用户同步"),
|
|
||||||
PERSON_SUB_TASK_DATA_QUEUE("person_sub_task_data_queue","按人子任务消息监听"),
|
|
||||||
IMOU_DEVICE_CALLBACK("imou_device_callback","乐橙设备回调事件"),
|
|
||||||
PERMANENT_CODE_UPDATE("permanent_code_update", "授权码变更"),
|
|
||||||
SHOP_STORE_GROUP_SYNC("shop_store_group_sync","门店通门店分组同步"),
|
|
||||||
DING_SINGLE_USER_SYNC("ding_single_user_sync","钉钉用户信息拉取"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
import com.cool.store.mapper.EnterpriseUserMapper;
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -44,4 +45,11 @@ public class EnterpriseUserDAO {
|
|||||||
}
|
}
|
||||||
enterpriseUserMapper.deleteUser(excludeUserIds);
|
enterpriseUserMapper.deleteUser(excludeUserIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer deleteUserByUserId(String userId){
|
||||||
|
if(StringUtils.isBlank(userId)){
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return enterpriseUserMapper.deleteUserByUserId(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.entity.EnterpriseUserRoleDO;
|
import com.cool.store.entity.EnterpriseUserRoleDO;
|
||||||
import com.cool.store.entity.SysRoleDO;
|
import com.cool.store.entity.SysRoleDO;
|
||||||
import com.cool.store.enums.DataSourceEnum;
|
import com.cool.store.enums.DataSourceEnum;
|
||||||
@@ -43,4 +44,11 @@ public class EnterpriseUserRoleDAO {
|
|||||||
return enterpriseUserRoleMapper.deleteUserInRole(userId, dataSourceEnum.getCode(), excludeRoleId);
|
return enterpriseUserRoleMapper.deleteUserInRole(userId, dataSourceEnum.getCode(), excludeRoleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer deleteUserRole(String userId){
|
||||||
|
if(StringUtils.isBlank(userId)){
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return enterpriseUserRoleMapper.deleteUserRole(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.entity.UserRegionMappingDO;
|
import com.cool.store.entity.UserRegionMappingDO;
|
||||||
import com.cool.store.enums.DataSourceEnum;
|
import com.cool.store.enums.DataSourceEnum;
|
||||||
import com.cool.store.mapper.UserRegionMappingMapper;
|
import com.cool.store.mapper.UserRegionMappingMapper;
|
||||||
@@ -51,4 +52,11 @@ public class UserRegionMappingDAO {
|
|||||||
return userRegionMappingMapper.deleteRegionUserByExcludeUserIds(excludeUserIds);
|
return userRegionMappingMapper.deleteRegionUserByExcludeUserIds(excludeUserIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer deleteUserRegionByUserId(String userId){
|
||||||
|
if(StringUtils.isBlank(userId)){
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return userRegionMappingMapper.deleteUserRegionByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,11 @@ public interface EnterpriseUserMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteUser(@Param("excludeUserIds") List<String> excludeUserIds);
|
int deleteUser(@Param("excludeUserIds") List<String> excludeUserIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer deleteUserByUserId(@Param("userId") String userId);
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,27 @@ public interface EnterpriseUserRoleMapper {
|
|||||||
int updateByPrimaryKeySelective(EnterpriseUserRoleDO record);
|
int updateByPrimaryKeySelective(EnterpriseUserRoleDO record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户角色
|
* 删除角色下的用户
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @param type
|
* @param type
|
||||||
* @param userIds
|
* @param excludeUserIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteRoleInUser(@Param("roleId") String roleId, @Param("type") Integer type, @Param("excludeUserIds") List<String> excludeUserIds);
|
int deleteRoleInUser(@Param("roleId") String roleId, @Param("type") Integer type, @Param("excludeUserIds") List<String> excludeUserIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户下的角色
|
||||||
|
* @param userId
|
||||||
|
* @param type
|
||||||
|
* @param excludeRoleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int deleteUserInRole(@Param("userId") String userId, @Param("type") Integer type, @Param("excludeRoleId") String excludeRoleId);
|
int deleteUserInRole(@Param("userId") String userId, @Param("type") Integer type, @Param("excludeRoleId") String excludeRoleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户所有角色
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer deleteUserRole(@Param("userId") String userId);
|
||||||
}
|
}
|
||||||
@@ -47,4 +47,11 @@ public interface UserRegionMappingMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer deleteRegionUserByExcludeUserIds(@Param("excludeUserIds") List<String> excludeUserIds);
|
Integer deleteRegionUserByExcludeUserIds(@Param("excludeUserIds") List<String> excludeUserIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户所在的区域
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer deleteUserRegionByUserId(@Param("userId") String userId);
|
||||||
}
|
}
|
||||||
@@ -242,4 +242,8 @@
|
|||||||
<update id="deleteUser">
|
<update id="deleteUser">
|
||||||
update enterprise_user set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
update enterprise_user set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteUserByUserId">
|
||||||
|
update enterprise_user set deleted = 1 where user_id = #{userId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -91,4 +91,8 @@
|
|||||||
<update id="deleteUserInRole">
|
<update id="deleteUserInRole">
|
||||||
update enterprise_user_role set deleted = 1 where role_id != #{excludeRoleId} and user_id = #{userId} and type = #{type}
|
update enterprise_user_role set deleted = 1 where role_id != #{excludeRoleId} and user_id = #{userId} and type = #{type}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteUserRole">
|
||||||
|
update enterprise_user_role set deleted = 1 where user_id = #{userId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -119,4 +119,8 @@
|
|||||||
update user_region_mapping set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
update user_region_mapping set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteUserRegionByUserId">
|
||||||
|
update user_region_mapping set deleted = 1 where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -8,7 +8,7 @@ import com.aliyun.openservices.ons.api.bean.Subscription;
|
|||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.enums.RocketMqGroupEnum;
|
import com.cool.store.enums.RocketMqGroupEnum;
|
||||||
import com.cool.store.mq.RocketMqConfig;
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
import com.cool.store.mq.consumer.listener.UserEventDealListener;
|
import com.cool.store.mq.consumer.listener.FeiShuEventListener;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -29,7 +29,7 @@ public class ConsumerClient {
|
|||||||
@Resource
|
@Resource
|
||||||
private RocketMqConfig rocketMqConfig;
|
private RocketMqConfig rocketMqConfig;
|
||||||
@Resource
|
@Resource
|
||||||
private UserEventDealListener userEventDealListener;
|
private FeiShuEventListener feiShuEventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通用配置
|
* 获取通用配置
|
||||||
@@ -66,17 +66,17 @@ public class ConsumerClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试test
|
* 用户事件监听
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||||
public ConsumerBean test() {
|
public ConsumerBean test() {
|
||||||
RocketMqGroupEnum groupEnum = RocketMqGroupEnum.DING_MSG_DEAL;
|
RocketMqGroupEnum groupEnum = RocketMqGroupEnum.FEI_SHU_EVENT_LISTENER;
|
||||||
ConsumerBean consumerBean = new ConsumerBean();
|
ConsumerBean consumerBean = new ConsumerBean();
|
||||||
//配置文件
|
//配置文件
|
||||||
Properties properties = getCommonProperties(groupEnum);
|
Properties properties = getCommonProperties(groupEnum);
|
||||||
consumerBean.setProperties(properties);
|
consumerBean.setProperties(properties);
|
||||||
Map<Subscription, MessageListener> commonSubscriptionTable = getCommonSubscriptionTable(groupEnum, userEventDealListener);
|
Map<Subscription, MessageListener> commonSubscriptionTable = getCommonSubscriptionTable(groupEnum, feiShuEventListener);
|
||||||
//订阅多个topic如上面设置
|
//订阅多个topic如上面设置
|
||||||
consumerBean.setSubscriptionTable(commonSubscriptionTable);
|
consumerBean.setSubscriptionTable(commonSubscriptionTable);
|
||||||
return consumerBean;
|
return consumerBean;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.aliyun.openservices.ons.api.Message;
|
|||||||
import com.aliyun.openservices.ons.api.MessageListener;
|
import com.aliyun.openservices.ons.api.MessageListener;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dto.buser.UserEventDTO;
|
import com.cool.store.dto.buser.UserEventDTO;
|
||||||
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
import com.cool.store.service.EnterpriseSyncService;
|
import com.cool.store.service.EnterpriseSyncService;
|
||||||
import com.cool.store.utils.RedisUtilPool;
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -22,7 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class UserEventDealListener implements MessageListener {
|
public class FeiShuEventListener implements MessageListener {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtilPool redisUtilPool;
|
private RedisUtilPool redisUtilPool;
|
||||||
@@ -37,13 +38,20 @@ public class UserEventDealListener implements MessageListener {
|
|||||||
return Action.CommitMessage;
|
return Action.CommitMessage;
|
||||||
}
|
}
|
||||||
log.info("重试消费次数 messageId:{},try times:{}", message.getMsgID(), message.getReconsumeTimes());
|
log.info("重试消费次数 messageId:{},try times:{}", message.getMsgID(), message.getReconsumeTimes());
|
||||||
|
|
||||||
String lockKey = "DingMsgDealListener:" + message.getMsgID();
|
String lockKey = "DingMsgDealListener:" + message.getMsgID();
|
||||||
boolean lock = redisUtilPool.setNxExpire(lockKey, message.getMsgID(), CommonConstants.NORMAL_LOCK_TIMES);
|
boolean lock = redisUtilPool.setNxExpire(lockKey, message.getMsgID(), CommonConstants.NORMAL_LOCK_TIMES);
|
||||||
if(lock){
|
if(lock){
|
||||||
try {
|
try {
|
||||||
UserEventDTO reqBody = JSONObject.parseObject(text, UserEventDTO.class);
|
RocketMqTagEnum tag = RocketMqTagEnum.getByTag(message.getTag());
|
||||||
enterpriseSyncService.userUpdateEvent(reqBody);
|
switch (tag){
|
||||||
|
case USER_EVENT:
|
||||||
|
UserEventDTO reqBody = JSONObject.parseObject(text, UserEventDTO.class);
|
||||||
|
enterpriseSyncService.userUpdateEvent(reqBody);
|
||||||
|
break;
|
||||||
|
case AUTH_SCOPE_CHANGE:
|
||||||
|
enterpriseSyncService.syncAll();
|
||||||
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("DingMsgDealListener consume dealAddressBookChange error",e);
|
log.error("DingMsgDealListener consume dealAddressBookChange error",e);
|
||||||
return Action.ReconsumeLater;
|
return Action.ReconsumeLater;
|
||||||
@@ -196,6 +196,9 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
|
|||||||
break;
|
break;
|
||||||
case USER_DELETED:
|
case USER_DELETED:
|
||||||
//人员职位删除状态,角色职位删除状态,人员从部门去除
|
//人员职位删除状态,角色职位删除状态,人员从部门去除
|
||||||
|
userRegionMappingDAO.deleteUserRegionByUserId(param.getUserId());
|
||||||
|
enterpriseUserRoleDAO.deleteUserRole(param.getUserId());
|
||||||
|
enterpriseUserDAO.deleteUserByUserId(param.getUserId());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ import java.util.List;
|
|||||||
@RequestMapping("test/")
|
@RequestMapping("test/")
|
||||||
public class TestController {
|
public class TestController {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SimpleMessageService simpleMessageService;
|
|
||||||
@Resource
|
@Resource
|
||||||
private EnterpriseUserService enterpriseUserService;
|
private EnterpriseUserService enterpriseUserService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -49,15 +47,6 @@ public class TestController {
|
|||||||
@Resource
|
@Resource
|
||||||
private EnterpriseSyncService enterpriseSyncService;
|
private EnterpriseSyncService enterpriseSyncService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/sendMq")
|
|
||||||
public ResponseResult sendMq(){
|
|
||||||
String msg = UUIDUtils.get8UUID();
|
|
||||||
log.info("msg:{}", msg);
|
|
||||||
simpleMessageService.send(msg, RocketMqTagEnum.TEST);
|
|
||||||
return ResponseResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/post")
|
@PostMapping("/post")
|
||||||
public ResponseResult<Boolean> get(@RequestBody List<TestRequest> testRequestList){
|
public ResponseResult<Boolean> get(@RequestBody List<TestRequest> testRequestList){
|
||||||
log.info(JSONObject.toJSONString(testRequestList));
|
log.info(JSONObject.toJSONString(testRequestList));
|
||||||
|
|||||||
Reference in New Issue
Block a user