Browse Source

分享话题id获取信息

dev_shibei_match
zxc 5 years ago
parent
commit
d283aba972
  1. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicShareConstant.java
  2. 29
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicVisitFormDTO.java
  3. 50
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicVisitResultDTO.java
  4. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java
  5. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java
  6. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java
  7. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java
  8. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java
  9. 65
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java
  10. 11
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml
  11. 11
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml
  12. 7
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicShareConstant.java

@ -10,4 +10,6 @@ public interface TopicShareConstant {
String NOT_EXIST_TOPIC_BELONG_GROUP = "未查询到话题所属小组......"; String NOT_EXIST_TOPIC_BELONG_GROUP = "未查询到话题所属小组......";
String NOT_EXIST_INVITE_RECORD = "未查询到该邀请记录......";
} }

29
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicVisitFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/12/18 下午3:12
*/
@Data
public class TopicVisitFormDTO implements Serializable {
private static final long serialVersionUID = -7231684507046042401L;
/**
* 当点击右上角三个点分享时传参为topicId点击页面内的分享时传参为inviteId
*/
/**
* 分享ID
*/
private String shareLinkId;
/**
* 话题ID
*/
private String topicId;
}

50
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicVisitResultDTO.java

@ -0,0 +1,50 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/12/18 下午3:15
*/
@Data
public class TopicVisitResultDTO implements Serializable {
private static final long serialVersionUID = -8053248999188056579L;
/**
* 是否存在入组待审核记录true存在false不存在
*/
private Boolean awaitAudit;
/**
* 是否在群内标志已经在群内:true, 不在群内:false
*/
private Boolean inGroup;
/**
* 小组ID
*/
private String groupId;
/**
* 网格ID
*/
private String gridId;
/**
* 话题ID
*/
private String topicId;
/**
* 客户ID
*/
private String customerId;
/**
* 话题屏蔽状态true已屏蔽false未屏蔽
*/
private Boolean shieldStatus;
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java

@ -50,4 +50,13 @@ public interface GroupMemeberOperationDao extends BaseDao<GroupMemeberOperationE
* @Date 2020/4/11 10:47 * @Date 2020/4/11 10:47
**/ **/
GroupMemeberOperationDTO selectLatestRecord(@Param("groupId")String groupId, @Param("userId") String userId); GroupMemeberOperationDTO selectLatestRecord(@Param("groupId")String groupId, @Param("userId") String userId);
/**
* @Description 校验此人是不是存在入此组待审核记录
* @Param userId
* @Param groupId
* @author zxc
* @date 2020/12/18 下午4:40
*/
Integer checkAwaitAudit(@Param("userId")String userId,@Param("groupId")String groupId);
} }

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java

@ -119,4 +119,13 @@ public interface ResiGroupMemberDao extends BaseDao<ResiGroupMemberEntity> {
* @date 2020.05.26 14:22 * @date 2020.05.26 14:22
**/ **/
List<String> getGroupIdByUserIdAndGridId(@Param("gridId")String gridId,@Param("userId")String userId,@Param("roleFlag")String roleFlag); List<String> getGroupIdByUserIdAndGridId(@Param("gridId")String gridId,@Param("userId")String userId,@Param("roleFlag")String roleFlag);
/**
* @Description 校验此人是不是在组内
* @Param userId
* @Param groupId
* @author zxc
* @date 2020/12/18 下午4:33
*/
Integer checkUserInGroup(@Param("userId")String userId,@Param("groupId")String groupId);
} }

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java

@ -13,8 +13,10 @@ import com.epmet.modules.topic.service.TopicShareLinkRecordService;
import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; 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.CreateUrlFormDTO;
import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; 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.CreateUrlResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; 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; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -93,4 +95,16 @@ public class TopicShareLinkRecordController {
return new Result<TopicBelongGroupResultDTO>().ok(topicShareLinkRecordService.selectTopicBelongGroup(formDTO)); return new Result<TopicBelongGroupResultDTO>().ok(topicShareLinkRecordService.selectTopicBelongGroup(formDTO));
} }
/**
* @Description 分享话题id获取信息
* @Param formDTO
* @Param tokenDto
* @author zxc
* @date 2020/12/18 下午3:34
*/
@PostMapping("visit")
public Result<TopicVisitResultDTO> topicVisit(@RequestBody TopicVisitFormDTO formDTO,@LoginUser TokenDto tokenDto){
return new Result<TopicVisitResultDTO>().ok(topicShareLinkRecordService.topicVisit(formDTO,tokenDto));
}
} }

