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..e3b0446113 --- /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 = false; + + /** + * 是否在群内标志,已经在群内:true, 不在群内:false + */ + private Boolean inGroup = false; + + /** + * 此人有没有加入所在小组所属网格下的任何一个小组,true:加入,false:未加入 + */ + private Boolean inAnyGroup = false; +} 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()); } //记录操作记录 @@ -880,17 +880,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..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,25 +9,37 @@ 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; 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 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; @@ -40,6 +52,7 @@ import java.util.Map; * @since v1.0.0 2020-12-18 */ @Service +@Slf4j public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkRecordService { @Autowired @@ -48,7 +61,12 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -191,4 +209,58 @@ 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 relation; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java index 34d9be5bb5..949cfd6bab 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java @@ -6,12 +6,18 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; 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.TopicShareLinkVisitRecordDao; import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -107,5 +113,4 @@ public class TopicShareLinkVisitRecordServiceImpl extends BaseServiceImpl