Browse Source

Merge branch 'dev_group_code' into dev

# Conflicts:
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
master
sunyuchao 5 years ago
parent
commit
97f449250f
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 16
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java
  3. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  4. 4
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java
  5. 1
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  6. 19
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AccessTokenDTO.java
  7. 53
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/utils/ThirdUtils.java
  8. 23
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java
  9. 16
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java
  10. 66
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java
  11. 101
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java
  12. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java
  13. 40
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java
  14. 40
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java
  15. 33
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java
  16. 35
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java
  17. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java
  18. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java
  19. 19
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/AcceptInvitationResultDTO.java
  20. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/LinkGroupInfoResultDTO.java
  21. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java
  22. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java
  23. 27
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/EditAuditSwitchFormDTO.java
  24. 6
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java
  25. 16
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  26. 15
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  27. 32
      epmet-module/resi-group/resi-group-server/pom.xml
  28. 49
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/config/AsyncConfig.java
  29. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java
  30. 112
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java
  31. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  32. 41
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java
  33. 72
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java
  34. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java
  35. 58
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java
  36. 126
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java
  37. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  38. 304
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java
  39. 43
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  40. 17
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java
  41. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java
  42. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java
  43. 177
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java
  44. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java
  45. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java
  46. 22
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  47. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java
  48. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  49. 25
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/properties/ThreadProperties.java
  50. 9
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml
  51. 16
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_code.sql
  52. 9
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__group_audit_switch.sql
  53. 6
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__group_invitation.sql
  54. 27
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml
  55. 3
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  56. 5
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml
  57. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  58. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

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

@ -48,7 +48,7 @@ public enum EpmetErrorCode {
IDCARDNO_ALREADY_EXITS(8109,"系统已存在相同身份证号码,请重新输入"),
IDCARDNO_ERROR(8110,"身份证号格式错误,请重新输入"),
CANNOT_DELETE_PARTY_MEMBER(8111,"该用户已注册党员,不允许删除"),
GROUP_LEADER_CAN_EDIT_GROUP_INFO(8112,"只有组长才可以修改小组信息"),
GROUP_LEADER_CAN_EDIT_GROUP_INFO(8112,"只有组长才可以操作"),
INVITE_NEW_MEMBER(8113,"只有讨论中的小组才可以邀请新成员"),
ACT_TITLE_SCAN_FAILED(8114,"活动标题审核失败,请重新编辑"),
ACT_REQ_SCAN_FAILED(8115,"活动报名条件审核失败,请重新编辑"),

16
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java

@ -66,4 +66,20 @@ public class HttpContextUtils {
}
return defaultLanguage;
}
public static String getRequestServerNameAndPort() {
HttpServletRequest request = getHttpServletRequest();
//X-Forwarded-Scheme是nginx中添加的一个header,用于获取真实的$scheme
String scheme = request.getHeader("X-Forwarded-Scheme");
if (StringUtils.isBlank(scheme)) {
scheme = "http";
}
String hostAndPort = request.getHeader("Host-And-Port");
if (StringUtils.isBlank(hostAndPort)) {
hostAndPort = request.getServerName().concat(":").concat(String.valueOf(request.getServerPort()));
}
return String.format("%s://%s", scheme, hostAndPort);
}
}

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -40,5 +40,5 @@ public interface EpmetHeartOpenFeignClient {
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.ActInfoDTO>>
*/
@PostMapping("/heart/resi/act/published/{staffId}")
Result<List<ActInfoDTO>> getPublishedAct(@PathVariable String staffId);
Result<List<ActInfoDTO>> getPublishedAct(@PathVariable("staffId") String staffId);
}

4
epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java

@ -30,6 +30,8 @@ import org.springframework.web.multipart.MultipartFile;
*/
@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class, fallback =
OssFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class, fallback =
// OssFeignClientFallback.class)
public interface OssFeignClient {
/**
* 文件上传
@ -44,7 +46,7 @@ public interface OssFeignClient {
Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file);
@Configuration
//@Configuration
class MultipartSupportConfig {
@Bean
public Encoder feignFormEncoder() {

1
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

@ -159,6 +159,7 @@ public class OssController {
public Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file) {
return ossService.uploadImg(file);
}
/**
* 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件这里不再使用通用的接口
* 针对每一个业务新建上传接口)

19
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AccessTokenDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/17 10:07
*/
@Data
public class AccessTokenDTO implements Serializable {
private String resiToken;
private String workToken;
private String errMsg;
}

53
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/utils/ThirdUtils.java

@ -0,0 +1,53 @@
package com.epmet.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.AccessTokenDTO;
import com.epmet.dto.result.CustomerTokensResultDTO;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/17 10:04
*/
public class ThirdUtils {
/**
* @Description 获取AccessToken公共方法
* @param customerId
* @return com.epmet.dto.AccessTokenDTO
* @Author liushaowen
* @Date 2020/11/17 10:09
*/
public static AccessTokenDTO getAccessToken(String customerId) {
EnvEnum envEnum = EnvEnum.getCurrentEnv();
AccessTokenDTO accessToken = new AccessTokenDTO();
String url = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/tokenlist";
JSONObject postData = new JSONObject();
postData.put("customerId", customerId);
String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(postData)).getData();
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (null != toResult.get("code")) {
mapToResult.setCode(((Integer) toResult.get("code")).intValue());
}
if (!mapToResult.success()) {
accessToken.setErrMsg( StringUtils.isBlank(mapToResult.getMsg()) ? mapToResult.getInternalMsg() : mapToResult.getMsg());
}
Object CustomerTokensResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(CustomerTokensResultDTO.toString());
CustomerTokensResultDTO customerTokensResultDTO = ConvertUtils.mapToEntity(json, com.epmet.dto.result.CustomerTokensResultDTO.class);
accessToken.setResiToken(customerTokensResultDTO.getResiAuthorizerToken());
accessToken.setWorkToken(customerTokensResultDTO.getWorkAuthorizerToken());
return accessToken;
}
}

23
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java

@ -0,0 +1,23 @@
package com.epmet.resi.group.constant;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/13 16:23
*/
public interface GroupCodeConstant {
/**
* 群二维码类型-邀请
*/
String CODE_TYPE_INVITE = "invite";
/**
* aliyun图片地址域名对应正则表达式
*/
String PATTERN = "^((http://)|(https://))?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(/)";
/**
* 供前端下载图片jenkins转发前缀
*/
String STORAGE = "/storage/";
}

16
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java

@ -41,4 +41,20 @@ public interface GroupStateConstant {
* 群已关闭 - closed
*/
String GROUP_CLOSED = "closed";
/**
* 邀请链接invited
*/
String GROUP_INVITED = "invited";
/**
* 扫码scancode
*/
String GROUP_SCANCODE = "scancode";
/**
* 进组审核open开启close关闭
*/
String AUDIT_SWITCH_OPEN = "open";
/**
* 进组审核open开启close关闭
*/
String AUDIT_SWITCH_CLOSED = "close";
}

66
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java

@ -0,0 +1,66 @@
package com.epmet.resi.group.dto;
import lombok.Data;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/16 13:52
*/
@Data
public class QRCodeMultipartFileDTO implements MultipartFile {
private String name = "file";
private String originalFilename;
private String contentType = "image/jpeg";
private byte[] bytes;
@Override
public String getName() {
return this.name;
}
@Override
public String getOriginalFilename() {
return this.originalFilename;
}
@Override
public String getContentType() {
return this.contentType;
}
@Override
public boolean isEmpty() {
return ArrayUtils.isEmpty(bytes)?true:false;
}
@Override
public long getSize() {
return ArrayUtils.isEmpty(bytes)?bytes.length:0;
}
@Override
public byte[] getBytes() {
return this.bytes;
}
@Override
public InputStream getInputStream() {
return null;
}
@Override
public void transferTo(File file) {
}
}

101
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java

