浏览代码

修复工作报告消息中心发送异常问题

fuyuchuan 1 周之前
父节点
当前提交
ed789791e3

+ 9 - 5
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/MceReceiveServiceImpl.java

@@ -240,6 +240,7 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
     }
 
     @Async
+    @Override
     public void addMceReceive(MceRequestVO mceRequestVO) {
         // 如果 infoTypeName 为空,则从字典数据中获取
         if (mceRequestVO.getInfoTypeName() == null) {
@@ -247,8 +248,10 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
             mceRequestVO.setInfoTypeName(infoTypeName);
         }
 
+        Integer tenantId = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, mceRequestVO.getUserName()).select(SysUser::getTenantId)).getTenantId();
+
         // 获取当前租户的所有用户
-        List<SysUser> userList = userMapper.tenantIdUserList(SecurityUtils.getTenantId());
+        List<SysUser> userList = userMapper.tenantIdUserList(tenantId);
         if (CollectionUtils.isEmpty(userList)) {
             return;
         }
@@ -299,12 +302,12 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
             for (SysUser user : userList) {
                 if (user.getUserId().equals(userId)) {
                     // 创建消息接收记录
-                    List<MceSetting> setting =  mceSettingService.list(Wrappers.lambdaQuery(MceSetting.class).eq(MceSetting::getCreateBy, user.getUserName()));
+                    List<MceSetting> setting = mceSettingService.list(Wrappers.lambdaQuery(MceSetting.class).eq(MceSetting::getCreateBy, user.getUserName()));
                     Integer receiveId = 0;
-                    if (CollectionUtils.isNotEmpty(setting)){
+                    if (CollectionUtils.isNotEmpty(setting)) {
                         MceReceive mceReceive = createMceReceive(user, generatedContentId, mceRequestVO, userNameNickNameMap);
                         this.save(mceReceive);
-                       receiveId =  mceReceive.getId();
+                        receiveId = mceReceive.getId();
                     }
 
                     if (mbUserOptional.isPresent()) {
@@ -482,7 +485,8 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
             mceReceiveVO.put("infoTypeName", infoTypeName);
         }
 
-        List<SysUser> list = userMapper.tenantIdUserList(SecurityUtils.getTenantId());
+        Integer tenantId = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, mceReceiveVO.get("userName")).select(SysUser::getTenantId)).getTenantId();
+        List<SysUser> list = userMapper.tenantIdUserList(tenantId);
         // 获取用户昵称与真实姓名Map
         Map<String, String> userNameNickNameMap = list.stream().collect(Collectors.toMap(SysUser::getUserName, SysUser::getNickName));
         MceContent mceContent = new MceContent();