3
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java

@ -2,6 +2,7 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity;
import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -20,7 +21,7 @@ public interface TopicShareLinkRecordDao extends BaseDao<TopicShareLinkRecordEnt
* @author zxc * @author zxc
* @date 2020/12/18 上午10:28 * @date 2020/12/18 上午10:28
*/ */
TopicShareLinkRecordEntity selectTopicInfoById(@Param("topicId") String topicId); TopicVisitResultDTO selectTopicInfoById(@Param("topicId") String topicId);
/** /**
* @Description 校验此人此话题是否存在邀请记录 * @Description 校验此人此话题是否存在邀请记录

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java

@ -7,8 +7,10 @@ import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity;
import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; 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.CreateUrlFormDTO;
import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; 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.CreateUrlResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -96,4 +98,13 @@ public interface TopicShareLinkRecordService extends BaseService<TopicShareLinkR
* @date 2020/12/18 下午2:08 * @date 2020/12/18 下午2:08
*/ */
TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO); TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO);
/**
* @Description 分享话题id获取信息
* @Param formDTO
* @Param tokenDto
* @author zxc
* @date 2020/12/18 下午3:34
*/
TopicVisitResultDTO topicVisit(TopicVisitFormDTO formDTO,TokenDto tokenDto);
} }

65
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java

@ -4,20 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.modules.member.dao.GroupMemeberOperationDao;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; 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.TopicShareLinkRecordEntity;
import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity;
import com.epmet.modules.topic.service.TopicShareLinkRecordService; import com.epmet.modules.topic.service.TopicShareLinkRecordService;
import com.epmet.resi.group.constant.TopicShareConstant; import com.epmet.resi.group.constant.TopicShareConstant;
import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; 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.CreateUrlFormDTO;
import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; 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.CreateUrlResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -34,6 +42,13 @@ import java.util.Map;
@Service @Service
public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareLinkRecordDao, TopicShareLinkRecordEntity> implements TopicShareLinkRecordService { public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareLinkRecordDao, TopicShareLinkRecordEntity> implements TopicShareLinkRecordService {
@Autowired
private TopicShareLinkVisitRecordDao visitRecordDao;
@Autowired
private ResiGroupMemberDao resiGroupMemberDao;
@Autowired
private GroupMemeberOperationDao groupMemeberOperationDao;
@Override @Override
public PageData<TopicShareLinkRecordDTO> page(Map<String, Object> params) { public PageData<TopicShareLinkRecordDTO> page(Map<String, Object> params) {
IPage<TopicShareLinkRecordEntity> page = baseDao.selectPage( IPage<TopicShareLinkRecordEntity> page = baseDao.selectPage(
@ -100,7 +115,7 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL
if (StringUtils.isNotBlank(shareLinkId)){ if (StringUtils.isNotBlank(shareLinkId)){
return new CreateUrlResultDTO(shareLinkId); return new CreateUrlResultDTO(shareLinkId);
} }
TopicShareLinkRecordEntity topicInfo = baseDao.selectTopicInfoById(form.getTopicId()); TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(form.getTopicId());
if (null == topicInfo){ if (null == topicInfo){
throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO);
} }
@ -123,11 +138,53 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL
*/ */
@Override @Override
public TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { public TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) {
TopicShareLinkRecordEntity entity = baseDao.selectTopicInfoById(formDTO.getTopicId()); TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(formDTO.getTopicId());
if (null == entity){ if (null == topicInfo){
throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_BELONG_GROUP); throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_BELONG_GROUP);
} }
return new TopicBelongGroupResultDTO(entity.getGroupId()); return new TopicBelongGroupResultDTO(topicInfo.getGroupId());
}
/**
* @Description 分享话题id获取信息
* @Param formDTO
* @Param tokenDto
* @author zxc
* @date 2020/12/18 下午3:34
*/
@Override
@Transactional(rollbackFor = Exception.class)
public TopicVisitResultDTO topicVisit(TopicVisitFormDTO formDTO, TokenDto tokenDto) {
String topicId = null;
if (StringUtils.isNotBlank(formDTO.getShareLinkId())){
// 点击页面上的分享时
TopicShareLinkRecordEntity linkRecord = baseDao.selectById(formDTO.getShareLinkId());
if (null == linkRecord){
throw new RenException(TopicShareConstant.NOT_EXIST_INVITE_RECORD);
}
TopicShareLinkVisitRecordEntity entity = new TopicShareLinkVisitRecordEntity();
entity.setCustomerId(linkRecord.getCustomerId());
entity.setShareUserId(linkRecord.getShareUserId());
entity.setInviteeUserId(tokenDto.getUserId());
entity.setShareLinkRecId(formDTO.getShareLinkId());
entity.setIsInviteRegister(NumConstant.ONE);
visitRecordDao.insert(entity);
topicId = linkRecord.getTopicId();
}else topicId = formDTO.getTopicId();
TopicVisitResultDTO result = baseDao.selectTopicInfoById(topicId);
if (null == result){
throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO);
}
Integer userInGroup = resiGroupMemberDao.checkUserInGroup(tokenDto.getUserId(), result.getGroupId());
if (userInGroup > NumConstant.ZERO){
result.setAwaitAudit(false);
result.setInGroup(true);
}else {
result.setInGroup(false);
Integer awaitAudit = groupMemeberOperationDao.checkAwaitAudit(tokenDto.getUserId(), result.getGroupId());
result.setAwaitAudit(awaitAudit > NumConstant.ZERO ? true : false);
}
return result;
} }
} }

