From 14927c56ea7a12face7855d32792f9c344908c6b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 25 Apr 2021 09:22:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=85=B3=E9=97=AD=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=B4=BB=E5=8A=A8=EF=BC=8C=E4=B8=8D=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E5=B7=B2=E8=AF=BB=E7=8A=B6=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GroupActInfoServiceImpl.java | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java index 3f2e21e297..60c079d945 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java @@ -193,8 +193,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl memberDTOList) { - /*String actReadKey= RedisKeys.getGroupMsgReadKey(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId()); - String actShoudReadUserKey=RedisKeys.getGroupMsgShouldReadUser(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId());*/ List readRecordEntityList=new ArrayList<>(); memberDTOList.forEach(memberDTO->{ ActReadRecordEntity actReadRecordEntity=new ActReadRecordEntity(); @@ -206,11 +204,8 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl{ @@ -505,27 +500,30 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl NumConstant.ZERO ? false : true); - //返回详情,并且已读状态 - ActReadRecordEntity actReadRecordEntity=actReadRecordDao.selectUserRec(formDTO.getGroupActId(),formDTO.getUserId()); - if(null== actReadRecordEntity){ - if(!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())){ - //插入已读记录,默认不属于应读人。 - ActReadRecordEntity insertEntity=new ActReadRecordEntity(); - insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); - insertEntity.setGroupActId(formDTO.getGroupActId()); - insertEntity.setReadFlag(GroupActConstant.READ); - insertEntity.setShouldBeRead(Constant.NO); - insertEntity.setUserId(formDTO.getUserId()); - insertEntity.setGridId(groupActInfoEntity.getGridId()); - insertEntity.setGroupId(groupActInfoEntity.getGroupId()); - actReadRecordDao.insert(insertEntity); - } - }else{ - if(GroupActConstant.UN_READ.equals(actReadRecordEntity.getReadFlag())){ - //未读->已读 - actReadRecordEntity.setReadFlag(GroupActConstant.READ); - actReadRecordEntity.setUpdatedTime(new Date()); - actReadRecordDao.updateById(actReadRecordEntity); + if (!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())) { + //如果活动关闭,则不更新已读记录 + //非关闭状态下,返回详情,并且已读状态 + ActReadRecordEntity actReadRecordEntity = actReadRecordDao.selectUserRec(formDTO.getGroupActId(), formDTO.getUserId()); + if (null == actReadRecordEntity) { + if (!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())) { + //插入已读记录,默认不属于应读人。 + ActReadRecordEntity insertEntity = new ActReadRecordEntity(); + insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setReadFlag(GroupActConstant.READ); + insertEntity.setShouldBeRead(Constant.NO); + insertEntity.setUserId(formDTO.getUserId()); + insertEntity.setGridId(groupActInfoEntity.getGridId()); + insertEntity.setGroupId(groupActInfoEntity.getGroupId()); + actReadRecordDao.insert(insertEntity); + } + } else { + if (GroupActConstant.UN_READ.equals(actReadRecordEntity.getReadFlag())) { + //未读->已读 + actReadRecordEntity.setReadFlag(GroupActConstant.READ); + actReadRecordEntity.setUpdatedTime(new Date()); + actReadRecordDao.updateById(actReadRecordEntity); + } } } return resultDTO; From 6760e37ec03977fa30e3a76d5c3c474bd31f01ed Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 25 Apr 2021 09:26:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=85=81=E8=AE=B8=E7=BC=96=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E4=B9=9F=E4=B8=8D=E5=86=8D=E7=AE=97=E6=98=AF?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notice/controller/NoticeController.java | 3 --- .../impl/NoticeReadRecordServiceImpl.java | 16 +++++++++++----- .../notice/service/impl/NoticeServiceImpl.java | 8 ++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java index 0736625518..fd4328ddaa 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java @@ -79,9 +79,6 @@ public class NoticeController { @PostMapping(value = "edit") public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); - if(formDTO.getExpirationTime().before(new Date())){ - throw new RenException("通知过期时间不能早于当前时间"); - } formDTO.setUserId(tokenDto.getUserId()); noticeService.edit(formDTO); return new Result(); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java index 93b728bcfb..6d135a0b8c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java @@ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -138,13 +139,18 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl if (null == entity) { throw new RenException(String.format("小组通知变更,获取通知数据失败,通知Id->", formDTO.getNoticeId())); } + //通知已过期时不允许再次变更 + if(entity.getChangeTime().before(new Date())){ + throw new RenException("通知已过期不允许再次变更"); + } + if(formDTO.getExpirationTime().before(new Date())){ + throw new RenException("通知过期时间不能早于当前时间"); + } + //2.文字、图片安全校验 List wordList = new ArrayList<>(); wordList.add(formDTO.getTitle()); From 7eada58795e51ece84df8efab3371f74584d0370 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 25 Apr 2021 09:29:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BB=84=E9=95=BF=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GroupActInfoServiceImpl.java | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java index 60c079d945..aecf370b48 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java @@ -198,15 +198,17 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl{ actReadRecordDao.insert(readRecordEntity); @@ -616,28 +618,31 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl { - StringBuffer name = new StringBuffer(); - StringBuffer url = new StringBuffer(); - resultDTOList.forEach(user -> { - if (l.getUserId().equals(user.getUserId())) { - name.append(user.getSurname()).append(user.getName()); - url.append(user.getHeadImgUrl()); + //不展示组长的记录 + if (!l.getUserId().equals(actReadViewFormDTO.getUserId())) { + StringBuffer name = new StringBuffer(); + StringBuffer url = new StringBuffer(); + resultDTOList.forEach(user -> { + if (l.getUserId().equals(user.getUserId())) { + name.append(user.getSurname()).append(user.getName()); + url.append(user.getHeadImgUrl()); + } + }); + if (GroupActConstant.READ.equals(l.getReadFlag())) { + //已读 + NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord(); + read.setUserId(l.getUserId()); + read.setUserName(name.toString()); + read.setUserHeadPhoto(url.toString()); + readList.add(read); + } else { + //未读 + NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord(); + unRead.setUserId(l.getUserId()); + unRead.setUserName(name.toString()); + unRead.setUserHeadPhoto(url.toString()); + unReadList.add(unRead); } - }); - if (GroupActConstant.READ.equals(l.getReadFlag())) { - //已读 - NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord(); - read.setUserId(l.getUserId()); - read.setUserName(name.toString()); - read.setUserHeadPhoto(url.toString()); - readList.add(read); - } else { - //未读 - NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord(); - unRead.setUserId(l.getUserId()); - unRead.setUserName(name.toString()); - unRead.setUserHeadPhoto(url.toString()); - unReadList.add(unRead); } });