Procházet zdrojové kódy

同一用户多个角色数据权限异常问题修复;改造通知公告代码,调用新消息中心代码

fuyuchuan před 2 týdny
rodič
revize
e1bcaf7c44

+ 20 - 8
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysNoticeServiceImpl.java

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.system.domain.MceRequestVO;
 import com.usky.system.domain.SysNotice;
 import com.usky.system.domain.SysUser;
 import com.usky.system.mapper.SysNoticeMapper;
@@ -64,6 +66,7 @@ public class SysNoticeServiceImpl extends AbstractCrudService<SysNoticeMapper, S
      */
     @Override
     public int insertNotice(SysNotice notice) {
+        notice.setTenantId(SecurityUtils.getTenantId());
         noticeMapper.insertNotice(notice);
         int insertId = notice.getNoticeId();
 
@@ -86,15 +89,24 @@ public class SysNoticeServiceImpl extends AbstractCrudService<SysNoticeMapper, S
      * @param userIds 接收人
      */
     private void sendNotice(String infoContent, Integer id, String userName, List<Long> userIds) {
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("infoTitle", "通知公告");
-        jsonObject.put("infoContent", infoContent);
-        jsonObject.put("infoType", 1);
-        jsonObject.put("id", id);
-        jsonObject.put("userName", userName);
-        jsonObject.put("userIds", userIds);
+
+        // JSONObject jsonObject = new JSONObject();
+        // jsonObject.put("infoTitle", "通知公告");
+        // jsonObject.put("infoContent", infoContent);
+        // jsonObject.put("infoType", 1);
+        // jsonObject.put("id", id);
+        // jsonObject.put("userName", userName);
+        // jsonObject.put("userIds", userIds);
+        MceRequestVO mceRequestVO = new MceRequestVO();
+        mceRequestVO.setInfoTitle("通知公告");
+        mceRequestVO.setInfoContent(infoContent);
+        mceRequestVO.setInfoType("1");
+        mceRequestVO.setId(id);
+        mceRequestVO.setUserName(userName);
+        mceRequestVO.setUserIds(userIds);
         try {
-            mceReceiveService.add(jsonObject.toString());
+            //mceReceiveService.add(jsonObject.toString());
+            mceReceiveService.addMceReceive(mceRequestVO);
         } catch (Exception e) {
             log.error(String.format("公告:%d,消息发送失败:%s", id, e.getMessage()));
         }