From 986a6685eb05fd44d4263e0db2059792b8b9930d Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Tue, 16 Jun 2020 17:14:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E7=BE=A41+1=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elink/esua/epdc/dto/PartyGroupDTO.java | 6 ++ .../dto/form/PartyUserNewInfoFormDTO.java | 25 +++++ .../elink/esua/epdc/dto/result/AllUsers.java | 4 + .../esua/epdc/dto/result/CurrentUser.java | 4 + .../result/PartyTopicSupportResultDTO.java | 51 +++++++++ .../elink/esua/epdc/dto/result/TopicList.java | 14 +++ .../epdc/controller/PartyGroupController.java | 7 +- .../elink/esua/epdc/dao/PartyGroupDao.java | 2 +- .../service/impl/PartyGroupServiceImpl.java | 37 +++++-- .../impl/PartyUserGroupServiceImpl.java | 34 +++++- .../main/resources/mapper/PartyGroupDao.xml | 2 +- .../main/resources/mapper/PartyTopicDao.xml | 25 ++++- .../resources/mapper/PartyUserGroupDao.xml | 101 ++++++++++-------- 13 files changed, 248 insertions(+), 64 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/PartyTopicSupportResultDTO.java diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupDTO.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupDTO.java index 7d14d171..3f655e00 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupDTO.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupDTO.java @@ -21,6 +21,7 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -132,4 +133,9 @@ public class PartyGroupDTO implements Serializable { */ private Integer sort; + /** + * 部门回显 + */ + private List deptIdList; + } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/PartyUserNewInfoFormDTO.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/PartyUserNewInfoFormDTO.java index 429362de..358b557c 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/PartyUserNewInfoFormDTO.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/PartyUserNewInfoFormDTO.java @@ -37,5 +37,30 @@ public class PartyUserNewInfoFormDTO implements Serializable { * 党员标识 */ private String partyMember; + /** + * 父所有部门ID + */ + private String parentDeptIds; + /** + * 父所有部门 + */ + private String parentDeptNames; + /** + * 所有部门ID + */ + private String allDeptIds; + /** + * 所有部门 + */ + private String allDeptNames; + + /** + * 网格 + */ + private String grid; + /** + * 网格ID + */ + private Long gridId; } diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/AllUsers.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/AllUsers.java index 51f3944f..cca307f2 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/AllUsers.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/AllUsers.java @@ -38,6 +38,10 @@ public class AllUsers implements Serializable { * 身份标识 0:群员 1:群主 2:副群主 */ private String identityFlag; + /** + * 是否是本社区居民:0-否,1-是 + */ + private String thisCommunity; /** * 禁言状态:0-未禁言,1-禁言1天,2-禁言1周,3-禁言一个月,4-永久禁言 diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/CurrentUser.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/CurrentUser.java index db0fbccd..419bc722 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/CurrentUser.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/CurrentUser.java @@ -38,6 +38,10 @@ public class CurrentUser implements Serializable { * 身份标识 0:群员 1:群主 2:副群主 */ private String identityFlag; + /** + * 是否是本社区居民:0-否,1-是 + */ + private String thisCommunity; /** * 禁言状态:0-未禁言,1-禁言1天,2-禁言1周,3-禁言一个月,4-永久禁言 diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/PartyTopicSupportResultDTO.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/PartyTopicSupportResultDTO.java new file mode 100644 index 00000000..62416017 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/PartyTopicSupportResultDTO.java @@ -0,0 +1,51 @@ +/** + * 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.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 话题点赞表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-05-29 + */ +@Data +public class PartyTopicSupportResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String userId; + /** + * 评论人昵称 + */ + private String nickname; + + /** + * 评论人头像 + */ + private String userAvatar; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/TopicList.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/TopicList.java index c97dd724..513ce52c 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/TopicList.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/result/TopicList.java @@ -97,10 +97,24 @@ public class TopicList implements Serializable { * 是否点赞 */ private String likeFlag; + /** + * 身份标识 - 话题发布人所在话题所属党群 + */ + private String identityFlag; + /** + * 是否是本社区居民 + */ + private String thisCommunity; /** * 评论列表 */ private List comments; + + /** + * 点赞列表 + */ + private List likes; + } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupController.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupController.java index 1f85b048..43c08351 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupController.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupController.java @@ -34,8 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; +import java.util.*; /** @@ -60,6 +59,10 @@ public class PartyGroupController { @GetMapping("{id}") public Result get(@PathVariable("id") String id){ PartyGroupDTO data = partyGroupService.get(id); + String[] allDeptIds = data.getAllDeptIds().split(","); + List deptIdList = new ArrayList<>(2); + Collections.addAll(deptIdList,allDeptIds[1],allDeptIds[2]); + data.setDeptIdList(deptIdList); return new Result().ok(data); } diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupDao.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupDao.java index 3c11779a..8c449e9b 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupDao.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupDao.java @@ -65,7 +65,7 @@ public interface PartyGroupDao extends BaseDao { * @Param [] * @return java.util.List **/ - List getAllPartyGroup(String userId,String streetId); + List getAllPartyGroup(String userId); /** * @Description 根据党群名获取党群 * @Author songyunpeng diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java index fc4ef054..a469d97f 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java @@ -258,15 +258,7 @@ public class PartyGroupServiceImpl extends BaseServiceImpl getAllPartyGroup(PartyGroupListFormDTO partyGroupListFormDTO) { - //根据网格ID获取街道ID - Result parentResult = adminFeignClient.getParentAndAllDept(partyGroupListFormDTO.getGridId()); - if (!parentResult.success() || parentResult.getData() == null) { - throw new RenException("获取用户部门信息失败"); - } - ParentAndAllDeptDTO parentAndAllDeptDTO = parentResult.getData(); - String allDeptIds = parentAndAllDeptDTO.getAllDeptIds(); - String[] allDeptIdList = allDeptIds.split(","); - return baseDao.getAllPartyGroup(partyGroupListFormDTO.getUserId(),allDeptIdList[1]); + return baseDao.getAllPartyGroup(partyGroupListFormDTO.getUserId()); } @Override @@ -277,6 +269,33 @@ public class PartyGroupServiceImpl extends BaseServiceImpl userInfoById = userFeignClient.getUserInfoById(partyUserJoinGroupFormDTO.getUserId()); + if (!userInfoById.success() || userInfoById.getData() == null) { + throw new RenException("获取用户信息失败"); + } + UserDTO userDto = userInfoById.getData(); + //网格信息 + if (userDto.getGridId() != null && userDto.getGridId() != 0) { + partyUserGroupDTO.setGrid(userDto.getGrid()); + partyUserGroupDTO.setGridId(userDto.getGridId()); + partyUserGroupDTO.setAllDeptIds(userDto.getAllDeptIds()); + partyUserGroupDTO.setAllDeptNames(userDto.getAllDeptNames()); + partyUserGroupDTO.setParentDeptIds(userDto.getParentDeptIds()); + partyUserGroupDTO.setParentDeptNames(userDto.getParentDeptNames()); + } else { + Result userFirstScanGird = userFeignClient.getUserFirstScanGird(partyUserJoinGroupFormDTO.getUserId()); + if (!userFirstScanGird.success() || userFirstScanGird.getData() == null) { + throw new RenException("获取用户网格关联信息失败"); + } + UserGridRelationDTO userGridRelationDTO = userFirstScanGird.getData(); + partyUserGroupDTO.setGrid(userGridRelationDTO.getGrid()); + partyUserGroupDTO.setGridId(userGridRelationDTO.getGridId()); + partyUserGroupDTO.setAllDeptIds(userGridRelationDTO.getAllDeptIds()); + partyUserGroupDTO.setAllDeptNames(userGridRelationDTO.getAllDeptNames()); + partyUserGroupDTO.setParentDeptIds(userGridRelationDTO.getParentDeptIds()); + partyUserGroupDTO.setParentDeptNames(userGridRelationDTO.getParentDeptNames()); + } //身份标识为群成员 partyUserGroupDTO.setIdentityFlag("2"); partyUserGroupDTO.setState(0); diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyUserGroupServiceImpl.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyUserGroupServiceImpl.java index 41f841c6..24c9831d 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyUserGroupServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyUserGroupServiceImpl.java @@ -28,9 +28,7 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.utils.DateUtils; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dao.PartyUserGroupDao; -import com.elink.esua.epdc.dto.GroupUserBannedFormDTO; -import com.elink.esua.epdc.dto.GroupUserManagerFormDTO; -import com.elink.esua.epdc.dto.PartyUserGroupDTO; +import com.elink.esua.epdc.dto.*; import com.elink.esua.epdc.dto.constant.PartyGroupConstant; import com.elink.esua.epdc.dto.form.PartyUserBannedFormDTO; import com.elink.esua.epdc.dto.form.PartyUserGroupFormDTO; @@ -41,6 +39,7 @@ import com.elink.esua.epdc.dto.result.CurrentUser; import com.elink.esua.epdc.dto.result.PartyUserGroupResultDTO; import com.elink.esua.epdc.entity.PartyUserGroupEntity; import com.elink.esua.epdc.enums.BannedEnum; +import com.elink.esua.epdc.feign.UserFeignClient; import com.elink.esua.epdc.redis.PartyUserGroupRedis; import com.elink.esua.epdc.service.PartyUserGroupService; import org.apache.commons.lang3.StringUtils; @@ -65,6 +64,8 @@ public class PartyUserGroupServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -203,6 +204,33 @@ public class PartyUserGroupServiceImpl extends BaseServiceImpl userInfoById = userFeignClient.getUserInfoById(formDTO.getUserId()); + if (!userInfoById.success() || userInfoById.getData() == null) { + throw new RenException("获取用户信息失败"); + } + UserDTO userDto = userInfoById.getData(); + //网格信息 + if (userDto.getGridId() != null && userDto.getGridId() != 0) { + formDTO.setGrid(userDto.getGrid()); + formDTO.setGridId(userDto.getGridId()); + formDTO.setAllDeptIds(userDto.getAllDeptIds()); + formDTO.setAllDeptNames(userDto.getAllDeptNames()); + formDTO.setParentDeptIds(userDto.getParentDeptIds()); + formDTO.setParentDeptNames(userDto.getParentDeptNames()); + } else { + Result userFirstScanGird = userFeignClient.getUserFirstScanGird(formDTO.getUserId()); + if (!userFirstScanGird.success() || userFirstScanGird.getData() == null) { + throw new RenException("获取用户网格关联信息失败"); + } + UserGridRelationDTO userGridRelationDTO = userFirstScanGird.getData(); + formDTO.setGrid(userGridRelationDTO.getGrid()); + formDTO.setGridId(userGridRelationDTO.getGridId()); + formDTO.setAllDeptIds(userGridRelationDTO.getAllDeptIds()); + formDTO.setAllDeptNames(userGridRelationDTO.getAllDeptNames()); + formDTO.setParentDeptIds(userGridRelationDTO.getParentDeptIds()); + formDTO.setParentDeptNames(userGridRelationDTO.getParentDeptNames()); + } baseDao.updateInfoByUserId(formDTO); return new Result(); } diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupDao.xml b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupDao.xml index 99b54fad..5bade5fe 100644 --- a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupDao.xml +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupDao.xml @@ -104,7 +104,7 @@ if(t1.ID is not null ,1,0) as isJoin from epdc_party_group t left join epdc_party_user_group t1 on t1.PARTY_GROUP_ID = t.ID and t1.DEL_FLAG ='0' and t1.USER_ID=#{userId} - where t.DEL_FLAG ='0' and t.STATE ='0' and t.DEPT_ID = #{streetId} order by t.SORT, t.CREATED_TIME desc + where t.DEL_FLAG ='0' and t.STATE ='0' order by t.SORT, t.CREATED_TIME desc - select t.ID, t.NICKNAME, t.USER_FACE, @@ -165,21 +171,30 @@ t.SUPPORT_NUM, t.COMMENT_NUM, t.TOPIC_ADDRESS, + t6.IDENTITY_FLAG, - if( ATTITUDE_FLAG='0',1,0)likeFlag, + if( t1.ATTITUDE_FLAG='0',1,0)likeFlag, t2.IMG_URL, t3.ID as commentId, t3.USERNAME as username, t3.USER_FACE as commentUserFace, t3.CONTENT as content, - t3.PARTY_MEMBER as commentPartyMemberDEL_FLAG + t3.PARTY_MEMBER as commentPartyMember, + t5.USER_ID as supportUserId, + t5.NICKNAME as supportNickname, + t5.USER_AVATAR as supportUserAvatar, + (if(find_in_set(t7.DEPT_ID,t6.ALL_DEPT_IDS)>0,'1','0'))as thisCommunity from epdc_party_topic t - left join epdc_party_topic_user_attitude t1 on t.ID = t1.PARTY_TOPIC_ID and t1.DEL_FLAG='0' and t1.USER_ID = #{userId} + left join (select * from epdc_party_topic_user_attitude group by PARTY_TOPIC_ID)t1 on t.ID = t1.PARTY_TOPIC_ID and t1.DEL_FLAG='0' and t1.USER_ID = #{userId} left join epdc_party_topic_img t2 on t.ID = t2.REFERENCE_ID and t2.DEL_FLAG='0' left join (select ID,USERNAME,USER_FACE,PARTY_MEMBER,CONTENT,TOPIC_ID,DEL_FLAG,CREATED_TIME from epdc_party_topic_comment order by CREATED_TIME desc) t3 on t.ID = t3.TOPIC_ID and t3.DEL_FLAG='0' + left join epdc_party_topic_user_attitude t4 on t.ID = t4.PARTY_TOPIC_ID and t4.DEL_FLAG='0' + left join (select epug.USER_ID,epug.NICKNAME,epug.USER_AVATAR,epug.DEL_FLAG from epdc_party_user_group epug where epug.DEL_FLAG='0' and epug.STATE ='0' group by epug.USER_ID)t5 on t4.USER_ID = t5.USER_ID + left join epdc_party_user_group t6 on t6.USER_ID = t.USER_ID and t6.PARTY_GROUP_ID = t.PARTY_GROUP_ID and t6.DEL_FLAG = '0' and t6.STATE ='0' + left join epdc_party_group t7 on t.PARTY_GROUP_ID = t7.ID and t7.DEL_FLAG = '0' where t.ID in (select tmp.ID from (SELECT t1.ID @@ -202,7 +217,7 @@ ORDER BY t1.CREATED_TIME DESC LIMIT #{pageIndex},#{pageSize}) tmp) - order by t.CREATED_TIME desc,t3.CREATED_TIME + order by t.CREATED_TIME desc,t3.CREATED_TIME,t4.CREATED_TIME