Browse Source

我的小组V2--条件获取我的小组

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
63bf54c77a
  1. 4
      epmet-gateway/pom.xml
  2. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/MyGroupFormDTO.java
  3. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/LastTextDTO.java
  4. 59
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/MyGroupV2ResultDTO.java
  5. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  6. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  7. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  8. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  9. 90
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

4
epmet-gateway/pom.xml

@ -299,8 +299,8 @@
<!-- <gateway.routes.resi-mine-server.uri>http://localhost:8094</gateway.routes.resi-mine-server.uri>-->
<gateway.routes.resi-mine-server.uri>lb://resi-mine-server</gateway.routes.resi-mine-server.uri>
<!-- 16、居民端楼院校组 -->
<!-- <gateway.routes.resi-group-server.uri>http://localhost:8095</gateway.routes.resi-group-server.uri>-->
<gateway.routes.resi-group-server.uri>lb://resi-group-server</gateway.routes.resi-group-server.uri>
<gateway.routes.resi-group-server.uri>http://localhost:8095</gateway.routes.resi-group-server.uri>
<!-- <gateway.routes.resi-group-server.uri>lb://resi-group-server</gateway.routes.resi-group-server.uri>-->
<!-- 17、党员认证、热心居民申请 -->
<!-- <gateway.routes.resi-partymember-server.uri>http://localhost:8096</gateway.routes.resi-partymember-server.uri>-->
<gateway.routes.resi-partymember-server.uri>lb://resi-partymember-server</gateway.routes.resi-partymember-server.uri>

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/MyGroupFormDTO.java

@ -43,4 +43,6 @@ public class MyGroupFormDTO implements Serializable {
*/
@NotBlank(message="当前用户id不能为空")
private String userId;
private String groupType;
}

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/LastTextDTO.java

@ -0,0 +1,18 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/8/25 14:01
*/
@Data
public class LastTextDTO implements Serializable {
private static final long serialVersionUID = 4908205806172407179L;
private String textId;
private String topicContent;
private String type;
}

59
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/MyGroupV2ResultDTO.java