@ -0,0 +1,101 @@
/**
* 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 qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@Data
public class ResiGroupCodeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格ID
*/
private String gridId;
/**
* 小组Id
*/
private String groupId;
/**
* 二维码类型
*/
private String type;
/**
* 邀请ID
*/
private String invitationId;
/**
* 二维码路径
*/
private String url;
/**
* 删除标志
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java

@ -74,6 +74,11 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private Date latestTopicPublishDate;
/**
* 进组审核open开启close关闭
*/
private String auditSwitch;
/**
* 删除标记 0未删除1已删除
*/

40
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/13 16:22
*/
@Data
public class CreateGroupCodeFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
* 网格id
*/
@NotBlank(message = "网格id不能为空")
private String gridId;
/**
* 组id
*/
@NotBlank(message = "群组id不能为空")
private String groupId;
/**
* 类型 GroupCodeConstant中的类型
*/
@NotBlank(message = "二维码类型不能为空")
private String type;
}

40
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/16 9:31
*/
@Data
public class GetGroupCodeFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
* 网格id
*/
@NotBlank(message = "网格id不能为空")
private String gridId;
/**
* 组id
*/
@NotBlank(message = "群组id不能为空")
private String groupId;
/**
* 类型 GroupCodeConstant中的类型
*/
@NotBlank(message = "二维码类型不能为空")
private String type;
}

33
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.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: 获取生成海报(小组码)信息-接口入参
* @author: sun
*/
@Data
public class GroupCodeBasicInfoFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class})
private String customerId;
/**
* 网格id
*/
@NotBlank(message = "网格id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class})
private String gridId;
/**
* 组id
*/
@NotBlank(message = "群组id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class})
private String groupId;
public interface GroupCodeInfo {}
}

35
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import java.io.Serializable;
/**
* @description: 获取生成海报(小组码)信息-接口入参
* @author: sun
*/
@Data
public class GroupCodeBasicInfoResultDTO implements Serializable {
private static final long serialVersionUID = -1590972041272087570L;
/**
* 小组Id
*/
private String groupId;
/**
* 小组名称
*/
private String groupName;
/**
* 小组头像
*/
private String groupHeadPhoto;
/**
* 小组介绍
*/
private String groupIntroduction;
/**
* 小组二维码路径
*/
private String groupCodeUrl;
}

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java

@ -65,6 +65,10 @@ public class GroupSummarizeResultDTO implements Serializable {
*/
private String leaderFlag;
/**
* 进组审核open开启close关闭
*/
private String auditSwitch;
public GroupSummarizeResultDTO(){
this.setGroupId("");
this.setGroupHeadPhoto("");
@ -76,5 +80,6 @@ public class GroupSummarizeResultDTO implements Serializable {
this.setTotalApplyingMember(NumConstant.ZERO);
this.setTotalTopics(NumConstant.ZERO);
this.setLeaderFlag("");
this.setAuditSwitch("open");
}
}

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java

@ -68,6 +68,11 @@ public class GroupInvitationDTO implements Serializable {
*/
private Date validEndTime;
/**
* 邀请链接invited;扫码scancode
*/
private String invitationType;
/**
* 删除标记 0未删除1已删除
*/

19
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/AcceptInvitationResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.resi.group.dto.invitation.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 同意邀请进组
* @Author sun
*/
@Data
public class AcceptInvitationResultDTO implements Serializable {
private static final long serialVersionUID = 8860336693592035343L;
/**
* true 已经入组过需要审核 false没有入组过
*/
private Boolean awaitAudit = false;
}

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/LinkGroupInfoResultDTO.java

@ -14,6 +14,10 @@ import java.io.Serializable;
public class LinkGroupInfoResultDTO implements Serializable {
private static final long serialVersionUID = 8860336693592035343L;
/**
* true 已经入组过需要审核 false没有入组过
*/
private Boolean awaitAudit;
/**
* 是否在群内标志已经在群内yes 不在群内no
*/

2
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;
/**
* 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
* 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群扫码入群 - scancode
*/
private String enterGroupType;

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;
/**
* 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群
* 入群方式受邀请入群 - invited 主动加入 - joincreated群主创建群自动进入群扫码入群 - scancode
*/
private String enterGroupType;

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

@ -0,0 +1,27 @@
package com.epmet.resi.group.dto.member.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 组长开启/关闭入群审核
*
* @author yinzuomei@elink-cn.com
* @date 2020/11/17 14:02
*/
@Data
public class EditAuditSwitchFormDTO implements Serializable {
private static final long serialVersionUID = -8185514609968752625L;
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "小组id不能为空")
private String groupId;
/**
* 进组审核open开启close关闭
*/
@NotBlank(message = "请选择是否开启", groups = {EditAuditSwitchFormDTO.AddUserShowGroup.class})
private String auditSwitch;
}

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

@ -47,6 +47,12 @@ public class ApplyingMemberResultDTO implements Serializable {
*/
private String status;
/**
* invited通过链接加入 join申请加入scancode通过扫码加入
*/
private String enterGroupType;
/**
* 用户徽章Url列表
*/

16
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -17,12 +17,18 @@ import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO;
import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO;
import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.HashMap;
import java.util.List;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -58,6 +64,16 @@ public interface ResiGroupOpenFeignClient {
Result govAuditEdit(@RequestBody GroupEditionAuditFormDTO param);
/**
* @Description 创建群组二维码
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author liushaowen
* @Date 2020/11/13 16:33
*/
@PostMapping(value = "/resi/group/resigroupcode/creategroupcode", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<String> createGroupCode(@RequestBody CreateGroupCodeFormDTO dto);
/**
* @Description 查询用户参与的且不是自己发表的话题对应的议题Id集合
* @author sun

15
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -17,6 +17,10 @@ import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO;
import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO;
import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component;
@ -46,6 +50,17 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
public Result govAuditEdit(GroupEditionAuditFormDTO param) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "govAuditEdit", param);
}
/**
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Description 创建群组二维码
* @Author liushaowen
* @Date 2020/11/13 16:33
*/
@Override
public Result<String> createGroupCode(CreateGroupCodeFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "createGroupCode", dto);
}
@Override
public Result<List<IssueGridResultDTO>> topicToIssueList(MyPartProjectsFormDTO formDTO) {

32
epmet-module/resi-group/resi-group-server/pom.xml

@ -94,6 +94,18 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@ -148,6 +160,11 @@
<spring.flyway.enabled>false</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
<!--线程池配置-->
<thread.pool.core-pool-size>5</thread.pool.core-pool-size>
<thread.pool.max-pool-size>8</thread.pool.max-pool-size>
<thread.pool.queue-capacity>10</thread.pool.queue-capacity>
<thread.pool.keep-alive>30</thread.pool.keep-alive>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>
@ -188,6 +205,11 @@
<spring.flyway.enabled>false</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
<!--线程池配置-->
<thread.pool.core-pool-size>5</thread.pool.core-pool-size>
<thread.pool.max-pool-size>8</thread.pool.max-pool-size>
<thread.pool.queue-capacity>10</thread.pool.queue-capacity>
<thread.pool.keep-alive>30</thread.pool.keep-alive>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>
@ -227,6 +249,11 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
<!--线程池配置-->
<thread.pool.core-pool-size>5</thread.pool.core-pool-size>
<thread.pool.max-pool-size>8</thread.pool.max-pool-size>
<thread.pool.queue-capacity>10</thread.pool.queue-capacity>
<thread.pool.keep-alive>30</thread.pool.keep-alive>
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>
@ -263,6 +290,11 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-open.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
<!--线程池配置-->
<thread.pool.core-pool-size>5</thread.pool.core-pool-size>
<thread.pool.max-pool-size>8</thread.pool.max-pool-size>
<thread.pool.queue-capacity>10</thread.pool.queue-capacity>
<thread.pool.keep-alive>30</thread.pool.keep-alive>
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>

49
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/config/AsyncConfig.java

@ -0,0 +1,49 @@
package com.epmet.config;
import com.epmet.properties.ThreadProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 线程池配置类
*/
@Configuration
@EnableConfigurationProperties(ThreadProperties.class)
@EnableAsync
public class AsyncConfig {
@Autowired
private ThreadProperties threadProperties;
@Bean
public Executor executor() {
ThreadProperties.ThreadPoolProperties threadPoolProps = threadProperties.getThreadPool();
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(threadPoolProps.getCorePoolSize());
executor.setMaxPoolSize(threadPoolProps.getMaxPoolSize());
executor.setQueueCapacity(threadPoolProps.getQueueCapacity());
executor.setThreadNamePrefix("epmet-resi-group-");
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
// CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //对拒绝task的处理策略
executor.setKeepAliveSeconds(threadPoolProps.getKeepAlive());
executor.initialize();
return executor;
}
@Bean
public ExecutorService executorService() {
ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) executor();
return executor.getThreadPoolExecutor();
}
}

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java

@ -28,6 +28,7 @@ public interface UserMessageConstant {
* 成员通过链接同意进群后组长会收到您的好友-认证的居民名字 xxx路-王先生通过邀请链接加入了组名
*/
String INVITED_JOIN_GROUP = "您的好友-【%s】通过邀请连接,加入了【%s】";
String SCANCODE_JOIN_GROUP = "您的好友-【%s】通过扫描二维码,加入了【%s】";
/**
* 组成员被禁言时会收到消息您已被禁言禁言时间2020.03.20 12:20-2020.03.27 12:20
@ -79,4 +80,14 @@ public interface UserMessageConstant {
*/
String WX_CREATE_GROUP_BEHAVIOR = "建组申请消息";
/**
* 邀请入组的入组理由
*/
String INVITED_OPERATE = "通过邀请链接加入小组。";
/**
* 扫码入组的入组理由
*/
String SCANCODE_OPERATE = "通过扫码加入小组。";
}

112
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java

@ -0,0 +1,112 @@
/**
* 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.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.group.service.ResiGroupCodeService;
import com.epmet.resi.group.dto.group.ResiGroupCodeDTO;
import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GroupCodeBasicInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 小组二维码 小组唯一二维码海报码和小组码是同一个二维码长期有效的
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@RestController
@RequestMapping("resigroupcode")
public class ResiGroupCodeController {
@Autowired
private ResiGroupCodeService resiGroupCodeService;
@GetMapping("page")
public Result<PageData<ResiGroupCodeDTO>> page(@RequestParam Map<String, Object> params){
PageData<ResiGroupCodeDTO> page = resiGroupCodeService.page(params);
return new Result<PageData<ResiGroupCodeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ResiGroupCodeDTO> get(@PathVariable("id") String id){
ResiGroupCodeDTO data = resiGroupCodeService.get(id);
return new Result<ResiGroupCodeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ResiGroupCodeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resiGroupCodeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ResiGroupCodeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resiGroupCodeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
resiGroupCodeService.delete(ids);
return new Result();
}
@RequestMapping("creategroupcode")
public Result<String> createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){
ValidatorUtils.validateEntity(dto);
return new Result<String>().ok(resiGroupCodeService.createGroupCode(dto, true));
}
@RequestMapping("getgroupcode")
public Result<String> getGroupCode(@RequestBody GetGroupCodeFormDTO dto){
ValidatorUtils.validateEntity(dto);
return resiGroupCodeService.getGroupCode(dto);
}
/**
* @param formDTO
* @Description 获取生成海报(小组码)信息
* @author sun
*/
@PostMapping("groupcodebasicinfo")
public Result<GroupCodeBasicInfoResultDTO> groupCodeBasicInfo(@RequestBody GroupCodeBasicInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GroupCodeBasicInfoFormDTO.GroupCodeInfo.class);
return new Result<GroupCodeBasicInfoResultDTO>().ok(resiGroupCodeService.groupCodeBasicInfo(formDTO));
}
}

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

@ -28,6 +28,7 @@ import com.epmet.resi.group.dto.group.GroupProcessingCountResultDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@ -35,6 +36,10 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@ -109,7 +114,7 @@ public class ResiGroupController {
* @param modifyGroupFormDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 修改组信息
* @Description 修改组信息 此接口废弃
* @Date 2020/3/28 22:20
**/
@PostMapping("modifygroup")
@ -429,6 +434,19 @@ public class ResiGroupController {
}
/**
* @param formDTO
* @author yinzuomei
* @description 组长开启/关闭入群审核
* @Date 2020/11/17 14:18
**/
@PostMapping("editauditswitch")
public Result editAuditSwitch(@RequestBody EditAuditSwitchFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,EditAuditSwitchFormDTO.AddUserShowGroup.class);
resiGroupService.editAuditSwitch(formDTO);
return new Result();
}
/**
* @Description 查询话题所属小组名
* @Param groupInfoFormDTO

41
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java

@ -0,0 +1,41 @@
/**
* 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.ResiGroupCodeEntity;
import com.epmet.resi.group.dto.group.form.GroupCodeBasicInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO;
import org.apache.ibatis.annotations.Mapper;
/**
* 小组二维码 小组唯一二维码海报码和小组码是同一个二维码长期有效的
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@Mapper
public interface ResiGroupCodeDao extends BaseDao<ResiGroupCodeEntity> {
/**
* @param formDTO
* @Description 获取生成海报(小组码)信息
* @author sun
*/
GroupCodeBasicInfoResultDTO selectGroupCodeBasicInfo(GroupCodeBasicInfoFormDTO formDTO);
}

72
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java

@ -0,0 +1,72 @@
/**
* 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 qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_code")
public class ResiGroupCodeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 网格ID
*/
private String gridId;
/**
* 小组Id
*/
private String groupId;
/**
* 二维码类型
*/
private String type;
/**
* 邀请ID
*/
private String invitationId;
/**
* 二维码路径
*/
private String url;
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java

@ -74,4 +74,9 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private Date latestTopicPublishDate;
/**
* 进组审核open开启close关闭
*/
private String auditSwitch;
}

58
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java

@ -0,0 +1,58 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 小组二维码 小组唯一二维码海报码和小组码是同一个二维码长期有效的
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@Component
public class ResiGroupCodeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
/**
* @Description 获取刷新
* @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType 前缀+客户ID+客户端类型
* @author zxc
*/
public Map<String,Object> getAuthorizerRefreshToken(String key){
Map<String, Object> result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key);
return result;
}
}

