Browse Source

创建群接口修改

master
yinzuomei 6 years ago
parent
commit
2543fa1b28
  1. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/EnterGroupTypeConstant.java
  2. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java
  3. 106
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java
  4. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java
  5. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreatedFormDTO.java
  6. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/MyGroupFormDTO.java
  7. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java
  8. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  9. 33
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupStatisticalDao.java
  10. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java
  11. 76
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java
  12. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupStatisticalService.java
  13. 82
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  14. 99
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupStatisticalServiceImpl.java
  15. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java
  16. 8
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

9
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/EnterGroupTypeConstant.java

@ -8,12 +8,17 @@ package com.epmet.resi.group.constant;
public interface EnterGroupTypeConstant { public interface EnterGroupTypeConstant {
/** /**
* 入群方式受邀请入群 - invited 主动加入 - join * 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
*/ */
String INVITED = "invited"; String INVITED = "invited";
/** /**
* 入群方式受邀请入群 - invited 主动加入 - join * 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
*/ */
String JOIN = "join"; String JOIN = "join";
/**
* 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
*/
String CREATED = "created";
} }

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java

@ -83,4 +83,8 @@ public class ResiGroupOperationDTO implements Serializable {
*/ */
private Date updatedTime; private Date updatedTime;
/**
* OPERATE_USER_ID操作人id
*/
private String operateUserId;
} }

106
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.resi.group.dto.group;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 群组统计信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-31
*/
@Data
public class ResiGroupStatisticalDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 小组id: 来源于resi_group表id
*/
private String resiGroupId;
/**
* 成员总数
*/
private Integer totalMembers;
/**
* 话题总数
*/
private Integer totalTopics;
/**
* 已转议题总数
*/
private Integer totalIssues;
/**
* 党员总数
*/
private Integer totalPartyMembers;
/**
* 热心居民总数
*/
private Integer totalEarnestMemebers;
/**
* 普通居民总数=群人数
*/
private Integer totalNormalMemebers;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人(用户id来源于customer_user.id)
*/
private String createdBy;
/**
* 创建时间(入群时间)
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 更新人
*/
private String updatedBy;
}

9
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java

@ -17,7 +17,7 @@ public class ApplyCreateGroupFormDTO implements Serializable {
/** /**
* 当前登录用户id由TokenDto赋值 * 当前登录用户id由TokenDto赋值
*/ */
@NotBlank(message="当前用户id为空") @NotBlank(message="当前用户id不能为空")
private String userId; private String userId;
/** /**
@ -49,4 +49,11 @@ public class ApplyCreateGroupFormDTO implements Serializable {
*/ */
@NotBlank(message = "当前网格id不能为空") @NotBlank(message = "当前网格id不能为空")
private String gridId; private String gridId;
/**
* 当前登录用户来源从token中获取
*/
@NotBlank(message="app不能为空")
private String app;
} }

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreatedFormDTO.java

@ -30,7 +30,7 @@ public class CreatedFormDTO implements Serializable {
* 用户当前所在网格所属客户id * 用户当前所在网格所属客户id
*/ */
@NotBlank(message = "客户id不能为空") @NotBlank(message = "客户id不能为空")
private String cusomerId; private String customerId;
/** /**
* 用户当前所在网格id * 用户当前所在网格id
@ -41,6 +41,6 @@ public class CreatedFormDTO implements Serializable {
/** /**
* 当前登录用户id由TokenDto赋值 * 当前登录用户id由TokenDto赋值
*/ */
@NotBlank(message="当前用户id为空") @NotBlank(message="当前用户id不能为空")
private String userId; private String userId;
} }

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

@ -30,7 +30,7 @@ public class MyGroupFormDTO implements Serializable {
* 用户当前所在网格所属客户id * 用户当前所在网格所属客户id
*/ */
@NotBlank(message = "客户id不能为空") @NotBlank(message = "客户id不能为空")
private String cusomerId; private String customerId;
/** /**
* 用户当前所在网格id * 用户当前所在网格id
@ -41,6 +41,6 @@ public class MyGroupFormDTO implements Serializable {
/** /**
* 当前登录用户id由TokenDto赋值 * 当前登录用户id由TokenDto赋值
*/ */
@NotBlank(message="当前用户id为空") @NotBlank(message="当前用户id不能为空")
private String userId; private String userId;
} }

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java

@ -106,4 +106,8 @@ public class GroupMemeberOperationDTO implements Serializable {
*/ */
private Date updatedTime; private Date updatedTime;
/**
* OPERATE_USER_ID操作人id
*/
private String operateUserId;
} }

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