@ -0,0 +1,59 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/8/25 14:05
*/
@Data
public class MyGroupV2ResultDTO implements Serializable {
private static final long serialVersionUID = -3299763394428383259L;
/**
* 群组id
*/
private String groupId;
/**
* 群组头像
*/
private String groupHeadPhoto;
/**
* 群组名称
*/
private String groupName;
/**
* 成员总数
*/
private Integer totalMember;
/**
* 党员总数
*/
private Integer totalPartyMember;
/**
* 审核通过 - approved 审核中 - under_auditting 审核未通过 - rejected 已屏蔽 - hidden 已关闭 - closed
*/
private String groupState;
/**
* member成员leader群主
*/
private String groupLeaderFlag;
/**
* 最新话题
*/
private LastTextDTO lastText;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -77,6 +77,15 @@ public class ResiGroupController {
return new Result<List<MyGroupResultDTO>>().ok(myGroupList);
}
@PostMapping("getmygroupV2")
public Result<List<MyGroupV2ResultDTO>> getMyGroupV2(@LoginUser TokenDto tokenDto, @RequestBody MyGroupFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO);
List<MyGroupV2ResultDTO> myGroupList = resiGroupService.getMyGroupV2(formDTO);
return new Result<List<MyGroupV2ResultDTO>>().ok(myGroupList);
}
/**
* @param tokenDto
* @param recommendGroupFormDTO

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java

@ -52,7 +52,7 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
* @Date 2020/3/28 20:39
**/
List<MyGroupResultDTO> selectListMyGroup(MyGroupFormDTO myGroupFormDTO);
List<MyGroupV2ResultDTO> selectListMyGroupV2(MyGroupFormDTO myGroupFormDTO);
/**
* @return com.epmet.resi.group.dto.group.result.LatestTopicDTO
* @param groupId
@ -62,6 +62,8 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
**/
LatestTopicDTO selectLatestTopic(String groupId);
LastTextDTO selectLatestText(String groupId);
/**
* @param recommendGroupFormDTO
* @return java.util.List<com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO>

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -114,6 +114,15 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
**/
List<MyGroupResultDTO> getMyGroup(MyGroupFormDTO myGroupFormDTO);
/**
* @Description 我的小组查询包含我创建的小组+我加入的小组以各组的最新话题时间有近到远排序
* @Param myGroupFormDTO
* @Return {@link List< MyGroupV2ResultDTO>}
* @Author zhaoqifeng
* @Date 2021/8/25 14:13
*/
List<MyGroupV2ResultDTO> getMyGroupV2(MyGroupFormDTO myGroupFormDTO);
/**
* @param recommendGroupFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO>>

20
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -247,6 +247,26 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return myGroupList;
}
/**
* @param myGroupFormDTO
* @Description 我的小组查询包含我创建的小组+我加入的小组以各组的最新话题时间有近到远排序
* @Param myGroupFormDTO
* @Return {@link List< MyGroupV2ResultDTO>}
* @Author zhaoqifeng
* @Date 2021/8/25 14:13
*/
@Override
public List<MyGroupV2ResultDTO> getMyGroupV2(MyGroupFormDTO myGroupFormDTO) {
int pageIndex = (myGroupFormDTO.getPageNo() - NumConstant.ONE) * myGroupFormDTO.getPageSize();
myGroupFormDTO.setPageNo(pageIndex);
List<MyGroupV2ResultDTO> myGroupList = baseDao.selectListMyGroupV2(myGroupFormDTO);
if (null == myGroupList || myGroupList.size() < 1) {
logger.info(String.format("我的小组V2查询为空,selectListMyGroup入参%s", JSON.toJSONString(myGroupFormDTO)));
return new ArrayList<>();
}
return myGroupList;
}
/**
* @param recommendGroupFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO>>

90
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

@ -14,6 +14,18 @@
<association property="latestTopic" select="com.epmet.modules.group.dao.ResiGroupDao.selectLatestTopic" column="id">
</association>
</resultMap>
<resultMap id="MyGroupV2ResultDTOMap" type="com.epmet.resi.group.dto.group.result.MyGroupV2ResultDTO">
<result property="groupId" column="id"/>
<result property="groupHeadPhoto" column="GROUP_HEAD_PHOTO"/>
<result property="groupName" column="GROUP_NAME"/>
<result property="totalMember" column="TOTAL_MEMBERS"/>
<result property="totalPartyMember" column="TOTAL_PARTY_MEMBERS"/>
<result property="groupState" column="STATE"/>
<result property="groupLeaderFlag" column="GROUP_LEADER_FLAG"/>
<association property="lastText" javaType="com.epmet.resi.group.dto.group.result.LastTextDTO" select="com.epmet.modules.group.dao.ResiGroupDao.selectLatestText" column="id">
</association>
</resultMap>
<!-- 我的小组查询(包含我创建的小组+我加入的小组),以各组的最新话题时间有近到远排序) -->
<select id="selectListMyGroup" parameterType="com.epmet.resi.group.dto.group.form.MyGroupFormDTO"
resultMap="MyGroupResultDTOMap">
@ -43,6 +55,37 @@
LIMIT #{pageNo}, #{pageSize}
</select>
<select id="selectListMyGroupV2" parameterType="com.epmet.resi.group.dto.group.form.MyGroupFormDTO"
resultMap="MyGroupV2ResultDTOMap">
SELECT
rg.id,
rg.GROUP_HEAD_PHOTO,
rg.GROUP_NAME ,
rgs.TOTAL_MEMBERS ,
rgs.TOTAL_PARTY_MEMBERS ,
rg.STATE ,
rgm.GROUP_LEADER_FLAG,
rg.GROUP_TYPE
FROM
resi_group_member rgm
LEFT JOIN resi_group rg ON ( rgm.RESI_GROUP_ID = rg.ID )
LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID )
WHERE
rg.DEL_FLAG = '0'
AND rgm.DEL_FLAG = '0'
AND rgs.DEL_FLAG = '0'
AND rg.CUSTOMER_ID = #{customerId}
AND rg.GRID_ID =#{gridId}
AND rgm.CUSTOMER_USER_ID = #{userId}
AND rgm.STATUS IN ( 'approved', 'silent' )
AND rg.STATE in('approved','hidden','closed')
<if test="groupType != null and groupType.trim() != ''">
AND rg.GROUP_TYPE = #{groupType}
</if>
order by rg.LATEST_TOPIC_PUBLISH_DATE desc
LIMIT #{pageNo}, #{pageSize}
</select>
<!-- 查询当前组最新话题 -->
<select id="selectLatestTopic" resultType="com.epmet.resi.group.dto.group.result.LatestTopicDTO">
SELECT
@ -58,6 +101,53 @@
limit 1
</select>
<!-- 查询当前组最新话题 -->
<select id="selectLatestText" resultType="com.epmet.resi.group.dto.group.result.LastTextDTO">
SELECT
textId,
topicContent,
type
FROM
(
SELECT
a.ID AS textId,
a.TOPIC_CONTENT AS topicContent,
'topic' AS type,
max( a.CREATED_TIME ) AS CREATED_TIME
FROM
resi_topic a
WHERE
a.GROUP_ID = #{groupId}
GROUP BY
a.GROUP_ID UNION ALL
SELECT
a.ID AS textId,
a.TITLE AS topicContent,
'notice' AS type,
max( a.CREATED_TIME ) AS CREATED_TIME
FROM
notice a
WHERE
a.GROUP_ID = #{groupId}
GROUP BY
a.GROUP_ID UNION ALL
SELECT
a.ID AS textId,
a.TITLE AS topicContent,
'activity' AS type,
max( a.CREATED_TIME ) AS CREATED_TIME
FROM
group_act_info a
WHERE
a.GROUP_ID = #{groupId}
GROUP BY
a.GROUP_ID
) a
ORDER BY
CREATED_TIME DESC
LIMIT 1
</select>
<!-- 推荐小组列表查询 -->
<select id="selectListRecommendGroup" parameterType="com.epmet.resi.group.dto.group.form.RecommendGroupFormDTO"
resultType="com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO">

Loading…
Cancel
Save