diff --git a/src/main/java/neatlogic/framework/dao/cache/NeatLogicConcurrentSafeCache.java b/src/main/java/neatlogic/framework/dao/cache/NeatLogicConcurrentSafeCache.java index 270679736d215d5e23ff83dfe4708c7a22705d9f..84f311e2ba75c425d613a0ae2427a1d5445f2b76 100644 --- a/src/main/java/neatlogic/framework/dao/cache/NeatLogicConcurrentSafeCache.java +++ b/src/main/java/neatlogic/framework/dao/cache/NeatLogicConcurrentSafeCache.java @@ -141,8 +141,8 @@ public class NeatLogicConcurrentSafeCache implements Cache { } if (flag) { if (obj != null) { - if (LOCAL_LOCK_MAP.containsValue(lock)) { - logger.error("NeatLogicConcurrentSafeCache.LOCAL_LOCK_MAP中的锁对象没有被正常移除"); + if (LOCAL_LOCK_MAP.get(lockKey) == lock) { + logger.error("NeatLogicConcurrentSafeCache.LOCAL_LOCK_MAP中的锁对象没有被正常移除,lockKey = " + lockKey); } // 获取到锁后,从缓存中得到的结果不为null,不会再查询数据库,也不会调用putObject方法,所以要在这里释放该锁 lock.unlock(); @@ -157,6 +157,8 @@ public class NeatLogicConcurrentSafeCache implements Cache { lock.unlock(); } } + } else { + logger.error("NeatLogicConcurrentSafeCache 获取锁超时 lockKey = " + lockKey); } } return obj; diff --git a/src/main/java/neatlogic/framework/message/dao/mapper/MessageMapper.xml b/src/main/java/neatlogic/framework/message/dao/mapper/MessageMapper.xml index 0ed00da6cd91befbf11ec34f12c00c351ac7ecfc..1ad914f860ad4d3b555368d517c54d041ec0152e 100755 --- a/src/main/java/neatlogic/framework/message/dao/mapper/MessageMapper.xml +++ b/src/main/java/neatlogic/framework/message/dao/mapper/MessageMapper.xml @@ -2,6 +2,8 @@ + + select `id`, @@ -132,7 +134,7 @@ where `system_notice_id` = #{value} - select distinct a.`id` from @@ -141,8 +143,9 @@ on a.`id` = b.`system_notice_id` where a.`status` = 'issued' + AND a.`id` NOT IN (SELECT `system_notice_id` FROM `system_notice_user` WHERE `user_uuid` = #{userUuid}) and b.`uuid` in - + #{item} diff --git a/src/main/java/neatlogic/framework/systemnotice/dto/SystemNoticeRecipientVo.java b/src/main/java/neatlogic/framework/systemnotice/dto/SystemNoticeRecipientVo.java index 8ce137470578db821282daf56ce18a0d3d2b8eaf..3061c46969a27cf36a29ab389788a42d34393c49 100755 --- a/src/main/java/neatlogic/framework/systemnotice/dto/SystemNoticeRecipientVo.java +++ b/src/main/java/neatlogic/framework/systemnotice/dto/SystemNoticeRecipientVo.java @@ -3,6 +3,8 @@ package neatlogic.framework.systemnotice.dto; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.restful.annotation.EntityField; +import java.io.Serializable; + /** * @Title: SystemNoticeRecipientVo * @Package: neatlogic.framework.systemnotice.dto @@ -10,7 +12,8 @@ import neatlogic.framework.restful.annotation.EntityField; * @Author: laiwt * @Date: 2021/1/13 17:40 **/ -public class SystemNoticeRecipientVo{ +public class SystemNoticeRecipientVo implements Serializable { + private static final long serialVersionUID = 2910089979265665036L; @EntityField(name = "公告id", type = ApiParamType.LONG) private Long systemNoticeId; @EntityField(name = "通知对象uuid", type = ApiParamType.STRING) diff --git a/src/main/java/neatlogic/module/framework/systemnotice/service/SystemNoticeServiceImpl.java b/src/main/java/neatlogic/module/framework/systemnotice/service/SystemNoticeServiceImpl.java index 239f132ed0b044aa18532711ee4229a2d6268a3a..3241d27858ebe6f49d0295ecc8413c573f3e9cf4 100644 --- a/src/main/java/neatlogic/module/framework/systemnotice/service/SystemNoticeServiceImpl.java +++ b/src/main/java/neatlogic/module/framework/systemnotice/service/SystemNoticeServiceImpl.java @@ -104,20 +104,21 @@ public class SystemNoticeServiceImpl implements SystemNoticeService, ISystemNoti @Override public void pullIssuedSystemNotice() { -// List recipientUuidList = getRecipientUuidList(); -// List issuedNoticeList = systemNoticeMapper.getIssuedNoticeIdListByRecipientUuidList(recipientUuidList); -// if (CollectionUtils.isNotEmpty(issuedNoticeList)) { -// List noticeUserVoList = new ArrayList<>(); -// for (Long id : issuedNoticeList) { -// noticeUserVoList.add(new SystemNoticeUserVo(id, UserContext.get().getUserUuid(true))); -// } -// systemNoticeMapper.batchInsertSystemNoticeUser(noticeUserVoList); -// } - String userUuid = UserContext.get().getUserUuid(); - List uuidList = UserContext.get().getUuidList(); - uuidList.add(userUuid); - uuidList.add(UserType.ALL.getValue()); - systemNoticeMapper.insertInsertSystemNoticeUser(userUuid, uuidList); + String userUuid = UserContext.get().getUserUuid(true); + List recipientUuidList = getRecipientUuidList(); + List issuedNoticeList = systemNoticeMapper.getIssuedNoticeIdListByUserUuidAndRecipientUuidList(userUuid, recipientUuidList); + if (CollectionUtils.isNotEmpty(issuedNoticeList)) { + List noticeUserVoList = new ArrayList<>(); + for (Long id : issuedNoticeList) { + noticeUserVoList.add(new SystemNoticeUserVo(id, userUuid)); + } + systemNoticeMapper.batchInsertSystemNoticeUser(noticeUserVoList); + } +// String userUuid = UserContext.get().getUserUuid(); +// List uuidList = UserContext.get().getUuidList(); +// uuidList.add(userUuid); +// uuidList.add(UserType.ALL.getValue()); +// systemNoticeMapper.insertInsertSystemNoticeUser(userUuid, uuidList); } @Override @@ -237,11 +238,11 @@ public class SystemNoticeServiceImpl implements SystemNoticeService, ISystemNoti } private List getRecipientUuidList() { - List uuidList = new ArrayList<>(); - uuidList.add(UserContext.get().getUserUuid(true)); + List uuidList = UserContext.get().getUuidList(); +// uuidList.add(UserContext.get().getUserUuid(true)); uuidList.add(UserType.ALL.getValue()); - uuidList.addAll(teamMapper.getTeamUuidListByUserUuid(UserContext.get().getUserUuid(true))); - uuidList.addAll(roleMapper.getRoleUuidListByUserUuid(UserContext.get().getUserUuid(true))); +// uuidList.addAll(teamMapper.getTeamUuidListByUserUuid(UserContext.get().getUserUuid(true))); +// uuidList.addAll(roleMapper.getRoleUuidListByUserUuid(UserContext.get().getUserUuid(true))); return uuidList; } }