11
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml

@ -28,4 +28,15 @@
gmo.CREATED_TIME DESC gmo.CREATED_TIME DESC
LIMIT 1 LIMIT 1
</select> </select>
<!-- 校验此人是不是存在入此组待审核记录 -->
<select id="checkAwaitAudit" resultType="java.lang.Integer">
SELECT
COUNT(ID)
FROM group_memeber_operation
WHERE DEL_FLAG = '0'
AND CUSTOMER_USER_ID = #{userId}
AND GROUP_ID = #{groupId}
AND OPERATE_STATUS = 'under_auditting'
</select>
</mapper> </mapper>

11
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml

@ -154,4 +154,15 @@
</where> </where>
</select> </select>
<!-- 校验此人是不是在组内 -->
<select id="checkUserInGroup" resultType="java.lang.Integer">
SELECT
count(ID)
FROM resi_group_member
WHERE DEL_FLAG = '0'
AND CUSTOMER_USER_ID = #{userId}
AND RESI_GROUP_ID = #{groupId}
AND `STATUS` = 'approved'
</select>
</mapper> </mapper>

7
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml

@ -4,11 +4,13 @@
<mapper namespace="com.epmet.modules.topic.dao.TopicShareLinkRecordDao"> <mapper namespace="com.epmet.modules.topic.dao.TopicShareLinkRecordDao">
<!-- 根据话题ID查询对应信息 --> <!-- 根据话题ID查询对应信息 -->
<select id="selectTopicInfoById" resultType="com.epmet.modules.topic.entity.TopicShareLinkRecordEntity"> <select id="selectTopicInfoById" resultType="com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO">
SELECT SELECT
rt.id AS topicId,
rt.GROUP_ID, rt.GROUP_ID,
rg.GRID_ID, rg.GRID_ID,
rg.CUSTOMER_ID rg.CUSTOMER_ID,
(CASE WHEN rt.`STATUS` = 'hidden' THEN TRUE ELSE FALSE END ) AS shieldStatus
FROM resi_topic rt FROM resi_topic rt
LEFT JOIN resi_group rg ON rg.ID = rt.GROUP_ID LEFT JOIN resi_group rg ON rg.ID = rt.GROUP_ID
WHERE rt.DEL_FLAG = '0' WHERE rt.DEL_FLAG = '0'
@ -25,4 +27,5 @@
AND SHARE_USER_ID = #{userId} AND SHARE_USER_ID = #{userId}
AND TOPIC_ID = #{topicId} AND TOPIC_ID = #{topicId}
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save