126
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java

@ -0,0 +1,126 @@
/**
* 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.commons.tools.utils.Result;
import com.epmet.modules.group.entity.ResiGroupCodeEntity;
import com.epmet.resi.group.dto.group.ResiGroupCodeDTO;
import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GroupCodeBasicInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO;
import java.util.List;
import java.util.Map;
/**
* 小组二维码 小组唯一二维码海报码和小组码是同一个二维码长期有效的
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
public interface ResiGroupCodeService extends BaseService<ResiGroupCodeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiGroupCodeDTO>
* @author generator
* @date 2020-11-13
*/
PageData<ResiGroupCodeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiGroupCodeDTO>
* @author generator
* @date 2020-11-13
*/
List<ResiGroupCodeDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ResiGroupCodeDTO
* @author generator
* @date 2020-11-13
*/
ResiGroupCodeDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-11-13
*/
void save(ResiGroupCodeDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-11-13
*/
void update(ResiGroupCodeDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-11-13
*/
void delete(String[] ids);
/**
* @Description 创建群组二维码
* @param dto,syncFlag(是否同步执行,true同步,false异步)
* @return String
* @Author liushaowen
* @Date 2020/11/13 16:32
*/
String createGroupCode(CreateGroupCodeFormDTO dto, boolean syncFlag);
/**
* @Description 获取群组二维码
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author liushaowen
* @Date 2020/11/16 9:37
*/
Result<String> getGroupCode(GetGroupCodeFormDTO dto);
/**
* @param formDTO
* @Description 获取生成海报(小组码)信息
* @author sun
*/
GroupCodeBasicInfoResultDTO groupCodeBasicInfo(GroupCodeBasicInfoFormDTO formDTO);
}

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

@ -27,6 +27,7 @@ import com.epmet.resi.group.dto.group.GroupProcessingCountResultDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
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 java.util.HashMap;
import java.util.List;
@ -135,6 +136,7 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Description 修改组信息
* @Date 2020/3/28 22:27
**/
@Deprecated
void modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO);
/**
@ -326,6 +328,15 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
*/
void auditEdit(GroupEditionAuditFormDTO param);
/**
* @return void
* @param formDTO
* @author yinzuomei
* @description 组长开启/关闭入群审核
* @Date 2020/11/17 14:18
**/
void editAuditSwitch(EditAuditSwitchFormDTO formDTO);
/**
* @Description 查询话题所属小组名
* @Param groupInfoFormDTO

304
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java

@ -0,0 +1,304 @@
/**
* 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.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.feign.OssFeignClient;
import com.epmet.modules.group.dao.ResiGroupCodeDao;
import com.epmet.modules.group.entity.ResiGroupCodeEntity;
import com.epmet.modules.group.redis.ResiGroupCodeRedis;
import com.epmet.modules.group.service.ResiGroupCodeService;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.invitation.service.GroupInvitationService;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.constant.GroupCodeConstant;
import com.epmet.resi.group.dto.QRCodeMultipartFileDTO;
import com.epmet.resi.group.dto.group.ResiGroupCodeDTO;
import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO;
import com.epmet.resi.group.dto.group.form.GroupCodeBasicInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO;
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO;
import com.epmet.utils.ThirdUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
/**
* 小组二维码 小组唯一二维码海报码和小组码是同一个二维码长期有效的
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-11-13
*/
@Service
public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, ResiGroupCodeEntity> implements ResiGroupCodeService {
private static final Logger logger = LoggerFactory.getLogger(ResiGroupCodeServiceImpl.class);
@Autowired
private ResiGroupCodeRedis resiGroupCodeRedis;
@Autowired
private OssFeignClient ossFeignClient;
@Autowired
private ExecutorService executorService;
@Autowired
private GroupInvitationService groupInvitationService;
@Autowired
private ResiGroupService resiGroupService;
@Override
public PageData<ResiGroupCodeDTO> page(Map<String, Object> params) {
IPage<ResiGroupCodeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiGroupCodeDTO.class);
}
@Override
public List<ResiGroupCodeDTO> list(Map<String, Object> params) {
List<ResiGroupCodeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiGroupCodeDTO.class);
}
private QueryWrapper<ResiGroupCodeEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiGroupCodeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiGroupCodeDTO get(String id) {
ResiGroupCodeEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiGroupCodeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiGroupCodeDTO dto) {
ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiGroupCodeDTO dto) {
ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param dto, syncFlag(是否同步执行,true同步,false异步)
* @return String
* @Description 创建群组二维码
* @Author liushaowen
* @Date 2020/11/13 16:32
*/
@Override
public String createGroupCode(CreateGroupCodeFormDTO dto, boolean syncFlag) {
if (syncFlag){
return createCodeFunction(dto);
}else {
executorService.execute(()->{
try {
long startTs = System.currentTimeMillis();
createCodeFunction(dto);
long endTs = System.currentTimeMillis();
logger.info("异步创建群二维码成功,执行时长:{}", endTs - startTs);
} catch (Exception e) {
logger.error("异步创建群二维码失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
}
});
return "";
}
}
/**
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Description 获取群组二维码
* @Author liushaowen
* @Date 2020/11/16 9:37
*/
@Override
public Result<String> getGroupCode(GetGroupCodeFormDTO dto) {
ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType());
if (codeByGroupId != null) {
//数据库有数据
return new Result<String>().ok(codeByGroupId.getUrl());
} else {
//从微信获取二维码并存储
CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO();
BeanUtils.copyProperties(dto, createDto);
String url = createGroupCode(createDto, true);
if (StringUtils.isBlank(url)){
throw new RenException("获取二维码失败");
}
return new Result<String>().ok(url);
}
}
private ResiGroupCodeEntity getCode(String groupId, String type) {
if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) {
throw new RenException("获取二维码失败,groupId或type为空");
}
QueryWrapper<ResiGroupCodeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("DEL_FLAG", "0");
queryWrapper.eq("GROUP_ID", groupId);
queryWrapper.eq("TYPE", type);
return baseDao.selectOne(queryWrapper);
}
private String createCodeFunction(CreateGroupCodeFormDTO dto){
String result = "";
ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType());
if (codeByGroupId != null) {
logger.error("本群组该类型二维码已存在,请勿重复添加。groupId:{},type:{}", dto.getGroupId(), dto.getType());
throw new RenException("本群组该类型二维码已存在,请勿重复添加。");
} else {
//向微信获取二维码
// 获取AccessToken
String accessToken = ThirdUtils.getAccessToken(dto.getCustomerId()).getResiToken();
if (StringUtils.isBlank(accessToken)) {
logger.error("获取accessToken失败,customerId:{}", dto.getCustomerId());
throw new RenException("获取accessToken失败");
}
//跳转的页面
StringBuilder path = new StringBuilder(ModuleConstant.CODE_INVITE_PAGE);
//获取invitationId
CreateGroupInvitationFormDTO invitationFormDTO = new CreateGroupInvitationFormDTO();
//获取群主userId
invitationFormDTO.setUserId(resiGroupService.get(dto.getGroupId()).getCreatedBy());
invitationFormDTO.setGroupId(dto.getGroupId());
CreateGroupInvitationResultDTO groupScanCodeInvitation = groupInvitationService.createGroupScanCodeInvitation(invitationFormDTO);
path.append("?invitationId=").append(groupScanCodeInvitation.getInvitationId());
//需要发送的Json
JSONObject data = new JSONObject();
data.put("path", path.toString());
data.put("width", 400);
//发送
byte[] buffer = HttpClientManager.getInstance().getMediaByteArray(ModuleConstant.GET_CODE_URL + accessToken, JSON.toJSONString(data)).getData();
if (buffer != null && buffer.length < 500) {
String wxResult = "";
try {
wxResult = new String(buffer, "UTF-8");
if (-1 != wxResult.indexOf("errcode")) {
logger.error("获取二维码接口返回错误:{}", wxResult);
throw new RenException("获取二维码失败");
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
//上传
QRCodeMultipartFileDTO qrCodeMultipartFile = new QRCodeMultipartFileDTO();
qrCodeMultipartFile.setBytes(buffer);
qrCodeMultipartFile.setOriginalFilename("qrcode.jpg");
Result<UploadImgResultDTO> uploadResult = ossFeignClient.uploadQrCode(qrCodeMultipartFile);
if (uploadResult.success()) {
result = uploadResult.getData().getUrl();
//存表
ResiGroupCodeEntity entity = new ResiGroupCodeEntity();
BeanUtils.copyProperties(dto, entity);
entity.setInvitationId(groupScanCodeInvitation.getInvitationId());
entity.setUrl(uploadResult.getData().getUrl());
baseDao.insert(entity);
} else {
logger.error("上传图片失败:{}", uploadResult.getMsg());
throw new RenException("上传图片失败");
}
}
return result;
}
/**
* @param formDTO
* @Description 获取生成海报(小组码)信息
* @author sun
*/
@Override
public GroupCodeBasicInfoResultDTO groupCodeBasicInfo(GroupCodeBasicInfoFormDTO formDTO) {
String headUrl = "";
String url = "";
//1.获取小组基本信息
GroupCodeBasicInfoResultDTO resultDTO = baseDao.selectGroupCodeBasicInfo(formDTO);
if (null == resultDTO) {
logger.error(String.format("获取小组码基本信息失败,小组Id:%s", formDTO.getGroupId()));
throw new RenException("获取小组码基本信息失败");
}
if (null == resultDTO.getGroupCodeUrl() || "".equals(resultDTO.getGroupCodeUrl())) {
CreateGroupCodeFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CreateGroupCodeFormDTO.class);
dto.setType(GroupCodeConstant.CODE_TYPE_INVITE);
url = createGroupCode(dto, true);
if (StringUtils.isBlank(url)) {
logger.error(String.format("生成小组二维码失败,小组Id:%s", formDTO.getGroupId()));
throw new RenException("获取小组码基本信息失败");
}
}
headUrl = resultDTO.getGroupHeadPhoto();
url = resultDTO.getGroupCodeUrl();
//2.图片的url,服务器域名端口+storage+阿里云相对路径,storage段是为了nginx做oss代理,前缀
String requestDomain = HttpContextUtils.getRequestServerNameAndPort();
resultDTO.setGroupHeadPhoto(requestDomain.concat(headUrl.replaceAll(GroupCodeConstant.PATTERN, GroupCodeConstant.STORAGE)));
resultDTO.setGroupCodeUrl(requestDomain.concat(url.replaceAll(GroupCodeConstant.PATTERN, GroupCodeConstant.STORAGE)));
return resultDTO;
}
}

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

