From 18767a58029ce1c468c0f977f2e1f216fca30e2a Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 29 Dec 2020 16:58:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?getstatus=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/topic/form/ShareLinkTypeFormDTO.java | 25 ++++++++++++ ...rRelationBetweenGroupAndGridResultDTO.java | 31 +++++++++++++++ .../TopicShareLinkRecordController.java | 17 +++++++++ .../service/TopicShareLinkRecordService.java | 11 ++++++ .../TopicShareLinkVisitRecordService.java | 2 + .../impl/ResiTopicCommentServiceImpl.java | 13 ++++--- .../service/impl/ResiTopicServiceImpl.java | 38 +++++++++---------- .../service/impl/TopicDraftServiceImpl.java | 21 +++++----- .../impl/TopicShareLinkRecordServiceImpl.java | 27 +++++++++++++ .../TopicShareLinkVisitRecordServiceImpl.java | 7 +++- 10 files changed, 155 insertions(+), 37 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java new file mode 100644 index 0000000000..da7887bc8d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 分享链接类型和Id入参 + * @ClassName ShareLinkTypefFormDTO + * @Auth wangc + * @Date 2020-12-29 14:53 + */ +@Data +public class ShareLinkTypeFormDTO implements Serializable { + + @NotBlank(message = "链接Id不能为空") + private String id; + + @NotBlank(message = "链接类型不能为空") + private String type; + + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java new file mode 100644 index 0000000000..a00b489f3a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 通过链接进入小程序的用户与链接所在的小组与网格的关系 + * @ClassName MemberRelationBetweenGroupAndGridResultDTO + * @Auth wangc + * @Date 2020-12-29 14:58 + */ +@Data +public class MemberRelationBetweenGroupAndGridResultDTO implements Serializable { + private static final long serialVersionUID = -5389490307870064071L; + + /** + * 是否存在入组待审核记录,true:存在,false:不存在 + */ + private Boolean awaitAudit; + + /** + * 是否在群内标志,已经在群内:true, 不在群内:false + */ + private Boolean inGroup; + + /** + * 此人有没有加入所在小组所属网格下的任何一个小组,true:加入,false:未加入 + */ + private Boolean inAnyGroup; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java index d8e9614ff2..bd138b5583 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java @@ -10,11 +10,14 @@ 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.topic.service.TopicShareLinkRecordService; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; import org.springframework.beans.factory.annotation.Autowired; @@ -108,4 +111,18 @@ public class TopicShareLinkRecordController { return new Result().ok(topicShareLinkRecordService.topicVisit(formDTO,tokenDto)); } + /** + * @Description 根据链接信息查询被邀请人在组/网格内的状态 + * @param param + * @return com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO + * @author wangc + * @date 2020.12.29 15:01 + */ + @PostMapping("getstatus") + public Result getStatus(@LoginUser TokenDto token, @RequestBody ShareLinkTypeFormDTO param){ + param.setUserId(token.getUserId()); + ValidatorUtils.validateEntity(param); + return new Result().ok(topicShareLinkRecordService.getStatusByLinkAndInvitee(param)); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java index c52f23d862..ec3bd6000d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java @@ -6,9 +6,11 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; @@ -107,4 +109,13 @@ public interface TopicShareLinkRecordService extends BaseService NumConstant.TEN ? - (topic.getTopicContent().substring(NumConstant.TEN) + "…") : - topic.getTopicContent()); + content.length() > NumConstant.TEN ? + (content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") : + content); builder.append("\""); - } + }else builder.append("语音话题"); + pointEventMsg.setRemark(builder.toString()); pointEventMsgList.add(pointEventMsg); 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 c1c8324494..05db5711cd 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 @@ -91,10 +91,12 @@ import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO; import com.epmet.resi.group.dto.topic.result.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.google.common.base.CharMatcher; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jsoup.helper.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -1598,14 +1600,14 @@ public class ResiTopicServiceImpl extends BaseServiceImpl topic.getTopicContent().length() ? "\"" : "…\"") + content + .substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN) + + (NumConstant.TEN > content.length() ? "\"" : "…\"") ).append("被转为议题").toString()); pointEventMsgList.add(pointEventMsg); @@ -1619,11 +1621,10 @@ public class ResiTopicServiceImpl extends BaseServiceImpl topic.getTopicContent().length() ? "\"" : "…\"") - ).append("转为议题").toString()); + new StringBuilder(new StringBuilder(pointEventMsg.getRemark().replaceFirst("小组中发布的","")) + .reverse().toString() + .replaceFirst("题议为转被","")).reverse() + ).append("转为议题").toString()); pointEventMsgList.add(pointEventMsg2); mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); @@ -1733,14 +1734,14 @@ public class ResiTopicServiceImpl extends BaseServiceImpl topic.getTopicContent().length() ? "\"" : "…\"") + content + .substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN) + + (NumConstant.TEN > content.length() ? "\"" : "…\"") ).append("被转为议题").toString()); pointEventMsgList.add(pointEventMsg); @@ -1754,10 +1755,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl topic.getTopicContent().length() ? "\"" : "…\"") + new StringBuilder(new StringBuilder(pointEventMsg.getRemark().replaceFirst("小组中发布的","")).reverse() + .toString().replaceFirst("题议为转被","")).reverse() ).append("转为议题").toString()); pointEventMsgList.add(pointEventMsg2); @@ -1768,7 +1767,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl NumConstant.TEN ? (draft.getTopicContent().substring(NumConstant.TEN) + "…") : draft.getTopicContent()); + breviary.append(content.length() > NumConstant.TEN ? (content.substring(NumConstant.TEN) + "…") : content); breviary.append("\""); - }else { - breviary.append("语音话题"); - } + }else breviary.append("话题"); sendMqMsg(draft.getCreatedBy(), draft.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString()); } //记录操作记录 @@ -778,17 +778,16 @@ public class TopicDraftServiceImpl extends BaseServiceImpl NumConstant.TEN ? (draft.getTopicContent().substring(NumConstant.TEN) + "…") : draft.getTopicContent()); + breviary.append(content.length() > NumConstant.TEN ? (content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") : content); breviary.append("\""); - }else { - breviary.append("语音话题"); - } + }else breviary.append("语音话题"); sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString()); } - + /** * @Description 发送积分事件 * @param userId diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java index 9d88bc7896..4b2ce36b96 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.modules.member.dao.GroupMemeberOperationDao; import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; @@ -19,9 +20,11 @@ import com.epmet.modules.topic.service.TopicShareLinkRecordService; import com.epmet.resi.group.constant.TopicShareConstant; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; import org.apache.commons.lang3.StringUtils; @@ -48,6 +51,8 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl page(Map params) { @@ -191,4 +196,26 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl Date: Wed, 30 Dec 2020 13:51:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=BF=94=E5=9B=9E=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=8E=E9=93=BE=E6=8E=A5=E4=B8=AD=E7=BB=84=E3=80=81?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=9A=84=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rRelationBetweenGroupAndGridResultDTO.java | 6 +-- .../impl/TopicShareLinkRecordServiceImpl.java | 49 ++++++++++++++++++- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java index a00b489f3a..e3b0446113 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java @@ -17,15 +17,15 @@ public class MemberRelationBetweenGroupAndGridResultDTO implements Serializable /** * 是否存在入组待审核记录,true:存在,false:不存在 */ - private Boolean awaitAudit; + private Boolean awaitAudit = false; /** * 是否在群内标志,已经在群内:true, 不在群内:false */ - private Boolean inGroup; + private Boolean inGroup = false; /** * 此人有没有加入所在小组所属网格下的任何一个小组,true:加入,false:未加入 */ - private Boolean inAnyGroup; + private Boolean inAnyGroup = false; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java index 4b2ce36b96..4163761b96 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java @@ -9,15 +9,22 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IssueShareLinkRecordDTO; import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.modules.group.dao.ResiGroupDao; +import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.modules.member.dao.GroupMemeberOperationDao; import com.epmet.modules.member.dao.ResiGroupMemberDao; +import com.epmet.modules.topic.dao.ResiTopicDao; import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; import com.epmet.modules.topic.dao.TopicShareLinkVisitRecordDao; import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.TopicShareLinkRecordService; +import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.TopicShareConstant; +import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; @@ -27,10 +34,12 @@ import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Arrays; import java.util.List; @@ -43,6 +52,7 @@ import java.util.Map; * @since v1.0.0 2020-12-18 */ @Service +@Slf4j public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkRecordService { @Autowired @@ -53,7 +63,10 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -212,10 +225,42 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl issueShareLinkInfo = issueClient.shareLinkInfo(param.getId()); + if(issueShareLinkInfo.success() && null != issueShareLinkInfo.getData()){ + String issueId = issueShareLinkInfo.getData().getIssueId(); + if(StringUtils.isNotBlank(issueId)){ + group = topicDao.selectGroupIdByIssueId(issueId); + } + } + } + if(StringUtils.isBlank(group)) throw new RenException("根据分享链接Id没有找到对应的组Id"); + String userId = param.getUserId(); + GroupMemeberOperationDTO applyRecord = groupMemeberOperationDao.selectLatestRecord(group, userId); + if(null != applyRecord && StringUtils.equals(ModuleConstant.GROUP_STATUS_UNDER_AUDITTING,applyRecord.getOperateStatus())){ + //under_auditing + relation.setAwaitAudit(true); + } + if(null != applyRecord && StringUtils.equals(ModuleConstant.AUDITING_OPERATION_APPROVAL,applyRecord.getOperateStatus())){ + //approved + relation.setInGroup(true); + relation.setInAnyGroup(true); + } + if(!relation.getInAnyGroup()) { + ResiGroupEntity groupEntity = groupDao.selectById(group); + if(null == groupEntity || StringUtils.isBlank(groupEntity.getGridId())) + throw new RenException("没有找到相应的组记录"); + List groups = resiGroupMemberDao.getGroupIdByUserIdAndGridId(groupEntity.getGridId(), userId, NumConstant.ONE_STR); + if(!CollectionUtils.isEmpty(groups)){ + relation.setInAnyGroup(true); + if(groups.contains(group)){ + relation.setInGroup(true); + log.error("查出用户{}是组{}中成员,但是没有对应的入群记录",param.getUserId(),group); + } + } } - return null; + return relation; } } \ No newline at end of file