@ -138,6 +138,7 @@ public class ResiGroupController {
public Result applyCreateGroup(@LoginUser TokenDto tokenDto, public Result applyCreateGroup(@LoginUser TokenDto tokenDto,
@RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { @RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
applyCreateGroupFormDTO.setUserId(tokenDto.getUserId()); applyCreateGroupFormDTO.setUserId(tokenDto.getUserId());
applyCreateGroupFormDTO.setApp(tokenDto.getApp());
ValidatorUtils.validateEntity(applyCreateGroupFormDTO); ValidatorUtils.validateEntity(applyCreateGroupFormDTO);
return resiGroupService.applyCreateGroup(applyCreateGroupFormDTO); return resiGroupService.applyCreateGroup(applyCreateGroupFormDTO);
} }
@ -173,4 +174,5 @@ public class ResiGroupController {
public Result initApplyCreatedGroup(@LoginUser TokenDto tokenDto, @RequestParam("customerId") String customerId) { public Result initApplyCreatedGroup(@LoginUser TokenDto tokenDto, @RequestParam("customerId") String customerId) {
return resiGroupService.initApplyCreatedGroup(tokenDto,customerId); return resiGroupService.initApplyCreatedGroup(tokenDto,customerId);
} }
} }

33
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupStatisticalDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.group.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 群组统计信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-31
*/
@Mapper
public interface ResiGroupStatisticalDao extends BaseDao<ResiGroupStatisticalEntity> {
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java

@ -53,4 +53,8 @@ public class ResiGroupOperationEntity extends BaseEpmetEntity {
*/ */
private String operateReason; private String operateReason;
/**
* OPERATE_USER_ID操作人id
*/
private String operateUserId;
} }

76
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java

@ -0,0 +1,76 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.group.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 群组统计信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-31
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_statistical")
public class ResiGroupStatisticalEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 小组id: 来源于resi_group表id
*/
private String resiGroupId;
/**
* 成员总数
*/
private Integer totalMembers;
/**
* 话题总数
*/
private Integer totalTopics;
/**
* 已转议题总数
*/
private Integer totalIssues;
/**
* 党员总数
*/
private Integer totalPartyMembers;
/**
* 热心居民总数
*/
private Integer totalEarnestMemebers;
/**
* 普通居民总数=群人数
*/
private Integer totalNormalMemebers;
}

95
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupStatisticalService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO;
import java.util.List;
import java.util.Map;
/**
* 群组统计信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-31
*/
public interface ResiGroupStatisticalService extends BaseService<ResiGroupStatisticalEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiGroupStatisticalDTO>
* @author generator
* @date 2020-03-31
*/
PageData<ResiGroupStatisticalDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiGroupStatisticalDTO>
* @author generator
* @date 2020-03-31
*/
List<ResiGroupStatisticalDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ResiGroupStatisticalDTO
* @author generator
* @date 2020-03-31
*/
ResiGroupStatisticalDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-31
*/
void save(ResiGroupStatisticalDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-31
*/
void update(ResiGroupStatisticalDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-31
*/
void delete(String[] ids);
}

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

@ -24,6 +24,7 @@ import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
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.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ErrorCode;
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;
@ -37,17 +38,25 @@ import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.service.ResiGroupOperationService; import com.epmet.modules.group.service.ResiGroupOperationService;
import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
import com.epmet.modules.member.service.GroupMemeberOperationService;
import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.utils.ModuleConstant; import com.epmet.modules.utils.ModuleConstant;
import com.epmet.redis.ResiGroupRedis; import com.epmet.redis.ResiGroupRedis;
import com.epmet.resi.group.constant.EnterGroupTypeConstant;
import com.epmet.resi.group.constant.GroupStateConstant; import com.epmet.resi.group.constant.GroupStateConstant;
import com.epmet.resi.group.constant.LeaderFlagConstant;
import com.epmet.resi.group.constant.MemberStateConstant;
import com.epmet.resi.group.dto.UserRoleDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.ResiGroupOperationDTO; import com.epmet.resi.group.dto.group.ResiGroupOperationDTO;
import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO;
import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.CreatedResultDTO; import com.epmet.resi.group.dto.group.result.CreatedResultDTO;
import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO;
import com.epmet.resi.group.dto.group.result.MyGroupResultDTO; import com.epmet.resi.group.dto.group.result.MyGroupResultDTO;
import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO; import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO;
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -81,6 +90,12 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired @Autowired
private EpmetUserFeignClient epmetUserFeignClient; private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GroupMemeberOperationService groupMemeberOperationService;
@Autowired
private ResiGroupStatisticalService resiGroupStatisticalService;
@Override @Override
public PageData<ResiGroupDTO> page(Map<String, Object> params) { public PageData<ResiGroupDTO> page(Map<String, Object> params) {
IPage<ResiGroupEntity> page = baseDao.selectPage( IPage<ResiGroupEntity> page = baseDao.selectPage(
@ -215,7 +230,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Override @Override
public Result<GroupSummarizeResultDTO> getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) { public Result<GroupSummarizeResultDTO> getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) {
GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO); GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO);
if (null != groupSummarizeResultDTO) { if (null == groupSummarizeResultDTO) {
return new Result<GroupSummarizeResultDTO>().error(ModuleConstant.GETGROUPSUMMARIZE_FAILED); return new Result<GroupSummarizeResultDTO>().error(ModuleConstant.GETGROUPSUMMARIZE_FAILED);
} }
//获取组长信息 //获取组长信息
@ -275,8 +290,45 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO();
resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); resiGroupOperation.setResiGroupId(resiGroupEntity.getId());
resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING);
resiGroupOperation.setCreatedBy(applyCreateGroupFormDTO.getUserId()); resiGroupOperation.setOperateUserId(applyCreateGroupFormDTO.getUserId());
resiGroupOperationService.save(resiGroupOperation); resiGroupOperationService.save(resiGroupOperation);
//4、插入一群成员信息(群主)
ResiGroupMemberDTO resiGroupMemberDTO=new ResiGroupMemberDTO();
resiGroupMemberDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId());
resiGroupMemberDTO.setResiGroupId(resiGroupEntity.getId());
resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER);
resiGroupMemberDTO.setStatus(MemberStateConstant.UNDER_AUDITTING);
resiGroupMemberDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED);
resiGroupMemberService.save(resiGroupMemberDTO);
//5、插入一条入群记录(群主的)
GroupMemeberOperationDTO groupMemeberOperationDTO=new GroupMemeberOperationDTO();
groupMemeberOperationDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId());
groupMemeberOperationDTO.setGroupId(resiGroupEntity.getId());
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.UNDER_AUDITTING);
groupMemeberOperationDTO.setOperateUserId(applyCreateGroupFormDTO.getUserId());
groupMemeberOperationDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED);
groupMemeberOperationService.save(groupMemeberOperationDTO);
//6、群初始统计记录
UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
applyCreateGroupFormDTO.getUserId(),
applyCreateGroupFormDTO.getCustomerId());
ResiGroupStatisticalDTO resiGroupStatisticalDTO=new ResiGroupStatisticalDTO();
resiGroupStatisticalDTO.setResiGroupId(resiGroupEntity.getId());
resiGroupStatisticalDTO.setTotalMembers(NumConstant.ONE);
resiGroupStatisticalDTO.setTotalNormalMemebers(NumConstant.ONE);
resiGroupStatisticalDTO.setTotalTopics(NumConstant.ZERO);
resiGroupStatisticalDTO.setTotalIssues(NumConstant.ZERO);
if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){
resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ONE);
}else{
resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ZERO);
}
if(NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())){
resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ONE);
}else{
resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO);
}
resiGroupStatisticalService.save(resiGroupStatisticalDTO);
return new Result(); return new Result();
} }
@ -346,8 +398,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) { if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) {
return new Result().error(ModuleConstant.USER_NOT_NULL); return new Result().error(ModuleConstant.USER_NOT_NULL);
} }
boolean flag = this.checkPartyMemberOrWarmHeated(tokenDto.getApp(), tokenDto.getUserId(), customerId); UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(tokenDto.getApp(), tokenDto.getUserId(), customerId);
if (!flag) { if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
Result errorResult = new Result(); Result errorResult = new Result();
errorResult.setCode(EpmetErrorCode.CANNOT_CREATE_GROUP.getValue()); errorResult.setCode(EpmetErrorCode.CANNOT_CREATE_GROUP.getValue());
errorResult.setMsg(EpmetErrorCode.CANNOT_CREATE_GROUP.getName()); errorResult.setMsg(EpmetErrorCode.CANNOT_CREATE_GROUP.getName());
@ -365,8 +417,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
* @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false * @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false
* @Date 2020/3/30 16:33 * @Date 2020/3/30 16:33
**/ **/
private boolean checkPartyMemberOrWarmHeated(String app, String userId, String customerId) { private UserRoleDTO checkPartyMemberOrWarmHeated(String app, String userId, String customerId) {
boolean flag = false; UserRoleDTO userRoleDTO = new UserRoleDTO();
UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO();
userRoleFormDTO.setApp(app); userRoleFormDTO.setApp(app);
userRoleFormDTO.setCustomerId(customerId); userRoleFormDTO.setCustomerId(customerId);
@ -374,19 +426,23 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
Result<List<UserRoleResultDTO>> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); Result<List<UserRoleResultDTO>> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
if (!userRoleListResult.success()) { if (!userRoleListResult.success()) {
logger.info("获取用户角色feign调用失败" + userRoleListResult.getMsg()); logger.info("获取用户角色feign调用失败" + userRoleListResult.getMsg());
return flag; return userRoleDTO;
} }
List<UserRoleResultDTO> userRoleList = userRoleListResult.getData(); List<UserRoleResultDTO> userRoleList = userRoleListResult.getData();
if (null == userRoleList || userRoleList.size() == 0) { if (null == userRoleList || userRoleList.size() == 0) {
return flag; return userRoleDTO;
} }
for (UserRoleResultDTO userRoleResultDTO : userRoleList) { for (UserRoleResultDTO userRoleResultDTO : userRoleList) {
if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey()) if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey())) {
|| EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) { userRoleDTO.setPartymemberFlag(NumConstant.ONE_STR);
flag = true; }
break; if (EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) {
userRoleDTO.setWarmHeartedFlag(NumConstant.ONE_STR);
}
if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(userRoleResultDTO.getRoleKey())) {
userRoleDTO.setRegisteredResiFlag(NumConstant.ONE_STR);
} }
} }
return flag; return userRoleDTO;
} }
} }

99
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupStatisticalServiceImpl.java

@ -0,0 +1,99 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.group.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 群组统计信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-31
*/
@Service
public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupStatisticalDao, ResiGroupStatisticalEntity> implements ResiGroupStatisticalService {
@Override
public PageData<ResiGroupStatisticalDTO> page(Map<String, Object> params) {
IPage<ResiGroupStatisticalEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiGroupStatisticalDTO.class);
}
@Override
public List<ResiGroupStatisticalDTO> list(Map<String, Object> params) {
List<ResiGroupStatisticalEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiGroupStatisticalDTO.class);
}
private QueryWrapper<ResiGroupStatisticalEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiGroupStatisticalEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiGroupStatisticalDTO get(String id) {
ResiGroupStatisticalEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiGroupStatisticalDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiGroupStatisticalDTO dto) {
ResiGroupStatisticalEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupStatisticalEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiGroupStatisticalDTO dto) {
ResiGroupStatisticalEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupStatisticalEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java

@ -76,4 +76,8 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的
*/ */
private String operateDes; private String operateDes;
/**
* OPERATE_USER_ID操作人id
*/
private String operateUserId;
} }

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

@ -33,8 +33,8 @@
rg.DEL_FLAG = '0' rg.DEL_FLAG = '0'
AND rgm.DEL_FLAG = '0' AND rgm.DEL_FLAG = '0'
AND rgs.DEL_FLAG = '0' AND rgs.DEL_FLAG = '0'
AND rg.CUSTOMER_ID = #{cusomerId} AND rg.CUSTOMER_ID = #{customerId}
AND rg.GRID_ID ={gridId} AND rg.GRID_ID =#{gridId}
AND rgm.CUSTOMER_USER_ID = #{userId} AND rgm.CUSTOMER_USER_ID = #{userId}
AND rgm.STATUS IN ( 'approved', 'silent' ) AND rgm.STATUS IN ( 'approved', 'silent' )
order by rg.LATEST_TOPIC_PUBLISH_DATE desc order by rg.LATEST_TOPIC_PUBLISH_DATE desc
@ -105,8 +105,8 @@
rg.DEL_FLAG = '0' rg.DEL_FLAG = '0'
AND rgm.DEL_FLAG = '0' AND rgm.DEL_FLAG = '0'
AND rgs.DEL_FLAG = '0' AND rgs.DEL_FLAG = '0'
AND rg.CUSTOMER_ID = #{cusomerId} AND rg.CUSTOMER_ID = #{customerId}
AND rg.GRID_ID ={gridId} AND rg.GRID_ID =#{gridId}
AND rgm.CUSTOMER_USER_ID = #{userId} AND rgm.CUSTOMER_USER_ID = #{userId}
AND rgm.GROUP_LEADER_FLAG = 'leader' AND rgm.GROUP_LEADER_FLAG = 'leader'
ORDER BY ORDER BY

Loading…
Cancel
Save