@ -28,6 +28,10 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
@ -51,6 +55,7 @@ import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupOperationEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.group.service.ResiGroupCodeService;
import com.epmet.modules.group.service.ResiGroupOperationService;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
@ -71,6 +76,7 @@ import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.github.pagehelper.PageHelper;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -155,6 +161,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired
private ResiGroupCodeService resiGroupCodeService;
@Override
public PageData<ResiGroupDTO> page(Map<String, Object> params) {
IPage<ResiGroupEntity> page = baseDao.selectPage(
@ -555,6 +564,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED);
groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId());
groupMemeberOperationService.update(groupMemeberOperationDTO);
//4-1.2020.11.17 sun 添加小组审核通过后生成小组的二维码图片逻辑 start
try {
CreateGroupCodeFormDTO dto = new CreateGroupCodeFormDTO();
dto.setCustomerId(resiGroupDTO.getCustomerId());
dto.setGridId(resiGroupDTO.getGridId());
dto.setGroupId(resiGroupDTO.getId());
dto.setType(GroupCodeConstant.CODE_TYPE_INVITE);
resiGroupCodeService.createGroupCode(dto ,false);
} catch (Exception e) {
logger.error(String.format("小组审核通过,生成小组二维码失败", e.getMessage()));
}
// end
//5、给用户发送消息???待定
//6、新增小组缓存信息、组员缓存信息
Map<String, Object> param = new HashMap<>();
@ -793,7 +814,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
resultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName());
} else {
logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg());
logger.warn("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), formDTO.getGroupId());
}
return new Result<GovGroupSummarizeResultDTO>().ok(resultDTO);
@ -984,12 +1005,30 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
dto.setLeaderName(groupLeaderUserInfo.getData().getShowName());
} else {
logger.warn("组长注册信息查询失败" + groupLeaderUserInfo.getMsg());
logger.warn("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), dto.getGroupId());
}
});
return recommendGroupList;
}
/**
* @param formDTO
* @return void
* @author yinzuomei
* @description 组长开启/关闭入群审核
* @Date 2020/11/17 14:18
**/
@Override
public void editAuditSwitch(EditAuditSwitchFormDTO formDTO) {
ResiGroupEntity resiGroupEntity=baseDao.selectById(formDTO.getGroupId());
String currentUserId=loginUserUtil.getLoginUserId();
if(!currentUserId.equals(resiGroupEntity.getCreatedBy())){
throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode());
}
resiGroupEntity.setAuditSwitch(formDTO.getAuditSwitch());
baseDao.updateById(resiGroupEntity);
}
/**
* @Description 给加入此网格的网格长发送消息
* @param msg

17
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java

@ -25,6 +25,7 @@ import com.epmet.modules.invitation.service.GroupInvitationService;
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO;
import com.epmet.resi.group.dto.invitation.result.AcceptInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
@ -89,12 +90,24 @@ public class GroupInvitationController {
* @Date 2020/3/31 23:47
**/
@PostMapping("acceptinvitation")
public Result accetInvitation(@LoginUser TokenDto tokenDto,
@RequestBody AccetInvitationFormDTO formDTO) {
public Result accetInvitation(@LoginUser TokenDto tokenDto, @RequestBody AccetInvitationFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setApp(tokenDto.getApp());
ValidatorUtils.validateEntity(formDTO);
groupInvitationService.accetInvitation(formDTO);
return new Result();
}
/**
* @param tokenDto formDTO
* @Author sun
* @Description 邀请链接或扫码进组
**/
@PostMapping("acceptinvitationv2")
public Result<AcceptInvitationResultDTO> accetInvitationV2(@LoginUser TokenDto tokenDto, @RequestBody AccetInvitationFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setApp(tokenDto.getApp());
ValidatorUtils.validateEntity(formDTO);
return new Result<AcceptInvitationResultDTO>().ok(groupInvitationService.accetInvitationV2(formDTO));
}
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java

@ -68,4 +68,9 @@ public class GroupInvitationEntity extends BaseEpmetEntity {
*/
private Date validEndTime;
/**
* 邀请链接invited;扫码scancode
*/
private String invitationType;
}

21
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java

@ -25,6 +25,7 @@ import com.epmet.resi.group.dto.invitation.GroupInvitationDTO;
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO;
import com.epmet.resi.group.dto.invitation.result.AcceptInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO;
@ -103,11 +104,20 @@ public interface GroupInvitationService extends BaseService<GroupInvitationEntit
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO>
* @param formDTO
* @Author yinzuomei
* @Description 生成邀请连接
* @Description 生成邀请连接-链接
* @Date 2020/3/31 22:50
**/
CreateGroupInvitationResultDTO createGroupInvitation(CreateGroupInvitationFormDTO formDTO);
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO>
* @param formDTO
* @Author liushaowen
* @Description 生成邀请连接-扫码
* @Date 2020-11-17 13:58
**/
CreateGroupInvitationResultDTO createGroupScanCodeInvitation(CreateGroupInvitationFormDTO formDTO);
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO>
* @param formDTO
@ -124,5 +134,12 @@ public interface GroupInvitationService extends BaseService<GroupInvitationEntit
* @Description 同意邀请进组
* @Date 2020/3/31 23:47
**/
void accetInvitation(AccetInvitationFormDTO formDTO);
void accetInvitation(AccetInvitationFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 邀请链接或扫码进组
**/
AcceptInvitationResultDTO accetInvitationV2(AccetInvitationFormDTO formDTO);
}

177
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java

@ -45,6 +45,7 @@ import com.epmet.modules.invitation.service.GroupInvitationService;
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.impl.ResiGroupMemberServiceImpl;
import com.epmet.resi.group.constant.EnterGroupTypeConstant;
import com.epmet.resi.group.constant.GroupStateConstant;
import com.epmet.resi.group.constant.LeaderFlagConstant;
@ -56,6 +57,7 @@ import com.epmet.resi.group.dto.invitation.GroupInvitationDTO;
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO;
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO;
import com.epmet.resi.group.dto.invitation.result.AcceptInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO;
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoDTO;
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO;
@ -102,6 +104,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
private ResiGuideFeignClient resiGuideFeignClient;
@Autowired
private ResiGroupRedis resiGroupRedis;
@Autowired
private ResiGroupMemberServiceImpl resiGroupMemberServiceImpl;
@Override
public PageData<GroupInvitationDTO> page(Map<String, Object> params) {
@ -181,6 +185,41 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + NumConstant.FOURTEEN);
groupInvitationEntity.setValidEndTime(calendar.getTime());
groupInvitationEntity.setResiGroupId(formDTO.getGroupId());
groupInvitationEntity.setInvitationType(GroupStateConstant.GROUP_INVITED);
insert(groupInvitationEntity);
CreateGroupInvitationResultDTO resultDTO = new CreateGroupInvitationResultDTO();
resultDTO.setInvitationId(groupInvitationEntity.getId());
return resultDTO;
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO>
* @Author liushaowen
* @Description 生成邀请连接-扫码
* @Date 2020-11-17 13:58
**/
@Override
public CreateGroupInvitationResultDTO createGroupScanCodeInvitation(CreateGroupInvitationFormDTO formDTO) {
//1、只有群主可以邀请新成员(这块界面限制死了,只有群主才能看到邀请新成员按钮)
//2、审核通过(讨论中)的群才可以分享邀请连接
ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId());
if (!GroupStateConstant.GROUP_APPROVED.equals(resiGroupDTO.getState())) {
logger.error(String.format("生成群成员链接失败,原因:%s",EpmetErrorCode.INVITE_NEW_MEMBER.getMsg()));
throw new RenException(EpmetErrorCode.INVITE_NEW_MEMBER.getCode());
}
//3、插入一条邀请记录
GroupInvitationEntity groupInvitationEntity = new GroupInvitationEntity();
groupInvitationEntity.setInviterUserId(formDTO.getUserId());
groupInvitationEntity.setInviterCustomerId(resiGroupDTO.getCustomerId());
groupInvitationEntity.setInviterGridId(resiGroupDTO.getGridId());
//添加类型字段 scancode
groupInvitationEntity.setInvitationType(GroupStateConstant.GROUP_SCANCODE);
//暂定50年有效期
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + NumConstant.FIFTY);
groupInvitationEntity.setValidEndTime(calendar.getTime());
groupInvitationEntity.setResiGroupId(formDTO.getGroupId());
insert(groupInvitationEntity);
CreateGroupInvitationResultDTO resultDTO = new CreateGroupInvitationResultDTO();
resultDTO.setInvitationId(groupInvitationEntity.getId());
@ -206,6 +245,13 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
} else {
linkGroupInfoResultDTO.setInGroup(Constant.NO);
}
//2020.11.27 sun 添加查询是否已存在待审核申请 start
linkGroupInfoResultDTO.setAwaitAudit(false);
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(groupInvitationDTO.getResiGroupId(), formDTO.getUserId());
if (null != groupMemeberOperationDTO && MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
linkGroupInfoResultDTO.setAwaitAudit(true);
}
//end
//2、查询组信息
LinkGroupInfoDTO groupInfo = baseDao.selectLinkGroupInfo(groupInvitationDTO.getResiGroupId());
if(null!=groupInfo){
@ -368,6 +414,124 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
resiGroupMemberService.saveOrUpdate(resiGroupMemberDTO);
//7、修改群统计值
resiGroupMemberDao.updateResiGroupStatistical(groupMemeberOperation.getGroupId(), userRoleDTO);
ResiGroupInfoRedisDTO groupCache =
resiGroupRedis.get(groupInvitationDTO.getResiGroupId());
if(null != groupCache && null != groupCache.getGroupStatisticalInfo()){
groupCache.getGroupStatisticalInfo().setTotalMembers(
null == groupCache.getGroupStatisticalInfo().getTotalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalMembers() +NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getPartymemberFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalPartyMembers(
null == groupCache.getGroupStatisticalInfo().getTotalPartyMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalPartyMembers()+NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getRegisteredResiFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalNormalMembers(
null == groupCache.getGroupStatisticalInfo().getTotalNormalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalNormalMembers()+NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getWarmHeartedFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalEarnestMembers(
null == groupCache.getGroupStatisticalInfo().getTotalEarnestMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalEarnestMembers()+NumConstant.ONE
);
resiGroupRedis.set(groupCache);
}
//8、发送消息
this.sendMessageToLeader(formDTO, resiGroupDTO,groupInvitationDTO);
}
/**
* @param formDTO
* @Author sun
* @Description 邀请链接或扫码进组
**/
@Override
public AcceptInvitationResultDTO accetInvitationV2(AccetInvitationFormDTO formDTO) {
AcceptInvitationResultDTO resultDTO = new AcceptInvitationResultDTO();
//1、申请是否有效
GroupInvitationDTO groupInvitationDTO=this.checkLinkValid(formDTO.getInvitationId());
//2、查询是否在群内
ResiGroupMemberDTO groupMember = resiGroupMemberDao.selectGroupMemberInfo(groupInvitationDTO.getResiGroupId(), formDTO.getUserId());
if (null != groupMember && !MemberStateConstant.REMOVED.equals(groupMember.getStatus())) {
logger.info("已经在群内,直接返回成功");
return resultDTO;
}
//2020.11.26 sun start
//先判断用户是否有在审核的入组申请,有的话直接给提示
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(groupInvitationDTO.getResiGroupId(), formDTO.getUserId());
if (null != groupMemeberOperationDTO && MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
logger.info("已存在待审核入组申请,不能重复审核");
resultDTO.setAwaitAudit(true);
return resultDTO;
}
//end
//3、进入小组所在的网格
ResiGroupDTO resiGroupDTO = resiGroupService.get(groupInvitationDTO.getResiGroupId());
if(null==resiGroupDTO){
logger.error(String.format("用户同意邀请进组,查询组信息失败。入参:userId【%s】、invitationId【%s】、groupId【%s】。",formDTO.getUserId(),formDTO.getInvitationId(),groupInvitationDTO.getResiGroupId()));
throw new RenException(EpmetErrorCode.LOSE_EFFICACY.getCode());
}
UserEnterGridFormDTO userEnterGridFormDTO=new UserEnterGridFormDTO();
userEnterGridFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
userEnterGridFormDTO.setGridId(resiGroupDTO.getGridId());
Result<UserInfoOnEnterGridResultDTO> result=resiGuideFeignClient.enterGrid(userEnterGridFormDTO);
if (!result.success() || null == result.getData()) {
logger.error(String.format("用户同意邀请进组,进入网格失败。入参:userId【%s】、invitationId【%s】、groupId【%s】、customerId【%s】、gridId【%s】",
formDTO.getUserId(), formDTO.getInvitationId(),
groupInvitationDTO.getResiGroupId()),
resiGroupDTO.getCustomerId(), resiGroupDTO.getGridId());
logger.error(String.format("用户同意邀请进组,进入网格失败。当前接口返回8000,调用enterGrid接口返回", result.toString()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
//4、校验是否已经注册居民
if(null==result.getData().getUserRoleList()||result.getData().getUserRoleList().size()==0){
logger.error(String.format("用户同意邀请进组失败,返回角色列表为空错误编码%s,错误提示%s",EpmetErrorCode.CANNOT_JOIN_GROUP.getCode(),EpmetErrorCode.CANNOT_JOIN_GROUP.getMsg()));
throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode());
}
//2020.11.17 sun 新增扫描或邀请进组是否需要审核的逻辑 start
GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO();
groupMemeberOperation.setGroupId(resiGroupDTO.getId());
groupMemeberOperation.setCustomerUserId(formDTO.getUserId());
groupMemeberOperation.setEnterGroupType(groupInvitationDTO.getInvitationType());
groupMemeberOperation.setGroupInvitationId(formDTO.getInvitationId());
groupMemeberOperation.setOperateUserId(formDTO.getUserId());
//邀请入组
if (StringUtils.isNotBlank(groupInvitationDTO.getInvitationType())) {
if (groupInvitationDTO.getInvitationType().equals(GroupStateConstant.GROUP_INVITED)) {
groupMemeberOperation.setOperateDes(UserMessageConstant.INVITED_OPERATE);
//扫码入组
} else if (groupInvitationDTO.getInvitationType().equals(GroupStateConstant.GROUP_SCANCODE)) {
groupMemeberOperation.setOperateDes(UserMessageConstant.SCANCODE_OPERATE);
}
} else {//兼容旧程序
groupMemeberOperation.setOperateDes(UserMessageConstant.INVITED_OPERATE);
}
//入组审核开关是开启状态则需要组长审核
if (StringUtils.isNotBlank(resiGroupDTO.getAuditSwitch()) && GroupStateConstant.AUDIT_SWITCH_OPEN.equals(resiGroupDTO.getAuditSwitch())) {
groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING);
//新增一条入组申请
groupMemeberOperationService.accetInvitation(groupMemeberOperation);
//给小组长推送站内信
resiGroupMemberServiceImpl.sendMessageToGroupLeader(resiGroupDTO, formDTO.getUserId());
resultDTO.setAwaitAudit(true);
return resultDTO;
}
UserRoleDTO userRoleDTO = this.getUserRoleDTO(result.getData().getUserRoleList());
//5、新增一条邀请入群、直接审核通过的入群记录
groupMemeberOperation.setOperateStatus(MemberStateConstant.APPROVED);
//2020.11.17 end
groupMemeberOperationService.accetInvitation(groupMemeberOperation);
//6、直接加入群成员关系表
//如果是之前被移除的,则修改resi_group_member记录
ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO();
ResiGroupMemberDTO resiGroupMember = resiGroupMemberDao.selectGroupMemberInfo(groupInvitationDTO.getResiGroupId(), formDTO.getUserId());
if (null != resiGroupMember) {
resiGroupMemberDTO.setId(resiGroupMember.getId());
}
resiGroupMemberDTO.setCustomerUserId(groupMemeberOperation.getCustomerUserId());
resiGroupMemberDTO.setResiGroupId(groupMemeberOperation.getGroupId());
resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER);
resiGroupMemberDTO.setEnterGroupType(groupMemeberOperation.getEnterGroupType());
resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED);
resiGroupMemberDTO.setCreatedBy(groupMemeberOperation.getCustomerUserId());
resiGroupMemberService.saveOrUpdate(resiGroupMemberDTO);
//7、修改群统计值
resiGroupMemberDao.updateResiGroupStatistical(groupMemeberOperation.getGroupId(), userRoleDTO);
ResiGroupInfoRedisDTO groupCache =
resiGroupRedis.get(groupInvitationDTO.getResiGroupId());
if(null != groupCache && null != groupCache.getGroupStatisticalInfo()){
@ -387,6 +551,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
}
//8、发送消息
this.sendMessageToLeader(formDTO, resiGroupDTO,groupInvitationDTO);
return resultDTO;
}
private UserRoleDTO getUserRoleDTO(List<String> userRoleList) {
@ -428,7 +593,17 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
userMessage.setApp(AppClientConstant.APP_RESI);
userMessage.setCustomerId(resiGroupDTO.getCustomerId());
userMessage.setGridId(resiGroupDTO.getGridId());
String messageContent = String.format(UserMessageConstant.INVITED_JOIN_GROUP, userResiInfoDTOResult.getData().getShowName(), resiGroupDTO.getGroupName());
//2020.11.18 sun start
String messageContent = "";
//邀请链接进组
if(GroupStateConstant.GROUP_INVITED.equals(groupInvitationDTO.getInvitationType())){
messageContent = String.format(UserMessageConstant.INVITED_JOIN_GROUP, userResiInfoDTOResult.getData().getShowName(), resiGroupDTO.getGroupName());
}
//扫码进组
if(GroupStateConstant.GROUP_SCANCODE.equals(groupInvitationDTO.getInvitationType())){
messageContent = String.format(UserMessageConstant.SCANCODE_JOIN_GROUP, userResiInfoDTOResult.getData().getShowName(), resiGroupDTO.getGroupName());
}
// end
userMessage.setMessageContent(messageContent);
userMessage.setReadFlag(ReadFlagConstant.UN_READ);
userMessage.setTitle(UserMessageConstant.GROUP_TITLE);

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

@ -62,7 +62,7 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的
private String operateStatus;
/**
* 入群方式受邀请入群 - invited 主动加入 - join
* 入群方式受邀请入群 - invited 主动加入 - join扫码入群 - scancode
*/
private String enterGroupType;

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java

@ -54,7 +54,7 @@ public class ResiGroupMemberEntity extends BaseEpmetEntity {
private String groupLeaderFlag;
/**
* 入群方式受邀请入群 - invited 主动加入 - join
* 入群方式受邀请入群 - invited 主动加入 - join扫码入群 - scancode
*/
private String enterGroupType;

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

@ -221,11 +221,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
//查看用户最新一条成员处理记录,避免重复申请
GroupMemeberOperationDTO groupMember = baseDao.selectGroupMemberOperationLatest(applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId());
if(null!=groupMember&&MemberStateConstant.UNDER_AUDITTING.equals(groupMember.getOperateStatus())){
logger.error(String.format("居民端用户【%s】申请加入小组【%s】失败,错误提示:%s",applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId(),ModuleConstant.ALREADY_APPLIED_GROUP));
logger.warn(String.format("居民端用户【%s】申请加入小组【%s】失败,错误提示:%s",applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId(),ModuleConstant.ALREADY_APPLIED_GROUP));
return;
}
if(null!=groupMember&&MemberStateConstant.APPROVED.equals(groupMember.getOperateStatus())){
logger.error(String.format("居民端用户【%s】申请加入小组【%s】失败,错误提示:%s",applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId(),ModuleConstant.ALREADY_IN_GROUP));
logger.warn(String.format("居民端用户【%s】申请加入小组【%s】失败,错误提示:%s",applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId(),ModuleConstant.ALREADY_IN_GROUP));
return;
}
//插入一条待审核的记录
@ -245,11 +245,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
}
//给组长发送消息,有人申请入群
private void sendMessageToGroupLeader(ResiGroupDTO resiGroupDTO, String currentUserId) {
public void sendMessageToGroupLeader(ResiGroupDTO resiGroupDTO, String currentUserId) {
try {
ResiGroupMemberDTO groupLeader = resiGroupDao.selectGroupLeader(resiGroupDTO.getId());
if (null == groupLeader) {
logger.error(String.format("居民申请入群,给组长发送消息通知异常,查询组长信息为空groupId%s", resiGroupDTO.getId()));
logger.warn(String.format("居民申请入群,给组长发送消息通知异常,查询组长信息为空groupId%s", resiGroupDTO.getId()));
return;
}
UserMessageFormDTO userMessage = new UserMessageFormDTO();
@ -263,7 +263,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
userResiInfoFormDTO.setUserId(currentUserId);
Result<UserResiInfoResultDTO> resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO);
if (!resultUserInfo.success() || null == resultUserInfo.getData()) {
logger.error(String.format("居民申请入群,给组长发送消息通知错误,调用%s服务查询申请用户名称失败,入参%s", ServiceConstant.EPMET_USER_SERVER, JSON.toJSONString(userResiInfoFormDTO)));
logger.warn(String.format("居民申请入群,给组长发送消息通知错误,调用%s服务查询申请用户名称失败,入参%s", ServiceConstant.EPMET_USER_SERVER, JSON.toJSONString(userResiInfoFormDTO)));
} else {
currentUserName = resultUserInfo.getData().getShowName();
}
@ -288,7 +288,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
msgList.add(subscribeDTO);
epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
} catch (Exception e) {
logger.error("居民申请入群,给组长发送消息通知异常");
logger.warn("居民申请入群,给组长发送消息通知异常");
e.printStackTrace();
}
}
@ -305,7 +305,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
groupMemberListFormDTO.setPageNo(pageIndex);
List<GroupMemberListResultDTO> list = baseDao.selectListGroupMember(groupMemberListFormDTO);
if (null == list || list.size() == 0) {
logger.error(String.format("群成员列表查询列表为空,selectListGroupMember入参%s",JSON.toJSONString(groupMemberListFormDTO)));
logger.warn(String.format("群成员列表查询列表为空,selectListGroupMember入参%s",JSON.toJSONString(groupMemberListFormDTO)));
return new ArrayList<>();
}
List<String> userIdList=new ArrayList<>();
@ -424,13 +424,13 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.get(agreeApplyFormDTO.getApplyId());
//1、当前申请单是否是待审核
if (null == groupMemeberOperationDTO || !MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
logger.error(String.format("居民端组长【%s】同意用户入群申请applyId【%s】失败,错误提示:%s",agreeApplyFormDTO.getUserId(),agreeApplyFormDTO.getApplyId(),ModuleConstant.APPLY_NOEXISTS));
logger.warn(String.format("居民端组长【%s】同意用户入群申请applyId【%s】失败,错误提示:%s",agreeApplyFormDTO.getUserId(),agreeApplyFormDTO.getApplyId(),ModuleConstant.APPLY_NOEXISTS));
return;
}
//2、只有群主才可以审批入群申请
ResiGroupMemberDTO leaderMember = baseDao.selectGroupMemberInfo(groupMemeberOperationDTO.getGroupId(), agreeApplyFormDTO.getUserId());
if (!LeaderFlagConstant.GROUP_LEADER.equals(leaderMember.getGroupLeaderFlag())) {
logger.error(String.format("居民端组长【%s】同意用户入群申请applyId【%s】失败,错误提示:%s",agreeApplyFormDTO.getUserId(),agreeApplyFormDTO.getApplyId(),ModuleConstant.CANNOT_AUDIT_APPLY));
logger.warn(String.format("居民端组长【%s】同意用户入群申请applyId【%s】失败,错误提示:%s",agreeApplyFormDTO.getUserId(),agreeApplyFormDTO.getApplyId(),ModuleConstant.CANNOT_AUDIT_APPLY));
return;
}
//3、修改操作状态
@ -533,13 +533,13 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.get(disagreeApplyFormDTO.getApplyId());
//1、当前申请单是否是待审核
if (null == groupMemeberOperationDTO || !MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
logger.error(String.format("居民端组长【%s】拒绝用户入群申请applyId【%s】失败,错误提示:%s",disagreeApplyFormDTO.getUserId(),disagreeApplyFormDTO.getApplyId(),ModuleConstant.APPLY_NOEXISTS));
logger.warn(String.format("居民端组长【%s】拒绝用户入群申请applyId【%s】失败,错误提示:%s",disagreeApplyFormDTO.getUserId(),disagreeApplyFormDTO.getApplyId(),ModuleConstant.APPLY_NOEXISTS));
return;
}
//2、只有群主才可以审批入群申请
ResiGroupMemberDTO leaderMember = baseDao.selectGroupMemberInfo(groupMemeberOperationDTO.getGroupId(), disagreeApplyFormDTO.getUserId());
if (!LeaderFlagConstant.GROUP_LEADER.equals(leaderMember.getGroupLeaderFlag())) {
logger.error(String.format("居民端组长【%s】拒绝用户入群申请applyId【%s】失败,错误提示:%s",disagreeApplyFormDTO.getUserId(),disagreeApplyFormDTO.getApplyId(),ModuleConstant.CANNOT_AUDIT_APPLY));
logger.warn(String.format("居民端组长【%s】拒绝用户入群申请applyId【%s】失败,错误提示:%s",disagreeApplyFormDTO.getUserId(),disagreeApplyFormDTO.getApplyId(),ModuleConstant.CANNOT_AUDIT_APPLY));
return;
}
//3、修改操作状态

21
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java

@ -0,0 +1,21 @@
package com.epmet.modules.test;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("test")
public class TestController {
@PostMapping("get-req-info")
public Result testDomain(HttpServletRequest request) {
String requestServerNameAndPort = HttpContextUtils.getRequestServerNameAndPort();
return new Result().ok(requestServerNameAndPort);
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -359,4 +359,13 @@ public interface ModuleConstant extends Constant {
* 审核操作 拒绝
*/
String AUDITING_OPERATION_REJECT = "rejected";
/**
* 获取二维码的url
*/
String GET_CODE_URL = "https://api.weixin.qq.com/wxa/getwxacode?access_token=";
/**
* 群邀请二维码跳转页面
*/
String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation";
}

25
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/properties/ThreadProperties.java

@ -0,0 +1,25 @@
package com.epmet.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 线程池属性类
*/
@ConfigurationProperties(prefix = "thread")
@Data
public class ThreadProperties {
private ThreadPoolProperties threadPool;
@Data
public static class ThreadPoolProperties {
private int corePoolSize;
private int maxPoolSize;
private int queueCapacity;
private int keepAlive;
public ThreadPoolProperties() {
}
}
}

9
epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

@ -127,6 +127,15 @@ openapi:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
thread:
# 线程池配置
threadPool:
corePoolSize: @thread.pool.core-pool-size@
maxPoolSize: @thread.pool.max-pool-size@
queueCapacity: @thread.pool.queue-capacity@
keepAlive: @thread.pool.keep-alive@
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@

16
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_code.sql

@ -0,0 +1,16 @@
CREATE TABLE `resi_group_code` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`GRID_ID` varchar(64) NOT NULL COMMENT '网格ID',
`GROUP_ID` varchar(64) NOT NULL COMMENT '小组Id',
`INVITATION_ID` varchar(64) NOT NULL COMMENT '邀请id',
`TYPE` varchar(32) NOT NULL COMMENT '微信二维码使用类型 邀请:invite',
`URL` varchar(128) NOT NULL COMMENT '二维码路径',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标志',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的';

9
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__group_audit_switch.sql

@ -0,0 +1,9 @@
ALTER TABLE `resi_group`
ADD COLUMN `AUDIT_SWITCH` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'open' COMMENT '进组审核open开启;close关闭' AFTER `LATEST_TOPIC_PUBLISH_DATE`;
ALTER TABLE `group_invitation`
ADD COLUMN `INVITATION_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'link' COMMENT '邀请链接:invited;扫码:scancode' AFTER `RESI_GROUP_ID`;
alter table group_memeber_operation MODIFY ENTER_GROUP_TYPE varchar(32) not null comment '入群方式:(受邀请入群 - invited;主动加入 - join;created创建群自动进入;scancode扫码入群)';
alter table resi_group_member modify ENTER_GROUP_TYPE varchar(32) not null comment '入群方式:(受邀请入群 - invited 、 主动加入 - join、created创建群自动进入、扫码入群-scancode)';

6
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__group_invitation.sql

@ -0,0 +1,6 @@
ALTER TABLE `group_invitation`
DROP COLUMN `INVITATION_TYPE`;
ALTER TABLE `group_invitation`
ADD COLUMN `INVITATION_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'invited' COMMENT '邀请链接:invited;扫码:scancode' AFTER `RESI_GROUP_ID`;

27
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.group.dao.ResiGroupCodeDao">
<select id="selectGroupCodeBasicInfo" resultType="com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO">
SELECT
rg.id AS "groupId",
rg.group_name AS "groupName",
rg.group_head_photo AS "groupHeadPhoto",
rg.group_introduction AS "groupIntroduction",
rgc.URL AS "groupCodeUrl"
FROM
resi_group rg
LEFT JOIN resi_group_code rgc ON rgc.group_id = rg.id AND rgc.del_flag = '0'
WHERE
rg.del_flag = '0'
AND rg.id = #{groupId}
<if test='null != customerId and "" != customerId'>
and rg.customer_id = #{customerId}
</if>
<if test='null != gridId and "" != gridId'>
and rg.grid_id = #{gridId}
</if>
</select>
</mapper>

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

@ -150,7 +150,8 @@
AND gmo.GROUP_ID = rg.id
AND gmo.OPERATE_STATUS = 'under_auditting'
) AS totalApplyingMember,
rgs.TOTAL_TOPICS
rgs.TOTAL_TOPICS,
rg.AUDIT_SWITCH
FROM
resi_group rg
LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID )

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

@ -30,8 +30,9 @@
gmo.CUSTOMER_USER_ID AS applyUserId,
NULL AS applyUserHeadPhoto,
NULL AS applyUserName,
gmo.OPERATE_DES AS applyReason,
gmo.OPERATE_STATUS as status
IFNULL(gmo.OPERATE_DES, '') AS applyReason,
gmo.OPERATE_STATUS as status,
gmo.ENTER_GROUP_TYPE as enterGroupType
FROM
group_memeber_operation gmo
WHERE

8
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -411,6 +411,14 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/govstaffrole/list-roles-by-rolekey/{role-key}")
Result<List<GovStaffRoleResultDTO>> listRolesByRoleKey(@PathVariable("role-key") String roleKey);
/**
* 根据userId集合查询用户注册信息
* @author sun
*/
@PostMapping("/epmetuser/userresiinfo/getuserresiinfolist")
Result<List<UserResiInfoResultDTO>> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO);
/**
* @Description 个人中心-我的建议列表
* @param dto

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -283,6 +283,11 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "listRolesByRoleKey", roleKey);
}
@Override
public Result<List<UserResiInfoResultDTO>> getUserResiInfoList(UserResiInfoListFormDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserResiInfoList", fromDTO);
}
@Override
public Result<List<MyAdviceListResultDTO>> myAdviceList(MyAdviceListFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "myAdviceList", dto);

Loading…
Cancel
Save