From b4c1f12b5e662930108915319359d2a4de4c7a2f Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 09:45:50 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E7=BE=A4=E7=BB=84=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/EpmetHeartOpenFeignClient.java | 2 +- .../epmet/dto/form/UploadBytesFormDTO.java | 24 ++ .../java/com/epmet/feign/OssFeignClient.java | 5 + .../com/epmet/controller/OssController.java | 8 + .../java/com/epmet/service/OssService.java | 3 + .../epmet/service/impl/OssServiceImpl.java | 19 ++ .../group/constant/GroupCodeConstant.java | 14 + .../group/dto/group/ResiGroupCodeDTO.java | 96 +++++++ .../group/form/CreateGroupCodeFormDTO.java | 40 +++ .../dto/group/form/GetGroupCodeFormDTO.java | 40 +++ .../group/feign/ResiGroupOpenFeignClient.java | 16 ++ .../ResiGroupOpenFeignClientFallback.java | 15 ++ .../resi-group/resi-group-server/pom.xml | 12 + .../controller/ResiGroupCodeController.java | 103 +++++++ .../modules/group/dao/ResiGroupCodeDao.java | 33 +++ .../group/entity/ResiGroupCodeEntity.java | 67 +++++ .../group/redis/ResiGroupCodeRedis.java | 58 ++++ .../group/service/ResiGroupCodeService.java | 117 ++++++++ .../impl/ResiGroupCodeServiceImpl.java | 255 ++++++++++++++++++ .../epmet/modules/utils/ModuleConstant.java | 9 + .../mapper/group/ResiGroupCodeDao.xml | 22 ++ 21 files changed, 957 insertions(+), 1 deletion(-) create mode 100644 epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 8043413311..f57bb25da3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/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> */ @PostMapping("/heart/resi/act/published/{staffId}") - Result> getPublishedAct(@PathVariable String staffId); + Result> getPublishedAct(@PathVariable("staffId") String staffId); } diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java new file mode 100644 index 0000000000..6e6d3ca1a0 --- /dev/null +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/13 10:56 + */ + +@Data +public class UploadBytesFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "字节数组不能为空") + private byte[] bytes; + + @NotBlank(message = "后缀不能为空") + private String extension; +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index 47daa888cc..d4c6cb170c 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -10,6 +10,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.fallback.OssFeignClientFallback; import feign.codec.Encoder; @@ -19,6 +20,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; @@ -43,6 +45,9 @@ public interface OssFeignClient { @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) Result uploadQrCode(@RequestPart(value = "file") MultipartFile file); + @PostMapping(value ="oss/file/uploadbytes", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result uploadBytes(@RequestBody UploadBytesFormDTO dto); + @Configuration class MultipartSupportConfig { diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 65cf6b2d2d..e5b8d98338 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -19,6 +19,7 @@ import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; import com.epmet.dto.UploadDTO; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.enums.OssTypeEnum; @@ -155,6 +156,13 @@ public class OssController { public Result uploadQrCode(@RequestPart(value = "file") MultipartFile file) { return ossService.uploadImg(file); } + + @PostMapping("uploadbytes") + public Result uploadBytes(@RequestBody UploadBytesFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return ossService.uploadBytes(dto); + } + /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 * 针对每一个业务新建上传接口) diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index c67fec06f2..9335b1e2aa 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -11,6 +11,7 @@ package com.epmet.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.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import org.springframework.web.multipart.MultipartFile; @@ -31,4 +32,6 @@ public interface OssService extends BaseService { Result uploadImg(MultipartFile file); Result extUpload(MultipartFile file, String fileName); + + Result uploadBytes(UploadBytesFormDTO dto); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index cc44456c7e..2c617ee3ee 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.OssDao; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.exception.ModuleErrorCode; @@ -104,4 +105,22 @@ public class OssServiceImpl extends BaseServiceImpl implement dto.setUrl(url); return new Result().ok(dto); } + + @Override + public Result uploadBytes(UploadBytesFormDTO dto) { + if (dto.getBytes().length == 0) { + return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); + } + //上传文件 + String url = null; + url = OssFactory.build().uploadSuffix(dto.getBytes(), dto.getExtension()); + //保存文件信息 + OssEntity ossEntity = new OssEntity(); + ossEntity.setUrl(url); + baseDao.insert(ossEntity); + //文件信息 + UploadImgResultDTO uploadImgResultDTO = new UploadImgResultDTO(); + uploadImgResultDTO.setUrl(url); + return new Result().ok(uploadImgResultDTO); + } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java new file mode 100644 index 0000000000..34a154cf6b --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java @@ -0,0 +1,14 @@ +package com.epmet.resi.group.constant; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/13 16:23 + */ + +public interface GroupCodeConstant { + /** + * 群二维码类型-邀请 + */ + String CODE_TYPE_INVITE = "invite"; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java new file mode 100644 index 0000000000..8871b5ec6d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; + + /** + * 二维码路径 + */ + private String url; + + /** + * 删除标志 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java new file mode 100644 index 0000000000..2de7fe7531 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java new file mode 100644 index 0000000000..351c8dbc7b --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index 58ff87be1e..d15be92ad0 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -1,9 +1,15 @@ package com.epmet.resi.group.feign; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import org.springframework.cloud.openfeign.FeignClient; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; +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调用该服务 @@ -13,4 +19,14 @@ import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; */ @FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class) public interface ResiGroupOpenFeignClient { + + /** + * @Description 创建群组二维码 + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/13 16:33 + */ + @PostMapping(value = "/resi/group/resigroupcode/creategroupcode", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index df1c7bebf2..ea474fefb2 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -1,5 +1,9 @@ package com.epmet.resi.group.feign.fallback; +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 org.springframework.stereotype.Component; @@ -11,4 +15,15 @@ import org.springframework.stereotype.Component; */ @Component public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClient { + /** + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Description 创建群组二维码 + * @Author liushaowen + * @Date 2020/11/13 16:33 + */ + @Override + public Result createGroupCode(CreateGroupCodeFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "createGroupCode", dto); + } } diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 43552aa943..8d7f6c1173 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -94,6 +94,18 @@ 2.0.0 compile + + com.epmet + epmet-third-client + 2.0.0 + compile + + + com.epmet + epmet-oss-client + 2.0.0 + compile + diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java new file mode 100644 index 0000000000..62620a50cd --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java @@ -0,0 +1,103 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.controller; + + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +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 org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @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> page(@RequestParam Map params){ + PageData page = resiGroupCodeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ResiGroupCodeDTO data = resiGroupCodeService.get(id); + return new Result().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 createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ + ValidatorUtils.validateEntity(dto); + resiGroupCodeService.createGroupCode(dto); + return new Result(); + } + + @RequestMapping("getgroupcode") + public Result getGroupCode(@RequestBody GetGroupCodeFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return resiGroupCodeService.getGroupCode(dto); + } + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java new file mode 100644 index 0000000000..5b46fce0df --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.group.entity.ResiGroupCodeEntity; +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 { + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java new file mode 100644 index 0000000000..ae5498c114 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java @@ -0,0 +1,67 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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; + + /** + * 二维码路径 + */ + private String url; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java new file mode 100644 index 0000000000..a34bae4c5e --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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 getAuthorizerRefreshToken(String key){ + Map result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key); + return result; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java new file mode 100644 index 0000000000..b9d95fe3ca --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java @@ -0,0 +1,117 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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 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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-13 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-13 + */ + List list(Map 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 + * @return String + * @Author liushaowen + * @Date 2020/11/13 16:32 + */ + String createGroupCode(CreateGroupCodeFormDTO dto); + + /** + * @Description 获取群组二维码 + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/16 9:37 + */ + Result getGroupCode(GetGroupCodeFormDTO dto); +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java new file mode 100644 index 0000000000..1c09971f48 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -0,0 +1,255 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.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.baomidou.mybatisplus.extension.api.R; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.enums.EnvEnum; +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.Result; +import com.epmet.dto.form.UploadBytesFormDTO; +import com.epmet.dto.result.CustomerTokensResultDTO; +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.utils.ModuleConstant; +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 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.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Service +public class ResiGroupCodeServiceImpl extends BaseServiceImpl implements ResiGroupCodeService { + + private static final Logger logger = LoggerFactory.getLogger(ResiGroupCodeServiceImpl.class); + + @Autowired + private ResiGroupCodeRedis resiGroupCodeRedis; + + @Autowired + private OssFeignClient ossFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiGroupCodeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiGroupCodeDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 + * @return void + * @Description 创建群组二维码 + * @Author liushaowen + * @Date 2020/11/13 16:32 + */ + @Override + public String createGroupCode(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 = getAccessToken(dto.getCustomerId()); + if (StringUtils.isBlank(accessToken)) { + logger.error("获取accessToken失败,customerId:{}", dto.getCustomerId()); + throw new RenException("获取accessToken失败"); + } + //跳转的页面 + StringBuilder path = new StringBuilder(ModuleConstant.CODE_INVITE_PAGE); + path.append("?groupId=").append(dto.getGroupId()); + //需要发送的Json + JSONObject data = new JSONObject(); + data.put("access_token", accessToken); + 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); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + //上传 + UploadBytesFormDTO uploadBytesFormDTO = new UploadBytesFormDTO(); + uploadBytesFormDTO.setBytes(buffer); + uploadBytesFormDTO.setExtension("jpg"); + Result uploadResult = ossFeignClient.uploadBytes(uploadBytesFormDTO); + if (uploadResult.success()) { + result = uploadResult.getData().getUrl(); + //存表 + ResiGroupCodeEntity entity = new ResiGroupCodeEntity(); + BeanUtils.copyProperties(dto, entity); + entity.setUrl(uploadResult.getData().getUrl()); + baseDao.insert(entity); + } else { + logger.error("上传图片失败:{}", uploadResult.getMsg()); + throw new RenException("上传图片失败" + uploadResult.getInternalMsg()); + } + } + return result; + } + + /** + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Description 获取群组二维码 + * @Author liushaowen + * @Date 2020/11/16 9:37 + */ + @Override + public Result getGroupCode(GetGroupCodeFormDTO dto) { + ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); + if (codeByGroupId != null) { + //数据库有数据 + return new Result().ok(codeByGroupId.getUrl()); + } else { + //从微信获取二维码并存储 + CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); + BeanUtils.copyProperties(dto, createDto); + String url = createGroupCode(createDto); + if (StringUtils.isBlank(url)){ + throw new RenException("获取二维码失败"); + } + return new Result().ok(url); + } + } + + private ResiGroupCodeEntity getCode(String groupId, String type) { + if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { + throw new RenException("获取二维码失败,groupId或type为空"); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("DEL_FLAG", "0"); + queryWrapper.eq("GROUP_ID", groupId); + queryWrapper.eq("TYPE", type); + return baseDao.selectOne(queryWrapper); + } + + //获取AccessToken + private String getAccessToken(String customerId) { + EnvEnum envEnum = EnvEnum.getCurrentEnv(); + String resiAccessToken = null; + if (EnvEnum.PROD.getCode().equals(envEnum.getCode())) { + //居民端 + StringBuilder resiKey = new StringBuilder(customerId).append(":resi"); + Map authorizerRefreshToken = new HashMap<>(); + authorizerRefreshToken = resiGroupCodeRedis.getAuthorizerRefreshToken(resiKey.toString()); + resiAccessToken = (String) authorizerRefreshToken.get("authorizerAccessToken"); + } else { + 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()); + } + Object CustomerTokensResultDTO = mapToResult.getData(); + JSONObject json = JSON.parseObject(CustomerTokensResultDTO.toString()); + CustomerTokensResultDTO customerTokensResultDTO = ConvertUtils.mapToEntity(json, com.epmet.dto.result.CustomerTokensResultDTO.class); + resiAccessToken = customerTokensResultDTO.getResiAuthorizerToken(); + } + return resiAccessToken; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 094c58bda7..bf00b9e475 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -328,4 +328,13 @@ public interface ModuleConstant extends Constant { String FIELD_OPERATION_TYPE = "OPERATION_TYPE"; String CLOSED_TOPIC_REASON_PREFIX="话题已关闭:"; + + /** + * 获取二维码的url + */ + String GET_CODE_URL = "https://api.weixin.qq.com/wxa/getwxacode?access_token="; + /** + * 群邀请二维码跳转页面 + */ + String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml new file mode 100644 index 0000000000..17b935a356 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + From 00a8494f894703e315150293c533686adc65a135 Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 09:58:01 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E7=BE=A4=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/controller/ResiGroupCodeController.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java index 62620a50cd..d3d26595a0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java @@ -88,10 +88,9 @@ public class ResiGroupCodeController { } @RequestMapping("creategroupcode") - public Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ + public Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ ValidatorUtils.validateEntity(dto); - resiGroupCodeService.createGroupCode(dto); - return new Result(); + return new Result().ok(resiGroupCodeService.createGroupCode(dto)); } @RequestMapping("getgroupcode") From b29de0a60d472f2096c1e00a687905dca91b1f6a Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 10:00:23 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/fallback/OssFeignClientFallback.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java index 0158f7f017..ea550200b2 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java @@ -11,6 +11,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; @@ -35,4 +36,8 @@ public class OssFeignClientFallback implements OssFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); } + @Override + public Result uploadBytes(UploadBytesFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadBytes", dto); + } } From 3764e06913dcd63f52adeb21bcef5eadb33b895d Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 10:02:34 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E7=BE=A4=E4=BA=8C=E7=BB=B4=E7=A0=81flywa?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V0.0.4__group_code.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql new file mode 100644 index 0000000000..9fe2aeae45 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql @@ -0,0 +1,15 @@ +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', + `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='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的'; From 580c1613a2ea723b81f4a0051add33c82b6b4c27 Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 10:30:57 +0800 Subject: [PATCH 05/44] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/service/impl/ResiGroupCodeServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 1c09971f48..fe80b0e406 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -153,7 +153,6 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Mon, 16 Nov 2020 14:05:46 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/dto/QRCodeMultipartFileDTO.java | 66 +++++++++++++++++++ .../impl/ResiGroupCodeServiceImpl.java | 10 +-- 2 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java new file mode 100644 index 0000000000..d843903c10 --- /dev/null +++ b/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; + + private String originalFilename; + + private String contentType; + + 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) { + + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index fe80b0e406..65fed60b0a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -39,6 +39,7 @@ 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.utils.ModuleConstant; +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; @@ -49,6 +50,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import java.io.UnsupportedEncodingException; import java.util.Arrays; @@ -170,10 +172,10 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl uploadResult = ossFeignClient.uploadBytes(uploadBytesFormDTO); + QRCodeMultipartFileDTO qrCodeMultipartFile = new QRCodeMultipartFileDTO(); + qrCodeMultipartFile.setBytes(buffer); + qrCodeMultipartFile.setOriginalFilename("qrcode.jpg"); + Result uploadResult = ossFeignClient.uploadQrCode(qrCodeMultipartFile); if (uploadResult.success()) { result = uploadResult.getData().getUrl(); //存表 From 0dabf683177dfd88544b7170017c62798db0c4da Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 16 Nov 2020 14:14:49 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81oss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/UploadBytesFormDTO.java | 24 ------------------- .../java/com/epmet/feign/OssFeignClient.java | 6 ----- .../fallback/OssFeignClientFallback.java | 5 ---- .../com/epmet/controller/OssController.java | 7 ------ .../java/com/epmet/service/OssService.java | 3 --- .../epmet/service/impl/OssServiceImpl.java | 19 --------------- .../group/dto/QRCodeMultipartFileDTO.java | 4 ++-- .../impl/ResiGroupCodeServiceImpl.java | 3 --- 8 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java deleted file mode 100644 index 6e6d3ca1a0..0000000000 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.epmet.dto.form; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * @description: - * @author: liushaowen - * @date: 2020/11/13 10:56 - */ - -@Data -public class UploadBytesFormDTO implements Serializable { - private static final long serialVersionUID = 1L; - - @NotNull(message = "字节数组不能为空") - private byte[] bytes; - - @NotBlank(message = "后缀不能为空") - private String extension; -} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index d4c6cb170c..34c77af8cb 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -10,7 +10,6 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.fallback.OssFeignClientFallback; import feign.codec.Encoder; @@ -20,7 +19,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; @@ -45,10 +43,6 @@ public interface OssFeignClient { @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) Result uploadQrCode(@RequestPart(value = "file") MultipartFile file); - @PostMapping(value ="oss/file/uploadbytes", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - Result uploadBytes(@RequestBody UploadBytesFormDTO dto); - - @Configuration class MultipartSupportConfig { @Bean diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java index ea550200b2..0158f7f017 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java @@ -11,7 +11,6 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; @@ -36,8 +35,4 @@ public class OssFeignClientFallback implements OssFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); } - @Override - public Result uploadBytes(UploadBytesFormDTO dto) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadBytes", dto); - } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index e5b8d98338..eaee4d1275 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -19,7 +19,6 @@ import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; import com.epmet.dto.UploadDTO; -import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.enums.OssTypeEnum; @@ -157,12 +156,6 @@ public class OssController { return ossService.uploadImg(file); } - @PostMapping("uploadbytes") - public Result uploadBytes(@RequestBody UploadBytesFormDTO dto){ - ValidatorUtils.validateEntity(dto); - return ossService.uploadBytes(dto); - } - /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 * 针对每一个业务新建上传接口) diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index 9335b1e2aa..c67fec06f2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -11,7 +11,6 @@ package com.epmet.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.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import org.springframework.web.multipart.MultipartFile; @@ -32,6 +31,4 @@ public interface OssService extends BaseService { Result uploadImg(MultipartFile file); Result extUpload(MultipartFile file, String fileName); - - Result uploadBytes(UploadBytesFormDTO dto); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 2c617ee3ee..cc44456c7e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -17,7 +17,6 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.OssDao; -import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.exception.ModuleErrorCode; @@ -105,22 +104,4 @@ public class OssServiceImpl extends BaseServiceImpl implement dto.setUrl(url); return new Result().ok(dto); } - - @Override - public Result uploadBytes(UploadBytesFormDTO dto) { - if (dto.getBytes().length == 0) { - return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); - } - //上传文件 - String url = null; - url = OssFactory.build().uploadSuffix(dto.getBytes(), dto.getExtension()); - //保存文件信息 - OssEntity ossEntity = new OssEntity(); - ossEntity.setUrl(url); - baseDao.insert(ossEntity); - //文件信息 - UploadImgResultDTO uploadImgResultDTO = new UploadImgResultDTO(); - uploadImgResultDTO.setUrl(url); - return new Result().ok(uploadImgResultDTO); - } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java index d843903c10..5b8f6a8cd9 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/QRCodeMultipartFileDTO.java @@ -16,11 +16,11 @@ import java.io.InputStream; @Data public class QRCodeMultipartFileDTO implements MultipartFile { - private String name; + private String name = "file"; private String originalFilename; - private String contentType; + private String contentType = "image/jpeg"; private byte[] bytes; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 65fed60b0a..878df03b6a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -21,7 +21,6 @@ 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.baomidou.mybatisplus.extension.api.R; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.enums.EnvEnum; @@ -30,7 +29,6 @@ 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.Result; -import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.CustomerTokensResultDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; @@ -50,7 +48,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.commons.CommonsMultipartFile; import java.io.UnsupportedEncodingException; import java.util.Arrays; From 3c50b64f16d13c75c3b9c3804bc8ebe579d989cd Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 16 Nov 2020 14:25:20 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E3=80=81?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=E8=8E=B7=E5=8F=96=E6=B5=B7=E6=8A=A5?= =?UTF-8?q?=E3=80=81=E5=B0=8F=E7=BB=84=E7=A0=81=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/form/GroupCodeBasicInfoFormDTO.java | 33 ++++++++++++++ .../result/GroupCodeBasicInfoResultDTO.java | 43 +++++++++++++++++++ .../controller/ResiGroupCodeController.java | 16 +++++-- .../modules/group/dao/ResiGroupCodeDao.java | 8 ++++ .../group/service/ResiGroupCodeService.java | 9 ++++ .../impl/ResiGroupCodeServiceImpl.java | 42 ++++++++++++++++-- .../mapper/group/ResiGroupCodeDao.xml | 39 ++++++++++------- .../epmet/feign/EpmetUserOpenFeignClient.java | 8 ++++ .../EpmetUserOpenFeignClientFallback.java | 5 +++ 9 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java new file mode 100644 index 0000000000..af31ed7145 --- /dev/null +++ b/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 {} + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java new file mode 100644 index 0000000000..a2c80d4125 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java @@ -0,0 +1,43 @@ +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; + /** + * 小组创建人称谓(街道-姓氏+称谓)(南宁路-李先生) + */ + private String showName; + /** + * 小组创建人Id + */ + private String groupUserId; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java index d3d26595a0..6f6430f358 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java @@ -19,7 +19,6 @@ package com.epmet.modules.group.controller; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -30,11 +29,11 @@ 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 javax.servlet.http.HttpServletResponse; -import java.util.List; import java.util.Map; @@ -99,4 +98,15 @@ public class ResiGroupCodeController { return resiGroupCodeService.getGroupCode(dto); } + /** + * @param formDTO + * @Description 获取生成海报(小组码)信息 + * @author sun + */ + @PostMapping("groupcodebasicinfo") + public Result groupCodeBasicInfo(@RequestBody GroupCodeBasicInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GroupCodeBasicInfoFormDTO.GroupCodeInfo.class); + return new Result().ok(resiGroupCodeService.groupCodeBasicInfo(formDTO)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java index 5b46fce0df..14415b5447 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java @@ -19,6 +19,8 @@ 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; /** @@ -30,4 +32,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ResiGroupCodeDao extends BaseDao { + /** + * @param formDTO + * @Description 获取生成海报(小组码)信息 + * @author sun + */ + GroupCodeBasicInfoResultDTO selectGroupCodeBasicInfo(GroupCodeBasicInfoFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java index b9d95fe3ca..de9a3a1505 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java @@ -25,6 +25,8 @@ 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; @@ -114,4 +116,11 @@ public interface ResiGroupCodeService extends BaseService { * @Date 2020/11/16 9:37 */ Result getGroupCode(GetGroupCodeFormDTO dto); + + /** + * @param formDTO + * @Description 获取生成海报(小组码)信息 + * @author sun + */ + GroupCodeBasicInfoResultDTO groupCodeBasicInfo(GroupCodeBasicInfoFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 878df03b6a..c1153785c2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -23,14 +23,18 @@ 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.constant.NumConstant; import com.epmet.commons.tools.enums.EnvEnum; 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.Result; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.result.CustomerTokensResultDTO; import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.modules.group.dao.ResiGroupCodeDao; import com.epmet.modules.group.entity.ResiGroupCodeEntity; @@ -41,6 +45,8 @@ 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 org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,10 +56,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 @@ -72,6 +75,9 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -251,4 +257,32 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl userIdList = new ArrayList<>(); + userIdList.add(resultDTO.getGroupUserId()); + userResiInfoListFormDTO.setUserIdList(userIdList); + Result> resultList = epmetUserOpenFeignClient.getUserResiInfoList(userResiInfoListFormDTO); + if (!resultList.success() || null == resultList.getData() || resultList.getData().size() < NumConstant.ONE) { + logger.error(String.format("调用user服务,查询用户基本信息失败,userId:%s", resultDTO.getGroupUserId())); + throw new RenException("获取小组创建人基本信息失败"); + } + resultDTO.setShowName(resultList.getData().get(NumConstant.ZERO).getShowName()); + return resultDTO; + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml index 17b935a356..2dcabe93b5 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -1,22 +1,29 @@ - - - - - - - - - - - - - - - - + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index e7fda8ad3e..ea80ac97fc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -334,4 +334,12 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/customerstaff/getstaffbasicinfo") Result getStaffBasicInfo(@RequestBody StaffBasicInfoFromDTO fromDTO); + + /** + * 根据userId集合查询用户注册信息 + * @author sun + */ + @PostMapping("/epmetuser/userresiinfo/getuserresiinfolist") + Result> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO); + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 9e0c973463..3ea59d86a6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -225,4 +225,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffBasicInfo", fromDTO); } + + @Override + public Result> getUserResiInfoList(UserResiInfoListFormDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserResiInfoList", fromDTO); + } } From 57cf9ddb496e955a102753138f99a5afec8d194b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 16 Nov 2020 16:53:34 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/result/GroupCodeBasicInfoResultDTO.java | 8 -------- .../service/impl/ResiGroupCodeServiceImpl.java | 14 -------------- .../resources/mapper/group/ResiGroupCodeDao.xml | 3 +-- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java index a2c80d4125..b3275408bf 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupCodeBasicInfoResultDTO.java @@ -32,12 +32,4 @@ public class GroupCodeBasicInfoResultDTO implements Serializable { * 小组二维码路径 */ private String groupCodeUrl; - /** - * 小组创建人称谓(街道-姓氏+称谓)(南宁路-李先生) - */ - private String showName; - /** - * 小组创建人Id - */ - private String groupUserId; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index c1153785c2..5e48167510 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -75,9 +75,6 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -271,17 +268,6 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl userIdList = new ArrayList<>(); - userIdList.add(resultDTO.getGroupUserId()); - userResiInfoListFormDTO.setUserIdList(userIdList); - Result> resultList = epmetUserOpenFeignClient.getUserResiInfoList(userResiInfoListFormDTO); - if (!resultList.success() || null == resultList.getData() || resultList.getData().size() < NumConstant.ONE) { - logger.error(String.format("调用user服务,查询用户基本信息失败,userId:%s", resultDTO.getGroupUserId())); - throw new RenException("获取小组创建人基本信息失败"); - } - resultDTO.setShowName(resultList.getData().get(NumConstant.ZERO).getShowName()); return resultDTO; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml index 2dcabe93b5..685f645b92 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -9,8 +9,7 @@ rgc.URL AS "groupCodeUrl", rg.GROUP_NAME AS "groupName", rg.GROUP_HEAD_PHOTO AS "groupHeadPhoto", - rg.GROUP_INTRODUCTION AS "groupIntroduction", - rg.CREATED_BY AS "groupUserId" + rg.GROUP_INTRODUCTION AS "groupIntroduction" FROM resi_group_code rgc INNER JOIN resi_group rg ON rgc.GROUP_ID = rg.ID From 50b6ccbf1b59e16a6a19f9240dec5d7abfef195e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 17 Nov 2020 09:44:13 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/form/GroupCodeBasicInfoFormDTO.java | 4 ++-- .../impl/ResiGroupCodeServiceImpl.java | 11 +++++++++ .../service/impl/ResiGroupServiceImpl.java | 17 ++++++++++---- .../mapper/group/ResiGroupCodeDao.xml | 23 +++++++++---------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java index af31ed7145..b9a6102ecd 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupCodeBasicInfoFormDTO.java @@ -15,12 +15,12 @@ public class GroupCodeBasicInfoFormDTO implements Serializable { /** * 客户id */ - //@NotBlank(message = "客户id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class}) + @NotBlank(message = "客户id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class}) private String customerId; /** * 网格id */ - //@NotBlank(message = "网格id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class}) + @NotBlank(message = "网格id不能为空", groups = {GroupCodeBasicInfoFormDTO.GroupCodeInfo.class}) private String gridId; /** * 组id diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 5e48167510..a09b756ca6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -41,6 +41,7 @@ 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.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; @@ -268,6 +269,16 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -520,6 +521,14 @@ public class ResiGroupServiceImpl extends BaseServiceImpl param = new HashMap<>(); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml index 685f645b92..a3cc1c6fd5 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -5,23 +5,22 @@ From 76b099ccec327367b71de0fa029bdc0866bf61fc Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 17 Nov 2020 09:51:00 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E3=80=81=E7=94=9F=E6=88=90=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E6=96=B9=E6=B3=95=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/service/impl/ResiGroupServiceImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 7ee707a354..0e4c2f2c5f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -522,12 +522,16 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 11:08:33 +0800 Subject: [PATCH 12/44] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E5=A2=9E=E5=8A=A0=E7=BA=BF=E7=A8=8B=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/AccessTokenDTO.java | 19 +++ .../main/java/com/epmet/utils/ThirdUtils.java | 53 +++++++ .../resi-group/resi-group-server/pom.xml | 20 +++ .../java/com/epmet/config/AsyncConfig.java | 49 +++++++ .../controller/ResiGroupCodeController.java | 2 +- .../group/service/ResiGroupCodeService.java | 4 +- .../impl/ResiGroupCodeServiceImpl.java | 134 +++++++++--------- .../service/impl/ResiGroupServiceImpl.java | 2 +- .../epmet/properties/ThreadProperties.java | 25 ++++ .../src/main/resources/bootstrap.yml | 10 +- 10 files changed, 244 insertions(+), 74 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AccessTokenDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/utils/ThirdUtils.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/config/AsyncConfig.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/properties/ThreadProperties.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AccessTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AccessTokenDTO.java new file mode 100644 index 0000000000..dac9be670e --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/utils/ThirdUtils.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/utils/ThirdUtils.java new file mode 100644 index 0000000000..426bab2b82 --- /dev/null +++ b/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; + } +} diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 8d7f6c1173..1489a642ca 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -160,6 +160,11 @@ false https://epmet-dev.elinkservice.cn/api/epmetscan/api + + 5 + 8 + 10 + 30 @@ -193,6 +198,11 @@ false https://epmet-dev.elinkservice.cn/api/epmetscan/api + + 5 + 8 + 10 + 30 @@ -225,6 +235,11 @@ true https://epmet-dev.elinkservice.cn/api/epmetscan/api + + 5 + 8 + 10 + 30 @@ -254,6 +269,11 @@ true https://epmet-open.elinkservice.cn/api/epmetscan/api + + 5 + 8 + 10 + 30 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/config/AsyncConfig.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/config/AsyncConfig.java new file mode 100644 index 0000000000..8a1a958939 --- /dev/null +++ b/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(); + } + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java index 6f6430f358..34b4458ea8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java @@ -89,7 +89,7 @@ public class ResiGroupCodeController { @RequestMapping("creategroupcode") public Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ ValidatorUtils.validateEntity(dto); - return new Result().ok(resiGroupCodeService.createGroupCode(dto)); + return new Result().ok(resiGroupCodeService.createGroupCode(dto, true)); } @RequestMapping("getgroupcode") diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java index de9a3a1505..e0b5e7ec4d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java @@ -101,12 +101,12 @@ public interface ResiGroupCodeService extends BaseService { /** * @Description 创建群组二维码 - * @param dto + * @param dto,syncFlag(是否同步执行,true同步,false异步) * @return String * @Author liushaowen * @Date 2020/11/13 16:32 */ - String createGroupCode(CreateGroupCodeFormDTO dto); + String createGroupCode(CreateGroupCodeFormDTO dto, boolean syncFlag); /** * @Description 获取群组二维码 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index a09b756ca6..d989b3a379 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.EnvEnum; +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; @@ -48,6 +49,7 @@ 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.utils.ThirdUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.UnsupportedEncodingException; import java.util.*; +import java.util.concurrent.ExecutorService; /** * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 @@ -76,6 +79,9 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -129,14 +135,68 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl{ + 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 + * @Description 获取群组二维码 + * @Author liushaowen + * @Date 2020/11/16 9:37 + */ + @Override + public Result getGroupCode(GetGroupCodeFormDTO dto) { + ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); + if (codeByGroupId != null) { + //数据库有数据 + return new Result().ok(codeByGroupId.getUrl()); + } else { + //从微信获取二维码并存储 + CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); + BeanUtils.copyProperties(dto, createDto); + String url = createGroupCode(createDto, false); + if (StringUtils.isBlank(url)){ + throw new RenException("获取二维码失败"); + } + return new Result().ok(url); + } + } + + private ResiGroupCodeEntity getCode(String groupId, String type) { + if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { + throw new RenException("获取二维码失败,groupId或type为空"); + } + QueryWrapper 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) { @@ -146,7 +206,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl - * @Description 获取群组二维码 - * @Author liushaowen - * @Date 2020/11/16 9:37 - */ - @Override - public Result getGroupCode(GetGroupCodeFormDTO dto) { - ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); - if (codeByGroupId != null) { - //数据库有数据 - return new Result().ok(codeByGroupId.getUrl()); - } else { - //从微信获取二维码并存储 - CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); - BeanUtils.copyProperties(dto, createDto); - String url = createGroupCode(createDto); - if (StringUtils.isBlank(url)){ - throw new RenException("获取二维码失败"); - } - return new Result().ok(url); - } - } - - private ResiGroupCodeEntity getCode(String groupId, String type) { - if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { - throw new RenException("获取二维码失败,groupId或type为空"); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("DEL_FLAG", "0"); - queryWrapper.eq("GROUP_ID", groupId); - queryWrapper.eq("TYPE", type); - return baseDao.selectOne(queryWrapper); - } - - //获取AccessToken - private String getAccessToken(String customerId) { - EnvEnum envEnum = EnvEnum.getCurrentEnv(); - String resiAccessToken = null; - if (EnvEnum.PROD.getCode().equals(envEnum.getCode())) { - //居民端 - StringBuilder resiKey = new StringBuilder(customerId).append(":resi"); - Map authorizerRefreshToken = new HashMap<>(); - authorizerRefreshToken = resiGroupCodeRedis.getAuthorizerRefreshToken(resiKey.toString()); - resiAccessToken = (String) authorizerRefreshToken.get("authorizerAccessToken"); - } else { - 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()); - } - Object CustomerTokensResultDTO = mapToResult.getData(); - JSONObject json = JSON.parseObject(CustomerTokensResultDTO.toString()); - CustomerTokensResultDTO customerTokensResultDTO = ConvertUtils.mapToEntity(json, com.epmet.dto.result.CustomerTokensResultDTO.class); - resiAccessToken = customerTokensResultDTO.getResiAuthorizerToken(); - } - return resiAccessToken; - } - /** * @param formDTO * @Description 获取生成海报(小组码)信息 @@ -272,7 +268,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 11:09:44 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/service/impl/ResiGroupCodeServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index d989b3a379..8cdb706bbe 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -177,7 +177,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 11:12:27 +0800 Subject: [PATCH 14/44] =?UTF-8?q?resi=5Fgroup=E6=96=B0=E5=A2=9EAUDIT=5FSWI?= =?UTF-8?q?TCH=EF=BC=9Bgroup=5Finvitation=E6=96=B0=E5=A2=9EINVITATION=5FTY?= =?UTF-8?q?PE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V0.0.5__group_audit_switch.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql new file mode 100644 index 0000000000..4d0ea52216 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql @@ -0,0 +1,4 @@ +alter table resi_group add column AUDIT_SWITCH varchar(32) not null DEFAULT'open' COMMENT '进组审核open开启;close关闭'; + + +alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'link' comment '邀请链接:link;扫码:scan_code'; \ No newline at end of file From 856e131c8db8a1f9c419196c580128dfdb633cae Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 17 Nov 2020 11:13:40 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E6=89=AB=E7=A0=81=EF=BC=9Ascancode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V0.0.5__group_audit_switch.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql index 4d0ea52216..00735c03bf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql @@ -1,4 +1,4 @@ alter table resi_group add column AUDIT_SWITCH varchar(32) not null DEFAULT'open' COMMENT '进组审核open开启;close关闭'; -alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'link' comment '邀请链接:link;扫码:scan_code'; \ No newline at end of file +alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'link' comment '邀请链接:link;扫码:scancode'; \ No newline at end of file From 39ea1a7dc8e550b871e3bb6770b3b573a022f55d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 17 Nov 2020 11:22:05 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9resi=5Fgroup=5Fmember?= =?UTF-8?q?=E5=92=8Cgroup=5Fmember=5Foperation=E4=B8=AD=E7=9A=84enter=5Fgr?= =?UTF-8?q?oup=5Ftype=E6=8F=8F=E8=BF=B0=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E5=85=A5=E7=BE=A4=20scancode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V0.0.5__group_audit_switch.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql index 00735c03bf..30eada9edd 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql @@ -1,4 +1,9 @@ alter table resi_group add column AUDIT_SWITCH varchar(32) not null DEFAULT'open' COMMENT '进组审核open开启;close关闭'; -alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'link' comment '邀请链接:link;扫码:scancode'; \ No newline at end of file +alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'link' comment '邀请链接:link;扫码:scancode'; + + +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)'; From c3bb16180937e0ec2956d98a70f2acb38125f2c2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 17 Nov 2020 13:49:59 +0800 Subject: [PATCH 17/44] =?UTF-8?q?DB=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/resi/group/dto/group/ResiGroupDTO.java | 5 +++++ .../epmet/resi/group/dto/invitation/GroupInvitationDTO.java | 5 +++++ .../resi/group/dto/member/GroupMemeberOperationDTO.java | 2 +- .../com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java | 2 +- .../java/com/epmet/modules/group/entity/ResiGroupEntity.java | 5 +++++ .../modules/invitation/entity/GroupInvitationEntity.java | 5 +++++ .../modules/member/entity/GroupMemeberOperationEntity.java | 2 +- .../epmet/modules/member/entity/ResiGroupMemberEntity.java | 2 +- 8 files changed, 24 insertions(+), 4 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java index 9045ac28ea..be61d33c2a 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java +++ b/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:已删除 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java index b4bc7fe18a..195403c41c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java +++ b/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; + /** + * 邀请链接:link;扫码:scancode + */ + private String invitationType; + /** * 删除标记 0:未删除,1:已删除 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java index 23a8331ac0..751153861a 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java +++ b/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 、 主动加入 - join、created群主创建群自动进入群) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java index 49de542902..c6cd651968 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java +++ b/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 、 主动加入 - join、created群主创建群自动进入群) + * 入群方式:(受邀请入群 - invited 、 主动加入 - join、created群主创建群自动进入群、扫码入群 - scancode) */ private String enterGroupType; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java index 0305fb7834..8dfa5e2db8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java +++ b/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; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java index 5595d7fd5c..12202fc2ad 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java +++ b/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; + /** + * 邀请链接:link;扫码:scancode + */ + private String invitationType; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java index 9ffc9f66d8..fd7537370c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java +++ b/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; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java index 492ab5da62..6dc7d21ad2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java +++ b/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; From 0208f3ac4137462699a9ac739c06436225a92b6d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 17 Nov 2020 13:57:21 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E7=BE=A4=E9=82=80=E8=AF=B7=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/resi/group/constant/GroupStateConstant.java | 8 ++++++++ .../service/impl/GroupInvitationServiceImpl.java | 1 + 2 files changed, 9 insertions(+) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java index fcb2afc28f..b91b09a2f3 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java @@ -41,4 +41,12 @@ public interface GroupStateConstant { * 群已关闭 - closed */ String GROUP_CLOSED = "closed"; + /** + * 邀请链接:link + */ + String GROUP_LINK = "link"; + /** + * 扫码:scancode + */ + String GROUP_SCANCODE = "scancode"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 606eb75fbe..a32d4d1d70 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -181,6 +181,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 14:00:16 +0800 Subject: [PATCH 19/44] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=95=8C=E9=9D=A2=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=94=E5=8F=82=EF=BC=9AauditSwitch=20?= =?UTF-8?q?=EF=BC=9A=E8=BF=9B=E7=BB=84=E5=AE=A1=E6=A0=B8open=E5=BC=80?= =?UTF-8?q?=E5=90=AF=EF=BC=9Bclose=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resi/group/dto/group/result/GroupSummarizeResultDTO.java | 5 +++++ .../src/main/resources/mapper/group/ResiGroupDao.xml | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java index 9e54c59eb5..0b19208c9f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java +++ b/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"); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 119db46b30..9f7b719a64 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/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 ) From bfa25c3bb78422b69d4a3c6f453cda0ef1cd831f Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Tue, 17 Nov 2020 14:27:06 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E7=BE=A4=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E5=8F=98=E4=B8=BAinvitationId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ResiGroupCodeServiceImpl.java | 19 ++++++++++- .../service/GroupInvitationService.java | 11 +++++- .../impl/GroupInvitationServiceImpl.java | 34 +++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 8cdb706bbe..297f2cfd71 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -41,6 +41,8 @@ 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; @@ -49,6 +51,8 @@ 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; @@ -82,6 +86,12 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -213,7 +223,14 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl * @param formDTO * @Author yinzuomei - * @Description 生成邀请连接 + * @Description 生成邀请连接-链接 * @Date 2020/3/31 22:50 **/ CreateGroupInvitationResultDTO createGroupInvitation(CreateGroupInvitationFormDTO formDTO); + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @Author liushaowen + * @Description 生成邀请连接-扫码 + * @Date 2020-11-17 13:58 + **/ + CreateGroupInvitationResultDTO createGroupScanCodeInvitation(CreateGroupInvitationFormDTO formDTO); + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index a32d4d1d70..aa5a5f13af 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -188,6 +188,40 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl + * @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()); + return resultDTO; + } + /** * @param formDTO * @return com.epmet.commons.tools.utils.Result From af95b5311ae49080c2cd17421355b1107baa8e25 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 17 Nov 2020 14:32:34 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=20=E7=BB=84=E9=95=BF=E5=BC=80=E5=90=AF/?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=85=A5=E7=BE=A4=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 2 +- .../member/form/EditAuditSwitchFormDTO.java | 27 +++++++++++++++++++ .../group/controller/ResiGroupController.java | 21 +++++++++++++-- .../group/service/ResiGroupService.java | 11 ++++++++ .../service/impl/ResiGroupServiceImpl.java | 24 ++++++++++++++++- 5 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/EditAuditSwitchFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index e4832a1c8b..c161babc30 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -47,7 +47,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,"活动报名条件审核失败,请重新编辑"), diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/EditAuditSwitchFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/EditAuditSwitchFormDTO.java new file mode 100644 index 0000000000..da1391fa51 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index afdce31da0..0b375a570f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -27,9 +27,13 @@ import com.epmet.modules.group.service.ResiGroupStatisticalService; import com.epmet.resi.group.dto.group.GroupProcessingCountResultDTO; 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.web.bind.annotation.*; +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.List; @@ -103,7 +107,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") @@ -359,4 +363,17 @@ public class ResiGroupController { resiGroupStatisticalService.updateWhenAuditedResiRole(resiIdentityFormDTO); return new Result(); } + + /** + * @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(); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index d410b4f391..c259137f33 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/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.List; import java.util.Map; @@ -134,6 +135,7 @@ public interface ResiGroupService extends BaseService { * @Description 修改组信息 * @Date 2020/3/28 22:27 **/ + @Deprecated void modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO); /** @@ -293,4 +295,13 @@ public interface ResiGroupService extends BaseService { * @return java.util.List */ List recommendedList(RecommendedListFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 组长开启/关闭入群审核 + * @Date 2020/11/17 14:18 + **/ + void editAuditSwitch(EditAuditSwitchFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 1cc0101da5..af234ee47b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -28,6 +28,7 @@ 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; @@ -58,13 +59,14 @@ import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.*; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.*; -import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.form.GridIdFormDTO; import com.epmet.resi.group.dto.group.form.ShouldVoteCountFormDTO; +import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; 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.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -127,6 +129,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { @@ -966,6 +970,24 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 14:34:10 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3oss-client=E5=BD=B1=E5=93=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/OssFeignClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index 47daa888cc..239ca51acc 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/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 uploadQrCode(@RequestPart(value = "file") MultipartFile file); - @Configuration + //@Configuration class MultipartSupportConfig { @Bean public Encoder feignFormEncoder() { From 4ef8e25b87a17da68bccab5f486a2e993a888c86 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 17 Nov 2020 15:30:52 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E6=89=AB=E7=A0=81=E8=BF=9B=E7=BE=A4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/constant/GroupStateConstant.java | 12 ++++++-- .../dto/invitation/GroupInvitationDTO.java | 2 +- .../entity/GroupInvitationEntity.java | 2 +- .../impl/GroupInvitationServiceImpl.java | 30 +++++++++++++++---- .../impl/ResiGroupMemberServiceImpl.java | 2 +- .../migration/V0.0.5__group_audit_switch.sql | 2 +- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java index b91b09a2f3..ee3bcda420 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java @@ -42,11 +42,19 @@ public interface GroupStateConstant { */ String GROUP_CLOSED = "closed"; /** - * 邀请链接:link + * 邀请链接:invited */ - String GROUP_LINK = "link"; + String GROUP_INVITED = "invited"; /** * 扫码:scancode */ String GROUP_SCANCODE = "scancode"; + /** + * 进组审核open开启;close关闭 + */ + String AUDIT_SWITCH_OPEN = "open"; + /** + * 进组审核open开启;close关闭 + */ + String AUDIT_SWITCH_CLOSED = "close"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java index 195403c41c..f157c439d1 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java @@ -69,7 +69,7 @@ public class GroupInvitationDTO implements Serializable { private Date validEndTime; /** - * 邀请链接:link;扫码:scancode + * 邀请链接:invited;扫码:scancode */ private String invitationType; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java index 12202fc2ad..bba85a4635 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java @@ -69,7 +69,7 @@ public class GroupInvitationEntity extends BaseEpmetEntity { private Date validEndTime; /** - * 邀请链接:link;扫码:scancode + * 邀请链接:invited;扫码:scancode */ private String invitationType; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index aa5a5f13af..dcd939a5f8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/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; @@ -102,6 +103,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl page(Map params) { @@ -181,7 +184,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Tue, 17 Nov 2020 16:21:24 +0800 Subject: [PATCH 24/44] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E7=BB=84=E9=95=BF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96=E5=A4=B1=E8=B4=A5=20?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/service/impl/ResiGroupServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 0e4c2f2c5f..463415c971 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -58,9 +58,9 @@ import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.*; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.*; -import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.form.GridIdFormDTO; import com.epmet.resi.group.dto.group.form.ShouldVoteCountFormDTO; +import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; @@ -291,6 +291,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); + if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); } else { @@ -771,7 +772,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl().ok(resultDTO); @@ -960,7 +961,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 18 Nov 2020 09:46:37 +0800 Subject: [PATCH 25/44] =?UTF-8?q?group=5Fcode=E8=A1=A8=E6=B7=BB=E5=8A=A0in?= =?UTF-8?q?vitationId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java | 5 +++++ .../com/epmet/modules/group/entity/ResiGroupCodeEntity.java | 5 +++++ .../modules/group/service/impl/ResiGroupCodeServiceImpl.java | 1 + .../db/migration/V0.0.6__add_group_code_invitation_id.sql | 1 + 4 files changed, 12 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__add_group_code_invitation_id.sql diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java index 8871b5ec6d..ac301a624c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java @@ -58,6 +58,11 @@ public class ResiGroupCodeDTO implements Serializable { */ private String type; + /** + * 邀请ID + */ + private String invitationId; + /** * 二维码路径 */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java index ae5498c114..3859492d3a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java @@ -59,6 +59,11 @@ public class ResiGroupCodeEntity extends BaseEpmetEntity { */ private String type; + /** + * 邀请ID + */ + private String invitationId; + /** * 二维码路径 */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 297f2cfd71..b833478cda 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -259,6 +259,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Wed, 18 Nov 2020 09:58:56 +0800 Subject: [PATCH 26/44] =?UTF-8?q?=E8=87=AA=E6=B5=8B=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/constant/UserMessageConstant.java | 11 +++++++++++ .../service/impl/GroupInvitationServiceImpl.java | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java index d7da80088c..9d8024921b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java +++ b/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 @@ -74,4 +75,14 @@ public interface UserMessageConstant { */ String WX_CREATE_GROUP_BEHAVIOR = "建组申请消息"; + /** + * 邀请入组的入组理由 + */ + String INVITED_OPERATE = "通过邀请链接加入小组。"; + + /** + * 扫码入组的入组理由 + */ + String SCANCODE_OPERATE = "通过扫码加入小组。"; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index dcd939a5f8..eebc106ca0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -389,7 +389,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Wed, 18 Nov 2020 10:21:51 +0800 Subject: [PATCH 27/44] =?UTF-8?q?sql=E8=84=9A=E6=9C=AC=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V0.0.4__group_code.sql | 5 +++-- .../resources/db/migration/V0.0.5__group_audit_switch.sql | 8 ++++---- .../db/migration/V0.0.6__add_group_code_invitation_id.sql | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__add_group_code_invitation_id.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql index 9fe2aeae45..3dfd63919e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql @@ -3,7 +3,8 @@ CREATE TABLE `resi_group_code` ( `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', `GROUP_ID` varchar(64) NOT NULL COMMENT '小组Id', - `TYPE` varchar(32) NOT NULL COMMENT '二维码类型 邀请:invite', + `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 '乐观锁', @@ -12,4 +13,4 @@ CREATE TABLE `resi_group_code` ( `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的'; \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql index e8fb026898..a23bb95f98 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql @@ -1,8 +1,8 @@ -alter table resi_group add column AUDIT_SWITCH varchar(32) not null DEFAULT'open' COMMENT '进组审核open开启;close关闭'; - - -alter table group_invitation add column INVITATION_TYPE VARCHAR(32) NOT NULL DEFAULT 'invited' comment '邀请链接:invited;扫码:scancode'; +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扫码入群)'; diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__add_group_code_invitation_id.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__add_group_code_invitation_id.sql deleted file mode 100644 index e8fa287adf..0000000000 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__add_group_code_invitation_id.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `resi_group_code` ADD INVITATION_ID varchar(64) NOT NULL COMMENT '邀请id'; From 34eb0a3beacb061bb41f34e11933f1f05a812a76 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 18 Nov 2020 10:38:13 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E8=B0=83=E6=95=B4flyway=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/{V0.0.4__group_code.sql => V0.0.5__group_code.sql} | 0 ....5__group_audit_switch.sql => V0.0.6__group_audit_switch.sql} | 0 .../db/migration/V0.0.7__add_group_code_invitation_id.sql | 1 + 3 files changed, 1 insertion(+) rename epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/{V0.0.4__group_code.sql => V0.0.5__group_code.sql} (100%) rename epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/{V0.0.5__group_audit_switch.sql => V0.0.6__group_audit_switch.sql} (100%) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_code.sql similarity index 100% rename from epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql rename to epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_code.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__group_audit_switch.sql similarity index 100% rename from epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.5__group_audit_switch.sql rename to epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.6__group_audit_switch.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql new file mode 100644 index 0000000000..e8fa287adf --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql @@ -0,0 +1 @@ +ALTER TABLE `resi_group_code` ADD INVITATION_ID varchar(64) NOT NULL COMMENT '邀请id'; From 84d3e7c025ecb76735eeadbc3d92fad7d01af282 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 18 Nov 2020 10:50:44 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E5=8E=BB=E6=8E=89flyway=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.7__add_group_code_invitation_id.sql | 1 - 1 file changed, 1 deletion(-) delete mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql deleted file mode 100644 index e8fa287adf..0000000000 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__add_group_code_invitation_id.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `resi_group_code` ADD INVITATION_ID varchar(64) NOT NULL COMMENT '邀请id'; From 31bf195e3860051c0f21d2658618cc2c98a48094 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 18 Nov 2020 11:13:18 +0800 Subject: [PATCH 30/44] =?UTF-8?q?DB=20key=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V0.0.7__group_invitation.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__group_invitation.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__group_invitation.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.7__group_invitation.sql new file mode 100644 index 0000000000..8b67b6e747 --- /dev/null +++ b/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`; + From fa988801544d81ec5f3de97fc5327cd3becd3d01 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 19 Nov 2020 09:51:20 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9/resi/group/member/geta?= =?UTF-8?q?pplyingmember=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=BF=94=E5=8F=82enterGroupType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/dto/member/result/ApplyingMemberResultDTO.java | 6 ++++++ .../src/main/resources/mapper/member/ResiGroupMemberDao.xml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java index 881333be54..23b94b4c45 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/ApplyingMemberResultDTO.java @@ -45,4 +45,10 @@ public class ApplyingMemberResultDTO implements Serializable { * 入群被拒 - rejected 、 */ private String status; + + /** + * invited:通过链接加入 ; join:申请加入;scancode通过扫码加入 + */ + private String enterGroupType; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index 7910965741..c0658e21d0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -31,7 +31,8 @@ NULL AS applyUserHeadPhoto, NULL AS applyUserName, gmo.OPERATE_DES AS applyReason, - gmo.OPERATE_STATUS as status + gmo.OPERATE_STATUS as status, + gmo.ENTER_GROUP_TYPE as enterGroupType FROM group_memeber_operation gmo WHERE From ee58f84e7b020fab021e78b5d3f458a8f680334f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 19 Nov 2020 21:31:10 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=B0=8F=E7=BB=84=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ResiGroupMemberServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index a43925c411..33ee329a30 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -218,11 +218,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl 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(); } @@ -285,7 +285,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl 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 userIdList=new ArrayList<>(); @@ -383,13 +383,13 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl Date: Mon, 23 Nov 2020 17:41:27 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/constant/GroupCodeConstant.java | 9 +++++++++ .../impl/ResiGroupCodeServiceImpl.java | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java index 34a154cf6b..2dd3ab893c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java @@ -11,4 +11,13 @@ 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/"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index b833478cda..12fb0b41cb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -23,19 +23,13 @@ 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.constant.NumConstant; -import com.epmet.commons.tools.enums.EnvEnum; 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.Result; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.result.CustomerTokensResultDTO; import com.epmet.dto.result.UploadImgResultDTO; -import com.epmet.dto.result.UserResiInfoResultDTO; -import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.modules.group.dao.ResiGroupCodeDao; import com.epmet.modules.group.entity.ResiGroupCodeEntity; @@ -63,7 +57,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.UnsupportedEncodingException; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; /** @@ -277,6 +273,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Tue, 24 Nov 2020 10:26:58 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E6=B5=B7=E6=8A=A5Bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/service/impl/ResiGroupCodeServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 12fb0b41cb..0fef8f55a4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -273,6 +273,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Tue, 24 Nov 2020 14:28:48 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiGroupServiceImpl.java | 2 -- .../epmet/modules/test/TestController.java | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index cc1eac2dc2..47ddbbd4a4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -162,8 +162,6 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java new file mode 100644 index 0000000000..735d85b45c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java @@ -0,0 +1,20 @@ +package com.epmet.modules.test; + +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-domain") + public Result testDomain(HttpServletRequest request) { + String domain = String.format("%s://%s", request.getScheme(), request.getServerName()); + return new Result().ok(domain); + } + +} From 461e1dc7d2f4cabbfe5a8d166badc8aa057fc790 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 24 Nov 2020 15:48:03 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=EF=BC=8Curl?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9F=9F=E5=90=8D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/utils/HttpContextUtils.java | 5 +++++ .../group/service/impl/ResiGroupCodeServiceImpl.java | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java index d27da23ab7..3a46b806c5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java @@ -66,4 +66,9 @@ public class HttpContextUtils { } return defaultLanguage; } + + public static String getRequestServerNameAndPort() { + HttpServletRequest request = getHttpServletRequest(); + return String.format("%s://%s:%s", request.getScheme(), request.getServerName(), request.getServerPort()); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 0fef8f55a4..b77e271163 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -28,6 +28,7 @@ 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; @@ -293,9 +294,10 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl Date: Wed, 25 Nov 2020 12:23:26 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=AF=B7=E6=B1=82=E4=BF=A1=E6=81=AF=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/modules/test/TestController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java index 735d85b45c..9a2df7e1d0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java @@ -11,9 +11,9 @@ import javax.servlet.http.HttpServletRequest; @RequestMapping("test") public class TestController { - @PostMapping("get-req-domain") + @PostMapping("get-req-info") public Result testDomain(HttpServletRequest request) { - String domain = String.format("%s://%s", request.getScheme(), request.getServerName()); + String domain = String.format("%s://%s:%s", request.getHeader("X-Forwarded-Scheme"), request.getServerName(), request.getServerPort()); return new Result().ok(domain); } From 8bb2df597a21a5d9a7e4faf4c81b137b5456c96b Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 25 Nov 2020 12:37:26 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9AHttpContextuti?= =?UTF-8?q?ls.getRequestServerNameAndPort()=E6=94=AF=E6=8C=81=E4=BB=8Engin?= =?UTF-8?q?x=E8=8E=B7=E5=8F=96X-Forwarded-Scheme=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/utils/HttpContextUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java index 3a46b806c5..6c3f50f057 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java @@ -69,6 +69,11 @@ public class HttpContextUtils { public static String getRequestServerNameAndPort() { HttpServletRequest request = getHttpServletRequest(); - return String.format("%s://%s:%s", request.getScheme(), request.getServerName(), request.getServerPort()); + //X-Forwarded-Scheme是nginx中添加的一个header,用于获取真实的$scheme + String scheme = request.getHeader("X-Forwarded-Scheme"); + if (StringUtils.isBlank(scheme)) { + scheme = "http"; + } + return String.format("%s://%s:%s", scheme, request.getServerName(), request.getServerPort()); } } From c9e729b7abfe0312dc133b35bc0949b0e5b3022a Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 25 Nov 2020 14:17:25 +0800 Subject: [PATCH 39/44] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=9F=9F=E5=90=8D=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/utils/HttpContextUtils.java | 8 +++++++- .../main/java/com/epmet/modules/test/TestController.java | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java index 6c3f50f057..a23b8f5d55 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpContextUtils.java @@ -74,6 +74,12 @@ public class HttpContextUtils { if (StringUtils.isBlank(scheme)) { scheme = "http"; } - return String.format("%s://%s:%s", scheme, request.getServerName(), request.getServerPort()); + + 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); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java index 9a2df7e1d0..e68a222f27 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/test/TestController.java @@ -1,5 +1,6 @@ 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; @@ -13,8 +14,8 @@ public class TestController { @PostMapping("get-req-info") public Result testDomain(HttpServletRequest request) { - String domain = String.format("%s://%s:%s", request.getHeader("X-Forwarded-Scheme"), request.getServerName(), request.getServerPort()); - return new Result().ok(domain); + String requestServerNameAndPort = HttpContextUtils.getRequestServerNameAndPort(); + return new Result().ok(requestServerNameAndPort); } } From 4356b96e077f5838f0ef36f8299409187d64a0d3 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 26 Nov 2020 14:55:19 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E5=8C=BA=E5=88=86=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E8=BF=9B=E7=BB=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/GroupInvitationServiceImpl.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index eebc106ca0..4196c164bf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -382,27 +382,31 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Thu, 26 Nov 2020 16:35:33 +0800 Subject: [PATCH 41/44] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=85=A5=E7=BB=84?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E8=B0=83=E6=95=B4=E5=85=BC=E5=AE=B9=E6=97=A7?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 3 ++- .../impl/GroupInvitationServiceImpl.java | 24 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 10533e98fd..550a78de43 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -128,7 +128,8 @@ public enum EpmetErrorCode { GROUP_EDIT_ERROR(9000,"组信息编辑失败"), GROUP_NOT_EXISTS(9001,"该组不存在"), GROUP_IN_AUDITING(9002,"该组已提交编辑,处于待审核状态,完成审核前不可再次提交"), - GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限"); + GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限"), + EXISTING_APPLICATION(9004,"已存在待审核入组申请,不能重复申请"); private int code; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 4196c164bf..2dd23728e4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -358,6 +358,14 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Thu, 26 Nov 2020 18:21:02 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=85=A5=E7=BE=A4?= =?UTF-8?q?=E5=BE=85=E5=AE=A1=E6=A0=B8=E5=88=97=E8=A1=A8SQL=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/member/ResiGroupMemberDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index c0658e21d0..f125ebb551 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -30,7 +30,7 @@ gmo.CUSTOMER_USER_ID AS applyUserId, NULL AS applyUserHeadPhoto, NULL AS applyUserName, - gmo.OPERATE_DES AS applyReason, + IFNULL(gmo.OPERATE_DES, '') AS applyReason, gmo.OPERATE_STATUS as status, gmo.ENTER_GROUP_TYPE as enterGroupType FROM From eb06ce39a09aa916ac39b72824f7811a5a53a44d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 27 Nov 2020 09:53:51 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=85=A5=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=8F=82?= =?UTF-8?q?=EF=BC=8C=E6=A0=87=E8=AF=86=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=B8=AD=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 3 +-- .../result/AcceptInvitationResultDTO.java | 19 +++++++++++++++++ .../result/LinkGroupInfoResultDTO.java | 4 ++++ .../controller/GroupInvitationController.java | 7 +++---- .../service/GroupInvitationService.java | 3 ++- .../impl/GroupInvitationServiceImpl.java | 21 ++++++++++++++----- 6 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/AcceptInvitationResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 550a78de43..10533e98fd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -128,8 +128,7 @@ public enum EpmetErrorCode { GROUP_EDIT_ERROR(9000,"组信息编辑失败"), GROUP_NOT_EXISTS(9001,"该组不存在"), GROUP_IN_AUDITING(9002,"该组已提交编辑,处于待审核状态,完成审核前不可再次提交"), - GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限"), - EXISTING_APPLICATION(9004,"已存在待审核入组申请,不能重复申请"); + GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限"); private int code; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/AcceptInvitationResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/AcceptInvitationResultDTO.java new file mode 100644 index 0000000000..c7dc6cf6f7 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/LinkGroupInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/LinkGroupInfoResultDTO.java index 4e3fd08cd5..441571f202 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/result/LinkGroupInfoResultDTO.java +++ b/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 */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java index cf50b0b4b3..14044a668f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java +++ b/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,10 @@ 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(); + return new Result().ok(groupInvitationService.accetInvitation(formDTO)); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java index 7f3153f9b7..12611bbbec 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java +++ b/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; @@ -133,5 +134,5 @@ public interface GroupInvitationService extends BaseService userRoleList) { From 5c990740500933d83fb98689ef455bedccefbe3d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 27 Nov 2020 10:51:13 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E6=88=96=E6=89=AB=E7=A0=81=E5=85=A5=E7=BB=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E6=97=A7=E6=96=B9=E6=B3=95=E4=B8=8D=E8=83=BD=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=EF=BC=8C=E5=A2=9E=E5=8A=A0v2.0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GroupInvitationController.java | 18 +++- .../service/GroupInvitationService.java | 9 +- .../impl/GroupInvitationServiceImpl.java | 87 ++++++++++++++++++- 3 files changed, 110 insertions(+), 4 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java index 14044a668f..3bd1a6c99d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java @@ -90,10 +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); - return new Result().ok(groupInvitationService.accetInvitation(formDTO)); + groupInvitationService.accetInvitation(formDTO); + return new Result(); + } + + /** + * @param tokenDto formDTO + * @Author sun + * @Description 邀请链接或扫码进组 + **/ + @PostMapping("acceptinvitationv2") + public Result accetInvitationV2(@LoginUser TokenDto tokenDto, @RequestBody AccetInvitationFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setApp(tokenDto.getApp()); + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(groupInvitationService.accetInvitationV2(formDTO)); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java index 12611bbbec..44f61b26ec 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java @@ -134,5 +134,12 @@ public interface GroupInvitationService extends BaseService 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()); + } + UserRoleDTO userRoleDTO=this.getUserRoleDTO(result.getData().getUserRoleList()); + //5、新增一条邀请入群、直接审核通过的入群记录 + GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO(); + groupMemeberOperation.setGroupId(resiGroupDTO.getId()); + groupMemeberOperation.setCustomerUserId(formDTO.getUserId()); + groupMemeberOperation.setOperateStatus(MemberStateConstant.APPROVED); + groupMemeberOperation.setEnterGroupType(EnterGroupTypeConstant.INVITED); + groupMemeberOperation.setOperateUserId(formDTO.getUserId()); + 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()){ + 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());