From f6da4109b343ec22e1e8bb8ec63515554f5022fa Mon Sep 17 00:00:00 2001 From: wangchao Date: Wed, 22 Apr 2020 10:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E9=99=A2=E5=B0=8F=E7=BB=84redis?= =?UTF-8?q?=E7=9A=84get=E6=93=8D=E4=BD=9C=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E3=80=81=E6=95=B0=E6=8D=AE=E5=BA=93=E5=85=A8?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=B0=81=E8=A3=85=EF=BC=8C=E5=85=B6=E4=BD=99?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8F=AA=E9=9C=80=E8=B0=83=E7=94=A8=E5=8D=B3?= =?UTF-8?q?=E5=8F=AF=E3=80=82=E6=94=BF=E5=BA=9C=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E2=91=A0=E5=BE=85=E5=AE=A1=E6=A0=B8=E7=9A=84=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E2=91=A1=E5=AE=A1=E6=A0=B8=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E8=AF=A6=E6=83=85(=E5=8C=85=E5=90=AB=E5=B7=B2?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=B8=8E=E6=9C=AA=E5=AE=A1=E6=A0=B8)?= =?UTF-8?q?=E2=91=A2=E5=90=8C=E6=84=8F=E5=BB=BA=E7=BB=84=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E2=91=A3=E9=A9=B3=E5=9B=9E=E5=BB=BA=E7=BB=84=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E3=80=82=E5=9C=A8resi-guide=E6=A8=A1=E5=9D=97=E5=8A=A0?= =?UTF-8?q?=E4=B8=8AsnakeYaml=E4=BE=9D=E8=B5=96=E8=A7=A3=E5=86=B3bootstrap?= =?UTF-8?q?.yml=E6=97=A0=E6=B3=95=E8=AF=95=E5=88=AB@=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/ResiGroupController.java | 63 ++++++++++- .../com/epmet/feign/ResiGroupFeignClient.java | 46 +++++++- .../ResiGroupFeignClientFallBack.java | 52 ++++++++- .../com/epmet/service/ResiGroupService.java | 41 ++++++- .../service/impl/ResiGroupServiceImpl.java | 34 +++++- .../resi/group/constant/TopicConstant.java | 5 + .../dto/group/form/ApplyingGroupsFormDTO.java | 9 ++ .../dto/group/form/CommonGroupIdFromDTO.java | 29 +++++ .../result/ApplyingGroupDetailResultDTO.java | 78 +++++++++++++ ...ltDTO.java => ApplyingGroupResultDTO.java} | 16 ++- .../group/controller/ResiGroupController.java | 46 +++++++- .../epmet/modules/group/dao/ResiGroupDao.java | 19 ++++ .../modules/group/redis/ResiGroupRedis.java | 83 ++++++++++++++ .../group/service/ResiGroupService.java | 20 +++- .../service/impl/ResiGroupServiceImpl.java | 107 ++++++++++++++++-- .../member/redis/ResiGroupMemberRedis.java | 82 ++++++++++++-- .../impl/ResiGroupMemberServiceImpl.java | 5 +- .../impl/ResiTopicCommentServiceImpl.java | 2 +- .../service/impl/ResiTopicServiceImpl.java | 10 +- .../epmet/modules/utils/ModuleConstant.java | 40 +++++++ .../src/main/resources/db/migration/db.sql | 2 +- .../resources/mapper/group/ResiGroupDao.xml | 49 ++++++++ .../resi-guide/resi-guide-server/pom.xml | 5 + .../impl/StrangerAccessRecordServiceImpl.java | 1 + .../impl/RegisterRelationServiceImpl.java | 1 + 25 files changed, 798 insertions(+), 47 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java rename epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/{ApplyingGroupsResultDTO.java => ApplyingGroupResultDTO.java} (75%) diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java index 0dec7e9d03..e4767bb45c 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java @@ -1,7 +1,12 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; @@ -33,4 +38,60 @@ public class ResiGroupController { public Result> audited(@RequestBody GroupAuditedFromDTO formDTO) { return resiGroupService.audited(formDTO); } + + /** + * @Description 查询小组待审核列表 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("auditing") + public Result> auditing(@LoginUser TokenDto tokenDto, @RequestBody ApplyingGroupsFormDTO applyingGroupsFormDTO){ + applyingGroupsFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(applyingGroupsFormDTO); + return resiGroupService.auditing(applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("applygroupdetail") + public Result applyGroupDetail(@LoginUser TokenDto tokenDto, @RequestBody CommonGroupIdFromDTO groupIdFromDTO){ + groupIdFromDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(groupIdFromDTO); + return resiGroupService.applyGroupDetail(groupIdFromDTO); + } + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @PostMapping("approve") + public Result agreeApplying(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO){ + agreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); + return resiGroupService.agreeApplying(agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("reject") + public Result disagreeApplying(@LoginUser TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO){ + disAgreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); + return resiGroupService.disagreeApplying(disAgreeApplyGroupFormDTO); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java index 9bc9428a86..a1e215d127 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java @@ -3,7 +3,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.fallback.ResiGroupFeignClientFallBack; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -25,4 +27,46 @@ public interface ResiGroupFeignClient { */ @PostMapping("/resi/group/group/audited") Result> audited(GroupAuditedFromDTO formDTO); + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("/resi/group/group/getapplyinggroups") + Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("/resi/group/group/getapplyinggroupdetail") + Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId); + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @PostMapping("/resi/group/group/agreeapplying") + Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("/resi/group/group/disagreeapplying") + Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); + + } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java index b95ccce2c7..8366a6a780 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java @@ -4,7 +4,9 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.ResiGroupFeignClient; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; import org.springframework.stereotype.Component; @@ -21,4 +23,52 @@ public class ResiGroupFeignClientFallBack implements ResiGroupFeignClient { public Result> audited(GroupAuditedFromDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "audited", formDTO); } + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @Override + public Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getApplyingGroups", applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @Override + public Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getApplyingGroupDetail", groupId); + } + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @Override + public Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "agreeApplying", agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @Override + public Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "disagreeApplying", disAgreeApplyGroupFormDTO); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java index 425f0f5bd2..e767a78f84 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java @@ -1,7 +1,9 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; import java.util.List; @@ -19,4 +21,41 @@ public interface ResiGroupService { * @return Result> */ Result> audited(GroupAuditedFromDTO formDTO); + + /** + * @Description 查询小组待审核列表-调用resi-group服务 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + Result> auditing(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 得到待审核/未审核小组信息的详情-调用resi-group服务 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + Result applyGroupDetail(CommonGroupIdFromDTO groupIdFromDTO); + + /** + * @Description 建组申请-审核通过-调用resi-group服务 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); + + /** + * @Description 建组申请-审核驳回-调用resi-group服务 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); + } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java index f20b368b9f..a3e56a1b10 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java @@ -2,7 +2,9 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.ResiGroupFeignClient; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; @@ -18,10 +20,32 @@ import java.util.List; */ @Service public class ResiGroupServiceImpl implements ResiGroupService{ - @Autowired - private ResiGroupFeignClient resiGroupFeignClient; + @Autowired + private ResiGroupFeignClient resiGroupFeignClient; + @Override + public Result> audited(GroupAuditedFromDTO formDTO) { + return resiGroupFeignClient.audited(formDTO); + } + @Override - public Result> audited(GroupAuditedFromDTO formDTO) { - return resiGroupFeignClient.audited(formDTO); + public Result> auditing(ApplyingGroupsFormDTO applyingGroupsFormDTO) { + return resiGroupFeignClient.getApplyingGroups(applyingGroupsFormDTO); } + + @Override + public Result applyGroupDetail(CommonGroupIdFromDTO groupIdFromDTO) { + return resiGroupFeignClient.getApplyingGroupDetail(groupIdFromDTO); + } + + @Override + public Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + return resiGroupFeignClient.agreeApplying(agreeApplyGroupFormDTO); + } + + @Override + public Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + return resiGroupFeignClient.disagreeApplying(disAgreeApplyGroupFormDTO); + } + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java index 0097751804..9d9971ccf3 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java @@ -67,4 +67,9 @@ public interface TopicConstant { * 构造queryWrapper 附件排序 * */ String SORT = "SORT"; + + /** + * 构造queryWrapper 用户Id + * */ + String CUSTOMER_USER_ID = "CUSTOMER_USER_ID"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java index 4bc9bd10e8..a30ecae5ef 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.resi.group.dto.group.form; import lombok.Data; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -18,11 +19,13 @@ public class ApplyingGroupsFormDTO implements Serializable{ /** * 客户Id * */ + @NotBlank(message = "客户Id不能为空") private String customerId; /** * 网格Id * */ + @NotBlank(message = "网格Id不能为空") private String gridId; /** @@ -35,4 +38,10 @@ public class ApplyingGroupsFormDTO implements Serializable{ * 每页数据 默认20 * */ private Integer pageSize = 20; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java new file mode 100644 index 0000000000..2dbfe636dd --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java @@ -0,0 +1,29 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用的传参DTO 只传groupId和userId + * @ClassName CommonGroupIdFromDTO + * @Author wangc + * @date 2020.04.20 14:04 + */ +@Data +public class CommonGroupIdFromDTO implements Serializable{ + private static final long serialVersionUID = 1L; + + /** + * 组Id + * */ + @NotBlank(message = "组Id不能为空") + private String groupId; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java new file mode 100644 index 0000000000..f8747baee9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java @@ -0,0 +1,78 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 建组申请详情 + * @ClassName ApplyingGroupDetailResultDTO + * @Author wangc + * @date 2020.04.17 16:13 + */ +@Data +public class ApplyingGroupDetailResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 组Id + * */ + private String groupId; + + /** + * 组名称 + * */ + private String groupName; + + /** + * 组头像 + * */ + private String groupHeadPhoto; + + /** + * 组介绍 + * */ + private String groupIntroduction; + + /** + * 申请时间 + * */ + private Date createdTime; + + /** + * 组长名称 + * */ + private String groupLeaderName; + + /** + * 已同意该申请approved 、已驳回rejected + * */ + private String status; + + /** + * 驳回理由 + * */ + private String rejectReason; + + /** + * 从数据库中获取组长的用户Id,方便获取组长用户信息,返回时将此值置为NULL + * */ + private String leaderId; + + /** + * 街道 + * */ + private String street; + + /** + * 未读已读标识 unread read + * */ + private String readFlag; + + /** + * 从数据库中获取组操作记录Id,返回时将此值置为NULL + * */ + private String operationId; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupsResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java similarity index 75% rename from epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupsResultDTO.java rename to epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java index 049c13c1b8..3683f760c5 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupsResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java @@ -3,16 +3,16 @@ package com.epmet.resi.group.dto.group.result; import lombok.Data; import java.io.Serializable; -import java.util.Date; + /** * @Description 政府端查询待审核的小组 - * @ClassName ApplyingGroupsResultDTO + * @ClassName ApplyingGroupResultDTO * @Author wangc * @date 2020.04.17 15:20 */ @Data -public class ApplyingGroupsResultDTO implements Serializable{ +public class ApplyingGroupResultDTO implements Serializable{ private static final long serialVersionUID = 1L; /** @@ -30,15 +30,10 @@ public class ApplyingGroupsResultDTO implements Serializable{ * */ private String groupHeadPhoto; - /** - * 组介绍 - * */ - private String groupIntroduction; - /** * 申请时间 * */ - private Date createdTime; + private String createdTime; /** * 审核人员已读未读标识(未读:unread ; 已读:read ) @@ -49,4 +44,7 @@ public class ApplyingGroupsResultDTO implements Serializable{ * 消息通知内容 * */ private String messageText; + + + } 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 7dbe4179ba..cfbeb29d57 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 @@ -22,7 +22,6 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.UserResiInfoFormDTO; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.dto.group.form.*; @@ -230,4 +229,49 @@ public class ResiGroupController { ValidatorUtils.validateEntity(formDTO); return resiGroupService.audited(formDTO); } + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("getapplyinggroups") + public Result> getApplyingGroups(@RequestBody ApplyingGroupsFormDTO applyingGroupsFormDTO){ + ValidatorUtils.validateEntity(applyingGroupsFormDTO); + return resiGroupService.getApplyingGroups(applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId; String userId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("getapplyinggroupdetail") + public Result getApplyingGroupDetail(@RequestBody CommonGroupIdFromDTO groupIdFromDTO){ + ValidatorUtils.validateEntity(groupIdFromDTO); + return resiGroupService.getApplyingGroupDetail(groupIdFromDTO); + } + + @PostMapping("agreeapplying") + public Result agreeApplying( @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); + return resiGroupService.agreeApplyGroup(agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回-供外部服务调用,当前用户Id需要调用时一并传入 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("disagreeapplying") + public Result disagreeApplying(@RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); + return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index 6c6d0aaf26..293d0c7f6b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -23,6 +23,7 @@ import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -113,4 +114,22 @@ public interface ResiGroupDao extends BaseDao { * @return */ List selectAuditedGroupList(GroupAuditedFromDTO formDTO); + + /** + * @Description 查询申请中的的小组 + * @Param ApplyingGroupsFormDTO + * @return List + * @Author wangc + * @Date 2020.04.20 00:11 + **/ + List getApplyingGroupsByCustIdAndGridId(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 获取组审核信息详情:已审核/未审核通用 + * @Param groupId + * @return ApplyingGroupDetailResultDTO + * @Author wangc + * @Date 2020.04.20 11:17 + **/ + ApplyingGroupDetailResultDTO getApplyingGroupDetailByGroupId(@Param("groupId") String groupId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java index 12d4ab4d7a..8971aae9dc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java @@ -17,13 +17,24 @@ package com.epmet.modules.group.redis; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.group.service.ResiGroupStatisticalService; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; +import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO; +import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.*; + /** * 群组信息表 * @@ -35,6 +46,13 @@ public class ResiGroupRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private ResiGroupService groupService; + + @Autowired + private ResiGroupStatisticalService statisticalService; + + public void delete(Object[] ids) { } @@ -51,10 +69,75 @@ public class ResiGroupRedis { } } + /** + * @Description 查询组的缓存信息,如果有直接返回,如果没有,则从数据库中查询,将数据放入缓存并返回 + * @Param + * @return + * @Author wangc + * @Date 2020.04.18 12:00 + **/ public ResiGroupInfoRedisDTO get(String groupId){ + if(StringUtils.isNotBlank(groupId)){ ResiGroupInfoRedisDTO groupCache = (ResiGroupInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupInfoKey(groupId)); + if(null == groupCache || StringUtils.isBlank(groupCache.getGroupId())){ + //如果缓存中没有该组信息,从数据库中查询并放入缓存 + ResiGroupDTO groupMySql = groupService.get(groupId); + if(null != groupMySql && StringUtils.isNotBlank(groupMySql.getId())){ + ResiGroupInfoRedisDTO groupRedis = ConvertUtils.sourceToTarget(groupMySql,ResiGroupInfoRedisDTO.class); + groupRedis.setGroupId(groupMySql.getId()); + groupRedis.setGroupState(groupMySql.getState()); + Map param = new HashMap<>(); + param.put(TopicConstant.RESI_GROUP_ID,groupId); + param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + List statisticalMySql = statisticalService.list(param); + if(null != statisticalMySql && statisticalMySql.size() >= 1){ + if(statisticalMySql.size() > 1){ + /* + Collections.sort(statisticalMySql, new Comparator() { + @Override + public int compare(ResiGroupStatisticalDTO o1, ResiGroupStatisticalDTO o2) { + if(null != o1.getCreatedTime() && null != o2.getCreatedTime()){ + return + o1.getCreatedTime().getTime() > o2.getCreatedTime().getTime() ? + -1 : (o1.getCreatedTime().getTime() == o2.getCreatedTime().getTime() ? + 0: 1); + }else{ + return 0; + } + } + }); + + statisticalMySql.sort((ResiGroupStatisticalDTO o1, ResiGroupStatisticalDTO o2) -> + o1.getCreatedTime().compareTo(o2.getCreatedTime()) + ); + //升序 + statisticalMySql.sort(Comparator.comparing(e -> e.getCreatedTime())); + + statisticalMySql.sort(Comparator.comparing(ResiGroupStatisticalDTO :: getCreatedTime, + (o1 , o2) -> { + return o2.compareTo(o 1); + })); + */ + + //按照createdTime降序排序 + statisticalMySql.sort(Comparator.comparing(ResiGroupStatisticalDTO :: getCreatedTime, + Collections.reverseOrder())); + } + ResiGroupStatisticalDTO statistical = statisticalMySql.get(0); + ResiGroupStatisticalInfoRedisDTO statisticalRedis = + ConvertUtils.sourceToTarget(statistical,ResiGroupStatisticalInfoRedisDTO.class); + statisticalRedis.setTotalEarnestMembers(statistical.getTotalEarnestMemebers()); + statisticalRedis.setTotalNormalMembers(statistical.getTotalNormalMemebers()); + groupRedis.setGroupStatisticalInfo(statisticalRedis); + } + //将从数据库中查询出的数据放入缓存 + set(groupRedis); + //返回数据 + return groupRedis; + } + } return groupCache; } return null; 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 787b160f6c..a630ff1275 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 @@ -20,9 +20,7 @@ package com.epmet.modules.group.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserResiInfoFormDTO; import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO; @@ -208,4 +206,22 @@ public interface ResiGroupService extends BaseService { * @return Result> */ Result> audited(GroupAuditedFromDTO formDTO); + + /** + * @Description 查询待审核的小组 + * @Param ApplyingGroupsFormDTO + * @return Result> + * @Author wangc + * @Date 2020.04.18 10:17 + **/ + Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 建组申请详情 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.19 23:32 + **/ + Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId); } 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 75f07cc192..c7d300b590 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 @@ -30,6 +30,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.form.UserRoleFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; @@ -37,12 +38,14 @@ import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.dao.ResiGroupOperationDao; import com.epmet.modules.group.entity.ResiGroupEntity; +import com.epmet.modules.group.entity.ResiGroupOperationEntity; import com.epmet.modules.group.redis.ResiGroupRedis; import com.epmet.modules.group.service.ResiGroupOperationService; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.group.service.ResiGroupStatisticalService; import com.epmet.modules.member.dao.GroupMemeberOperationDao; import com.epmet.modules.member.dao.ResiGroupMemberDao; +import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.utils.ModuleConstant; @@ -56,6 +59,7 @@ 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 org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,6 +107,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { @@ -457,21 +464,45 @@ public class ResiGroupServiceImpl extends BaseServiceImpl param = new HashMap<>(); - param.put("resiGroupId", resiGroupDTO.getId()); + param.put(ModuleConstant.RESI_GROUP_ID_CAMEL, resiGroupDTO.getId()); + param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); List statisticalList = resiGroupStatisticalService.list(param); if (null != statisticalList && statisticalList.size() > 0) { ResiGroupInfoRedisDTO groupRedis = transferToGroupInfoRedis(resiGroupDTO, statisticalList.get(0)); resiGroupRedis.set(groupRedis); + + ResiGroupMemberInfoRedisDTO memberRedis = new ResiGroupMemberInfoRedisDTO(); + memberRedis.setUserId(resiGroupMemberDTO.getCustomerUserId()); + memberRedis.setGroupLeaderFlag("leader"); + memberRedis.setEnterGroupType(resiGroupMemberDTO.getEnterGroupType()); + memberRedis.setMemberStatus(resiGroupMemberDTO.getStatus()); + memberRedis.setGroupId(resiGroupMemberDTO.getResiGroupId()); + + UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); + userParam.setUserId(resiGroupMemberDTO.getCustomerUserId()); + userParam.setCustomerId(resiGroupDTO.getCustomerId()); + Result userInfo = + epmetUserFeignClient.getUserResiInfoDTO(userParam); + if(userInfo.success() && null != userInfo.getData()){ + memberRedis.setUserShowName(userInfo.getData().getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + resiGroupMemberRedis.set(memberRedis); } else { - //当没有查询到组统计信息时 - UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); - userRoleFormDTO.setApp("resi"); - userRoleFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - userRoleFormDTO.setUserId(agreeApplyGroupFormDTO.getUserId()); - //userRoleFormDTO.setGridId - //epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + /* + 当没有查询到组统计信息时,需要自己封装统计信息 + @param UserRoleFormDTO::getApp + @param UserRoleFormDTO::getCustomerId + @param UserRoleFormDTO::getUserId + @param UserRoleFormDTO::getGridId + 查询用户身份信息[热心居民/党员] + epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + */ + logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); } @@ -589,4 +620,62 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> + * @Author wangc + * @Date 2020.04.18 10:18 + **/ + @Override + public Result> getApplyingGroups(ApplyingGroupsFormDTO params){ + if(null == params.getPageNo()){ + throw new RenException(ModuleConstant.PAGE_INDEX_NOT_NULL); + } + params.setPageNo((params.getPageNo() - NumConstant.ONE) * params.getPageSize()); + return new Result>().ok(baseDao.getApplyingGroupsByCustIdAndGridId(params)); + } + + /** + * @Description 建组申请详情 已审核(更新已读未读标识)/未审核 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.19 23:32 + **/ + @Override + public Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId){ + //1.查询小组信息 + //注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题 + ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId()); + //2.查询用户信息(TODO 先走数据库,之后改成走缓存) + List userId = new ArrayList<>(); + userId.add(detail.getLeaderId()); + Result> userInfoResult = + epmetUserFeignClient.getUserResiInfoList(new UserResiInfoListFormDTO(userId)); + if(userInfoResult.success() && null != userInfoResult.getData() && userInfoResult.getData().size() >= 1){ + detail.setGroupHeadPhoto(userInfoResult.getData().get(0).getHeadPhoto()); + //姓氏+先生/女士 注:在数据库中拼接成[街道+显示名称]默认格式,故要进行截取 + //detail.setGroupLeaderName(userInfoResult.getData().get(0).getShowName().split("-")[NumConstant.ONE]); + //姓氏+名称 + detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName()); + detail.setStreet(userInfoResult.getData().get(0).getStreet()); + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + //3.未读改成已读 + if(StringUtils.equals(detail.getReadFlag(),ModuleConstant.UNREAD)){ + ResiGroupOperationEntity operationEntity = new ResiGroupOperationEntity(); + operationEntity.setId(detail.getOperationId()); + operationEntity.setReadFlag(ModuleConstant.READ); + operationEntity.setUpdatedBy(groupId.getUserId()); + resiGroupOperationDao.updateById(operationEntity); + } + //4.将组长用户Id隐藏 + detail.setLeaderId(null); + detail.setOperationId(null); + + return new Result().ok(detail); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index 9285e70f54..d59e819155 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java @@ -17,15 +17,26 @@ package com.epmet.modules.member.redis; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.map.MapUtil; + +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.modules.utils.ModuleConstant; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -42,6 +53,17 @@ public class ResiGroupMemberRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private ResiGroupMemberService memberService; + + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + @Autowired + private ResiGroupService groupService; + + private Logger logger = LoggerFactory.getLogger(getClass()); + public void delete(Object[] ids) { } @@ -70,14 +92,54 @@ public class ResiGroupMemberRedis { * @Date 2020.04.13 23:36 **/ public ResiGroupMemberInfoRedisDTO get(String groupId ,String userId){ - /* - Map map = redisUtils.hGetAll(); - if (MapUtil.isEmpty(map)) { - return null; + + ResiGroupMemberInfoRedisDTO memberCache = + (ResiGroupMemberInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupMemberInfoKey(groupId,userId)); + //如果缓存中没有该成员数据 + if(null == memberCache && StringUtils.isNotBlank(memberCache.getUserId())){ + Map param = new HashMap<>(); + param.put(TopicConstant.CUSTOMER_USER_ID,userId); + param.put(TopicConstant.RESI_GROUP_ID,groupId); + param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + List memberList = memberService.list(param); + if(null != memberList && memberList.size() >= 1){ + if(memberList.size() > 1) { + memberList.sort(Comparator.comparing(ResiGroupMemberDTO::getCreatedTime, Collections.reverseOrder())); + } + ResiGroupMemberDTO memberMySql = memberList.get(0); + ResiGroupMemberInfoRedisDTO memberRedis = ConvertUtils.sourceToTarget(memberMySql,ResiGroupMemberInfoRedisDTO.class); + + memberRedis.setUserId(memberMySql.getCustomerUserId()); + memberRedis.setGroupId(memberMySql.getResiGroupId()); + memberRedis.setMemberStatus(memberMySql.getStatus()); + + + UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); + userParam.setUserId(memberMySql.getCustomerUserId()); + userParam.setCustomerId(groupService.get(groupId).getCustomerId()); + Result userInfo = epmetUserFeignClient.getUserResiInfoDTO(userParam); + if(userInfo.success()){ + if(null != userInfo.getData()){ + memberRedis.setUserShowName(userInfo.getData().getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); + } + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + + set(memberRedis); + return memberRedis; + }else{ + //日志打印效果:找不到组员信息,组Id: ********,用户Id:******** + logger.warn(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND + .concat(ModuleConstant.GROUP_ID) + .concat(groupId) + .concat(ModuleConstant.USER_ID) + .concat(userId)); + } } - //map to bean - ResiGroupMemberInfoRedisDTO member = BeanUtil.mapToBean(map, ResiGroupMemberInfoRedisDTO.class, true);*/ - return (ResiGroupMemberInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupMemberInfoKey(groupId,userId)); + + return memberCache; } 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 e02a61318e..33da2273dd 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 @@ -132,7 +132,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); return wrapper; } @@ -176,6 +176,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(groupId), "RESI_GROUP_ID", groupId) .eq(StringUtils.isNotBlank(userId), "CUSTOMER_USER_ID", userId); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); List list = baseDao.selectList(wrapper); if (null == list || list.size() == 0) { return null; @@ -358,6 +359,8 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl paramsMap = new HashMap<>(); paramsMap.put(TopicConstant.RESI_GROUP_ID,groupMemeberOperationDTO.getGroupId()); + paramsMap.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + //不再进行计算,直接从数据库中拉取更新过的数据(在同一个事务中) List statisticalDTO = resiGroupStatisticalService.list(paramsMap); if(null != statisticalDTO && statisticalDTO.size() > 0){ ResiGroupStatisticalInfoRedisDTO statisticalObjct = diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index 67fd903074..9fc3289632 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -98,7 +98,7 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); return wrapper; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 1925d2b28b..c4af44761f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -138,6 +138,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; @@ -235,6 +236,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.RESI_GROUP_ID,resiTopicPublishFormDTO.getGroupId()); List statistical = resiGroupStatisticalDao.selectList(wrapper); if(null != statistical && statistical.size() >= NumConstant.ONE){ @@ -524,6 +526,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.TOPIC_ID,topicId); wrapper.orderByAsc(TopicConstant.SORT); List attachments = resiTopicAttachmentDao.selectList(wrapper); @@ -818,6 +821,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl + + + + + + diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index a3f4106c28..1b49df5bd3 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -76,6 +76,11 @@ 2.0.0 compile + + org.yaml + snakeyaml + ${snakeyaml.version} + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java index 729ce30565..edc0784fa5 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java @@ -101,6 +101,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); Calendar before3daysDate = Calendar.getInstance(); before3daysDate.setTime(new Date()); before3daysDate.add(Calendar.DATE, -3); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index 3defd336ac..e2f315d22f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -172,6 +172,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(UserCustomerConstant.CUSTOMER_ID,enterGridFormDTO.getCustomerId()); wrapper.eq(UserCustomerConstant.USER_ID,enterGridFormDTO.getUserId()); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); //1.查找用户注册关系表,如果没有表示当前用户为陌生人(拉取用户微信表信息),如果有表示当前用户已经进行居民认证