From b665709ee0f6de90f2b61007bc18fb391afad859 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 21 Apr 2021 14:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/group/form/AllGroupListFormDTO.java | 7 ++- .../dto/notice/form/AddNoticeFormDTO.java | 12 +++- .../dto/notice/form/EditNoticeFormDTO.java | 13 ++++- .../dto/notice/form/NoticeCommentFormDTO.java | 5 ++ .../notice/form/NoticeCommentListFormDTO.java | 2 +- .../group/dto/notice/form/NoticeFileDTO.java | 23 ++++++++ .../dto/notice/form/ReadTypeFormDTO.java | 5 ++ .../group/controller/ResiGroupController.java | 9 +-- .../group/service/ResiGroupService.java | 3 +- .../service/impl/ResiGroupServiceImpl.java | 7 +-- .../controller/NoticeCommentController.java | 22 +++---- .../notice/controller/NoticeController.java | 21 ++----- .../NoticeReadRecordController.java | 24 +++----- .../notice/dao/NoticeReadRecordDao.java | 4 +- .../notice/service/NoticeCommentService.java | 8 +-- .../service/NoticeReadRecordService.java | 10 +--- .../modules/notice/service/NoticeService.java | 11 +--- .../impl/NoticeCommentServiceImpl.java | 22 +++---- .../impl/NoticeReadRecordServiceImpl.java | 19 ++---- .../service/impl/NoticeServiceImpl.java | 58 +++++++++---------- .../mapper/notice/NoticeReadRecordDao.xml | 7 ++- 21 files changed, 140 insertions(+), 152 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java index 32d4164244..232d6b647e 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java @@ -23,12 +23,17 @@ public class AllGroupListFormDTO implements Serializable { * 请求页码 */ @Min(1) - private int pageNo; + private int pageNo = 1; /** * 每页多少条数据 */ private int pageSize = 20; + /** + * token中用户Id + */ + private String userId; + public interface GroupList { } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java index d9345790fe..2344e94898 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java @@ -1,7 +1,6 @@ package com.epmet.resi.group.dto.notice.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -35,12 +34,19 @@ public class AddNoticeFormDTO { /** * 图片附件集合 */ - private List imageList; + private List imageList; /** * 文件附件url集合 */ - private List docList; + private List docList; + + /** + * token中用户Id + */ + private String userId; public interface Add{} public interface AddUserShow extends CustomerClientShowGroup {} + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java index 08573cae19..940077459f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java @@ -1,7 +1,6 @@ package com.epmet.resi.group.dto.notice.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -23,22 +22,30 @@ public class EditNoticeFormDTO { /** * 通知标题 */ + @NotBlank(message = "通知标题不能为空",groups = {EditNoticeFormDTO.EditUserShow.class}) @Length(max = 20, message = "通知标题不能超过20个字符",groups = {EditNoticeFormDTO.EditUserShow.class}) private String title; /** * 通知内容 */ + @NotBlank(message = "通知内容不能为空",groups = {EditNoticeFormDTO.EditUserShow.class}) @Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {EditNoticeFormDTO.EditUserShow.class}) private String content; /** * 图片附件集合 */ - private List imageList; + private List imageList; /** * 文件附件url集合 */ - private List docList; + private List docList; + + /** + * token中用户Id + */ + private String userId; public interface Edit{} public interface EditUserShow extends CustomerClientShowGroup {} + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java index 5fc28f52ef..c543bf7222 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java @@ -25,6 +25,11 @@ public class NoticeCommentFormDTO { @Length(max = 20, message = "评论内容不能超过300个字符",groups = {NoticeCommentFormDTO.UserShow.class}) private String commentContent; + /** + * token中用户Id + */ + private String userId; + public interface Comment{} public interface UserShow extends CustomerClientShowGroup {} } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java index 960ba374e5..8d9ad97476 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java @@ -23,7 +23,7 @@ public class NoticeCommentListFormDTO implements Serializable { * 请求页码 * */ @Min(1) - private int pageNo; + private int pageNo = 1; /** * 每页多少条数据 * */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java new file mode 100644 index 0000000000..a71ac3d509 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeFileDTO.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 小组通知保存、变更-接口入参 + */ +@NoArgsConstructor +@Data +public class NoticeFileDTO implements Serializable { + + private static final long serialVersionUID = -3930520724652521552L; + private String name; + private String url; + private String type; + private String format; + private Integer size; + private Integer duration; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java index f3170ebc9b..6477c87fb8 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java @@ -17,5 +17,10 @@ public class ReadTypeFormDTO { @NotBlank(message = "通知Id不能为空",groups = {ReadTypeFormDTO.Read.class}) private String noticeId; + /** + * token中用户Id + */ + private String userId; + public interface Read{} } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index 1d77fc28b9..f9f38417d8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -31,18 +31,12 @@ import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO; -import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; -import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; @@ -513,7 +507,8 @@ public class ResiGroupController { @PostMapping(value = "allgrouplist") public Result> allGroupList(@LoginUser TokenDto tokenDto, @RequestBody AllGroupListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AllGroupListFormDTO.GroupList.class); - return new Result>().ok(resiGroupService.allGroupList(tokenDto, formDTO)); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(resiGroupService.allGroupList(formDTO)); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index a27d726fc8..c2073a7952 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -20,7 +20,6 @@ package com.epmet.modules.group.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.resi.group.dto.UserRoleDTO; @@ -378,5 +377,5 @@ public interface ResiGroupService extends BaseService { * @Author sun * @Description 所有小组查询 **/ - List allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO); + List allGroupList(AllGroupListFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 6cc56ca171..5a54c45f06 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -30,7 +30,6 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; @@ -1500,7 +1499,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) { + public List allGroupList(AllGroupListFormDTO formDTO) { //1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序 int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); formDTO.setPageNo(pageIndex); @@ -1511,7 +1510,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId()); + Result> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(formDTO.getUserId()); if (!resultDTOList.success()) { throw new RenException("调用user服务,获取用户基础数据失败"); } @@ -1529,7 +1528,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> noticeCommentList(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentListFormDTO formDTO){ + public Result> noticeCommentList(@RequestBody NoticeCommentListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeCommentListFormDTO.CommentList.class); - return new Result>().ok(noticeCommentService.noticeCommentList(tokenDto, formDTO)); + return new Result>().ok(noticeCommentService.noticeCommentList(formDTO)); } } \ No newline at end of file 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 02d6bf79ec..ad2a0dd9dc 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 @@ -18,16 +18,9 @@ package com.epmet.modules.notice.controller; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.modules.notice.excel.NoticeExcel; import com.epmet.modules.notice.service.NoticeService; import com.epmet.resi.group.dto.notice.NoticeDTO; import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO; @@ -37,10 +30,6 @@ import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; - /** * 小组通知表 @@ -70,7 +59,8 @@ public class NoticeController { @PostMapping(value = "add") public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class); - noticeService.add(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeService.add(formDTO); return new Result(); } @@ -83,7 +73,8 @@ public class NoticeController { @PostMapping(value = "edit") public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); - noticeService.edit(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeService.edit(formDTO); return new Result(); } @@ -94,9 +85,9 @@ public class NoticeController { * @Description 小组通知详情 **/ @PostMapping(value = "noticedetail") - public Result noticeDetail(@LoginUser TokenDto tokenDto, @RequestBody NoticeDetailFormDTO formDTO){ + public Result noticeDetail(@RequestBody NoticeDetailFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeDetailFormDTO.Detail.class); - return new Result().ok(noticeService.noticeDetail(tokenDto, formDTO)); + return new Result().ok(noticeService.noticeDetail(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java index ca1dcf86b2..a4b992fd0f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java @@ -18,27 +18,18 @@ package com.epmet.modules.notice.controller; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.modules.notice.excel.NoticeReadRecordExcel; import com.epmet.modules.notice.service.NoticeReadRecordService; -import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO; import com.epmet.resi.group.dto.notice.form.ReadTypeFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** @@ -61,9 +52,9 @@ public class NoticeReadRecordController { * @Description 通知已读未读列表查询 **/ @PostMapping(value = "noticereadlist") - public Result noticeReadList(@LoginUser TokenDto tokenDto, @RequestBody NoticeReadListFormDTO formDTO){ + public Result noticeReadList(@RequestBody NoticeReadListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, NoticeReadListFormDTO.List.class); - return new Result().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO)); + return new Result().ok(noticeReafdRecordService.noticeReadList(formDTO)); } /** @@ -75,7 +66,8 @@ public class NoticeReadRecordController { @PostMapping(value = "readtype") public Result readType(@LoginUser TokenDto tokenDto, @RequestBody ReadTypeFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, ReadTypeFormDTO.Read.class); - noticeReafdRecordService.readType(tokenDto, formDTO); + formDTO.setUserId(tokenDto.getUserId()); + noticeReafdRecordService.readType(formDTO); return new Result(); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java index 2375b63db6..3842c4fd98 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java @@ -42,9 +42,9 @@ public interface NoticeReadRecordDao extends BaseDao { /** * @Author sun - * @Description 根据通知Id查询组成员已读未读数据 + * @Description 根据通知Id查询组成员已读未读数据,抛去组长数据 **/ - List getByNoticeId(@Param("noticeId") String noticeId); + List getByNoticeId(@Param("noticeId") String noticeId, @Param("leaderId") String leaderId); /** * @Author sun diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java index 6e3a82690d..0ac50c21e7 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java @@ -18,16 +18,12 @@ package com.epmet.modules.notice.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.notice.entity.NoticeCommentEntity; -import com.epmet.resi.group.dto.notice.NoticeCommentDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import java.util.List; -import java.util.Map; /** * 小组通知评论表 @@ -43,7 +39,7 @@ public interface NoticeCommentService extends BaseService { * @Author sun * @Description 发布通知评论 **/ - void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO); + void noticeComment(NoticeCommentFormDTO formDTO); /** * @param formDTO @@ -51,5 +47,5 @@ public interface NoticeCommentService extends BaseService { * @Author sun * @Description 通知评论列表查询 **/ - List noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO); + List noticeCommentList(NoticeCommentListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java index 17d41252c0..fd4a4d6d4b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java @@ -18,17 +18,11 @@ package com.epmet.modules.notice.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.notice.entity.NoticeReadRecordEntity; -import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import com.epmet.resi.group.dto.notice.form.NoticeReadListFormDTO; import com.epmet.resi.group.dto.notice.form.ReadTypeFormDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; -import java.util.List; -import java.util.Map; - /** * 小组通知组成员阅读记录表 * @@ -43,7 +37,7 @@ public interface NoticeReadRecordService extends BaseService { * @Author sun * @Description 小组通知保存 **/ - void add(TokenDto tokenDto, AddNoticeFormDTO formDTO); + void add(AddNoticeFormDTO formDTO); /** * @param formDTO @@ -62,7 +57,7 @@ public interface NoticeService extends BaseService { * @Author sun * @Description 小组通知变更 **/ - void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO); + void edit(EditNoticeFormDTO formDTO); /** * @param formDTO @@ -70,5 +65,5 @@ public interface NoticeService extends BaseService { * @Author sun * @Description 小组通知详情 **/ - NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO); + NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java index 4bd79318c2..b4ee53de76 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java @@ -17,19 +17,13 @@ package com.epmet.modules.notice.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.UserBaseInfoResultDTO; @@ -43,9 +37,7 @@ import com.epmet.modules.notice.service.NoticeService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.constant.TopicConstant; -import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; -import com.epmet.resi.group.dto.notice.NoticeCommentDTO; import com.epmet.resi.group.dto.notice.NoticeDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; @@ -58,7 +50,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; /** @@ -92,7 +86,7 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl", formDTO.getNoticeId())); } ResiGroupMemberDTO resiGroupMemberDTO = - resiGroupMemberService.getResiGroupMember(notice.getGroupId(), tokenDto.getUserId()); + resiGroupMemberService.getResiGroupMember(notice.getGroupId(), formDTO.getUserId()); //查看当前用户是否被禁言或者被移除 if (null != resiGroupMemberDTO) { if (MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())) { @@ -154,7 +148,7 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO) { + public List noticeCommentList(NoticeCommentListFormDTO formDTO) { //1.分页查询通知评论列表 formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); List resultList = baseDao.getNoticeCommentList(formDTO); 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 ad26bc805e..eac1b1b18d 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 @@ -17,14 +17,8 @@ package com.epmet.modules.notice.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.result.UserBaseInfoResultDTO; @@ -45,9 +39,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; /** @@ -66,7 +58,6 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl readList = new ArrayList<>(); List unReadList = new ArrayList<>(); @@ -82,7 +73,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl list = baseDao.getByNoticeId(formDTO.getNoticeId()); + List list = baseDao.getByNoticeId(formDTO.getNoticeId(), leaderId); //2.调用user服务,查询人员基础数据 List userIdList = list.stream().map(NoticeReadRecordDTO::getUserId).collect(Collectors.toList()); @@ -132,9 +123,9 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private NoticeAttachmentService noticeAttachmentService; @@ -111,7 +110,7 @@ public class NoticeServiceImpl extends BaseServiceImpl @Autowired private NoticeReadRecordService noticeReafdRecordService; @Autowired - private NoticeReadRecordDao noticeReafdRecordDao; + private NoticeReadRecordDao noticeReadRecordDao; @Override @@ -128,7 +127,7 @@ public class NoticeServiceImpl extends BaseServiceImpl **/ @Override @Transactional(rollbackFor = Exception.class) - public void add(TokenDto tokenDto, AddNoticeFormDTO formDTO) { + public void add(AddNoticeFormDTO formDTO) { //1.查询组内成员数据 List memberList = resiGroupMemberDao.getMemberList(formDTO.getGroupId()); if (CollUtil.isEmpty(memberList)) { @@ -138,7 +137,7 @@ public class NoticeServiceImpl extends BaseServiceImpl //2.校验当前操作人员是否为组长 AtomicReference bl = new AtomicReference<>(true); memberList.forEach(m -> { - if (m.getCustomerUserId().equals(tokenDto.getUserId()) && "leader".equals(m.getGroupLeaderFlag())) { + if (m.getCustomerUserId().equals(formDTO.getUserId()) && "leader".equals(m.getGroupLeaderFlag())) { bl.set(false); } }); @@ -150,30 +149,27 @@ public class NoticeServiceImpl extends BaseServiceImpl List wordList = new ArrayList<>(); wordList.add(formDTO.getTitle()); wordList.add(formDTO.getContent()); - List imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); + List imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); safetyCheck(wordList, imageList); //4.保存小组通知基础数据 //4-1.获取小组信息 ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); if (null == groupEntity) { - throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); + throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", formDTO.getUserId())); } //4-2.获取token用户所属组织信息 - LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); - dto.setApp(tokenDto.getApp()); - dto.setClient(tokenDto.getClient()); - dto.setUserId(tokenDto.getUserId()); - Result result = epmetUserOpenFeignClient.getLoginUserDetails(dto); - if (!result.success() || org.springframework.util.StringUtils.isEmpty(result.getData().getAgencyId())) { - throw new RenException(String.format("调用user服务查询用户数据失败,userId->", tokenDto.getUserId())); + Result result = govOrgOpenFeignClient.queryGridInfo(groupEntity.getGridId()); + if (!result.success() || org.springframework.util.StringUtils.isEmpty(result.getData().getParentAgencyId())) { + throw new RenException(String.format("调用user服务查询用户数据失败,userId->", formDTO.getUserId())); } - LoginUserDetailsResultDTO resultDTO = result.getData(); + GridInfoResultDTO resultDTO = result.getData(); + //4-3.保存通知数据 NoticeEntity entity = new NoticeEntity(); entity.setCustomerId(resultDTO.getCustomerId()); - entity.setAgencyId(resultDTO.getAgencyId()); + entity.setAgencyId(resultDTO.getParentAgencyId()); entity.setGridId(groupEntity.getGridId()); entity.setGroupId(formDTO.getGroupId()); entity.setTitle(formDTO.getTitle()); @@ -237,7 +233,7 @@ public class NoticeServiceImpl extends BaseServiceImpl if ("leader".equals(m.getGroupLeaderFlag())) { reafdRecord.setReadFlag(ReadFlagConstant.READ); }else { - reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); + reafdRecord.setReadFlag("un_read"); } reafdRecordList.add(reafdRecord); }); @@ -274,7 +270,7 @@ public class NoticeServiceImpl extends BaseServiceImpl * @Description 小组通知变更 **/ @Override - public void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO) { + public void edit(EditNoticeFormDTO formDTO) { //1.查询通知是否存在 NoticeEntity entity = baseDao.selectById(formDTO.getNoticeId()); if (null == entity) { @@ -284,7 +280,7 @@ public class NoticeServiceImpl extends BaseServiceImpl List wordList = new ArrayList<>(); wordList.add(formDTO.getTitle()); wordList.add(formDTO.getContent()); - List imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); + List imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); safetyCheck(wordList, imageList); //3.查询组成员列表数据 @@ -346,7 +342,7 @@ public class NoticeServiceImpl extends BaseServiceImpl } //6.通知已读未读消息表数据先删后增 - noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); + noticeReadRecordDao.delByNoticeId(formDTO.getNoticeId()); List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); @@ -358,7 +354,7 @@ public class NoticeServiceImpl extends BaseServiceImpl if ("leader".equals(m.getGroupLeaderFlag())) { reafdRecord.setReadFlag(ReadFlagConstant.READ); }else { - reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); + reafdRecord.setReadFlag("un_read"); } reafdRecordList.add(reafdRecord); }); @@ -370,7 +366,7 @@ public class NoticeServiceImpl extends BaseServiceImpl //7-1.获取小组信息 ResiGroupEntity groupEntity = resiGroupDao.selectById(entity.getGroupId()); if (null == groupEntity) { - throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); + throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", formDTO.getUserId())); } //7-2.推送站内信信息 List userMessageFormDTOS = new ArrayList<>(); @@ -400,7 +396,7 @@ public class NoticeServiceImpl extends BaseServiceImpl * @Description 小组通知详情 **/ @Override - public NoticeDetailResultDTO noticeDetail(TokenDto tokenDto, NoticeDetailFormDTO formDTO) { + public NoticeDetailResultDTO noticeDetail(NoticeDetailFormDTO formDTO) { NoticeDetailResultDTO resultDTO = new NoticeDetailResultDTO(); List imageList = new ArrayList<>(); List docList = new ArrayList<>(); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml index 74b99c2e1b..3848b66959 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml @@ -7,17 +7,18 @@ SELECT * FROM - notice_reafd_record + notice_read_record WHERE del_flag = '0' AND notice_id = #{noticeId} + AND user_id != #{leaderId}