Browse Source

所有小组查询

dev_shibei_match
sunyuchao 4 years ago
parent
commit
a89fd3c87b
  1. 34
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java
  2. 51
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java
  3. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  4. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  5. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  6. 46
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  7. 23
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

34
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AllGroupListFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 所有小组查询-接口入参
*/
@Data
public class AllGroupListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
@NotBlank(message = "网格Id不能为空", groups = {AllGroupListFormDTO.GroupList.class})
private String gridId;
/**
* 请求页码
*/
@Min(1)
private int pageNo;
/**
* 每页多少条数据
*/
private int pageSize = 20;
public interface GroupList {
}
}

51
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 推荐小组查询返参
* @Author yinzuomei
* @Date 2020/3/28 17:11
*/
@Data
public class AllGroupListResultDTO implements Serializable {
private static final long serialVersionUID = -155229599412911489L;
/**
* 群组id
*/
private String groupId;
/**
* 群组头像
*/
private String groupHeadPhoto;
/**
* 群组名称
*/
private String groupName;
/**
* 成员总数
*/
private Integer totalMember;
/**
* 党员总数
*/
private Integer totalPartyMember;
/**
* under_auditting审核中rejected已拒绝的前端显示加入
*/
private String status="";
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
}

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

@ -31,6 +31,8 @@ import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO;
import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO;
import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
@ -502,4 +504,16 @@ public class ResiGroupController {
return new Result();
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 所有小组查询
**/
@PostMapping(value = "allgrouplist")
public Result<List<AllGroupListResultDTO>> allGroupList(@LoginUser TokenDto tokenDto, @RequestBody AllGroupListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AllGroupListFormDTO.GroupList.class);
return new Result<List<AllGroupListResultDTO>>().ok(resiGroupService.allGroupList(tokenDto, formDTO));
}
}

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

@ -27,7 +27,6 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@ -236,4 +235,10 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
* @Date 2020/12/25 13:18
**/
List<GroupProcessingCountResultDTO> queryGroupProcessingCount(@Param("gridIdList") List<String> gridIdList);
/**
* @Author sun
* @Description 分页查询网格下所有小组列表
**/
List<AllGroupListResultDTO> selectAllGroupList(AllGroupListFormDTO formDTO);
}

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

@ -20,6 +20,7 @@ package com.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.resi.group.dto.UserRoleDTO;
@ -370,4 +371,12 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @return void
*/
void setVisitSwitch(ManageInitFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 所有小组查询
**/
List<AllGroupListResultDTO> allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO);
}

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

@ -30,6 +30,7 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
@ -87,6 +88,7 @@ import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -1491,4 +1493,48 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
resiGroupRedis.delGroup(param.getGroupId());
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 所有小组查询
**/
@Override
public List<AllGroupListResultDTO> allGroupList(TokenDto tokenDto, AllGroupListFormDTO formDTO) {
//1.分页查询网格下所有小组列表且是审核通过状态的,以组内人员数从多到少排序
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
List<AllGroupListResultDTO> resultList = baseDao.selectAllGroupList(formDTO);
if (null == resultList || resultList.size() == 0) {
return new ArrayList<>();
}
//2.查询当前用户居民端角色列表
AtomicBoolean isPartymember = new AtomicBoolean(false);
Result<List<UserRoleResultDTO>> resultDTOList = epmetUserOpenFeignClient.getUserRoleInfoByUserId(tokenDto.getUserId());
if (!resultDTOList.success()) {
throw new RenException("调用user服务,获取用户基础数据失败");
}
List<UserRoleResultDTO> roleList = resultDTOList.getData();
roleList.forEach(rl -> {
if ("partymember".equals(rl.getRoleKey())) {
isPartymember.set(true);
}
});
//3.调用已有方法赋值当前人员是否可以入组值
for (AllGroupListResultDTO dto : resultList) {
//非党员角色不允许加入支部小组
if ("branch".equals(dto.getGroupType()) && !isPartymember.get()) {
dto.setStatus("rejected");
continue;
}
GroupMemeberOperationDTO operation = groupMemeberOperationService.selectLatestRecord(dto.getGroupId(), tokenDto.getUserId());
if (null != operation) {
dto.setStatus(operation.getOperateStatus());
}
}
return resultList;
}
}

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

@ -527,4 +527,27 @@
GROUP BY
temp.gridId
</select>
<select id="selectAllGroupList" resultType="com.epmet.resi.group.dto.group.result.AllGroupListResultDTO">
SELECT
rg.id AS groupId,
rg.group_head_photo AS groupHeadPhoto,
rg.group_name AS groupName,
rg.group_type AS groupType,
rgs.total_members AS totalMember,
rgs.total_party_members AS totalPartyMember
FROM
resi_group rg
LEFT JOIN resi_group_statistical rgs ON (rg.id = rgs.resi_group_id)
WHERE
rg.del_flag = '0'
AND rgs.del_flag = '0'
AND rg.grid_id = #{gridId}
AND rg.state = 'approved'
ORDER BY
totalMember DESC
LIMIT
#{pageNo}, #{pageSize}
</select>
</mapper>

Loading…
Cancel
Save