From 11bf503e0fa891ee023e68cc439e1662247bf75e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 10:01:11 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/notice/form/NoticeCommentFormDTO.java | 28 +++++ .../controller/NoticeCommentController.java | 16 +++ .../notice/service/NoticeCommentService.java | 10 ++ .../impl/NoticeCommentServiceImpl.java | 101 +++++++++++++++++- 4 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java 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 new file mode 100644 index 0000000000..b2f91f22f9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * @Author sun + * @Description 小组通知编辑-接口入参 + */ +@Data +public class NoticeCommentFormDTO { + + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {NoticeCommentFormDTO.Comment.class}) + private String noticeId; + /** + * 评论内容300 + */ + @NotBlank(message = "评论内容不能为空",groups = {NoticeCommentFormDTO.Comment.class}) + @Length(max = 20, message = "评论内容不能超过300个字符") + private String commentContent; + + public interface Comment{} +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java index a7114f3834..4d85bbe530 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java @@ -17,7 +17,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; @@ -28,6 +30,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.modules.notice.excel.NoticeCommentExcel; import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.resi.group.dto.notice.NoticeCommentDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -91,4 +94,17 @@ public class NoticeCommentController { ExcelUtils.exportExcelToTarget(response, null, list, NoticeCommentExcel.class); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 发布通知评论 + **/ + @PostMapping(value = "noticecomment") + public Result noticeComment(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, NoticeCommentFormDTO.Comment.class); + noticeCommentService.noticeComment(tokenDto, formDTO); + return new Result(); + } + } \ No newline at end of file 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 0204df5cc9..c0cadd139f 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 @@ -19,8 +19,10 @@ 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 java.util.List; import java.util.Map; @@ -92,4 +94,12 @@ public interface NoticeCommentService extends BaseService { * @date 2021-04-19 */ void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 发布通知评论 + **/ + void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO 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 81ed00809a..c4847f0581 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 @@ -21,21 +21,44 @@ 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.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.modules.member.service.ResiGroupMemberService; import com.epmet.modules.notice.dao.NoticeCommentDao; import com.epmet.modules.notice.entity.NoticeCommentEntity; +import com.epmet.modules.notice.entity.NoticeEntity; import com.epmet.modules.notice.redis.NoticeCommentRedis; import com.epmet.modules.notice.service.NoticeCommentService; +import com.epmet.modules.notice.service.NoticeService; +import com.epmet.modules.topic.service.ResiTopicService; +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.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.topic.ResiTopicDTO; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.UUID; /** * 小组通知评论表 @@ -45,9 +68,18 @@ import java.util.Map; */ @Service public class NoticeCommentServiceImpl extends BaseServiceImpl implements NoticeCommentService { - + private final Log logger = LogFactory.getLog(getClass()); @Autowired private NoticeCommentRedis noticeCommentRedis; + @Autowired + private NoticeService noticeService; + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Override public PageData page(Map params) { @@ -65,8 +97,8 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -101,4 +133,67 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error(String.format(TopicConstant.REVIEW_TOPIC, commentContent)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + + //2.判断当前用户是否被禁言、移除、非本组成员 + NoticeDTO notice = noticeService.get(formDTO.getNoticeId()); + if (null == notice) { + logger.error(ModuleConstant.NO_SUCH_TOPIC); + throw new RenException(ModuleConstant.NO_SUCH_TOPIC); + } + + ResiGroupMemberDTO resiGroupMemberDTO = + resiGroupMemberService.getResiGroupMember(notice.getGroupId(), tokenDto.getUserId()); + //查看当前用户是否被禁言或者被移除 + if (null != resiGroupMemberDTO) { + if (MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())) { + //当前用户被禁言 + logger.error(ModuleConstant.SLIENT_MEMBER); + throw new RenException(ModuleConstant.SLIENT_MEMBER); + } else if (MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())) { + //当前用户已被移出群 + logger.error(ModuleConstant.REMOVED_MEMBER); + throw new RenException(ModuleConstant.REMOVED_MEMBER); + } + } else { + //当前用户非组内成员 + logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); + throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); + } + + //3.通知评论表新增数据 + NoticeCommentEntity entity = new NoticeCommentEntity(); + entity.setCustomerId(notice.getCustomerId()); + entity.setNoticeId(formDTO.getNoticeId()); + entity.setCommentContent(formDTO.getCommentContent()); + insert(entity); + } + } \ No newline at end of file From 73531fd1f19007ef6dfc9126c70658b9a3a41112 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 10:43:12 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comment/result/ResiCommentResultDTO.java | 2 + .../notice/form/NoticeCommentListFormDTO.java | 33 ++++++++++ .../result/NoticeCommentListResultDTO.java | 44 +++++++++++++ .../controller/NoticeCommentController.java | 14 +++++ .../modules/notice/dao/NoticeCommentDao.java | 11 +++- .../notice/service/NoticeCommentService.java | 10 +++ .../impl/NoticeCommentServiceImpl.java | 63 +++++++++++++++---- .../mapper/notice/NoticeCommentDao.xml | 15 +++++ 8 files changed, 180 insertions(+), 12 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java index 2a2f287460..c28985e054 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.resi.group.dto.comment.result; import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -40,6 +41,7 @@ public class ResiCommentResultDTO implements Serializable { /** * 用户Id 评论者Id * */ + @JsonIgnore private String userId; /** 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 new file mode 100644 index 0000000000..960ba374e5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 通知评论列表查询-接口入参 + */ +@Data +public class NoticeCommentListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {NoticeCommentListFormDTO.CommentList.class}) + private String noticeId; + /** + * 请求页码 + * */ + @Min(1) + private int pageNo; + /** + * 每页多少条数据 + * */ + private int pageSize = 20; + + public interface CommentList{} +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java new file mode 100644 index 0000000000..c086df0f94 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java @@ -0,0 +1,44 @@ +package com.epmet.resi.group.dto.notice.result; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author sun + * @Description 通知评论列表查询-接口返参 + */ +@Data +public class NoticeCommentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 评论Id + * */ + private String noticeCommentId; + /** + * 评论内容 + * */ + private String commentContent; + /** + * 评论者头像 + * */ + private String commentUserHeadPhoto; + /** + * 评论者姓名 + * */ + private String commentUserName; + /** + * 评论时间 yyyy-MM-dd HH:mm + * */ + @JSONField(format="yyyy-MM-dd HH:mm") + private Date commentTime; + /** + * 用户Id 评论者Id + * */ + private String userId; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java index 4d85bbe530..f3972f4478 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentController.java @@ -31,6 +31,8 @@ import com.epmet.modules.notice.excel.NoticeCommentExcel; import com.epmet.modules.notice.service.NoticeCommentService; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -107,4 +109,16 @@ public class NoticeCommentController { return new Result(); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 通知评论列表查询 + **/ + @PostMapping(value = "noticecommentlist") + public Result> noticeCommentList(@LoginUser TokenDto tokenDto, @RequestBody NoticeCommentListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, NoticeCommentListFormDTO.CommentList.class); + return new Result>().ok(noticeCommentService.noticeCommentList(tokenDto, formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java index db988edb81..308fc3ea0a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentDao.java @@ -19,8 +19,12 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.notice.entity.NoticeCommentEntity; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 小组通知评论表 * @@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface NoticeCommentDao extends BaseDao { - + + /** + * @Author sun + * @Description 分页查询通知评论列表 + **/ + List getNoticeCommentList(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/NoticeCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java index c0cadd139f..50b3beaa9d 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 @@ -23,6 +23,8 @@ 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; @@ -102,4 +104,12 @@ public interface NoticeCommentService extends BaseService { * @Description 发布通知评论 **/ void noticeComment(TokenDto tokenDto, NoticeCommentFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 通知评论列表查询 + **/ + List noticeCommentList(TokenDto tokenDto, 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/impl/NoticeCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java index c4847f0581..f3b2671eb4 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 @@ -21,6 +21,7 @@ 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; @@ -31,22 +32,24 @@ 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; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.notice.dao.NoticeCommentDao; import com.epmet.modules.notice.entity.NoticeCommentEntity; -import com.epmet.modules.notice.entity.NoticeEntity; import com.epmet.modules.notice.redis.NoticeCommentRedis; import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.modules.notice.service.NoticeService; -import com.epmet.modules.topic.service.ResiTopicService; 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.topic.ResiTopicDTO; +import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -55,10 +58,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; +import java.util.stream.Collectors; /** * 小组通知评论表 @@ -71,14 +72,16 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl noticeCommentList(TokenDto tokenDto, NoticeCommentListFormDTO formDTO) { + //1.分页查询通知评论列表 + formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); + List resultList = baseDao.getNoticeCommentList(formDTO); + if (resultList.size() < NumConstant.ONE) { + return new ArrayList<>(); + } + + //2.调用user服务,查询评论人员基础信息 + List userIdList = resultList.stream().map(NoticeCommentListResultDTO::getUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List resultDTOList = result.getData(); + + //3.封装数据并返回 + resultList.forEach(l -> { + StringBuffer name = new StringBuffer(); + resultDTOList.forEach(user -> { + if (l.getUserId().equals(user.getUserId())) { + name.append(null == user.getSurname() ? "" : user.getSurname()).append(null == user.getName() ? "" : user.getName()); + l.setCommentUserHeadPhoto(user.getHeadImgUrl()); + } + }); + l.setCommentUserName(name.toString()); + }); + + return resultList; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml index 90c7baed49..a5612ddcbf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml @@ -3,5 +3,20 @@ + \ No newline at end of file From cfac35ed5fdc2b52729974c193257ef6e5128f30 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 10:53:06 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=B7=B2=E8=AF=BB?= =?UTF-8?q?=E6=9C=AA=E8=AF=BB=E5=88=97=E8=A1=A8=EF=BC=8C=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85=20=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 4 +- .../dto/act/form/ActReadViewFormDTO.java | 29 ++++ .../dto/act/result/ActDetailResultDTO.java | 143 +++++++++++++++++- .../controller/GroupActInfoController.java | 16 ++ .../act/dao/ActOperationRecordDao.java | 9 +- .../modules/act/dao/ActReadRecordDao.java | 26 ++++ .../modules/act/dao/GroupActContentDao.java | 20 ++- .../act/service/GroupActInfoService.java | 10 ++ .../service/impl/GroupActInfoServiceImpl.java | 119 ++++++++++++++- .../mapper/act/ActOperationRecordDao.xml | 15 +- .../resources/mapper/act/ActReadRecordDao.xml | 24 +++ .../mapper/act/GroupActContentDao.xml | 15 +- 12 files changed, 418 insertions(+), 12 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index b54663f866..7e745709a6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -166,8 +166,8 @@ public enum EpmetErrorCode { PLEASE_INPUT_ACT_CONTENT(8903,"请输入活动内容,或添加图片"), GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"), GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"), - PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"); - + PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), + NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"); private int code; private String msg; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java new file mode 100644 index 0000000000..dacf0fbb27 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActReadViewFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 016、活动已读未读列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/19 19:36 + */ +@Data +public class ActReadViewFormDTO implements Serializable { + private static final long serialVersionUID = -7382937811770356934L; + + public interface AddUserInternalGroup { + } + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} + diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java index 7b019f904d..37507b4009 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java @@ -1,10 +1,149 @@ package com.epmet.resi.group.dto.act.result; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + /** - * 描述一下 + * 004、活动详情 返参 * * @author yinzuomei@elink-cn.com * @date 2021/4/19 19:24 */ -public class ActDetailResultDTO { +@Data +public class ActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 8912162789028312892L; + + + private String groupActId; + + /** + * 小组id + */ + private String groupId; + + /** + * 活动标题; + */ + private String title; + + /** + * 活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date startTime; + + /** + * 活动所属类别编码 + */ + private String categoryCode; + + /** + * 上级类别编码 + */ + private String parentCode; + + /** + * 活动类别名称;eg:支部建设-三会一课 + */ + private String allCategoryName; + + /** + * 活动地点 + */ + private String address; + + /** + * 活动地点-经度 + */ + private BigDecimal longitude; + + /** + * 活动地点-纬度 + */ + private BigDecimal latitude; + + /** + * 应参加人数组长填入;此列也是应签到人数; + */ + private Integer shouldAttend; + + /** + * 活动状态:已发布:published;已取消:canceled;已变更:changed;已关闭:closed + */ + private String status; + + /** + * 签到开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInStartTime; + + /** + * 签到截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInEndTime; + /** + * 是否填写总结?1:已填写;0:未填写 + */ + private Integer summaryFlag; + + /** + * 取消时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date canceledTime; + + /** + * 关闭时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date closedTime; + + /** + * 活动发布人用户id + */ + private String publishUserId; + + /** + * 内容列表 + */ + private List textList; + + /** + * 图片列表 + */ + private List imgList; + + //以下字段需要单独赋值 + /** + * 取消原因 + */ + private String canceledReason; + + /** + * blank: 不显示; display:显示 + */ + private String signInButton; + + /** + * 未签到时的描述,可能是签到时间未开始,可能是签到时间已经过 + */ + private String signInDesc; + + /** + * member成员,leader群主 + */ + private String userRole; + + /** + * 有签到后不可以修改活动时间:true可以修改,false不可以, + */ + private Boolean startTimeEditFlag; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java index e063637bca..5bf98dc5a4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java @@ -24,8 +24,10 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -77,4 +79,18 @@ public class GroupActInfoController { return new Result().ok(groupActInfoService.queryActDetail(actDetailFormDTO)); } + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @param actReadViewFormDTO + * @author yinzuomei + * @description 016、活动已读未读列表 + * @Date 2021/4/19 19:37 + **/ + @PostMapping("readlist") + public Result queryReadList(@RequestBody @LoginUser TokenDto tokenDto, @RequestBody ActReadViewFormDTO actReadViewFormDTO){ + actReadViewFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(actReadViewFormDTO,ActReadViewFormDTO.AddUserInternalGroup.class); + return new Result().ok(groupActInfoService.queryReadList(actReadViewFormDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java index aa37d62b60..8c05a11e0f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActOperationRecordDao.java @@ -29,5 +29,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActOperationRecordDao extends BaseDao { - + + /** + * 查询活动取消的原因 + * + * @param groupActId + * @return int + */ + String selectCanceledReason(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java index 139c075655..1f41006683 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java @@ -20,6 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActReadRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动已读记录 @@ -30,5 +33,28 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ActReadRecordDao extends BaseDao { + /** + * 重新发布活动,删除原来的已读未读记录,重新插入应读记录 + * + * @param groupActId + * @return int + */ int deleteByActId(String groupActId); + + /** + * 查询当前活动,应读人员列表 + * + * @param groupActId + * @return com.epmet.modules.act.entity.ActReadRecordEntity + */ + List selectByGroupActId(String groupActId); + + /** + * 查询用户是否阅读过此活动 + * + * @param groupActId + * @param userId + * @return com.epmet.modules.act.entity.ActReadRecordEntity + */ + ActReadRecordEntity selectUserRec(@Param("groupActId") String groupActId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java index 14402fbe3d..fbbb87774d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java @@ -20,7 +20,9 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.GroupActContentEntity; import org.apache.ibatis.annotations.Mapper; -import org.springframework.data.repository.query.Param; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 组织活动内容 @@ -31,5 +33,21 @@ import org.springframework.data.repository.query.Param; @Mapper public interface GroupActContentDao extends BaseDao { + /** + * 重新编辑活动提交,将原来的内容置为已删除 + * + * @param groupActId 活动id + * @param userId 更新人 + * @return int + */ int updateToDel(@Param("groupActId") String groupActId, @Param("userId") String userId); + + /** + * 活动内容,升序返回 + * + * @param groupActId 活动id + * @param contentType 内容类型: 文字:text;图片:img + * @return String + */ + List selectContentList(@Param("groupActId")String groupActId, @Param("contentType") String contentType); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java index 6bad0862fa..f7645bce4e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java @@ -21,8 +21,10 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; /** * 组织活动信息 @@ -47,4 +49,12 @@ public interface GroupActInfoService extends BaseService { * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO */ ActDetailResultDTO queryActDetail(ActDetailFormDTO actDetailFormDTO); + + /** + * 016、活动已读未读列表 + * + * @param actReadViewFormDTO + * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO + */ + NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO); } \ No newline at end of file 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 6db5b3551d..80fde8f3cb 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 @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; @@ -33,6 +34,8 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.GridInfoResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.modules.act.dao.ActOperationRecordDao; import com.epmet.modules.act.dao.ActReadRecordDao; @@ -49,10 +52,12 @@ import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -65,6 +70,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; /** * 组织活动信息 @@ -95,7 +101,8 @@ public class GroupActInfoServiceImpl extends BaseServiceImplNumConstant.ZERO?false:true); + //返回详情,并且已读状态 + ActReadRecordEntity actReadRecordEntity=actReadRecordDao.selectUserRec(formDTO.getGroupActId(),formDTO.getUserId()); + if(null== actReadRecordEntity){ + //插入 + ActReadRecordEntity insertEntity=new ActReadRecordEntity(); + insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setRead(GroupActConstant.READ); + insertEntity.setShouldBeRead(Constant.NO); + insertEntity.setUserId(formDTO.getUserId()); + actReadRecordDao.insert(insertEntity); + }else{ + if(GroupActConstant.UN_READ.equals(actReadRecordEntity.getRead())){ + //未读->已读 + actReadRecordEntity.setRead(GroupActConstant.READ); + actReadRecordDao.updateById(actReadRecordEntity); + } + } + return resultDTO; + } + + private void handleSignInDesc(ActDetailResultDTO resultDTO) { //todo - return null; + //blank: 不显示; display:显示 + //在签到时间范围内,并且未签到的,显示签到按钮 + resultDTO.setSignInButton("todo"); + // 1、签到成功显示已签到 + // 2、未到签到时间显示距离签到时间还有多久 + // 3、在签到时间范围内,并且未签到的,显示签到按钮,描述显示空字符串 + // 4、签到时间已过且未签到的,显示“当前时间已超过签到时间” + resultDTO.setSignInDesc("todo"); + } + + /** + * 016、活动已读未读列表 + * + * @param actReadViewFormDTO + * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO + */ + @Override + public NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO) { + NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO(); + List readList = new ArrayList<>(); + List unReadList = new ArrayList<>(); + //1.根据活动id,查询应读人员列表 + List list = actReadRecordDao.selectByGroupActId(actReadViewFormDTO.getGroupActId()); + + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(ActReadRecordEntity::getUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List resultDTOList = result.getData(); + if (!CollectionUtils.isEmpty(resultDTOList)) { + //3.遍历封装数据并返回 + list.forEach(l -> { + 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.getRead())) { + //已读 + 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); + } + }); + + } + //已读人数 + resultDTO.setReadCount(readList.size()); + //未读人数 + resultDTO.setUnReadCount(unReadList.size()); + //已读列表 + resultDTO.setReadList(readList); + //未读列表 + resultDTO.setUnReadList(unReadList); + return resultDTO; } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml index aa2a3e7679..46f3194d11 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml @@ -3,6 +3,19 @@ - + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml index 9f55748033..2e1b70570d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml @@ -2,9 +2,33 @@ + + delete from act_read_record where GROUP_ACT_ID=#{groupActId} + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml index 7152cf67eb..b835f36889 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml @@ -2,7 +2,7 @@ - + UPDATE group_act_content SET DEL_FLAG = '1', @@ -12,4 +12,17 @@ GROUP_ACT_ID = #{groupActId} + + \ No newline at end of file From 5f2cadbd9522c7eeba49f3d6e0811d931a509d73 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Apr 2021 11:10:25 +0800 Subject: [PATCH 04/17] =?UTF-8?q?8098ErrorCode=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/commons/tools/exception/EpmetErrorCode.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 7e745709a6..034a61bad6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -167,7 +167,8 @@ public enum EpmetErrorCode { GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"), GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"), PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), - NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"); + NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"), + PARTY_MEMBER_JOIN_BRANCH_GROUP(8908,"您不是党员,不能加入支部小组"); private int code; private String msg; From 44667fad07b9c1990b17c96729ffa9c22505dae3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 12:29:38 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 4 +- .../resi/group/dto/act/GroupActIdDTO.java | 2 +- .../group/dto/act/form/CancelActFormDTO.java | 38 ++++++ .../controller/GroupActInfoController.java | 15 +++ .../modules/act/dao/ActSignInRecordDao.java | 11 +- .../act/service/ActSignInRecordService.java | 8 ++ .../act/service/GroupActInfoService.java | 9 ++ .../impl/ActSignInRecordServiceImpl.java | 15 ++- .../service/impl/GroupActInfoServiceImpl.java | 117 ++++++++++++++++-- .../modules/constant/GroupActConstant.java | 4 + .../mapper/act/ActSignInRecordDao.xml | 12 +- 11 files changed, 220 insertions(+), 15 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 7e745709a6..28f06e19be 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -167,7 +167,9 @@ public enum EpmetErrorCode { GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"), GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"), PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), - NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"); + NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"), + CAN_NOT_CANCEL(8908,"活动%s,不能取消"); + private int code; private String msg; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java index c898920da1..a558bdc265 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.io.Serializable; /** - * 描述一下 + * 组织活动id * * @author yinzuomei@elink-cn.com * @date 2021/4/19 15:11 diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java new file mode 100644 index 0000000000..39283ef63a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CancelActFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.resi.group.dto.act.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 011、取消活动 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:04 + */ +@Data +public class CancelActFormDTO implements Serializable { + private static final long serialVersionUID = 6126854423030661426L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + @NotBlank(message = "取消原因不能为空", groups = AddUserShowGroup.class) + @Length(max = 300, message = "取消原因最多输入300字", groups = AddUserShowGroup.class) + private String reason; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java index 5bf98dc5a4..da9107f7c2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java @@ -25,6 +25,7 @@ import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; @@ -93,4 +94,18 @@ public class GroupActInfoController { ValidatorUtils.validateEntity(actReadViewFormDTO,ActReadViewFormDTO.AddUserInternalGroup.class); return new Result().ok(groupActInfoService.queryReadList(actReadViewFormDTO)); } + + /** + * @return + * @param formDTO + * @author yinzuomei + * @description 011、取消活动 + * @Date 2021/4/20 12:09 + **/ + @PostMapping("cancel") + public Result cancelAct(@LoginUser TokenDto tokenDto,@RequestBody CancelActFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,CancelActFormDTO.AddUserShowGroup.class,CancelActFormDTO.AddUserInternalGroup.class); + return new Result().ok(groupActInfoService.cancelAct(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java index 788ed87051..1d103db768 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java @@ -20,6 +20,7 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSignInRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 组织活动签到记录 @@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInRecordDao extends BaseDao { - + + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param signUserId + * @return int + */ + int selectCountUserRec(@Param("groupActId")String groupActId, @Param("signUserId")String signUserId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java index 279a72fd3a..b3ea3f44fe 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java @@ -28,4 +28,12 @@ import com.epmet.modules.act.entity.ActSignInRecordEntity; */ public interface ActSignInRecordService extends BaseService { + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param currentUserId + * @return boolean + */ + boolean queryUserSignInRec(String groupActId, String currentUserId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java index f7645bce4e..a6ea5dd94d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java @@ -22,6 +22,7 @@ import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.notice.result.NoticeReadListResultDTO; @@ -57,4 +58,12 @@ public interface GroupActInfoService extends BaseService { * @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO */ NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO); + + /** + * 011、取消活动 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.GroupActIdDTO + */ + GroupActIdDTO cancelAct(CancelActFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java index 3dd6e6e8e1..393f355f1c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java @@ -32,5 +32,18 @@ import org.springframework.stereotype.Service; @Service public class ActSignInRecordServiceImpl extends BaseServiceImpl implements ActSignInRecordService { - + /** + * 查询当前用户是否签到 + * + * @param groupActId + * @param signUserId + * @return boolean + */ + @Override + public boolean queryUserSignInRec(String groupActId, String signUserId) { + if (baseDao.selectCountUserRec(groupActId, signUserId) > 0) { + return true; + } + return false; + } } \ No newline at end of file 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 80fde8f3cb..62e3816594 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 @@ -46,6 +46,7 @@ import com.epmet.modules.act.entity.ActReadRecordEntity; import com.epmet.modules.act.entity.GroupActContentEntity; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.modules.act.service.ActCategoryDictService; +import com.epmet.modules.act.service.ActSignInRecordService; import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.modules.constant.GroupActConstant; import com.epmet.modules.group.service.ResiGroupService; @@ -53,6 +54,7 @@ import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; +import com.epmet.resi.group.dto.act.form.CancelActFormDTO; import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO; import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO; @@ -103,6 +105,8 @@ public class GroupActInfoServiceImpl extends BaseServiceImplNumConstant.ZERO?false:true); @@ -397,24 +401,76 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl已读 actReadRecordEntity.setRead(GroupActConstant.READ); + actReadRecordEntity.setUpdatedTime(new Date()); actReadRecordDao.updateById(actReadRecordEntity); } } return resultDTO; } - private void handleSignInDesc(ActDetailResultDTO resultDTO) { - //todo - //blank: 不显示; display:显示 - //在签到时间范围内,并且未签到的,显示签到按钮 - resultDTO.setSignInButton("todo"); + private void handleSignInDesc(ActDetailResultDTO resultDTO,String currentUserId) { + if(GroupActConstant.CANCELED.equals(resultDTO.getStatus()) + ||GroupActConstant.CLOSED.equals(resultDTO.getStatus())){ + //活动已取消或者已关闭,不显示签到按钮,也不显示描述 + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } + if (null == resultDTO.getSignInStartTime() || null == resultDTO.getSignInEndTime()) { + //未设置签到开始、截止时间,默认不显示签到按钮,也不显示描述 + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } + //查询当前用户是否签到 + boolean signedInFlag=actSignInRecordService.queryUserSignInRec(resultDTO.getGroupActId(),currentUserId); // 1、签到成功显示已签到 - // 2、未到签到时间显示距离签到时间还有多久 - // 3、在签到时间范围内,并且未签到的,显示签到按钮,描述显示空字符串 - // 4、签到时间已过且未签到的,显示“当前时间已超过签到时间” - resultDTO.setSignInDesc("todo"); + if(signedInFlag){ + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc("已签到"); + return; + } + Date nowDate=new Date(); + long nowTime=nowDate.getTime(); + long signInStartTime=resultDTO.getSignInStartTime().getTime(); + long signInEndTime=resultDTO.getSignInEndTime().getTime(); + if (nowTime < signInStartTime) { + resultDTO.setSignInButton(GroupActConstant.DISPLAY); + // 2、未到签到时间显示距离签到时间还有多久 + //距离签到开始还有XX天4小时32分钟 + String remainStr=getDatePoor(resultDTO.getSignInStartTime(),nowDate); + resultDTO.setSignInDesc(String.format("距离签到开始还有%s",remainStr)); + return; + } else if (signInStartTime <= nowTime && nowTime <= signInEndTime) { + // 3、在签到时间范围内,并且未签到的,显示签到按钮,描述显示空字符串 + resultDTO.setSignInButton(GroupActConstant.DISPLAY); + resultDTO.setSignInDesc(StrConstant.EPMETY_STR); + return; + } else if (nowTime > signInEndTime) { + // 4、签到时间已过且未签到的,显示“当前时间已超过签到时间” + resultDTO.setSignInButton(GroupActConstant.BLANK); + resultDTO.setSignInDesc("当前时间已超过签到时间"); + } } + public static String getDatePoor(Date endDate, Date nowDate) { + + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } /** * 016、活动已读未读列表 * @@ -475,4 +531,45 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl - + + \ No newline at end of file From 67c18b268535ca76e7be415a9694f5501226e9ff Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 13:13:11 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 5 +- .../group/dto/act/form/CommentFormDTO.java | 39 +++++++ .../dto/act/form/CommentQueryFormDTO.java | 25 ++++ .../dto/act/result/CommentResultDTO.java | 30 +++++ .../act/controller/ActCommentController.java | 40 +++++++ .../epmet/modules/act/dao/ActCommentDao.java | 6 +- .../act/service/ActCommentService.java | 20 ++++ .../act/service/GroupActInfoService.java | 9 ++ .../service/impl/ActCommentServiceImpl.java | 107 ++++++++++++++++++ .../service/impl/GroupActInfoServiceImpl.java | 35 +++++- .../resources/mapper/act/ActCommentDao.xml | 16 ++- 11 files changed, 323 insertions(+), 9 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 27936afa85..49514ffd1b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -169,8 +169,9 @@ public enum EpmetErrorCode { PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"), PARTY_MEMBER_JOIN_BRANCH_GROUP(8908,"您不是党员,不能加入支部小组"), - CAN_NOT_CANCEL(8909,"活动%s,不能取消"); - + GROUP_ACT_CAN_NOT_CANCEL(8909,"活动%s,不能取消"), + //8910的msg动态赋值 + GROUP_ACT_CAN_NOT_COMMENT(8910,"当前活动,不能评论"); private int code; private String msg; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java new file mode 100644 index 0000000000..92fce732ae --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.group.dto.act.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 005、评论活动 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:35 + */ +@Data +public class CommentFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + + @NotBlank(message = "评论内容不能为空", groups = AddUserShowGroup.class) + @Length(max = 500, message = "评论内容最多输入500字", groups = AddUserShowGroup.class) + private String commentContent; + + /** + * 当前用户id + */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; + + @NotBlank(message = "tokenDto获取customerId为空", groups = AddUserInternalGroup.class) + private String customerId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java new file mode 100644 index 0000000000..109d6f387a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentQueryFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 006、活动评论列表查询 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:55 + */ +@Data +public class CommentQueryFormDTO implements Serializable { + private static final long serialVersionUID = 4013876445914100561L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + private Integer pageNo; + private Integer pageSize; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java new file mode 100644 index 0000000000..efb8066f28 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.resi.group.dto.act.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 006、活动评论列表查询 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 12:58 + */ +@Data +public class CommentResultDTO implements Serializable { + private static final long serialVersionUID = 6487668038520643604L; + private String commentId; + + private String commentContent; + + private String commentUserHeadPhoto; + + private String commentUserName; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date commentTime; + + private String commentUserId; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java index 331cf578ce..eff2910608 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentController.java @@ -17,11 +17,23 @@ package com.epmet.modules.act.controller; +import com.baomidou.mybatisplus.extension.api.R; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.act.service.ActCommentService; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; import org.springframework.beans.factory.annotation.Autowired; +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.List; + /** * 活动评论表 @@ -36,5 +48,33 @@ public class ActCommentController { @Autowired private ActCommentService actCommentService; + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 005、评论活动 + * @Date 2021/4/20 12:38 + **/ + @PostMapping("submit") + public Result submitComment(@LoginUser TokenDto tokenDto, @RequestBody CommentFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCommentContent(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,CommentFormDTO.AddUserShowGroup.class,CommentFormDTO.AddUserInternalGroup.class); + actCommentService.submitComment(formDTO); + return new Result(); + } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 006、活动评论列表查询 + * @Date 2021/4/20 13:01 + **/ + @PostMapping("comlist") + public Result> queryCommentList(@RequestBody CommentQueryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CommentQueryFormDTO.AddUserInternalGroup.class); + return new Result>().ok(actCommentService.queryCommentList(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java index 93a72a4913..b70207027a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentDao.java @@ -19,8 +19,11 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActCommentEntity; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 活动评论表 * @@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActCommentDao extends BaseDao { - + + List selectCommentList(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java index e8da2bae21..57e3abf651 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentService.java @@ -19,6 +19,11 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActCommentEntity; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; + +import java.util.List; /** * 活动评论表 @@ -28,4 +33,19 @@ import com.epmet.modules.act.entity.ActCommentEntity; */ public interface ActCommentService extends BaseService { + /** + * 005、评论活动 + * + * @param formDTO + * @return + */ + void submitComment(CommentFormDTO formDTO); + + /** + * 006、活动评论列表查询 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.CommentResultDTO + */ + List queryCommentList(CommentQueryFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java index a6ea5dd94d..9c066628bf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java @@ -20,6 +20,7 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; import com.epmet.resi.group.dto.act.form.CancelActFormDTO; @@ -66,4 +67,12 @@ public interface GroupActInfoService extends BaseService { * @return com.epmet.resi.group.dto.act.GroupActIdDTO */ GroupActIdDTO cancelAct(CancelActFormDTO formDTO); + + /** + * 查询活动主信息 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.GroupActInfoDTO + */ + GroupActInfoDTO getGroupActInfoDTO(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java index 6f4ea05296..c249c4ec28 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java @@ -18,10 +18,34 @@ package com.epmet.modules.act.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +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.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.act.dao.ActCommentDao; import com.epmet.modules.act.entity.ActCommentEntity; import com.epmet.modules.act.service.ActCommentService; +import com.epmet.modules.act.service.GroupActInfoService; +import com.epmet.modules.constant.GroupActConstant; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; +import com.epmet.resi.group.dto.act.form.CommentFormDTO; +import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; +import com.epmet.resi.group.dto.act.result.CommentResultDTO; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; /** * 活动评论表 @@ -32,5 +56,88 @@ import org.springframework.stereotype.Service; @Service public class ActCommentServiceImpl extends BaseServiceImpl implements ActCommentService { + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + + @Autowired + private GroupActInfoService groupActInfoService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + + /** + * 005、评论活动 + * + * @param formDTO + * @return + */ + @Override + public void submitComment(CommentFormDTO formDTO) { + //1、关闭和已取消不能评论 + GroupActInfoDTO groupActInfoDTO = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + if (GroupActConstant.CLOSED.equals(groupActInfoDTO.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_COMMENT.getCode(), "当前活动已关闭,不能评论"); + } else if (GroupActConstant.CANCELED.equals(groupActInfoDTO.getStatus())) { + throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_COMMENT.getCode(), "当前活动已取消,不能评论"); + } + //2、评论内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(formDTO.getCommentContent()); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + //3、插入记录 + ActCommentEntity actCommentEntity = new ActCommentEntity(); + actCommentEntity.setCustomerId(formDTO.getCustomerId()); + actCommentEntity.setCommentContent(formDTO.getCommentContent()); + actCommentEntity.setCommentUserId(formDTO.getUserId()); + actCommentEntity.setGroupActId(formDTO.getGroupActId()); + baseDao.insert(actCommentEntity); + } + + /** + * 006、活动评论列表查询 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.CommentResultDTO + */ + @Override + public List queryCommentList(CommentQueryFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list=baseDao.selectCommentList(formDTO.getGroupActId()); + if(CollectionUtils.isEmpty(list)){ + return Collections.EMPTY_LIST; + } + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(CommentResultDTO::getCommentUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + if (!CollectionUtils.isEmpty(result.getData())) { + //3.遍历封装数据并返回 + list.forEach(l -> { + result.getData().forEach(user -> { + if (l.getCommentUserId().equals(user.getUserId())) { + l.setCommentUserHeadPhoto(user.getHeadImgUrl()); + l.setCommentUserName(user.getSurname().concat(user.getName())); + } + }); + }); + + } + return list; + } + } \ No newline at end of file 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 62e3816594..e37d8adae6 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 @@ -52,6 +52,7 @@ import com.epmet.modules.constant.GroupActConstant; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.resi.group.dto.act.GroupActIdDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.act.form.ActReadViewFormDTO; import com.epmet.resi.group.dto.act.form.CancelActFormDTO; @@ -268,7 +269,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl textList, List imgList) { //活动标题 if (StringUtils.isNotBlank(title)) { - //创建话题内容审核 TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); TextTaskDTO taskDTO = new TextTaskDTO(); taskDTO.setContent(title); @@ -547,17 +547,31 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + //4、记录取消时间 Date nowDate=new Date(); actInfoEntity.setCanceledTime(nowDate); actInfoEntity.setStatus(GroupActConstant.CANCELED); baseDao.updateById(actInfoEntity); - //4、插入一条操作日志 + //5、插入一条操作日志 ActOperationRecordEntity actOperationRecordEntity = new ActOperationRecordEntity(); actOperationRecordEntity.setCustomerId(actInfoEntity.getCustomerId()); actOperationRecordEntity.setOperateUserId(formDTO.getUserId()); @@ -572,4 +586,15 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl - + \ No newline at end of file From a89fd3c87bc592ac6fb74343a862699f65b8b46f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 13:49:19 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E6=89=80=E6=9C=89=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/group/form/AllGroupListFormDTO.java | 34 +++++++++++++ .../group/result/AllGroupListResultDTO.java | 51 +++++++++++++++++++ .../group/controller/ResiGroupController.java | 14 +++++ .../epmet/modules/group/dao/ResiGroupDao.java | 7 ++- .../group/service/ResiGroupService.java | 9 ++++ .../service/impl/ResiGroupServiceImpl.java | 46 +++++++++++++++++ .../resources/mapper/group/ResiGroupDao.xml | 23 +++++++++ 7 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.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 new file mode 100644 index 0000000000..32d4164244 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 所有小组查询-接口入参 + */ +@Data +public class AllGroupListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空", groups = {AllGroupListFormDTO.GroupList.class}) + private String gridId; + /** + * 请求页码 + */ + @Min(1) + private int pageNo; + /** + * 每页多少条数据 + */ + private int pageSize = 20; + + public interface GroupList { + } +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java new file mode 100644 index 0000000000..8ec0a07554 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 推荐小组查询返参 + * @Author yinzuomei + * @Date 2020/3/28 17:11 + */ +@Data +public class AllGroupListResultDTO implements Serializable { + + private static final long serialVersionUID = -155229599412911489L; + /** + * 群组id + */ + private String groupId; + + /** + * 群组头像 + */ + private String groupHeadPhoto; + + /** + * 群组名称 + */ + private String groupName; + + /** + * 成员总数 + */ + private Integer totalMember; + + /** + * 党员总数 + */ + private Integer totalPartyMember; + + /** + * under_auditting审核中、rejected已拒绝的前端显示加入 + */ + private String status=""; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + +} 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 23ffab9d29..1d77fc28b9 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,6 +31,8 @@ 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; @@ -502,4 +504,16 @@ public class ResiGroupController { return new Result(); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 所有小组查询 + **/ + @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)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index 9a11aa39c2..b15f08293f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -27,7 +27,6 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; - import java.util.List; /** @@ -236,4 +235,10 @@ public interface ResiGroupDao extends BaseDao { * @Date 2020/12/25 13:18 **/ List queryGroupProcessingCount(@Param("gridIdList") List gridIdList); + + /** + * @Author sun + * @Description 分页查询网格下所有小组列表 + **/ + List selectAllGroupList(AllGroupListFormDTO 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 b4bccf14e9..a27d726fc8 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,6 +20,7 @@ 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; @@ -370,4 +371,12 @@ public interface ResiGroupService extends BaseService { * @return void */ void setVisitSwitch(ManageInitFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 所有小组查询 + **/ + List allGroupList(TokenDto tokenDto, 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 a3770a028c..6cc56ca171 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,6 +30,7 @@ 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; @@ -87,6 +88,7 @@ import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; @@ -1491,4 +1493,48 @@ public class ResiGroupServiceImpl extends BaseServiceImpl allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) { + //1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List resultList = baseDao.selectAllGroupList(formDTO); + if (null == resultList || resultList.size() == 0) { + return new ArrayList<>(); + } + + //2.查询当前用户居民端角色列表 + AtomicBoolean isPartymember = new AtomicBoolean(false); + Result> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId()); + if (!resultDTOList.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List roleList = resultDTOList.getData(); + roleList.forEach(rl -> { + if ("partymember".equals(rl.getRoleKey())) { + isPartymember.set(true); + } + }); + + //3.调用已有方法赋值当前人员是否可以入组值 + for (AllGroupListResultDTO dto : resultList) { + //非党员角色不允许加入支部小组 + if ("branch".equals(dto.getGroupType()) && !isPartymember.get()) { + dto.setStatus("rejected"); + continue; + } + GroupMemeberOperationDTO operation = groupMemeberOperationService.selectLatestRecord(dto.getGroupId(), tokenDto.getUserId()); + if (null != operation) { + dto.setStatus(operation.getOperateStatus()); + } + } + return resultList; + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 7d1ea0a898..fc8a6280f1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -527,4 +527,27 @@ GROUP BY temp.gridId + + + From d3b8fceefc9d96c3095627dc5c137003033cee04 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Apr 2021 14:05:38 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E5=85=A5=E7=BB=84=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E9=83=A8=E5=B0=8F=E7=BB=84=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/GroupInvitationServiceImpl.java | 17 +++++++++++++++++ .../impl/GroupMemeberOperationServiceImpl.java | 13 +++++++++++++ .../impl/ResiGroupMemberServiceImpl.java | 12 ++++++++++++ 3 files changed, 42 insertions(+) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 8e8e064936..93a3d454a6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -32,6 +32,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.UserInfoOnEnterGridResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.constant.UserMessageConstant; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.ResiGuideFeignClient; @@ -46,6 +47,7 @@ import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.impl.ResiGroupMemberServiceImpl; +import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.EnterGroupTypeConstant; import com.epmet.resi.group.constant.GroupStateConstant; import com.epmet.resi.group.constant.LeaderFlagConstant; @@ -106,6 +108,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl page(Map params) { @@ -455,6 +459,19 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl booleanResult = epmetUserOpenFeignClient.selectIsPartyMemberByUserId(formDTO.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } + //2020.11.26 sun start //先判断用户是否有在审核的入组申请,有的话直接给提示 GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(groupInvitationDTO.getResiGroupId(), formDTO.getUserId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java index 11760b07b3..6813b2edbc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; +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.utils.ConvertUtils; @@ -247,6 +248,18 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl booleanResult = userClient.selectIsPartyMemberByUserId(param.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } //先判断用户是否有在审核的入组申请,有的话直接给提示 GroupMemeberOperationDTO groupMemeberOperationDTO = operationDao.selectLatestRecord(groupId, param.getUserId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index 9fbc039d40..5f7cd2eb5b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -218,6 +218,18 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl booleanResult = userOpenFeignClient.selectIsPartyMemberByUserId(applyJoinGroupFormDTO.getUserId()); + if (!booleanResult.success()){ + throw new RenException(ModuleConstant.IS_PARTY_MEMBER_ERR); + } + // 不是党员直接抛出 + if (!booleanResult.getData()){ + throw new RenException(EpmetErrorCode.PARTY_MEMBER_JOIN_BRANCH_GROUP.getCode()); + } + } + UserRoleDTO userRoleDTO = resiGroupService.checkPartyMemberOrWarmHeated(applyJoinGroupFormDTO.getApp(), applyJoinGroupFormDTO.getUserId(), resiGroupDTO.getCustomerId(), From d362e9c756713ffeaba2d3d7257da19ef12fa516 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 14:54:00 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=89=E7=AD=BE=E5=88=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/act/form/SetSignTimeFormDTO.java | 39 ++++++++++ .../dto/act/result/SetSignTimeResultDTO.java | 22 ++++++ .../controller/ActSignInRecordController.java | 23 ++++++ .../modules/act/dao/ActSignInCodeDao.java | 9 ++- .../act/service/ActSignInCodeService.java | 8 ++ .../act/service/ActSignInRecordService.java | 10 +++ .../impl/ActSignInCodeServiceImpl.java | 11 +++ .../impl/ActSignInRecordServiceImpl.java | 75 ++++++++++++++++++- .../service/impl/GroupActInfoServiceImpl.java | 5 +- .../resources/mapper/act/ActSignInCodeDao.xml | 9 ++- 10 files changed, 206 insertions(+), 5 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java new file mode 100644 index 0000000000..d4a04f82f1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SetSignTimeFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 010、设置(修改)签到时间,生成签到码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 13:34 + */ +@Data +public class SetSignTimeFormDTO implements Serializable { + private static final long serialVersionUID = 4134192208518833623L; + public interface AddUserInternalGroup { + } + /** + * 小组活动id + */ + @NotBlank(message = "groupActId不能为空",groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 签到开始时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "开始时间不能为空",groups = AddUserInternalGroup.class) + private String signInStartTime; + + /** + * 签到截止时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "截止时间不能为空",groups = AddUserInternalGroup.class) + private String signInEndTime; + + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java new file mode 100644 index 0000000000..08e190e3da --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SetSignTimeResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.resi.group.dto.act.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 010、设置(修改)签到时间,生成签到码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 13:46 + */ +@Data +public class SetSignTimeResultDTO implements Serializable { + private static final long serialVersionUID = -7444245554430563944L; + + private String groupActId; + private Date signInStartTime; + private Date signInEndTime; + private String signInCodeUrl; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java index f315d843b5..7bece885f4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java @@ -17,8 +17,16 @@ package com.epmet.modules.act.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.act.service.ActSignInRecordService; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; import org.springframework.beans.factory.annotation.Autowired; +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; @@ -36,4 +44,19 @@ public class ActSignInRecordController { @Autowired private ActSignInRecordService actSignInRecordService; + + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 010、设置(修改)签到时间,生成签到码 + * @Date 2021/4/20 13:50 + **/ + @PostMapping("setsigntime") + public Result setSignTime(@LoginUser TokenDto tokenDto, @RequestBody SetSignTimeFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, SetSignTimeFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSignInRecordService.setSignTime(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java index cc918ba292..3c50862d57 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInCodeDao.java @@ -19,6 +19,7 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.ActSignInCodeEntity; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -29,5 +30,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInCodeDao extends BaseDao { - + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + ActSignInCodeDTO selectLastRec(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java index a5d713dcb2..78bff472cd 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInCodeService.java @@ -19,6 +19,7 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSignInCodeEntity; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; /** * 组织活动签到码 @@ -28,4 +29,11 @@ import com.epmet.modules.act.entity.ActSignInCodeEntity; */ public interface ActSignInCodeService extends BaseService { + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + ActSignInCodeDTO selectLastRec(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java index b3ea3f44fe..eb62f8d39a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java @@ -19,6 +19,8 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSignInRecordEntity; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; /** * 组织活动签到记录 @@ -36,4 +38,12 @@ public interface ActSignInRecordService extends BaseService implements ActSignInCodeService { + /** + * 获取最后一次生成的签到码 + * + * @param groupActId + * @return com.epmet.resi.group.dto.act.ActSignInCodeDTO + */ + @Override + public ActSignInCodeDTO selectLastRec(String groupActId) { + return baseDao.selectLastRec(groupActId); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java index 393f355f1c..eb44cd3fbc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java @@ -18,10 +18,27 @@ package com.epmet.modules.act.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.modules.act.dao.ActSignInRecordDao; +import com.epmet.modules.act.dao.GroupActInfoDao; import com.epmet.modules.act.entity.ActSignInRecordEntity; +import com.epmet.modules.act.entity.GroupActInfoEntity; +import com.epmet.modules.act.service.ActSignInCodeService; import com.epmet.modules.act.service.ActSignInRecordService; +import com.epmet.modules.act.service.GroupActInfoService; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.dto.act.ActSignInCodeDTO; +import com.epmet.resi.group.dto.act.GroupActInfoDTO; +import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * 组织活动签到记录 @@ -29,9 +46,17 @@ import org.springframework.stereotype.Service; * @author generator generator@elink-cn.com * @since v1.0.0 2021-04-16 */ +@Slf4j @Service public class ActSignInRecordServiceImpl extends BaseServiceImpl implements ActSignInRecordService { - + @Autowired + private GroupActInfoService groupActInfoService; + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Autowired + private GroupActInfoDao groupActInfoDao; + @Autowired + private ActSignInCodeService actSignInCodeService; /** * 查询当前用户是否签到 * @@ -46,4 +71,52 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl - + \ No newline at end of file From 9329921568abccb3ed0540421c9c25cba632b0c1 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 15:25:22 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E6=9C=AA=E8=AF=BB?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E9=95=BF=E5=B7=B2=E8=AF=BB=E8=AE=B0=E5=BD=95=EF=BC=8C=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=88=97=E8=A1=A8=E4=B8=8D=E6=9F=A5=E8=AF=A2=E7=BB=84?= =?UTF-8?q?=E9=95=BF=E5=B7=B2=E8=AF=BB=E6=9C=AA=E8=AF=BB=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/notice/dao/NoticeDao.java | 8 ++++- .../impl/NoticeReafdRecordServiceImpl.java | 6 ++++ .../service/impl/NoticeServiceImpl.java | 36 ++++++++++--------- .../resources/mapper/notice/NoticeDao.xml | 14 ++++++++ 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java index 2cab9440db..4ee6056a2b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java @@ -20,6 +20,7 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.notice.entity.NoticeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 小组通知表 @@ -29,5 +30,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface NoticeDao extends BaseDao { - + + /** + * @Author sun + * @Description 查询通知对应的小组的组长Id + **/ + String selectNoticeGroupLeader(@Param("noticeId") String noticeId); } \ 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/NoticeReafdRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java index 11507e85ba..e45a250a0d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.notice.dao.NoticeDao; import com.epmet.modules.notice.dao.NoticeReafdRecordDao; import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; import com.epmet.modules.notice.redis.NoticeReafdRecordRedis; @@ -60,6 +61,8 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl page(Map params) { @@ -124,6 +127,9 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl readList = new ArrayList<>(); List unReadList = new ArrayList<>(); + //0.查询通知对应的小组的组长Id + String leaderId = noticeDao.selectNoticeGroupLeader(formDTO.getNoticeId()); + //1.根据通知Id查询组成员已读未读数据 List list = baseDao.getByNoticeId(formDTO.getNoticeId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java index 8ef6c3dcc4..5b7cd69be3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java @@ -275,16 +275,18 @@ public class NoticeServiceImpl extends BaseServiceImpl //6.通知已读未读表初始数据 List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - if (!"".equals(m.getGroupLeaderFlag())) { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); - reafdRecord.setCustomerId(resultDTO.getCustomerId()); - reafdRecord.setGridId(groupEntity.getGridId()); - reafdRecord.setGroupId(formDTO.getGroupId()); - reafdRecord.setNoticeId(entity.getId()); - reafdRecord.setUserId(m.getCustomerUserId()); + NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + reafdRecord.setCustomerId(resultDTO.getCustomerId()); + reafdRecord.setGridId(groupEntity.getGridId()); + reafdRecord.setGroupId(formDTO.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); @@ -394,16 +396,18 @@ public class NoticeServiceImpl extends BaseServiceImpl noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - if (!"".equals(m.getGroupLeaderFlag())) { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); - reafdRecord.setCustomerId(entity.getCustomerId()); - reafdRecord.setGridId(entity.getGridId()); - reafdRecord.setGroupId(entity.getGroupId()); - reafdRecord.setNoticeId(entity.getId()); - reafdRecord.setUserId(m.getCustomerUserId()); + NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + reafdRecord.setCustomerId(entity.getCustomerId()); + reafdRecord.setGridId(entity.getGridId()); + reafdRecord.setGroupId(entity.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml index 7f7dc8e127..332dfa0b5c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml @@ -3,5 +3,19 @@ + \ No newline at end of file From 2d93f0693626a9b93fe2c33a05d1d7fd1ed1ec95 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Apr 2021 15:57:34 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E5=86=85?= =?UTF-8?q?=E8=BF=91=E5=8D=81=E6=9D=A1=E6=95=B0=E6=8D=AE=E6=A1=86=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/topic/form/GetLatestV2FormDTO.java | 24 ++++ .../topic/result/GetLatestV2ResultDTO.java | 47 ++++++++ .../dto/topic/result/LatestTenResultDTO.java | 104 ++++++++++++++++++ .../topic/controller/ResiTopicController.java | 14 +++ .../topic/service/ResiTopicService.java | 9 ++ .../service/impl/ResiTopicServiceImpl.java | 12 ++ 6 files changed, 210 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java new file mode 100644 index 0000000000..19406e5a62 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/GetLatestV2FormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:23 + * @DESC + */ +@Data +public class GetLatestV2FormDTO implements Serializable { + + private static final long serialVersionUID = -5212709032157867124L; + + public interface GetLatestV2Form{} + + @NotBlank(message = "小组ID不能为空",groups = GetLatestV2Form.class) + private String groupId; + + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java new file mode 100644 index 0000000000..ee37afd1bf --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/GetLatestV2ResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:34 + * @DESC + */ +@Data +public class GetLatestV2ResultDTO implements Serializable { + + private static final long serialVersionUID = 1386600583326358070L; + + /** + * 当前人员组内角色(member成员,leader群主) + */ + private String userRole; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 是否显示通知按钮 + */ + private String noticeBut; + + /** + * 是否显示活动按钮 + */ + private String actBut; + + /** + * 是否存在未读消息 + */ + private Boolean unReadNews; + + /** + * 近十条数据 + */ + private List list; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java new file mode 100644 index 0000000000..0f8d7c3222 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/LatestTenResultDTO.java @@ -0,0 +1,104 @@ +package com.epmet.resi.group.dto.topic.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午2:45 + * @DESC + */ +@Data +public class LatestTenResultDTO implements Serializable { + + private static final long serialVersionUID = -8447212650446365613L; + + /** + * 话题、通知、活动Id + */ + private String id; + + /** + * 话题、通知、活动Id发布人的id + */ + private String userId; + + /** + * 发布者的全称(街道-姓氏先生/女士)【专项组显示真实名】 + */ + private String releaseUserName; + + /** + * 话题发布者的头像Url + */ + private String releaseUserHeadPhoto; + + /** + * 发布时间yyyy-MM-dd HH:mm + */ + private String releaseTimed; + + /** + * 内容 + */ + private String content; + + /** + * 话题状态(discussing进行中、closed已关闭) + */ + private String status; + + /** + * 是否本人 + */ + private String releaseUserFlag; + + /** + * 如果有图片,后台只返回第一张,没有图片此列为空 + */ + private String firstPhoto; + + /** + * 议题id + */ + private String issueId; + + /** + * 是否被转为议题true,false + */ + private Boolean shiftIssueFlag; + + /** + * 数据类型(topic:话题 notice:通知 act:活动) + */ + private String contentType; + + /** + * 本人已读未读状态(read已读 unread未读) + */ + private String readOrUnRead; + + /** + * 通知或活动未读人员数 + */ + private Integer unReadCount; + + public LatestTenResultDTO() { + this.id = ""; + this.userId = ""; + this.releaseUserName = ""; + this.releaseUserHeadPhoto = ""; + this.releaseTimed = ""; + this.content = ""; + this.status = ""; + this.releaseUserFlag = ""; + this.firstPhoto = ""; + this.issueId = ""; + this.shiftIssueFlag = false; + this.contentType = ""; + this.readOrUnRead = ""; + this.unReadCount = NumConstant.ZERO; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 419f927f83..4e824c18ef 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -441,4 +441,18 @@ public class ResiTopicController { } return new Result<>(); } + + /** + * @Description 查询组内近十条数据 + * @Param tokenDto + * @Param formDTO + * @author zxc + * @date 2021/4/20 下午2:34 + */ + @PostMapping("getlatestv2") + public Result getLatestV2(@LoginUser TokenDto tokenDto,@RequestBody GetLatestV2FormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GetLatestV2FormDTO.GetLatestV2Form.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(topicService.getLatestV2(formDTO)); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java index 20f234d9aa..48ba5166e5 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java @@ -352,4 +352,13 @@ public interface ResiTopicService extends BaseService { void sendTopicPointEventByEventType(TopicEventFormDTO param); ResiTopicDTO queryTopicInfoByIssueId(String issueId); + + /** + * @Description 查询组内近十条数据 + * @Param tokenDto + * @Param formDTO + * @author zxc + * @date 2021/4/20 下午2:34 + */ + GetLatestV2ResultDTO getLatestV2(GetLatestV2FormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 36199596a1..f3a4bb6f71 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -2181,6 +2181,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl Date: Tue, 20 Apr 2021 15:59:21 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E3=80=81=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 4 +- .../group/dto/act/form/SignInFormDTO.java | 47 ++++++++ .../group/dto/act/form/SignInRecFormDTO.java | 25 ++++ .../dto/act/result/SignInRecResultDTO.java | 31 +++++ .../controller/ActSignInRecordController.java | 33 ++++++ .../modules/act/dao/ActSignInRecordDao.java | 10 ++ .../act/service/ActSignInRecordService.java | 19 ++++ .../impl/ActSignInRecordServiceImpl.java | 107 ++++++++++++++++++ .../service/impl/GroupActInfoServiceImpl.java | 11 +- .../mapper/act/ActSignInRecordDao.xml | 11 ++ 10 files changed, 290 insertions(+), 8 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 49514ffd1b..90ed153985 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -171,7 +171,9 @@ public enum EpmetErrorCode { PARTY_MEMBER_JOIN_BRANCH_GROUP(8908,"您不是党员,不能加入支部小组"), GROUP_ACT_CAN_NOT_CANCEL(8909,"活动%s,不能取消"), //8910的msg动态赋值 - GROUP_ACT_CAN_NOT_COMMENT(8910,"当前活动,不能评论"); + GROUP_ACT_CAN_NOT_COMMENT(8910,"当前活动,不能评论"), + SIGN_IN_TIME_NOT_START(8911,"未到签到时间,不允许签到"), + SIGN_IN_TIME_PASSED(8912,"当前时间已超过签到时间"); private int code; private String msg; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java new file mode 100644 index 0000000000..af00808a0f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 007、签到 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:14 + */ +@Data +public class SignInFormDTO implements Serializable { + private static final long serialVersionUID = 3632452994910057034L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "活动id不能为空",groups = AddUserInternalGroup.class) + private String groupActId; + + /** + * 签到地址 + */ + @NotBlank(message = "签到地址不能为空",groups = AddUserInternalGroup.class) + private String signInAddress; + /** + * 签到地点-经度 + */ + private BigDecimal longitude; + + /** + * 签到地点-纬度 + */ + private BigDecimal latitude; + + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) + private String userId; + + @NotBlank(message = "tokenDto获取customerId为空", groups = AddUserInternalGroup.class) + private String customerId; + +} + diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java new file mode 100644 index 0000000000..95af7d5f77 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/SignInRecFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 009、签到记录列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:42 + */ +@Data +public class SignInRecFormDTO implements Serializable { + private static final long serialVersionUID = -144395799437468448L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) + private String groupActId; + private Integer pageNo; + private Integer pageSize; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java new file mode 100644 index 0000000000..0bdb2b17d0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/SignInRecResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.group.dto.act.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 009、签到记录列表 + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/20 15:43 + */ +@Data +public class SignInRecResultDTO implements Serializable { + private static final long serialVersionUID = -2847848186325667663L; + private Integer signedInNum; + private Integer shouldAttend; + private List list; + + @NoArgsConstructor + @Data + public static class SignInDetail { + private String signUserId; + private String signUserName; + private Date signInTime; + private String signInAddress; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java index 7bece885f4..3e8883dbd6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActSignInRecordController.java @@ -23,7 +23,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.act.service.ActSignInRecordService; import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.form.SignInFormDTO; +import com.epmet.resi.group.dto.act.form.SignInRecFormDTO; import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -59,4 +62,34 @@ public class ActSignInRecordController { ValidatorUtils.validateEntity(formDTO, SetSignTimeFormDTO.AddUserInternalGroup.class); return new Result().ok(actSignInRecordService.setSignTime(formDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @param formDTO + * @author yinzuomei + * @description 007、签到 + * @Date 2021/4/20 15:19 + **/ + @PostMapping("signin") + public Result signIn(@LoginUser TokenDto tokenDto, @RequestBody SignInFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,SignInFormDTO.AddUserInternalGroup.class); + actSignInRecordService.signIn(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 009、签到记录列表 + * @Date 2021/4/20 15:46 + **/ + @PostMapping("reclist") + public Result querySignRecList(@RequestBody SignInRecFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,SignInRecFormDTO.AddUserInternalGroup.class); + return new Result().ok(actSignInRecordService.querySignRecList(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java index 1d103db768..6e53fe6bef 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActSignInRecordDao.java @@ -22,6 +22,8 @@ import com.epmet.modules.act.entity.ActSignInRecordEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 组织活动签到记录 * @@ -39,4 +41,12 @@ public interface ActSignInRecordDao extends BaseDao { * @return int */ int selectCountUserRec(@Param("groupActId")String groupActId, @Param("signUserId")String signUserId); + + /** + * 查询活动的签到记录 + * + * @param groupActId + * @return int + */ + List selectListByGroupActId(String groupActId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java index eb62f8d39a..da979840b0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSignInRecordService.java @@ -20,7 +20,10 @@ package com.epmet.modules.act.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.modules.act.entity.ActSignInRecordEntity; import com.epmet.resi.group.dto.act.form.SetSignTimeFormDTO; +import com.epmet.resi.group.dto.act.form.SignInFormDTO; +import com.epmet.resi.group.dto.act.form.SignInRecFormDTO; import com.epmet.resi.group.dto.act.result.SetSignTimeResultDTO; +import com.epmet.resi.group.dto.act.result.SignInRecResultDTO; /** * 组织活动签到记录 @@ -46,4 +49,20 @@ public interface ActSignInRecordService extends BaseService signInEndTime) { + //未签到、已经超过了签到时间 + throw new RenException(EpmetErrorCode.SIGN_IN_TIME_PASSED.getCode(),EpmetErrorCode.SIGN_IN_TIME_PASSED.getMsg()); + } + + //未签到、在签到时间范围内的,可以签到 + GroupActInfoEntity groupActInfoEntity = ConvertUtils.sourceToTarget(originalActInfo, GroupActInfoEntity.class); + groupActInfoEntity.setSignedInNum(originalActInfo.getSignedInNum() + NumConstant.ONE); + groupActInfoDao.updateById(groupActInfoEntity); + + ActSignInRecordEntity insertEntity=new ActSignInRecordEntity(); + insertEntity.setCustomerId(formDTO.getCustomerId()); + insertEntity.setGroupActId(formDTO.getGroupActId()); + insertEntity.setSignUserId(formDTO.getUserId()); + insertEntity.setSignInAddress(formDTO.getSignInAddress()); + insertEntity.setLatitude(formDTO.getLatitude()); + insertEntity.setLongitude(formDTO.getLongitude()); + baseDao.insert(insertEntity); + } + + /** + * 009、签到记录列表 + * + * @param formDTO + * @return com.epmet.resi.group.dto.act.result.SignInRecResultDTO + */ + @Override + public SignInRecResultDTO querySignRecList(SignInRecFormDTO formDTO) { + GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); + SignInRecResultDTO resultDTO = new SignInRecResultDTO(); + resultDTO.setSignedInNum(originalActInfo.getSignedInNum()); + resultDTO.setShouldAttend(originalActInfo.getShouldAttend()); + List list = baseDao.selectListByGroupActId(formDTO.getGroupActId()); + if (!CollectionUtils.isEmpty(list)) { + //2.调用user服务,查询人员基础数据 + List userIdList = list.stream().map(ActSignInRecordEntity::getSignUserId).collect(Collectors.toList()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + if (!CollectionUtils.isEmpty(result.getData())) { + List signInDetailList = new ArrayList<>(); + //3.遍历封装数据并返回 + list.forEach(l -> { + result.getData().forEach(user -> { + if (l.getSignUserId().equals(user.getUserId())) { + SignInRecResultDTO.SignInDetail signInDetail = new SignInRecResultDTO.SignInDetail(); + signInDetail.setSignInAddress(l.getSignInAddress()); + signInDetail.setSignInTime(l.getCreatedTime()); + signInDetail.setSignUserId(l.getSignUserId()); + signInDetail.setSignUserName(user.getSurname().concat(user.getName())); + } + }); + }); + resultDTO.setList(signInDetailList); + } + } + return resultDTO; + } } \ No newline at end of file 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 9a5ebaf733..ecf6f045df 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 @@ -174,15 +174,12 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl + + + \ No newline at end of file From d1a125765b4750a59cd75a95b0773986a389f83a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 16:36:56 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/notice/form/ReadTypeFormDTO.java | 21 ++++++++++ .../NoticeReafdRecordController.java | 14 +++++++ .../notice/dao/NoticeReafdRecordDao.java | 6 +++ .../service/NoticeReafdRecordService.java | 9 +++++ .../impl/NoticeReafdRecordServiceImpl.java | 39 ++++++++++++++++++- .../mapper/notice/NoticeReafdRecordDao.xml | 11 ++++++ 6 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java 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 new file mode 100644 index 0000000000..f3170ebc9b --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/ReadTypeFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.notice.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Author sun + * @Description 通知已读未读列表查询-接口入参 + */ +@Data +public class ReadTypeFormDTO { + + /** + * 通知Id + */ + @NotBlank(message = "通知Id不能为空",groups = {ReadTypeFormDTO.Read.class}) + private String noticeId; + + public interface Read{} +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java index 902615a92b..d9881363e3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java @@ -31,6 +31,7 @@ import com.epmet.modules.notice.excel.NoticeReafdRecordExcel; import com.epmet.modules.notice.service.NoticeReafdRecordService; import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; 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.*; @@ -107,4 +108,17 @@ public class NoticeReafdRecordController { return new Result().ok(noticeReafdRecordService.noticeReadList(tokenDto, formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 小组通知阅读状态修改 + **/ + @PostMapping(value = "readtype") + public Result readType(@LoginUser TokenDto tokenDto, @RequestBody ReadTypeFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ReadTypeFormDTO.Read.class); + noticeReafdRecordService.readType(tokenDto, formDTO); + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java index 9e767ed133..8bf123949f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java @@ -45,4 +45,10 @@ public interface NoticeReafdRecordDao extends BaseDao { * @Description 根据通知Id查询组成员已读未读数据 **/ List getByNoticeId(@Param("noticeId") String noticeId); + + /** + * @Author sun + * @Description 查询当前人员是否存在对通知已读未读数据 + **/ + NoticeReafdRecordEntity selectByNoticeId(@Param("noticeId") String noticeId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java index c142fefcdc..77e2ca9419 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; 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; @@ -103,4 +104,12 @@ public interface NoticeReafdRecordService extends BaseService + + DELETE FROM From effacacffa1316d339bbd0d3d58e184ec8d044ed Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 17:12:17 +0800 Subject: [PATCH 14/17] =?UTF-8?q?act=5Fread=5Frecord=E6=96=B0=E5=A2=9Egrid?= =?UTF-8?q?=5Fid=E3=80=81group=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/resi/group/dto/act/ActReadRecordDTO.java | 13 ++++++++++++- .../modules/act/entity/ActReadRecordEntity.java | 10 ++++++++++ .../act/service/impl/GroupActInfoServiceImpl.java | 9 +++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java index 78bbec055c..b1040693b0 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java @@ -17,9 +17,10 @@ package com.epmet.resi.group.dto.act; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -43,6 +44,16 @@ public class ActReadRecordDTO implements Serializable { */ private String customerId; + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + /** * group_act_info.id */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java index ad7809400d..561a3d760a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java @@ -40,6 +40,16 @@ public class ActReadRecordEntity extends BaseEpmetEntity { */ private String customerId; + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + /** * group_act_info.id */ 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 ecf6f045df..a62da74ca6 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 @@ -148,7 +148,8 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl readRecordEntityList=constructReadRec(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getGroupId(), - formDTO.getPublishUserId()); + formDTO.getPublishUserId(), + groupDTO.getGridId()); //2、插入活动内容 contentList.forEach(textContentEntity->{ groupActContentDao.insert(textContentEntity); @@ -167,7 +168,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl constructReadRec(String groupActId, String customerId, String groupId,String publishUserId) { + private List constructReadRec(String groupActId, String customerId, String groupId,String publishUserId,String gridId) { List list=new ArrayList<>(); List memberDTOList=resiGroupMemberService.getMemberList(groupId); memberDTOList.forEach(memberDTO->{ @@ -177,6 +178,8 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl Date: Tue, 20 Apr 2021 17:24:51 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E8=87=B3=E5=A4=9A3=E5=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/act/service/impl/GroupActInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a62da74ca6..6276e1ab89 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 @@ -251,7 +251,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl NumConstant.THREE) { + if (formDTO.getImgList().size() > NumConstant.THREE) { throw new RenException(EpmetErrorCode.GROUP_ACT_IMG_MAX.getCode(), EpmetErrorCode.GROUP_ACT_IMG_MAX.getMsg()); } } From 4b8096b76392d5203913f55411a9719f3dc9c1e9 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 20 Apr 2021 17:30:52 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E5=BB=BA=E7=BB=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/dto/group/ResiGroupSetupDTO.java | 101 ++++++++++++++++++ ...ecordDTO.java => NoticeReadRecordDTO.java} | 2 +- .../controller/ResiGroupSetupController.java | 40 +++++++ .../modules/group/dao/ResiGroupSetupDao.java | 33 ++++++ .../group/entity/ResiGroupSetupEntity.java | 71 ++++++++++++ .../group/redis/ResiGroupSetupRedis.java | 47 ++++++++ .../group/service/ResiGroupSetupService.java | 31 ++++++ .../impl/ResiGroupSetupServiceImpl.java | 40 +++++++ .../impl/InvitationRecordServiceImpl.java | 1 - ...r.java => NoticeReadRecordController.java} | 30 +++--- ...ecordDao.java => NoticeReadRecordDao.java} | 10 +- ...ntity.java => NoticeReadRecordEntity.java} | 2 +- ...dExcel.java => NoticeReadRecordExcel.java} | 2 +- ...dRedis.java => NoticeReadRecordRedis.java} | 2 +- ...vice.java => NoticeReadRecordService.java} | 16 +-- ....java => NoticeReadRecordServiceImpl.java} | 52 ++++----- .../service/impl/NoticeServiceImpl.java | 19 ++-- .../mapper/group/ResiGroupSetupDao.xml | 7 ++ ...dRecordDao.xml => NoticeReadRecordDao.xml} | 6 +- 19 files changed, 440 insertions(+), 72 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java rename epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/{NoticeReafdRecordDTO.java => NoticeReadRecordDTO.java} (96%) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/{NoticeReafdRecordController.java => NoticeReadRecordController.java} (79%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/{NoticeReafdRecordDao.java => NoticeReadRecordDao.java} (78%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/{NoticeReafdRecordEntity.java => NoticeReadRecordEntity.java} (96%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/{NoticeReafdRecordExcel.java => NoticeReadRecordExcel.java} (97%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/{NoticeReafdRecordRedis.java => NoticeReadRecordRedis.java} (96%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/{NoticeReafdRecordService.java => NoticeReadRecordService.java} (84%) rename epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/{NoticeReafdRecordServiceImpl.java => NoticeReadRecordServiceImpl.java} (77%) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml rename epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/{NoticeReafdRecordDao.xml => NoticeReadRecordDao.xml} (83%) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java new file mode 100644 index 0000000000..9cad3f3f9a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupSetupDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.group; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Data +public class ResiGroupSetupDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID,初始默认为default + */ + private String customerId; + + /** + * 默认小组头像 + */ + private String logo; + + /** + * 小组名称 + */ + private String name; + + /** + * 小组简介 + */ + private String describe; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 专用:dedicated;常用:common_used + */ + private String category; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java similarity index 96% rename from epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java rename to epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java index 8574f2deb2..a93531c096 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReafdRecordDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java @@ -29,7 +29,7 @@ import lombok.Data; * @since v1.0.0 2021-04-19 */ @Data -public class NoticeReafdRecordDTO implements Serializable { +public class NoticeReadRecordDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java new file mode 100644 index 0000000000..6f21b623e3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupSetupController.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.controller; + +import com.epmet.modules.group.service.ResiGroupSetupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@RestController +@RequestMapping("resigroupsetup") +public class ResiGroupSetupController { + + @Autowired + private ResiGroupSetupService resiGroupSetupService; + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java new file mode 100644 index 0000000000..1efca98aa2 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupSetupDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Mapper +public interface ResiGroupSetupDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java new file mode 100644 index 0000000000..77727f9fa3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupSetupEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_group_setup") +public class ResiGroupSetupEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID,初始默认为default + */ + private String customerId; + + /** + * 默认小组头像 + */ + private String logo; + + /** + * 小组名称 + */ + private String name; + + /** + * 小组简介 + */ + private String describe; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 专用:dedicated;常用:common_used + */ + private String category; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java new file mode 100644 index 0000000000..fac89893ba --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupSetupRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Component +public class ResiGroupSetupRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java new file mode 100644 index 0000000000..180466d9ea --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupSetupService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +public interface ResiGroupSetupService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java new file mode 100644 index 0000000000..79ca65f419 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupSetupServiceImpl.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.group.dao.ResiGroupSetupDao; +import com.epmet.modules.group.entity.ResiGroupSetupEntity; +import com.epmet.modules.group.redis.ResiGroupSetupRedis; +import com.epmet.modules.group.service.ResiGroupSetupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 建组设置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-20 + */ +@Service +public class ResiGroupSetupServiceImpl extends BaseServiceImpl implements ResiGroupSetupService { + + @Autowired + private ResiGroupSetupRedis resiGroupSetupRedis; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java index f8a24b172d..2a7648e63d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/InvitationRecordServiceImpl.java @@ -25,7 +25,6 @@ import com.epmet.modules.invitation.dao.InvitationRecordDao; import com.epmet.modules.invitation.entity.InvitationRecordEntity; import com.epmet.modules.invitation.service.InvitationRecordService; import com.epmet.modules.notice.dao.NoticeDao; -import com.epmet.modules.notice.dao.NoticeReafdRecordDao; import com.epmet.modules.notice.entity.NoticeEntity; import com.epmet.resi.group.dto.invitation.form.ShareFormDTO; import com.epmet.resi.group.dto.invitation.result.ShareResultDTO; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java similarity index 79% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java index d9881363e3..dd865bfdf8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReafdRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeReadRecordController.java @@ -27,9 +27,9 @@ 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.NoticeReafdRecordExcel; -import com.epmet.modules.notice.service.NoticeReafdRecordService; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +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; @@ -49,25 +49,25 @@ import java.util.Map; */ @RestController @RequestMapping("noticereafdrecord") -public class NoticeReafdRecordController { +public class NoticeReadRecordController { @Autowired - private NoticeReafdRecordService noticeReafdRecordService; + private NoticeReadRecordService noticeReafdRecordService; @GetMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = noticeReafdRecordService.page(params); - return new Result>().ok(page); + public Result> page(@RequestParam Map params){ + PageData page = noticeReafdRecordService.page(params); + return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ - NoticeReafdRecordDTO data = noticeReafdRecordService.get(id); - return new Result().ok(data); + public Result get(@PathVariable("id") String id){ + NoticeReadRecordDTO data = noticeReafdRecordService.get(id); + return new Result().ok(data); } @PostMapping - public Result save(@RequestBody NoticeReafdRecordDTO dto){ + public Result save(@RequestBody NoticeReadRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); noticeReafdRecordService.save(dto); @@ -75,7 +75,7 @@ public class NoticeReafdRecordController { } @PutMapping - public Result update(@RequestBody NoticeReafdRecordDTO dto){ + public Result update(@RequestBody NoticeReadRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); noticeReafdRecordService.update(dto); @@ -92,8 +92,8 @@ public class NoticeReafdRecordController { @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = noticeReafdRecordService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, NoticeReafdRecordExcel.class); + List list = noticeReafdRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, NoticeReadRecordExcel.class); } /** diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java similarity index 78% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java index 8bf123949f..2375b63db6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReafdRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeReadRecordDao.java @@ -18,8 +18,8 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +import com.epmet.modules.notice.entity.NoticeReadRecordEntity; +import com.epmet.resi.group.dto.notice.NoticeReadRecordDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -32,7 +32,7 @@ import java.util.List; * @since v1.0.0 2021-04-19 */ @Mapper -public interface NoticeReafdRecordDao extends BaseDao { +public interface NoticeReadRecordDao extends BaseDao { /** * @Author sun @@ -44,11 +44,11 @@ public interface NoticeReafdRecordDao extends BaseDao { * @Author sun * @Description 根据通知Id查询组成员已读未读数据 **/ - List getByNoticeId(@Param("noticeId") String noticeId); + List getByNoticeId(@Param("noticeId") String noticeId); /** * @Author sun * @Description 查询当前人员是否存在对通知已读未读数据 **/ - NoticeReafdRecordEntity selectByNoticeId(@Param("noticeId") String noticeId, @Param("userId") String userId); + NoticeReadRecordEntity selectByNoticeId(@Param("noticeId") String noticeId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java similarity index 96% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java index e9a63804a1..0f1498b243 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReafdRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java @@ -34,7 +34,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("notice_reafd_record") -public class NoticeReafdRecordEntity extends BaseEpmetEntity { +public class NoticeReadRecordEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java similarity index 97% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java index 8f005770cd..3f58dbdef8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReafdRecordExcel.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/excel/NoticeReadRecordExcel.java @@ -29,7 +29,7 @@ import java.util.Date; * @since v1.0.0 2021-04-19 */ @Data -public class NoticeReafdRecordExcel { +public class NoticeReadRecordExcel { @Excel(name = "主键") private String id; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java similarity index 96% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java index dc20469216..c45eff7e15 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReafdRecordRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/redis/NoticeReadRecordRedis.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; * @since v1.0.0 2021-04-19 */ @Component -public class NoticeReafdRecordRedis { +public class NoticeReadRecordRedis { @Autowired private RedisUtils redisUtils; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java similarity index 84% rename from epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java rename to epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java index 77e2ca9419..f4d048055f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReafdRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeReadRecordService.java @@ -20,8 +20,8 @@ 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.NoticeReafdRecordEntity; -import com.epmet.resi.group.dto.notice.NoticeReafdRecordDTO; +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; @@ -35,7 +35,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2021-04-19 */ -public interface NoticeReafdRecordService extends BaseService { +public interface NoticeReadRecordService extends BaseService { /** * 默认分页 @@ -45,7 +45,7 @@ public interface NoticeReafdRecordService extends BaseService page(Map params); + PageData page(Map params); /** * 默认查询 @@ -55,7 +55,7 @@ public interface NoticeReafdRecordService extends BaseService list(Map params); + List list(Map params); /** * 单条查询 @@ -65,7 +65,7 @@ public interface NoticeReafdRecordService extends BaseService implements NoticeReafdRecordService { +public class NoticeReadRecordServiceImpl extends BaseServiceImpl implements NoticeReadRecordService { @Autowired - private NoticeReafdRecordRedis noticeReafdRecordRedis; + private NoticeReadRecordRedis noticeReafdRecordRedis; @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private NoticeDao noticeDao; @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( + public PageData page(Map params) { + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); - return getPageData(page, NoticeReafdRecordDTO.class); + return getPageData(page, NoticeReadRecordDTO.class); } @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); - return ConvertUtils.sourceToTarget(entityList, NoticeReafdRecordDTO.class); + return ConvertUtils.sourceToTarget(entityList, NoticeReadRecordDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; } @Override - public NoticeReafdRecordDTO get(String id) { - NoticeReafdRecordEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, NoticeReafdRecordDTO.class); + public NoticeReadRecordDTO get(String id) { + NoticeReadRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, NoticeReadRecordDTO.class); } @Override @Transactional(rollbackFor = Exception.class) - public void save(NoticeReafdRecordDTO dto) { - NoticeReafdRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReafdRecordEntity.class); + public void save(NoticeReadRecordDTO dto) { + NoticeReadRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReadRecordEntity.class); insert(entity); } @Override @Transactional(rollbackFor = Exception.class) - public void update(NoticeReafdRecordDTO dto) { - NoticeReafdRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReafdRecordEntity.class); + public void update(NoticeReadRecordDTO dto) { + NoticeReadRecordEntity entity = ConvertUtils.sourceToTarget(dto, NoticeReadRecordEntity.class); updateById(entity); } @@ -133,10 +133,10 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl list = baseDao.getByNoticeId(formDTO.getNoticeId()); + List list = baseDao.getByNoticeId(formDTO.getNoticeId()); //2.调用user服务,查询人员基础数据 - List userIdList = list.stream().map(NoticeReafdRecordDTO::getUserId).collect(Collectors.toList()); + List userIdList = list.stream().map(NoticeReadRecordDTO::getUserId).collect(Collectors.toList()); Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); if (!result.success()){ throw new RenException("调用user服务,获取用户基础数据失败"); @@ -185,14 +185,14 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl @Autowired private NoticeAttachmentDao noticeAttachmentDao; @Autowired - private NoticeReafdRecordService noticeReafdRecordService; + private NoticeReadRecordService noticeReafdRecordService; @Autowired - private NoticeReafdRecordDao noticeReafdRecordDao; + private NoticeReadRecordDao noticeReafdRecordDao; @Override @@ -273,9 +272,9 @@ public class NoticeServiceImpl extends BaseServiceImpl } //6.通知已读未读表初始数据 - List reafdRecordList = new ArrayList<>(); + List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); reafdRecord.setCustomerId(resultDTO.getCustomerId()); reafdRecord.setGridId(groupEntity.getGridId()); reafdRecord.setGroupId(formDTO.getGroupId()); @@ -394,9 +393,9 @@ public class NoticeServiceImpl extends BaseServiceImpl //6.通知已读未读消息表数据先删后增 noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); - List reafdRecordList = new ArrayList<>(); + List reafdRecordList = new ArrayList<>(); memberList.forEach(m -> { - NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); reafdRecord.setCustomerId(entity.getCustomerId()); reafdRecord.setGridId(entity.getGridId()); reafdRecord.setGroupId(entity.getGroupId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml new file mode 100644 index 0000000000..0c883e6bff --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml similarity index 83% rename from epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml rename to epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml index 935db4d0a8..74b99c2e1b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReafdRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml @@ -1,9 +1,9 @@ - + - SELECT * FROM @@ -13,7 +13,7 @@ AND notice_id = #{noticeId} - SELECT * FROM From 3e6edb6b9663daf68e280d67b30f4b0c6b2862e8 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 20 Apr 2021 17:45:19 +0800 Subject: [PATCH 17/17] act_read_record:read=>read_flag --- .../epmet/resi/group/dto/act/ActReadRecordDTO.java | 2 +- .../modules/act/entity/ActReadRecordEntity.java | 2 +- .../act/service/impl/GroupActInfoServiceImpl.java | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java index b1040693b0..c9350d4716 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActReadRecordDTO.java @@ -62,7 +62,7 @@ public class ActReadRecordDTO implements Serializable { /** * 已读: read未读:un_read;查看活动详情后修改此表,或者插入一条新的已读记录 */ - private String read; + private String readFlag; /** * 用户id diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java index 561a3d760a..4ffe1d4c5f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActReadRecordEntity.java @@ -58,7 +58,7 @@ public class ActReadRecordEntity extends BaseEpmetEntity { /** * 已读: read未读:un_read;查看活动详情后修改此表,或者插入一条新的已读记录 */ - private String read; + private String readFlag; /** * 用户id 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 6276e1ab89..8fa5bfecd6 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 @@ -175,7 +175,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl已读 - actReadRecordEntity.setRead(GroupActConstant.READ); + actReadRecordEntity.setReadFlag(GroupActConstant.READ); actReadRecordEntity.setUpdatedTime(new Date()); actReadRecordDao.updateById(actReadRecordEntity); } @@ -505,7 +506,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl