Browse Source

Merge remote-tracking branch 'origin/dev0.2' into dev0.2

dev_shibei_match
wangchao 5 years ago
parent
commit
95376d0ceb
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/EnterGroupTypeConstant.java
  3. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java
  4. 106
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java
  5. 27
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AgreeApplyGroupFormDTO.java
  6. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java
  7. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreatedFormDTO.java
  8. 33
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/DisAgreeApplyGroupFormDTO.java
  9. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/MyGroupFormDTO.java
  10. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/RecommendGroupFormDTO.java
  11. 6
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java
  12. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java
  13. 8
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java
  14. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupMemberListResultDTO.java
  15. 30
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  16. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupOperationDao.java
  17. 33
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupStatisticalDao.java
  18. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java
  19. 76
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java
  20. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  21. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupStatisticalService.java
  22. 158
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  23. 99
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupStatisticalServiceImpl.java
  24. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java
  25. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java
  26. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java
  27. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  28. 13
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  29. 11
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupOperationDao.xml
  30. 13
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupMemeberOperationDao.xml
  31. 26
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -8,7 +8,8 @@ package com.epmet.commons.tools.exception;
public enum EpmetErrorCode { public enum EpmetErrorCode {
CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"), CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"),
CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"), CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"),
GROUP_ALREADY_EXISTED(8003,"您的组名已存在,请重新修改"); GROUP_ALREADY_EXISTED(8003,"您的组名已存在,请重新修改"),
ALREADY_APPLIED_GROUP(8004,"该群已申请过,请耐心等待审核");
private int value; private int value;
private String name; private String name;

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;
}

27
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/AgreeApplyGroupFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 网格长同意群申请入参DTO-测试后面会迁移到政府端
* @Author yinzuomei
* @Date 2020/3/31 12:45
*/
@Data
public class AgreeApplyGroupFormDTO implements Serializable{
private static final long serialVersionUID = 1L;
/**
* 要审核的组id
*/
@NotBlank(message="groupId不能为空")
private String groupId;
/**
* 当前登录用户id由TokenDto赋值
*/
@NotBlank(message="当前用户id不能为空")
private String userId;
}

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;
} }

33
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/DisAgreeApplyGroupFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 网格长拒绝群申请入参DTO-测试后面会迁移到政府端
* @Author yinzuomei
* @Date 2020/3/31 13:20
*/
@Data
public class DisAgreeApplyGroupFormDTO implements Serializable {
private static final long serialVersionUID = -3038681990616751705L;
/**
* 要审核的组id
*/
@NotBlank(message="groupId不能为空")
private String groupId;
/**
* 拒绝理由
*/
@NotBlank(message="拒绝理由不能为空")
private String rejectReason;
/**
* 当前登录用户id由TokenDto赋值
*/
@NotBlank(message="当前用户id不能为空")
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;
} }

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

@ -30,7 +30,7 @@ public class RecommendGroupFormDTO implements Serializable {
* 用户当前所在网格所属客户id * 用户当前所在网格所属客户id
*/ */
@NotBlank(message = "客户id不能为空") @NotBlank(message = "客户id不能为空")
private String cusomerId; private String customerId;
/** /**
* 用户当前所在网格id * 用户当前所在网格id

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

@ -62,7 +62,7 @@ public class GroupMemeberOperationDTO implements Serializable {
private String operateStatus; private String operateStatus;
/** /**
* 入群方式受邀请入群 - invited 主动加入 - join * 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
*/ */
private String enterGroupType; private String enterGroupType;
@ -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-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java

@ -54,7 +54,7 @@ public class ResiGroupMemberDTO implements Serializable {
private String groupLeaderFlag; private String groupLeaderFlag;
/** /**
* 入群方式受邀请入群 - invited 主动加入 - join * 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
*/ */
private String enterGroupType; private String enterGroupType;

8
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java

@ -37,4 +37,12 @@ public class ApplyingMemberResultDTO implements Serializable {
* 入群理由 * 入群理由
*/ */
private String applyReason; private String applyReason;
/**
* 状态审核中 - under_auditting
* 审核通过 - approved
* 入群被拒 - rejected
*/
private String status;
} }

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupMemberListResultDTO.java

@ -17,7 +17,7 @@ public class GroupMemberListResultDTO implements Serializable {
/** /**
* 成员id * 成员id
*/ */
private String memeberId; private String memberId;
/** /**
* 用户id * 用户id

30
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,33 @@ 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);
} }
/**
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 审核(同意)群申请-测试用后面会放到政府端
* @Date 2020/3/31 12:31
**/
@PostMapping("agreeapplygroup")
public Result agreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) {
agreeApplyGroupFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(agreeApplyGroupFormDTO);
return resiGroupService.agreeApplyGroup(agreeApplyGroupFormDTO);
}
/**
* @param tokenDto
* @param disAgreeApplyGroupFormDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 审核(拒绝)群申请-测试用后面会放到政府端
* @Date 2020/3/31 13:23
**/
@PostMapping("disagreeapplygroup")
public Result disagreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) {
disAgreeApplyGroupFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO);
return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO);
}
} }

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupOperationDao.java

@ -19,6 +19,7 @@ package com.epmet.modules.group.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupOperationEntity; import com.epmet.modules.group.entity.ResiGroupOperationEntity;
import com.epmet.resi.group.dto.group.ResiGroupOperationDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ResiGroupOperationDao extends BaseDao<ResiGroupOperationEntity> { public interface ResiGroupOperationDao extends BaseDao<ResiGroupOperationEntity> {
/**
* @return com.epmet.resi.group.dto.group.ResiGroupOperationDTO
* @param groupId
* @Author yinzuomei
* @Description 查询组的申请记录
* @Date 2020/3/31 13:04
**/
ResiGroupOperationDTO selectGroupApplyRecord(String groupId);
} }

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;
}

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

@ -174,4 +174,22 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Date 2020/3/30 15:50 * @Date 2020/3/30 15:50
**/ **/
Result initApplyCreatedGroup(TokenDto tokenDto, String customerId); Result initApplyCreatedGroup(TokenDto tokenDto, String customerId);
/**
* @return com.epmet.commons.tools.utils.Result
* @param agreeApplyGroupFormDTO
* @Author yinzuomei
* @Description 审核(同意)群申请-测试用后面会放到政府端
* @Date 2020/3/31 12:44
**/
Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO);
/**
* @return com.epmet.commons.tools.utils.Result
* @param disAgreeApplyGroupFormDTO
* @Author yinzuomei
* @Description 审核拒绝群申请-测试用后面会放到政府端
* @Date 2020/3/31 13:22
**/
Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO);
} }

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);
}

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

@ -34,20 +34,31 @@ import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupOperationDao;
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.dao.GroupMemeberOperationDao;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
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 +92,21 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired @Autowired
private EpmetUserFeignClient epmetUserFeignClient; private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GroupMemeberOperationService groupMemeberOperationService;
@Autowired
private ResiGroupStatisticalService resiGroupStatisticalService;
@Autowired
private ResiGroupOperationDao resiGroupOperationDao;
@Autowired
private ResiGroupMemberDao resiGroupMemberDao;
@Autowired
private GroupMemeberOperationDao groupMemeberOperationDao;
@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(
@ -186,6 +212,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
* @Description 修改组信息 * @Description 修改组信息
* @Date 2020/3/28 22:27 * @Date 2020/3/28 22:27
**/ **/
@Transactional(rollbackFor = Exception.class)
@Override @Override
public Result modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO) { public Result modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO) {
//校验是否是群主 //校验是否是群主
@ -215,7 +242,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);
} }
//获取组长信息 //获取组长信息
@ -258,6 +285,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
* @Description 创建小组 * @Description 创建小组
* @Date 2020/3/29 19:26 * @Date 2020/3/29 19:26
**/ **/
@Transactional(rollbackFor = Exception.class)
@Override @Override
public Result applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { public Result applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
//1、校验是否同名 //1、校验是否同名
@ -275,8 +303,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 +411,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());
@ -356,6 +421,69 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return new Result(); return new Result();
} }
/**
* @param agreeApplyGroupFormDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 审核群申请-测试用后面会放到政府端
* @Date 2020/3/31 12:44
**/
@Override
public Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) {
//1、更新组的状态
ResiGroupDTO resiGroupDTO = this.get(agreeApplyGroupFormDTO.getGroupId());
resiGroupDTO.setState(GroupStateConstant.GROUP_APPROVED);
this.update(resiGroupDTO);
//2、更新组的申请记录改为已通过
ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(agreeApplyGroupFormDTO.getGroupId());
resiGroupOperation.setState(GroupStateConstant.GROUP_APPROVED);
resiGroupOperation.setOperateUserId(agreeApplyGroupFormDTO.getUserId());
resiGroupOperationService.update(resiGroupOperation);
//3、将群主在群成员的状态改为已通过
ResiGroupMemberDTO resiGroupMemberDTO=resiGroupMemberDao.selectLeaderMember(agreeApplyGroupFormDTO.getGroupId());
resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED);
resiGroupMemberService.update(resiGroupMemberDTO);
//4、更新群主的出入群记录改为已通过
GroupMemeberOperationDTO groupMemeberOperationDTO=groupMemeberOperationDao.selectLeaderRecord(agreeApplyGroupFormDTO.getGroupId());
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED);
groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId());
groupMemeberOperationService.update(groupMemeberOperationDTO);
//5、给用户发送消息???待定
return new Result();
}
/**
* @param disAgreeApplyGroupFormDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 审核拒绝群申请-测试用后面会放到政府端
* @Date 2020/3/31 13:22
**/
@Override
public Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) {
//1、更新组的状态
ResiGroupDTO resiGroupDTO = this.get(disAgreeApplyGroupFormDTO.getGroupId());
resiGroupDTO.setState(GroupStateConstant.GROUP_REJECTED);
this.update(resiGroupDTO);
//2、更新组的申请记录改为已通过
ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(disAgreeApplyGroupFormDTO.getGroupId());
resiGroupOperation.setState(GroupStateConstant.GROUP_REJECTED);
resiGroupOperation.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId());
resiGroupOperation.setOperateReason(disAgreeApplyGroupFormDTO.getRejectReason());
resiGroupOperationService.update(resiGroupOperation);
//3、将群主在群成员的状态改为已通过
ResiGroupMemberDTO resiGroupMemberDTO=resiGroupMemberDao.selectLeaderMember(disAgreeApplyGroupFormDTO.getGroupId());
resiGroupMemberDTO.setStatus(MemberStateConstant.REJECTED);
resiGroupMemberService.update(resiGroupMemberDTO);
//4、更新群主的出入群记录改为已通过
GroupMemeberOperationDTO groupMemeberOperationDTO=groupMemeberOperationDao.selectLeaderRecord(disAgreeApplyGroupFormDTO.getGroupId());
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.REJECTED);
groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId());
groupMemeberOperationService.update(groupMemeberOperationDTO);
//5、给用户发送消息???待定
return new Result();
}
/** /**
* @param app * @param app
* @param userId * @param userId
@ -365,8 +493,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 +502,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));
}
}

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

@ -19,6 +19,7 @@ package com.epmet.modules.member.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.member.entity.GroupMemeberOperationEntity; import com.epmet.modules.member.entity.GroupMemeberOperationEntity;
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -30,4 +31,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface GroupMemeberOperationDao extends BaseDao<GroupMemeberOperationEntity> { public interface GroupMemeberOperationDao extends BaseDao<GroupMemeberOperationEntity> {
/**
* @param groupId
* @return com.epmet.resi.group.dto.member.GroupMemeberOperationDTO
* @Author yinzuomei
* @Description 查询组长的入群记录
* @Date 2020/3/31 13:05
**/
GroupMemeberOperationDTO selectLeaderRecord(String groupId);
} }

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

@ -20,6 +20,8 @@ package com.epmet.modules.member.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.member.entity.ResiGroupMemberEntity; import com.epmet.modules.member.entity.ResiGroupMemberEntity;
import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.UserRoleDTO;
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.form.ApplyingMemberFormDTO; import com.epmet.resi.group.dto.member.form.ApplyingMemberFormDTO;
import com.epmet.resi.group.dto.member.form.GroupMemberListFormDTO; import com.epmet.resi.group.dto.member.form.GroupMemberListFormDTO;
import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO;
@ -65,4 +67,23 @@ public interface ResiGroupMemberDao extends BaseDao<ResiGroupMemberEntity> {
* @Date 2020/3/30 22:40 * @Date 2020/3/30 22:40
**/ **/
int updateResiGroupStatistical(@Param("groupId") String groupId, @Param("userRoleDTO") UserRoleDTO userRoleDTO); int updateResiGroupStatistical(@Param("groupId") String groupId, @Param("userRoleDTO") UserRoleDTO userRoleDTO);
/**
* @return com.epmet.resi.group.dto.member.ResiGroupMemberDTO
* @param groupId
* @Author yinzuomei
* @Description 查询群主的记录
* @Date 2020/3/31 13:04
**/
ResiGroupMemberDTO selectLeaderMember(String groupId);
/**
* @return com.epmet.resi.group.dto.member.GroupMemeberOperationDTO
* @param userId
* @param groupId
* @Author yinzuomei
* @Description 查看用户是否存在有效的入群申请
* @Date 2020/3/31 14:52
**/
GroupMemeberOperationDTO selectGroupMemberOperationUnderAudit(@Param("userId") String userId, @Param("groupId") String groupId);
} }

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;
} }

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -175,6 +175,14 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
return errorResult; return errorResult;
} }
} }
//校验是否存在待审核的入群记录
GroupMemeberOperationDTO groupMember = baseDao.selectGroupMemberOperationUnderAudit(applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId());
if(null!=groupMember){
Result errorResult = new Result();
errorResult.setCode(EpmetErrorCode.ALREADY_APPLIED_GROUP.getValue());
errorResult.setMsg(EpmetErrorCode.ALREADY_APPLIED_GROUP.getName());
return errorResult;
}
//插入一条待审核的记录 //插入一条待审核的记录
GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO(); GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO();
groupMemeberOperation.setGroupId(applyJoinGroupFormDTO.getGroupId()); groupMemeberOperation.setGroupId(applyJoinGroupFormDTO.getGroupId());
@ -184,6 +192,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING); groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING);
groupMemeberOperation.setEnterGroupType(EnterGroupTypeConstant.JOIN); groupMemeberOperation.setEnterGroupType(EnterGroupTypeConstant.JOIN);
groupMemeberOperation.setCreatedBy(applyJoinGroupFormDTO.getUserId()); groupMemeberOperation.setCreatedBy(applyJoinGroupFormDTO.getUserId());
groupMemeberOperation.setOperateUserId(applyJoinGroupFormDTO.getUserId());
groupMemeberOperationService.save(groupMemeberOperation); groupMemeberOperationService.save(groupMemeberOperation);
return new Result(); return new Result();
} }

13
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
@ -71,7 +71,7 @@
WHERE WHERE
rg.DEL_FLAG = '0' rg.DEL_FLAG = '0'
AND rgs.DEL_FLAG = '0' AND rgs.DEL_FLAG = '0'
and rg.id not EXISTS ( and rg.id not in (
SELECT SELECT
rgm.RESI_GROUP_ID rgm.RESI_GROUP_ID
FROM FROM
@ -81,8 +81,9 @@
AND rgm.`STATUS` !='removed' AND rgm.`STATUS` !='removed'
AND rgm.CUSTOMER_USER_ID = #{userId} AND rgm.CUSTOMER_USER_ID = #{userId}
) )
and rg.CUSTOMER_ID=#{cusomerId} and rg.CUSTOMER_ID=#{customerId}
and rg.GRID_ID=#{gridId} and rg.GRID_ID=#{gridId}
and rg.STATE ='approved'
order by totalMember desc,rg.LATEST_TOPIC_PUBLISH_DATE desc order by totalMember desc,rg.LATEST_TOPIC_PUBLISH_DATE desc
LIMIT #{pageNo}, #{pageSize} LIMIT #{pageNo}, #{pageSize}
</select> </select>
@ -105,8 +106,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

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

@ -3,6 +3,17 @@
<mapper namespace="com.epmet.modules.group.dao.ResiGroupOperationDao"> <mapper namespace="com.epmet.modules.group.dao.ResiGroupOperationDao">
<!-- 查看组的申请记录 -->
<select id="selectGroupApplyRecord" parameterType="java.lang.String" resultType="com.epmet.resi.group.dto.group.ResiGroupOperationDTO">
SELECT
rgo.*
FROM
resi_group_operation rgo
WHERE
rgo.DEL_FLAG = '0'
AND rgo.STATE = 'under_auditting'
AND rgo.RESI_GROUP_ID = #{groupId}
</select>
</mapper> </mapper>

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

@ -2,7 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.member.dao.GroupMemeberOperationDao"> <mapper namespace="com.epmet.modules.member.dao.GroupMemeberOperationDao">
<!-- 查询组长的入群记录 -->
<select id="selectLeaderRecord" parameterType="java.lang.String" resultType="com.epmet.resi.group.dto.member.GroupMemeberOperationDTO">
SELECT
*
FROM
group_memeber_operation gmo
WHERE
gmo.DEL_FLAG = '0'
AND gmo.ENTER_GROUP_TYPE = 'created'
AND gmo.GROUP_ID = #{groupId}
</select>
</mapper> </mapper>

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

@ -30,12 +30,14 @@
gmo.CUSTOMER_USER_ID AS applyUserId, gmo.CUSTOMER_USER_ID AS applyUserId,
NULL AS applyUserHeadPhoto, NULL AS applyUserHeadPhoto,
NULL AS applyUserName, NULL AS applyUserName,
gmo.OPERATE_DES AS applyReason gmo.OPERATE_DES AS applyReason,
gmo.OPERATE_STATUS as status
FROM FROM
group_memeber_operation gmo group_memeber_operation gmo
WHERE WHERE
gmo.DEL_FLAG = '0' gmo.DEL_FLAG = '0'
AND gmo.GROUP_ID = #{groupId} AND gmo.GROUP_ID = #{groupId}
and gmo.ENTER_GROUP_TYPE!='created'
AND gmo.OPERATE_STATUS IN ( 'under_auditting', 'approved', 'rejected' ) AND gmo.OPERATE_STATUS IN ( 'under_auditting', 'approved', 'rejected' )
ORDER BY ORDER BY
gmo.CREATED_TIME DESC gmo.CREATED_TIME DESC
@ -57,4 +59,26 @@
rgs.RESI_GROUP_ID = #{groupId} rgs.RESI_GROUP_ID = #{groupId}
AND rgs.DEL_FLAG = '0' AND rgs.DEL_FLAG = '0'
</update> </update>
<!-- 查询群主的记录 -->
<select id="selectLeaderMember" parameterType="java.lang.String" resultType="com.epmet.resi.group.dto.member.ResiGroupMemberDTO">
SELECT
rgm.*
FROM
resi_group_member rgm
WHERE
rgm.DEL_FLAG = '0'
AND rgm.ENTER_GROUP_TYPE = 'created'
AND rgm.GROUP_LEADER_FLAG = 'leader'
AND rgm.RESI_GROUP_ID = #{groupId}
</select>
<!-- 查看用户是否存在有效的入群申请 -->
<select id="selectGroupMemberOperationUnderAudit" parameterType="map" resultType="com.epmet.resi.group.dto.member.GroupMemeberOperationDTO">
select gmo.* from group_memeber_operation gmo
where gmo.DEL_FLAG='0'
and gmo.OPERATE_STATUS='under_auditting'
and gmo.CUSTOMER_USER_ID=#{userId}
and gmo.GROUP_ID=#{groupId}
</select>
</mapper> </mapper>

Loading…
Cancel
Save