From c3bd49786360f2b2cf91d477372b3def6a654269 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 2 Nov 2020 17:04:17 +0800 Subject: [PATCH 01/38] =?UTF-8?q?=E6=8F=90=E4=BA=A4=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/group/form/EditGroupFormDTO.java | 24 +++++ .../group/controller/ResiGroupController.java | 9 ++ .../group/dao/GroupEditSubmitRecordDao.java | 33 +++++++ .../entity/GroupEditSubmitRecordEntity.java | 91 +++++++++++++++++++ .../redis/GroupEditSubmitRecordRedis.java | 47 ++++++++++ .../group/service/ResiGroupService.java | 2 + .../service/impl/ResiGroupServiceImpl.java | 10 ++ .../mapper/group/GroupEditSubmitRecordDao.xml | 27 ++++++ 8 files changed, 243 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/GroupEditSubmitRecordRedis.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java new file mode 100644 index 0000000000..370c479070 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class EditGroupFormDTO { + + // 分组详情校验 + public interface GroupDetailVG {} + + + /** + * 组id + */ + @NotBlank(message = "组ID不能为空", groups = { GroupDetailVG.class }) + private String groupId; + +} 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..e1ea6dbeed 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 @@ -359,4 +359,13 @@ public class ResiGroupController { resiGroupStatisticalService.updateWhenAuditedResiRole(resiIdentityFormDTO); return new Result(); } + + + @PostMapping("get-detail") + public Result getGroupDetail(@RequestBody EditGroupFormDTO form){ + ValidatorUtils.validateEntity(form, EditGroupFormDTO.GroupDetailVG.class); + resiGroupService.getGroupDetail(form.getGroupId()); + return new Result(); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java new file mode 100644 index 0000000000..db30254f23 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.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.GroupEditSubmitRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组编辑提交记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-02 + */ +@Mapper +public interface GroupEditSubmitRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java new file mode 100644 index 0000000000..19b2d50a2e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java @@ -0,0 +1,91 @@ +/** + * 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 generator generator@elink-cn.com + * @since v1.0.0 2020-11-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_edit_submit_record") +public class GroupEditSubmitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 小组ID + */ + private String groupId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private Integer gridId; + + /** + * 头像 + */ + private String groupHeadPhoto; + + /** + * 小组名称 + */ + private String groupName; + + /** + * 小组介绍 + */ + private String groupIntroduction; + + /** + * 审核状态。under_auditting:审核中,approved:通过,rejected:驳回 + */ + private String auditStatus; + + /** + * 审核人ID + */ + private String staffId; + + /** + * 回复 + */ + private String remark; + + /** + * 审核时间 + */ + private Date auditTime; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/GroupEditSubmitRecordRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/GroupEditSubmitRecordRedis.java new file mode 100644 index 0000000000..346ebd5924 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/GroupEditSubmitRecordRedis.java @@ -0,0 +1,47 @@ +/** + * 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; + +/** + * 组编辑提交记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-02 + */ +@Component +public class GroupEditSubmitRecordRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file 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..930e7bd529 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 @@ -293,4 +293,6 @@ public interface ResiGroupService extends BaseService { * @return java.util.List */ List recommendedList(RecommendedListFormDTO formDTO); + + void getGroupDetail(String 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 dacfd6dbb8..cadf8b8b44 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 @@ -122,6 +122,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -970,4 +973,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 02338382fe13f3bdca42fa9e5ad27e659b85165c Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 2 Nov 2020 23:09:26 +0800 Subject: [PATCH 02/38] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=EF=BC=9A=E5=B1=85=E6=B0=91=E7=AB=AF=E6=9F=A5=E8=AF=A2=E5=B0=8F?= =?UTF-8?q?=E7=BB=84=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/DateUtils.java | 20 ++++++ .../constant/GroupAuditStatusConstant.java | 14 +++++ .../group/constant/GroupLimitConstant.java | 10 +++ .../group/result/GroupDetailResultDTO.java | 21 +++++++ .../group/dao/GroupEditSubmitRecordDao.java | 21 ++++++- .../group/service/ResiGroupService.java | 2 +- .../service/impl/ResiGroupServiceImpl.java | 61 +++++++++++++++++-- .../mapper/group/GroupEditSubmitRecordDao.xml | 41 ++++++++++++- 8 files changed, 181 insertions(+), 9 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupAuditStatusConstant.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupLimitConstant.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index a7a768b095..d739bb8069 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -681,4 +681,24 @@ public class DateUtils { } }else return null; } + + /** + * 指定月份的开始时间 + * @param date + * @return + */ + public static Date getMonthStart(Date date) { + LocalDate ldn = new LocalDate(date); + return ldn.dayOfMonth().withMinimumValue().toDate(); + } + + /** + * 指定月份的结束时间 + * @param date + * @return + */ + public static Date getMonthEnd(Date date) { + LocalDate ldn = new LocalDate(date); + return ldn.dayOfMonth().withMaximumValue().toDate(); + } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupAuditStatusConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupAuditStatusConstant.java new file mode 100644 index 0000000000..8544c6fe12 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupAuditStatusConstant.java @@ -0,0 +1,14 @@ +package com.epmet.resi.group.constant; + +public interface GroupAuditStatusConstant { + + // 审核中 + String UNDER_AUDITING = "under_auditing"; + + // 驳回 + String REJECTED = "rejected"; + + // 支持 + String APPROVED = "approved"; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupLimitConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupLimitConstant.java new file mode 100644 index 0000000000..0e158a8804 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupLimitConstant.java @@ -0,0 +1,10 @@ +package com.epmet.resi.group.constant; + +public interface GroupLimitConstant { + + /** + * 每月可以编辑2次 + */ + Integer EDIT_NUM_LIMIT_MONTH = 2; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java new file mode 100644 index 0000000000..c7767054d4 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class GroupDetailResultDTO { + + private String groupHeadPhoto; + private String groupName; + private String groupIntroduction; + private Integer editNumLimit; + private Integer avaliableEditNum; + private String auditStatus; + private Boolean editable; + private String remark; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java index db30254f23..37eb9f366e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java @@ -20,6 +20,9 @@ package com.epmet.modules.group.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; /** * 组编辑提交记录表 @@ -29,5 +32,21 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface GroupEditSubmitRecordDao extends BaseDao { - + + /** + * 查询指定组,指定时间段内的编辑次数 + * @param groupId + * @param monthStart + * @param monthEnd + * @return + */ + int countEditNum(@Param("groupId") String groupId, + @Param("monthStart") Date monthStart, + @Param("monthEnd") Date monthEnd); + + /** + * 查询最后一次编辑提交记录 + * @param groupId + */ + GroupEditSubmitRecordEntity getLatestEditSubmitRecord(@Param("groupId") String groupId); } \ No newline at end of file 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 930e7bd529..70011a5c89 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 @@ -294,5 +294,5 @@ public interface ResiGroupService extends BaseService { */ List recommendedList(RecommendedListFormDTO formDTO); - void getGroupDetail(String groupId); + GroupDetailResultDTO getGroupDetail(String 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 cadf8b8b44..dba8c69a1c 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 @@ -38,8 +38,10 @@ import com.epmet.modules.constant.UserMessageConstant; import com.epmet.modules.feign.EpmetMessageFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; +import com.epmet.modules.group.dao.GroupEditSubmitRecordDao; import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.dao.ResiGroupOperationDao; +import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity; import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.modules.group.entity.ResiGroupOperationEntity; import com.epmet.modules.group.redis.ResiGroupRedis; @@ -52,10 +54,7 @@ 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; -import com.epmet.resi.group.constant.EnterGroupTypeConstant; -import com.epmet.resi.group.constant.GroupStateConstant; -import com.epmet.resi.group.constant.LeaderFlagConstant; -import com.epmet.resi.group.constant.MemberStateConstant; +import com.epmet.resi.group.constant.*; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.*; import com.epmet.resi.group.dto.group.form.*; @@ -125,6 +124,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -975,9 +977,56 @@ public class ResiGroupServiceImpl extends BaseServiceImpl - + + + + id, + group_id, + customer_id, + grid_id, + group_head_photo, + group_name, + group_introduction, + audit_status, + staff_id, + remark, + audit_time, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + @@ -23,5 +43,24 @@ + + + + \ No newline at end of file From 4e1e7ef569586826a4f2b7c229dd5817c85f6604 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 3 Nov 2020 10:07:36 +0800 Subject: [PATCH 03/38] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E8=A1=A8Entity=E5=B1=9E=E6=80=A7=E7=9B=B8=E5=85=B3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E5=B7=A5=E4=BD=9C=E7=AB=AF=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=8F=82=E5=85=A5?= =?UTF-8?q?=E5=8F=82DTO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/form/CommonGridAndPageFormDTO.java | 37 +++++++++++++++ .../group/form/GroupEditionAuditFormDTO.java | 43 +++++++++++++++++ .../result/GroupEditionApplyResultDTO.java | 46 +++++++++++++++++++ .../result/GroupEditionDetailResultDTO.java | 42 +++++++++++++++++ .../entity/GroupEditSubmitRecordEntity.java | 12 ++++- .../mapper/group/GroupEditSubmitRecordDao.xml | 4 ++ 6 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupEditionAuditFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java new file mode 100644 index 0000000000..87ed69166f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java @@ -0,0 +1,37 @@ +package com.epmet.resi.group.dto.group.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用网格分页传参DTO + * @ClassName CommonGridAndPageFormDTO + * @Auth wangc + * @Date 2020-11-02 17:22 + */ +@Data +public class CommonGridAndPageFormDTO implements Serializable { + private static final long serialVersionUID = -7916909736115741017L; + + public interface GridPageGroup extends CustomerClientShowGroup{} + + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空" , groups = GridPageGroup.class) + private String gridId; + + /** + * 页码 + */ + private Integer pageNo; + + /** + * 每页多少条数 + */ + private Integer pageSize; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupEditionAuditFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupEditionAuditFormDTO.java new file mode 100644 index 0000000000..fccd849619 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupEditionAuditFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.resi.group.dto.group.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 组信息修改审核入参DTO + * @ClassName GroupEditionAuditFormDTO + * @Auth wangc + * @Date 2020-11-02 17:30 + */ +@Data +public class GroupEditionAuditFormDTO implements Serializable { + private static final long serialVersionUID = 3851649860177395296L; + + public interface GroupEditionAuditGroup extends CustomerClientShowGroup{} + + /** + * 组Id + */ + @NotBlank(message = "组Id不能为空",groups = GroupEditionAuditGroup.class) + private String groupId; + + /** + * 审核结果 审核结果。approved:支持;rejected:拒绝 + */ + @NotBlank(message = "审核结果不能为空",groups = GroupEditionAuditGroup.class) + private String auditResult; + + /** + * 拒绝时的备注 + */ + private String remark; + + /** + * 工作人员Id + */ + @NotBlank(message = "工作人员Id不能为空",groups = GroupEditionAuditGroup.class) + private String staffId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java new file mode 100644 index 0000000000..e8811f98c9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java @@ -0,0 +1,46 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 工作端 - 群组审核列表返参DTO + * @ClassName GroupEditionApplyResultDTO + * @Auth wangc + * @Date 2020-11-03 09:06 + */ +@Data +public class GroupEditionApplyResultDTO implements Serializable { + private static final long serialVersionUID = 437035656436226205L; + + /** + * 组Id + */ + private String groupId; + + /** + * 原始组姓名 + */ + private String groupName; + + /** + * 原始组头像 + */ + private String groupHeadPhoto; + + /** + * 已读 未读 + */ + private String readFlag; + + /** + * 审核人员查看待审核列表时的文案 如:党员李华申请变更小组【原小组名】,请审核。 + */ + private String messageText; + + /** + * yyyy-MM-dd HH:mm:ss + */ + private String submitTime; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java new file mode 100644 index 0000000000..0cf88d6802 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java @@ -0,0 +1,42 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * @Description 工作端 群信息修改申请详情 + * @ClassName GroupEditionDetailResultDTO + * @Auth wangc + * @Date 2020-11-02 17:54 + */ +@Data +public class GroupEditionDetailResultDTO implements Serializable { + private static final long serialVersionUID = -784043668974222480L; + + /** + * 待审核的小组Id + */ + private String groupId; + + /** + * 待审核小组名称 是提交的名称,如果没有更改群名称则还是原来的 + */ + private String groupName; + + /** + * 待审核小组图片 是提交的群头像,如果没有更改群头像则还是原来的 + */ + private String groupHeadPhoto; + + /** + * 待审核小组的介绍 是提交的群介绍,如果没有更改群介绍则还是原来的 + */ + private String groupIntroduction; + + /** + * 群主的昵称 xx路-xx先生/女士 + */ + private String groupLeaderName; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java index 19b2d50a2e..9f8b5c8816 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java @@ -51,7 +51,7 @@ public class GroupEditSubmitRecordEntity extends BaseEpmetEntity { /** * 网格ID */ - private Integer gridId; + private String gridId; /** * 头像 @@ -88,4 +88,14 @@ public class GroupEditSubmitRecordEntity extends BaseEpmetEntity { */ private Date auditTime; + /** + * 审核人员查看待审核列表时的文案 如:党员李华申请变更小组【原小组名】,请审核。 + */ + private String messageText; + + /** + * 已读read 未读unread + */ + private String readFlag; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml index c785d9bb1a..1b689eb363 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml @@ -15,6 +15,8 @@ staff_id, remark, audit_time, + read_flag, + message_text, del_flag, revision, created_by, @@ -35,6 +37,8 @@ + + From 4b78da437d3e02fcef8698afc28ffbecbb317971 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 3 Nov 2020 10:47:06 +0800 Subject: [PATCH 04/38] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=20=20?= =?UTF-8?q?=E7=BB=84=E5=8F=98=E6=9B=B4=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/service/ResiGroupService.java | 9 +++++++++ .../group/service/impl/ResiGroupServiceImpl.java | 13 +++++++++++++ 2 files changed, 22 insertions(+) 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 70011a5c89..3fa639ae7c 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 @@ -295,4 +295,13 @@ public interface ResiGroupService extends BaseService { List recommendedList(RecommendedListFormDTO formDTO); GroupDetailResultDTO getGroupDetail(String groupId); + + /** + * @Description 工作端 查询组变更待审核列表 + * @param param + * @return java.util.List + * @author wangc + * @date 2020.11.03 10:19 + */ + List getEditAuditingList(CommonGridAndPageFormDTO param); } 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 dba8c69a1c..9ced852869 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 @@ -1029,4 +1029,17 @@ public class ResiGroupServiceImpl extends BaseServiceImpl + * @author wangc + * @date 2020.11.03 10:19 + */ + @Override + public List getEditAuditingList(CommonGridAndPageFormDTO param) { + + return null; + } } From 595c9ca11d852d4665ca8f3cb4e2423bf19aa0c4 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 3 Nov 2020 10:52:15 +0800 Subject: [PATCH 05/38] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=EF=BC=9A=E7=BB=84=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../dto/group/form/EditGroupFormDTO.java | 14 ++- .../group/controller/ResiGroupController.java | 20 +++- .../entity/GroupEditSubmitRecordEntity.java | 2 +- .../group/service/ResiGroupService.java | 2 + .../service/impl/ResiGroupServiceImpl.java | 96 ++++++++++++++++++- 6 files changed, 127 insertions(+), 8 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 e4832a1c8b..1976ca3337 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 @@ -41,6 +41,7 @@ public enum EpmetErrorCode { MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"), MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"), + GROUP_EDIT_ERROR(8107,"组信息编辑失败"), ORG_IS_NOT_NULL(8107,"党组织关系不能为空"), CANNOT_DELETE_PARTY_BRANCH(8108,"当前支部存在党员,不允许删除"), diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java index 370c479070..bb1251bf6a 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java @@ -14,11 +14,23 @@ public class EditGroupFormDTO { // 分组详情校验 public interface GroupDetailVG {} + // 提交组编辑校验组 + public interface SubmitGroupEditVG {} + /** * 组id */ - @NotBlank(message = "组ID不能为空", groups = { GroupDetailVG.class }) + @NotBlank(message = "组ID不能为空", groups = { GroupDetailVG.class, SubmitGroupEditVG.class }) private String groupId; + @NotBlank(message = "组头像不能为空", groups = { SubmitGroupEditVG.class }) + private String groupHeadPhoto; + + @NotBlank(message = "组名称不能为空", groups = { SubmitGroupEditVG.class }) + private String groupName; + + @NotBlank(message = "组介绍不能为空", groups = { SubmitGroupEditVG.class }) + private String groupIntroduction; + } 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 e1ea6dbeed..98c572ad08 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 @@ -360,11 +360,27 @@ public class ResiGroupController { return new Result(); } - + /** + * 查询组详情 + * @param form + * @return + */ @PostMapping("get-detail") public Result getGroupDetail(@RequestBody EditGroupFormDTO form){ ValidatorUtils.validateEntity(form, EditGroupFormDTO.GroupDetailVG.class); - resiGroupService.getGroupDetail(form.getGroupId()); + GroupDetailResultDTO groupDetail = resiGroupService.getGroupDetail(form.getGroupId()); + return new Result().ok(groupDetail); + } + + /** + * 提交小组信息编辑 + * @param form + * @return + */ + @PostMapping("submit-edit") + public Result submitGroupEdit(@RequestBody EditGroupFormDTO form){ + ValidatorUtils.validateEntity(form, EditGroupFormDTO.SubmitGroupEditVG.class); + resiGroupService.submitGroupEdit(form.getGroupId(), form.getGroupName(), form.getGroupHeadPhoto(), form.getGroupIntroduction()); return new Result(); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java index 19b2d50a2e..c0f0f3fe2c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java @@ -51,7 +51,7 @@ public class GroupEditSubmitRecordEntity extends BaseEpmetEntity { /** * 网格ID */ - private Integer gridId; + private String gridId; /** * 头像 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 70011a5c89..d3c6a6b2ad 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 @@ -295,4 +295,6 @@ public interface ResiGroupService extends BaseService { List recommendedList(RecommendedListFormDTO formDTO); GroupDetailResultDTO getGroupDetail(String groupId); + + void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction); } 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 dba8c69a1c..979462d3f3 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 @@ -27,9 +27,15 @@ 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.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -68,6 +74,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -127,6 +134,15 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -980,7 +996,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + + // 图片内容审核 + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + ImgTaskDTO task = new ImgTaskDTO(); + task.setUrl(groupHeadPhoto); + imgScanParamDTO.getTasks().add(task); + + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + logger.error("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); + } + } + } } From 14c662ccc17eeed53743c6bef53e02e597873fb5 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 3 Nov 2020 14:17:19 +0800 Subject: [PATCH 06/38] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BB=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=BC=96=E8=BE=91=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/constant/UserMessageConstant.java | 5 + .../service/impl/ResiGroupServiceImpl.java | 92 ++++++++++++++++++- 2 files changed, 94 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 f9b97bfb9f..5ae3c98d8f 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 @@ -59,6 +59,11 @@ public interface UserMessageConstant { */ String CREATION_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请创建小组【%s】,请审核。"; + /** + * 变更组信息时的消息模板 + */ + String EDIT_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请变更小组【%s】,请审核。"; + /** * 组长审核入组申请时的微信订阅behavior */ 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 979462d3f3..b3bb7d4a5e 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 @@ -32,6 +32,7 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +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; @@ -77,6 +78,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; import java.util.*; @@ -134,6 +136,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl resiRoles = getResiRoles(app, customerId, userId, gridId); + boolean isPartymember = false; + boolean isWarmhearted = false; + for (UserRoleResultDTO role : resiRoles) { + if (EpmetRoleKeyConstant.WARMHEARTED.equals(role.getRoleKey())) { + isWarmhearted = true; + } + if (EpmetRoleKeyConstant.PARTYMEMBER.equals(role.getRoleKey())) { + isPartymember = true; + } + } + if (!isWarmhearted && isPartymember) { + throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode(), "只有党员和热心居民才能创建和编辑小组"); + } + String roleName = ""; + if (isPartymember) { + roleName = ModuleConstant.PARTYMEMBER; + } else if (isWarmhearted) { + roleName = ModuleConstant.WAREMHEARTED_RESI; + } + + //3.获取居民注册信息 + UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); + resiParam.setCustomerId(customerId); + resiParam.setUserId(userId); + Result resiResult = + epmetUserFeignClient.getUserResiInfoDTO(resiParam); + String userName = ""; + if (resiResult.success() && null != resiResult.getData()) { + userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) + + (StringUtils.isBlank(resiResult.getData().getName()) ? "" : resiResult.getData().getName()); + } + userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; + return String.format(UserMessageConstant.EDIT_OF_GROUP_MESSAGE_TEMPLATE, roleName, userName, groupName); + } + + /** + * 查询居民的角色列表 + * @param app + * @param customerId + * @param userId + * @param gridId + * @return + */ + private List getResiRoles(String app, String customerId, String userId, String gridId) { + UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); + userRoleFormDTO.setApp(app); + userRoleFormDTO.setCustomerId(customerId); + userRoleFormDTO.setUserId(userId); + userRoleFormDTO.setGridId(gridId); + Result> rolesResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + + if (! rolesResult.success()) { + logger.error("修改组信息:查询居民角色失败,详情:{}", rolesResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "查询居民角色失败"); + } else { + List roles = rolesResult.getData(); + if (CollectionUtils.isEmpty(roles)) { + roles = new ArrayList<>(); + } + return roles; + } + } + /** * 内容检查 * @param groupName @@ -1084,12 +1169,12 @@ public class ResiGroupServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); if (!textSyncScanResult.success()) { @@ -1104,6 +1189,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Tue, 3 Nov 2020 15:28:49 +0800 Subject: [PATCH 07/38] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=BB=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91=E6=8F=90=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=BD=91=E6=A0=BC=E5=86=85?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=AD=98=E5=9C=A8=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/group/dao/ResiGroupDao.java | 13 ++++++++++++ .../service/impl/ResiGroupServiceImpl.java | 7 ++++++- .../resources/mapper/group/ResiGroupDao.xml | 21 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) 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 867a3d11ba..57fd94d9ab 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 @@ -188,4 +188,17 @@ public interface ResiGroupDao extends BaseDao { * @date 2020.05.22 09:54 **/ List selectGroupListByGridIds(@Param("gridIds") List gridIds); + + /** + * 编辑提交的时候,检查组名是否存在。网格内检查, + * 检查resi_group中已审核通过的和待审核的 + * 检查submit_record中待审核的。已审核的不用检查,因为已经更新到resi_group中了 + * @param groupId + * @param gridId + * @param groupName + * @return + */ + int countExistsGroupNameBeforeEdit(@Param("groupId") String groupId, + @Param("gridId") String gridId, + @Param("groupName") String groupName); } 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 b3bb7d4a5e..624f0f73ef 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 @@ -1064,8 +1064,13 @@ public class ResiGroupServiceImpl extends BaseServiceImpl 0) { + // 已存在组名,拒绝提交 + throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "组名已存在"); + } + // 2.内容检查 - scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto); + //scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto); String app = loginUserUtil.getLoginUserApp(); String userId = loginUserUtil.getLoginUserId(); 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..94c2422159 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 @@ -397,4 +397,25 @@ GRID_ID = #{gridId} + + From f7044af28bac95c6c1313bac5b28f8cf4e94d604 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 3 Nov 2020 16:07:02 +0800 Subject: [PATCH 08/38] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E4=BA=91=E5=86=85=E5=AE=B9=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiGroupServiceImpl.java | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 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 624f0f73ef..a36df9e93c 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 @@ -359,38 +359,45 @@ public class ResiGroupServiceImpl extends BaseServiceImpl resiResult = - epmetUserFeignClient.getUserResiInfoDTO(resiParam); - String userName = ""; - if(resiResult.success() && null != resiResult.getData()){ - userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) - + (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName()); - } + //4.获取居民注册信息 + UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); + resiParam.setCustomerId(applyCreateGroupFormDTO.getCustomerId()); + resiParam.setUserId(applyCreateGroupFormDTO.getUserId()); + Result resiResult = + epmetUserFeignClient.getUserResiInfoDTO(resiParam); + String userName = ""; + if(resiResult.success() && null != resiResult.getData()){ + userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) + + (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName()); + } userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; - String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName()); - //3.2、插入一条待审核的操作记录 + String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName()); + //4.2、插入一条待审核的操作记录 ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); @@ -398,7 +405,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Tue, 3 Nov 2020 16:39:40 +0800 Subject: [PATCH 09/38] =?UTF-8?q?1.=E5=B0=8F=E7=BB=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=A2=9E=E5=8A=A0flyway=E8=84=9A=E6=9C=AC=20?= =?UTF-8?q?2.=E5=A2=9E=E5=8A=A0=E5=B0=8F=E7=BB=84=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=88=97=E8=A1=A8=E6=9D=83=E9=99=90=E5=AD=97?= =?UTF-8?q?=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/enums/RequirePermissionEnum.java | 1 + .../V0.0.4__createGroupSubmitRecord.sql | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__createGroupSubmitRecord.sql diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 284ef67e74..288526433e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -10,6 +10,7 @@ public enum RequirePermissionEnum { * 工作-基层治理-群组管理 */ WORK_GRASSROOTS_GROUP_AUDITINGLIST("work_grassroots_group_auditinglist", "基层治理:群组管理:待审核列表", "基层治理:群组管理:待审核列表查询"), + WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST("work_grassroots_group_edit_auditinglist", "基层治理:群组管理:小组变更待审核列表", "基层治理:群组管理:小组变更待审核列表"), WORK_GRASSROOTS_GROUP_GROUPSINTHEGRID("work_grassroots_group_groupsinthegrid", "基层治理:群组管理:本网格小组列表", "基层治理:群组管理:本网格小组列表查询"), WORK_GRASSROOTS_GROUP_AUDIT("work_grassroots_group_audit", "基层治理:群组管理:审核建组", "基层治理:群组管理:审核建组(通过或驳回)"), WORK_GRASSROOTS_GROUP_AUDITED("work_grassroots_group_audited", "基层治理:群组管理:审核历史", "基层治理:群组管理:审核历史列表查询"), diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__createGroupSubmitRecord.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__createGroupSubmitRecord.sql new file mode 100644 index 0000000000..1e53a7d6f1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__createGroupSubmitRecord.sql @@ -0,0 +1,24 @@ +CREATE TABLE `group_edit_submit_record` +( + `ID` varchar(64) NOT NULL, + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(64) DEFAULT NULL COMMENT '网格ID', + `GROUP_HEAD_PHOTO` varchar(255) NOT NULL COMMENT '头像', + `GROUP_NAME` varchar(10) NOT NULL COMMENT '小组名称', + `GROUP_INTRODUCTION` varchar(500) NOT NULL COMMENT '小组介绍', + `AUDIT_STATUS` varchar(30) NOT NULL COMMENT '审核状态。under_auditting:审核中,approved:通过,rejected:驳回', + `STAFF_ID` varchar(64) DEFAULT NULL COMMENT '审核人ID', + `REMARK` varchar(255) DEFAULT NULL COMMENT '回复', + `AUDIT_TIME` datetime DEFAULT NULL COMMENT '审核时间', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(8) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人 提交人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '修改人ID', + `UPDATED_TIME` datetime NOT NULL COMMENT '修改时间', + `READ_FLAG` varchar(8) NOT NULL COMMENT '已读read 未读unread', + `MESSAGE_TEXT` varchar(255) NOT NULL COMMENT '审核人员查看待审核列表时的文案,如:党员李华申请变更小组【原小组名】,请审核。', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='组编辑提交记录表' \ No newline at end of file From 21cacb49a88b41273fb867fb23cb778acbffdd2a Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 4 Nov 2020 11:00:39 +0800 Subject: [PATCH 10/38] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4=E7=BB=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=BC=96=E8=BE=91=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=90=8D=E5=AD=97=E5=92=8C=E4=BB=8B=E7=BB=8D=E7=9A=84?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java | 3 +++ .../resi-group-server/src/main/resources/logback-spring.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java index bb1251bf6a..a86f1bb9ae 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.resi.group.dto.group.form; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; @@ -28,9 +29,11 @@ public class EditGroupFormDTO { private String groupHeadPhoto; @NotBlank(message = "组名称不能为空", groups = { SubmitGroupEditVG.class }) + @Length(max = 10, message = "组名称长度不能超过10个字", groups = { SubmitGroupEditVG.class }) private String groupName; @NotBlank(message = "组介绍不能为空", groups = { SubmitGroupEditVG.class }) + @Length(max = 500, message = "组介绍长度不能超过500个字", groups = { SubmitGroupEditVG.class }) private String groupIntroduction; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/logback-spring.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/logback-spring.xml index 40fb0f8615..4232677864 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/logback-spring.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/logback-spring.xml @@ -134,7 +134,7 @@ - + From 61dfe891614e365753bdb4aa823eb376612315aa Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 4 Nov 2020 11:12:06 +0800 Subject: [PATCH 11/38] =?UTF-8?q?1.=E7=BB=84=E4=BF=A1=E6=81=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=8F=90=E4=BA=A4=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=AC=A1=E6=95=B0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/service/impl/ResiGroupServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 a36df9e93c..b5c505adbb 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 @@ -1065,6 +1065,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 4 Nov 2020 14:27:27 +0800 Subject: [PATCH 12/38] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=20=20?= =?UTF-8?q?=E7=BB=84=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/enums/RequirePermissionEnum.java | 2 + .../epmet/commons/tools/redis/RedisKeys.java | 7 ++ .../form/WorkPointVerificationFormDTO.java | 5 +- .../epmet/controller/ExchangeController.java | 3 +- .../epmet/controller/ResiGroupController.java | 48 ++++++++++++ .../group/form/CommonGridAndPageFormDTO.java | 3 + .../group/form/GovGroupSummarizeFromDTO.java | 6 ++ .../result/GroupEditionApplyResultDTO.java | 46 ------------ .../group/feign/ResiGroupOpenFeignClient.java | 35 +++++++++ .../ResiGroupOpenFeignClientFallback.java | 24 ++++++ .../group/controller/ResiGroupController.java | 38 ++++++++++ .../group/dao/GroupEditSubmitRecordDao.java | 32 ++++++++ .../epmet/modules/group/dao/ResiGroupDao.java | 1 + .../modules/group/redis/ResiGroupRedis.java | 26 +++++++ .../group/service/ResiGroupService.java | 22 +++++- .../service/impl/ResiGroupServiceImpl.java | 73 +++++++++++++++++-- .../epmet/modules/utils/ModuleConstant.java | 10 +++ .../mapper/group/GroupEditSubmitRecordDao.xml | 67 +++++++++++++++++ .../dto/result/UserBaseInfoResultDTO.java | 2 +- 19 files changed, 391 insertions(+), 59 deletions(-) delete mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 288526433e..9ddd2f9c8e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -11,6 +11,8 @@ public enum RequirePermissionEnum { */ WORK_GRASSROOTS_GROUP_AUDITINGLIST("work_grassroots_group_auditinglist", "基层治理:群组管理:待审核列表", "基层治理:群组管理:待审核列表查询"), WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST("work_grassroots_group_edit_auditinglist", "基层治理:群组管理:小组变更待审核列表", "基层治理:群组管理:小组变更待审核列表"), + WORK_GRASSROOTS_GROUP_EDIT_DETAIL("work_grassroots_group_edit_detail","基层治理:群组管理:变更申请","基层治理:群组管理:小组信息变更申请详情"), + WORK_GRASSROOTS_GROUP_EDIT_AUDIT("work_grassroots_group_edit_audit","基层治理:群组管理:变更审核","基层治理:群组管理:小组信息变更审核(通过或驳回)"), WORK_GRASSROOTS_GROUP_GROUPSINTHEGRID("work_grassroots_group_groupsinthegrid", "基层治理:群组管理:本网格小组列表", "基层治理:群组管理:本网格小组列表查询"), WORK_GRASSROOTS_GROUP_AUDIT("work_grassroots_group_audit", "基层治理:群组管理:审核建组", "基层治理:群组管理:审核建组(通过或驳回)"), WORK_GRASSROOTS_GROUP_AUDITED("work_grassroots_group_audited", "基层治理:群组管理:审核历史", "基层治理:群组管理:审核历史列表查询"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 463ec06427..444077098f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -353,4 +353,11 @@ public class RedisKeys { public static String getScreenIndexDataLockKey() { return rootPrefix.concat("stats:indexcal:lock"); } + + /** + * @Description 用户缓存Key + **/ + public static String getResiUserKey(String userId){ + return rootPrefix.concat("resi:user:").concat(userId); + } } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java index c9cbe06642..fdb09a68f3 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.Max; @@ -17,7 +18,9 @@ import java.io.Serializable; public class WorkPointVerificationFormDTO implements Serializable { private static final long serialVersionUID = -590822390667788693L; - @NotBlank(message = "获取不到用户Id",groups = ResiCommonUserIdFormDTO.UserIdGroup.class) + public interface WorkPointVerifyGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "获取不到用户Id",groups = WorkPointVerifyGroup.class) private String staffId; /** diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java index 8bb1d31cc5..4624abcaff 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java @@ -6,7 +6,6 @@ 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.PointVerificationFormDTO; -import com.epmet.dto.form.ResiCommonUserIdFormDTO; import com.epmet.dto.form.WorkPointVerificationFormDTO; import com.epmet.dto.result.PointVerificationResultDTO; import com.epmet.dto.result.WorkPointVerficationListResultDTO; @@ -54,7 +53,7 @@ public class ExchangeController { @PostMapping("recordmonthly") public Result getStaffVerificationRecordMonthly(@LoginUser TokenDto token,@RequestBody WorkPointVerificationFormDTO verificationParam){ verificationParam.setStaffId(token.getUserId()); - ValidatorUtils.validateEntity(verificationParam, ResiCommonUserIdFormDTO.UserIdGroup.class); + ValidatorUtils.validateEntity(verificationParam, WorkPointVerificationFormDTO.WorkPointVerifyGroup.class); return new Result().ok(pointVerificationLogService.getStaffVerificationRecordMonthly(verificationParam)); } 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 207ce24099..79fe109f52 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 @@ -11,6 +11,7 @@ import com.epmet.resi.group.dto.group.result.*; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -31,6 +32,8 @@ import java.util.List; public class ResiGroupController { @Autowired ResiGroupService resiGroupService; + @Autowired + ResiGroupOpenFeignClient groupOpenFeignClient; /** * 小组审核历史列表 * @@ -127,4 +130,49 @@ public class ResiGroupController { ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); return resiGroupService.disagreeApplying(disAgreeApplyGroupFormDTO); } + + /** + * @Description 工作端 查询组变更待审核列表 + * @param param + * @return + * @author wangc + * @date 2020.11.03 10:19 + */ + @PostMapping("edit-auditing-list") + //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST) + public Result> getEditAuditingList(@RequestBody CommonGridAndPageFormDTO param){ + ValidatorUtils.validateEntity(param, CommonGridAndPageFormDTO.GridPageGroup.class); + return groupOpenFeignClient.govEditAuditingList(param); + } + + /** + * @Description 工作端-查询小组修改信息的详情内容 + * @param param + * @returncom.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + @PostMapping("edit-auditing-detail") + //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_DETAIL) + public Result getEditAuditingDetail(@RequestBody GovGroupSummarizeFromDTO param){ + ValidatorUtils.validateEntity(param, GovGroupSummarizeFromDTO.GroupIdG.class); + return groupOpenFeignClient.govEditAuditingDetail(param); + } + + /** + * @Description 工作端-工作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + @PostMapping("audit-edit") + //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDIT) + public Result auditEdit(@LoginUser TokenDto tokenDto,@RequestBody GroupEditionAuditFormDTO param){ + param.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(param, GroupEditionAuditFormDTO.GroupEditionAuditGroup.class); + return groupOpenFeignClient.govAuditEdit(param); + } + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java index 87ed69166f..169073eb68 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.resi.group.dto.group.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -27,11 +28,13 @@ public class CommonGridAndPageFormDTO implements Serializable { /** * 页码 */ + @Min(1) private Integer pageNo; /** * 每页多少条数 */ + @Min(1) private Integer pageSize; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java index 7757d54e37..00163136a2 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java @@ -1,7 +1,9 @@ package com.epmet.resi.group.dto.group.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -12,8 +14,12 @@ import java.io.Serializable; @Data public class GovGroupSummarizeFromDTO implements Serializable { private static final long serialVersionUID = 1L; + + public interface GroupIdG extends CustomerClientShowGroup{} + /** * 小组id */ + @NotBlank(message = "群组Id不能为空",groups = GroupIdG.class) private String groupId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java deleted file mode 100644 index e8811f98c9..0000000000 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionApplyResultDTO.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.epmet.resi.group.dto.group.result; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @Description 工作端 - 群组审核列表返参DTO - * @ClassName GroupEditionApplyResultDTO - * @Auth wangc - * @Date 2020-11-03 09:06 - */ -@Data -public class GroupEditionApplyResultDTO implements Serializable { - private static final long serialVersionUID = 437035656436226205L; - - /** - * 组Id - */ - private String groupId; - - /** - * 原始组姓名 - */ - private String groupName; - - /** - * 原始组头像 - */ - private String groupHeadPhoto; - - /** - * 已读 未读 - */ - private String readFlag; - - /** - * 审核人员查看待审核列表时的文案 如:党员李华申请变更小组【原小组名】,请审核。 - */ - private String messageText; - - /** - * yyyy-MM-dd HH:mm:ss - */ - private String submitTime; -} 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..42288e61ea 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,19 @@ package com.epmet.resi.group.feign; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.CommonGridAndPageFormDTO; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupEditionAuditFormDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO; import org.springframework.cloud.openfeign.FeignClient; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -11,6 +21,31 @@ import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:16 */ +//@FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class,url = "localhost:8095") @FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class) public interface ResiGroupOpenFeignClient { + + @PostMapping("/resi/group/group/gov-edit-auditing-list") + Result> govEditAuditingList(@RequestBody CommonGridAndPageFormDTO param); + + /** + * @Description 查询小组修改信息的详情内容 + * @param param + * @returncom.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + @PostMapping("/resi/group/group/gov-edit-auditing-detail") + Result govEditAuditingDetail(@RequestBody GovGroupSummarizeFromDTO param); + + /** + * @Description 工作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + @PostMapping("/resi/group/group/gov-audit-edit") + Result govAuditEdit(@RequestBody GroupEditionAuditFormDTO param); + } 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..de1cb39021 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,8 +1,18 @@ 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.CommonGridAndPageFormDTO; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupEditionAuditFormDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -11,4 +21,18 @@ import org.springframework.stereotype.Component; */ @Component public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClient { + @Override + public Result> govEditAuditingList(CommonGridAndPageFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "govEditAuditingList", param); + } + + @Override + public Result govEditAuditingDetail(GovGroupSummarizeFromDTO param) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "govEditAuditingDetail", param); + } + + @Override + public Result govAuditEdit(GroupEditionAuditFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "govAuditEdit", param); + } } 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 98c572ad08..900fa91908 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 @@ -384,4 +384,42 @@ public class ResiGroupController { return new Result(); } + + /** + * @Description 工作端 查询组变更待审核列表 + * @param param + * @return + * @author wangc + * @date 2020.11.03 10:19 + */ + @PostMapping("gov-edit-auditing-list") + public Result> govEditAuditingList(@RequestBody CommonGridAndPageFormDTO param){ + return new Result>().ok(resiGroupService.getEditAuditingList(param)); + } + + /** + * @Description 工作端-查询小组修改信息的详情内容 + * @param param + * @returncom.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + @PostMapping("gov-edit-auditing-detail") + public Result govEditAuditingDetail(@RequestBody GovGroupSummarizeFromDTO param){ + return new Result().ok(resiGroupService.getEditAuditingDetail(param)); + } + + /** + * @Description 工作端-作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + @PostMapping("gov-audit-edit") + public Result govAuditEdit(@RequestBody GroupEditionAuditFormDTO param){ + resiGroupService.auditEdit(param); + return new Result(); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java index 37eb9f366e..71ba9175a3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java @@ -19,10 +19,12 @@ package com.epmet.modules.group.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.Date; +import java.util.List; /** * 组编辑提交记录表 @@ -49,4 +51,34 @@ public interface GroupEditSubmitRecordDao extends BaseDao selectGroupEditApplyList(@Param("gridId")String gridId); + + /** + * @Description 查询小组修改信息详情 + * @param + * @return com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:32 + */ + GroupEditSubmitRecordEntity selectEditDetail(@Param("groupId")String groupId,@Param("auditResult") String auditResult); + + /** + * @Description 审核群信息更改 + * @param groupId + * @param staffId + * @param auditStatus + * @param remark + * @return int + * @author wangc + * @date 2020.11.03 17:33 + */ + int updateAuditResult(@Param("groupId")String groupId,@Param("staffId") String staffId,@Param("auditStatus") String auditStatus,@Param("remark")String remark); } \ No newline at end of file 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 57fd94d9ab..2cbc78cae1 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 @@ -26,6 +26,7 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import java.util.List; /** 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 7f2442a8e7..6401780dfc 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 @@ -19,8 +19,12 @@ 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.commons.tools.utils.Result; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.group.service.ResiGroupStatisticalService; @@ -36,6 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import java.util.*; @@ -57,6 +62,9 @@ public class ResiGroupRedis { @Autowired private ResiGroupStatisticalService statisticalService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + public void delete(Object[] ids) { @@ -215,4 +223,22 @@ public class ResiGroupRedis { } }); } + + /** + * @Description 从缓存中获取用户的真实姓名 + * @param userId + * @return java.lang.String + * @author wangc + * @date 2020.11.03 15:27 + */ + public String getFullName(String userId){ + String fieldValue = (String)redisUtils.hGet(RedisKeys.getResiUserKey(userId),"realName"); + if(StringUtils.isNotBlank(fieldValue)) return fieldValue; + List userParam = new LinkedList<>(); userParam.add(userId); + Result> userCacheResult = epmetUserOpenFeignClient.queryUserBaseInfo(userParam); + if(userCacheResult.success() && !CollectionUtils.isEmpty(userCacheResult.getData())){ + return userCacheResult.getData().iterator().next().getRealName(); + } + return null; + } } \ No newline at end of file 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 b5227cdc3a..43bbca9b1b 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 @@ -301,9 +301,27 @@ public interface ResiGroupService extends BaseService { /** * @Description 工作端 查询组变更待审核列表 * @param param - * @return java.util.List + * @return * @author wangc * @date 2020.11.03 10:19 */ - List getEditAuditingList(CommonGridAndPageFormDTO param); + List getEditAuditingList(CommonGridAndPageFormDTO param); + + /** + * @Description 查询小组修改信息的详情内容 + * @param param + * @returncom.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + GroupEditionDetailResultDTO getEditAuditingDetail(GovGroupSummarizeFromDTO param); + + /** + * @Description 工作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + void auditEdit(GroupEditionAuditFormDTO param); } 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 ed535453db..def31ee6ba 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 @@ -32,11 +32,9 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.commons.tools.utils.*; import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -71,6 +69,7 @@ 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.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -139,6 +138,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl + * @return * @author wangc * @date 2020.11.03 10:19 */ @Override - public List getEditAuditingList(CommonGridAndPageFormDTO param) { + public List getEditAuditingList(CommonGridAndPageFormDTO param) { + return Optional.ofNullable(PageHelper.startPage(null == param.getPageNo() ? NumConstant.ONE : param.getPageNo() , null == param.getPageSize() ? NumConstant.TWELVE : param.getPageSize()) + .doSelectPage(() -> { + groupEditSubmitRecordDao.selectGroupEditApplyList(param.getGridId());}).getResult()).orElse(new LinkedList<>()) + .stream().map(o -> { return (ApplyingGroupResultDTO)o; }).collect(Collectors.toList()); + } - return null; + /** + * @Description 查询小组修改信息的详情内容 不加事务! + * @param param + * @return com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + @Override + public GroupEditionDetailResultDTO getEditAuditingDetail(GovGroupSummarizeFromDTO param) { + GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null); + if(null == edit) { + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.getEditAuditingDetail,未找到小组变更信息记录,传参:{}",JSON.toJSONString(param)); + return null;} + //取消未读状态 + GroupEditSubmitRecordEntity _update = new GroupEditSubmitRecordEntity(); + _update.setId(edit.getId());_update.setReadFlag(ModuleConstant.READ); + groupEditSubmitRecordDao.updateById(_update); + GroupEditionDetailResultDTO result = ConvertUtils.sourceToTarget(edit, GroupEditionDetailResultDTO.class); + result.setGroupLeaderName(resiGroupRedis.getFullName(edit.getCreatedBy())); + return result; } + + /** + * @Description 工作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void auditEdit(GroupEditionAuditFormDTO param) { + if(StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT) && StringUtils.isBlank(param.getRemark())){ + throw new RenException("拒绝理由不能为空"); + } + int affectedRows = groupEditSubmitRecordDao.updateAuditResult(param.getGroupId(),param.getStaffId(),param.getAuditResult(),param.getRemark()); + if(affectedRows <= NumConstant.ZERO){ + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,更新组编辑记录时受影响行数小于1,传参:{}",JSON.toJSONString(param)); + throw new RenException("更新组编辑记录时受影响行数小于1"); + } + if(!StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT)){ + //同意 + GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),param.getAuditResult()); + if(null == edit){ + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,找不到待审核的组更新记录,传参:{}",JSON.toJSONString(param)); + throw new RenException("找不到待审核的组更新记录"); + } + ResiGroupEntity _update = ConvertUtils.sourceToTarget(edit,ResiGroupEntity.class); + _update.setId(param.getGroupId()); + baseDao.updateById(_update); + } + + } + } 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..6f6a94d7ed 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,14 @@ public interface ModuleConstant extends Constant { String FIELD_OPERATION_TYPE = "OPERATION_TYPE"; String CLOSED_TOPIC_REASON_PREFIX="话题已关闭:"; + + /** + * 审核操作 同意 + */ + String AUDITING_OPERATION_APPROVAL = "approved"; + + /** + * 审核操作 拒绝 + */ + String AUDITING_OPERATION_REJECT = "rejected"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml index 1b689eb363..5485a96af6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml @@ -66,5 +66,72 @@ limit 1 + + + + + + + + UPDATE + group_edit_submit_record + SET + AUDIT_STATUS = #{auditStatus}, + STAFF_ID = #{staffId}, + + REMARK = #{remark}, + + AUDIT_TIME = NOW(),UPDATED_TIME = NOW(),UPDATED_BY = #{staffId} + WHERE + DEL_FLAG = '0' + AND + GROUP_ID = #{groupId} + AND + AUDIT_STATUS = 'under_auditIng' + AND + STAFF_ID IS NULL + LIMIT 1 + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java index c674685ee5..2c23abe08b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBaseInfoResultDTO.java @@ -1,6 +1,6 @@ package com.epmet.dto.result; -import com.fasterxml.jackson.annotation.JsonIgnore; + import lombok.Data; import java.io.Serializable; From 361edcb801b4988fb89db181d7f3cc928a452a07 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 4 Nov 2020 15:02:12 +0800 Subject: [PATCH 13/38] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91=E5=BC=82=E5=B8=B8=E6=8A=9B?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/exception/EpmetErrorCode.java | 8 ++++++-- .../modules/group/service/impl/ResiGroupServiceImpl.java | 9 ++++----- 2 files changed, 10 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 1976ca3337..5a261b93bf 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 @@ -41,7 +41,6 @@ public enum EpmetErrorCode { MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"), MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"), - GROUP_EDIT_ERROR(8107,"组信息编辑失败"), ORG_IS_NOT_NULL(8107,"党组织关系不能为空"), CANNOT_DELETE_PARTY_BRANCH(8108,"当前支部存在党员,不允许删除"), @@ -123,7 +122,12 @@ public enum EpmetErrorCode { SELECT_CUSTOMER_ERROR(8652,"未查询到注册客户信息"), SELECT_AGENCY_ERROR(8653,"根据客户信息未查询到注册客户组织信息"), SELECT_USER_ERROR(8654,"根据客户信息未查询到注册客户管理员信息"), - UPDATE_CUSTOMER_ERROR(8655,"更新注册客户信息为已完成初始化失败"); + UPDATE_CUSTOMER_ERROR(8655,"更新注册客户信息为已完成初始化失败"), + + GROUP_EDIT_ERROR(9000,"组信息编辑失败"), + GROUP_NOT_EXISTS(9001,"该组不存在"), + GROUP_IN_AUDITING(9002,"该组已提交编辑,处于待审核状态,完成审核前不可再次提交"), + GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限"); private int code; 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 b5c505adbb..03a5f0cd6f 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 @@ -1062,27 +1062,26 @@ public class ResiGroupServiceImpl extends BaseServiceImpl 0) { // 已存在组名,拒绝提交 - throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "组名已存在"); + throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(), EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg()); } Date now = new Date(); int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now)); if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) { // 达到最大编辑次数了 - throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), - String.format("本月可用修改次数为%s次,您已使用%s次", GroupLimitConstant.EDIT_NUM_LIMIT_MONTH, usedEditNum)); + throw new RenException(EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getCode(), EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getMsg()); } // 3.内容检查 From dba6589ffa794577b12af879d72ff699d6065fb1 Mon Sep 17 00:00:00 2001 From: wangchao Date: Wed, 4 Nov 2020 15:24:24 +0800 Subject: [PATCH 14/38] =?UTF-8?q?=E7=BB=84=E5=8F=98=E6=9B=B4=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=EF=BC=8C=E4=B8=BB=E9=A1=B5=E7=BA=A2=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/ResiGroupController.java | 6 +++--- .../group/service/impl/ResiGroupServiceImpl.java | 16 ++++++++++------ .../mapper/group/GroupEditSubmitRecordDao.xml | 5 +++-- 3 files changed, 16 insertions(+), 11 deletions(-) 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 79fe109f52..193e5bac1e 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 @@ -139,7 +139,7 @@ public class ResiGroupController { * @date 2020.11.03 10:19 */ @PostMapping("edit-auditing-list") - //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST) + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST) public Result> getEditAuditingList(@RequestBody CommonGridAndPageFormDTO param){ ValidatorUtils.validateEntity(param, CommonGridAndPageFormDTO.GridPageGroup.class); return groupOpenFeignClient.govEditAuditingList(param); @@ -153,7 +153,7 @@ public class ResiGroupController { * @date 2020.11.03 14:10 */ @PostMapping("edit-auditing-detail") - //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_DETAIL) + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_DETAIL) public Result getEditAuditingDetail(@RequestBody GovGroupSummarizeFromDTO param){ ValidatorUtils.validateEntity(param, GovGroupSummarizeFromDTO.GroupIdG.class); return groupOpenFeignClient.govEditAuditingDetail(param); @@ -167,7 +167,7 @@ public class ResiGroupController { * @date 2020.11.03 16:02 */ @PostMapping("audit-edit") - //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDIT) + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDIT) public Result auditEdit(@LoginUser TokenDto tokenDto,@RequestBody GroupEditionAuditFormDTO param){ param.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(param, GroupEditionAuditFormDTO.GroupEditionAuditGroup.class); 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 00b85fcda6..3dad3f4555 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 @@ -1108,6 +1108,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 4 Nov 2020 17:06:22 +0800 Subject: [PATCH 15/38] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/group/service/impl/ResiGroupServiceImpl.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/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 3dad3f4555..a7067e7f6d 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 @@ -1279,7 +1279,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Thu, 5 Nov 2020 10:54:00 +0800 Subject: [PATCH 16/38] =?UTF-8?q?=E6=89=93=E5=BC=80=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=B0=8F=E7=BB=84=E4=BF=A1=E6=81=AF=E7=9A=84=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/group/service/impl/ResiGroupServiceImpl.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/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index a7067e7f6d..b4930b337a 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 @@ -1087,7 +1087,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Thu, 12 Nov 2020 14:12:09 +0800 Subject: [PATCH 17/38] =?UTF-8?q?=E7=BB=84=E4=BF=AE=E6=94=B9=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E=E5=88=A0=E9=99=A4=E8=AF=A5?= =?UTF-8?q?=E7=BB=84=E4=BF=A1=E6=81=AF=E7=9A=84=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/modules/group/redis/ResiGroupRedis.java | 10 ++++++++++ .../group/service/impl/ResiGroupServiceImpl.java | 1 + 2 files changed, 11 insertions(+) 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 6401780dfc..03dcc4ecba 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 @@ -132,6 +132,16 @@ public class ResiGroupRedis { return null; } + /** + * @Description 删除组缓存 + * @param groupId + * @return void + * @author wangc + * @date 2020.11.12 14:07 + */ + public void delGroup(String groupId){ + redisUtils.delete(ResiGroupRedisKeys.getResiGroupInfoKey(groupId)); + } /** * @param gridId 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 b4930b337a..f9ce49ff21 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 @@ -1297,6 +1297,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Fri, 13 Nov 2020 10:19:29 +0800 Subject: [PATCH 18/38] =?UTF-8?q?=E5=9F=BA=E5=B1=82=E6=B2=BB=E7=90=86-?= =?UTF-8?q?=E7=BE=A4=E7=BB=84=E7=AE=A1=E7=90=86=E7=BA=A2=E7=82=B9=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=EF=BC=88+=E5=8F=98=E6=9B=B4=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8D=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/feign/ResiGroupFeignClient.java | 2 +- .../com/epmet/service/impl/RemindServiceImpl.java | 3 +-- .../group/controller/ResiGroupController.java | 2 +- .../modules/group/dao/GroupEditSubmitRecordDao.java | 8 ++++++++ .../group/service/impl/ResiGroupServiceImpl.java | 7 ++++--- .../mapper/group/GroupEditSubmitRecordDao.xml | 12 ++++++++++++ 6 files changed, 27 insertions(+), 7 deletions(-) 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 18815b635a..2fc38efdf0 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 @@ -143,7 +143,7 @@ public interface ResiGroupFeignClient { * @param gridIdList * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei - * @Description 查询网格下待审核的小组总数 + * @Description 查询网格下待审核的小组总数+变更小组信息申请数 * @Date 2020/5/13 15:49 **/ @PostMapping(value = "/resi/group/group/groupprocessingcount",consumes = MediaType.APPLICATION_JSON_VALUE) diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/RemindServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/RemindServiceImpl.java index e7cfdcbd6c..d9a22f75cd 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/RemindServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/RemindServiceImpl.java @@ -104,8 +104,7 @@ public class RemindServiceImpl implements RemindService { } } }else{ - logger.error(String.format("调用%s服务,查询网格%s待审核小组数失败code%s,msg:", ServiceConstant.RESI_GROUP_SERVER, gridIdList.get(0), groupProcessingCountResult.getCode(), - groupProcessingCountResult.getMsg())); + logger.error(String.format("查询群组管理待办事项数失败,%s",groupProcessingCountResult.getMsg())); } return false; } 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 900fa91908..a32e44626b 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 @@ -297,7 +297,7 @@ public class ResiGroupController { * @param gridIdList * @return com.epmet.commons.tools.utils.Result> * @Author yinzuomei - * @Description 传入网格id列表,返回每个网格的待审核小组总数 + * @Description 传入网格id列表,返回每个网格的待审核小组总数+变更小组信息申请数 * @Date 2020/5/13 21:33 **/ @PostMapping("groupprocessingcount") diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java index 71ba9175a3..829beba4f7 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java @@ -81,4 +81,12 @@ public interface GroupEditSubmitRecordDao extends BaseDao + + + \ No newline at end of file From cd6f50a9dede851c708f8284a9ff871b7550007d Mon Sep 17 00:00:00 2001 From: wxz Date: Sat, 14 Nov 2020 13:55:58 +0800 Subject: [PATCH 19/38] =?UTF-8?q?=E4=BF=AE=E6=94=B9:=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=BB=84=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E5=88=A4=E6=96=AD=E5=BD=93=E5=89=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=BA=BA=E6=98=AF=E5=90=A6=E6=98=AF=E7=BB=84=E9=95=BF?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E6=9C=89=E7=BB=84=E9=95=BF=E6=89=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/group/controller/ResiGroupController.java | 4 ++-- .../epmet/modules/group/service/ResiGroupService.java | 2 +- .../modules/group/service/impl/ResiGroupServiceImpl.java | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) 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 a32e44626b..8f6620be9d 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 @@ -378,9 +378,9 @@ public class ResiGroupController { * @return */ @PostMapping("submit-edit") - public Result submitGroupEdit(@RequestBody EditGroupFormDTO form){ + public Result submitGroupEdit(@RequestBody EditGroupFormDTO form, @LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(form, EditGroupFormDTO.SubmitGroupEditVG.class); - resiGroupService.submitGroupEdit(form.getGroupId(), form.getGroupName(), form.getGroupHeadPhoto(), form.getGroupIntroduction()); + resiGroupService.submitGroupEdit(form.getGroupId(), form.getGroupName(), form.getGroupHeadPhoto(), form.getGroupIntroduction(), tokenDto.getUserId()); 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 43bbca9b1b..b17f2c7cf1 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 @@ -296,7 +296,7 @@ public interface ResiGroupService extends BaseService { GroupDetailResultDTO getGroupDetail(String groupId); - void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction); + void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId); /** * @Description 工作端 查询组变更待审核列表 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 2e8ee1216b..39acacad26 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 @@ -1061,13 +1061,20 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 18 Nov 2020 11:07:16 +0800 Subject: [PATCH 20/38] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=B0=86?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=9D=83=E9=99=90=E5=90=8C=E6=AD=A5=E5=88=B0?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=AE=A2=E6=88=B7=E7=9A=84=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../form/AccessConfigAsyncDefaultFormDTO.java | 17 ++++++ .../controller/AccessConfigController.java | 19 +++++++ .../epmet/service/AccessConfigService.java | 2 + .../service/impl/AccessConfigServiceImpl.java | 57 +++++++++++++++++++ .../src/main/resources/bootstrap.yml | 4 ++ .../epmet/feign/EpmetUserOpenFeignClient.java | 9 +++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../controller/GovStaffRoleController.java | 12 ++++ .../java/com/epmet/dao/GovStaffRoleDao.java | 2 + .../epmet/service/GovStaffRoleService.java | 2 + .../service/impl/GovStaffRoleServiceImpl.java | 11 ++++ .../main/resources/mapper/GovStaffRoleDao.xml | 8 +++ 13 files changed, 149 insertions(+) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.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..bce453d0af 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 @@ -110,6 +110,7 @@ public enum EpmetErrorCode { OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"), OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"), OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"), + USER_LIST_ROLES_BY_KEY_FAIL(8715, "根据角色key查询角色列表失败"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java new file mode 100644 index 0000000000..cf458aa878 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class AccessConfigAsyncDefaultFormDTO { + @NotBlank(message = "角色Key不能为空") + private String roleKey; + + @NotBlank(message = "操作Key不能为空") + private String operationKey; + + private List scopeKeys; +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java index ec11eaa26f..39d1305138 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java @@ -12,6 +12,7 @@ import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Set; @@ -116,4 +117,22 @@ public class AccessConfigController { return new Result(); } + /** + * @Description 将默认的角色操作和范围同步给具体的角色 + * @return + * @author wxz + * @date 2020.11.17 17:41 + */ + @PostMapping("role-ope-and-scopes/async-from-default") + public Result asyncRoleOpeAndScopesFromDefault(@RequestBody AccessConfigAsyncDefaultFormDTO form ) { + ValidatorUtils.validateEntity(form); + String roleKey = form.getRoleKey(); + String operationKey = form.getOperationKey(); + List scopeKeys = form.getScopeKeys(); + + accessConfigService.asyncRoleOpeAndScopesFromDefault(roleKey, operationKey, scopeKeys); + return new Result(); + } + + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java index 3fc28b675f..2c2c1518d3 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java @@ -25,4 +25,6 @@ public interface AccessConfigService { List listOpeDefaultScopes4Role(String roleKey, String operationKey); void saveOpeDefaultScopes(String roleKey, String operationKey, List scopeKeys); + + void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java index 7b635cedf0..bc53201ce0 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java @@ -2,12 +2,14 @@ package com.epmet.service.impl; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.*; import com.epmet.dto.result.*; import com.epmet.entity.OperationScopeDefaultEntity; import com.epmet.entity.RoleOperationDefaultEntity; import com.epmet.entity.RoleOperationEntity; import com.epmet.entity.RoleScopeEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessConfigService; import org.slf4j.Logger; @@ -41,6 +43,9 @@ public class AccessConfigServiceImpl implements AccessConfigService { @Autowired private OperationScopeDefaultDao operationScopeDefaultDao; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Override public List listOpesByRole(String roleId) { return roleOperationDao.listOpesForAccessConfig(roleId); @@ -196,4 +201,56 @@ public class AccessConfigServiceImpl implements AccessConfigService { operationScopeDefaultDao.insert(entity); } } + + /** + * @Description 将默认的角色操作和范围同步给具体的角色 + * @return + * @author wxz + * @date 2020.11.17 17:41 + */ + @Override + public void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys) { + Result> rolesResult = epmetUserOpenFeignClient.listRolesByRoleKey(roleKey); + if (!rolesResult.success()) { + String msg = "调用user服务,根据key查询角色列表失败"; + throw new RenException(EpmetErrorCode.USER_LIST_ROLES_BY_KEY_FAIL.getCode(), msg, msg, + RenException.MessageMode.CODE_INTERNAL_EXTERNAL.CODE_INTERNAL_EXTERNAL); + } + + List roles = rolesResult.getData(); + List roleIds2Add = roles.stream().map(GovStaffRoleResultDTO::getRoleId).collect(Collectors.toList()); + asyncRoleOpeAndScopesFromDefault(roleIds2Add, operationKey, scopeKeys); + } + + /** + * @Description 将默认的角色操作和范围同步给具体的角色 + * @return + * @author wxz + * @date 2020.11.17 17:38 + */ + @Transactional(rollbackFor = Exception.class) + public void asyncRoleOpeAndScopesFromDefault(List roleIds, String operationKey, List scopeKeys) { + for (String roleId : roleIds) { + // 只给没有添加该权限的用户赋予该权限,已经添加了和添加了又取消的不操作 + RoleOperationEntity roleOpe = roleOperationDao.getRoleOpe(roleId, operationKey); + if (roleOpe == null) { + // 没有该操作,则添加 + RoleOperationEntity roleOperation = new RoleOperationEntity(); + roleOperation.setOperationKey(operationKey); + roleOperation.setRoleId(roleId); + roleOperationDao.insert(roleOperation); + } + for (String scopeKey : scopeKeys) { + // 没有的话则添加 + RoleScopeEntity roleScopeInDb = roleScopeDao.getByRoleIdAndOpeKey(roleId, operationKey, scopeKey); + if (roleScopeInDb == null) { + RoleScopeEntity roleScopeEntity = new RoleScopeEntity(); + roleScopeEntity.setOperationKey(operationKey); + roleScopeEntity.setRoleId(roleId); + roleScopeEntity.setScopeKey(scopeKey); + roleScopeDao.insert(roleScopeEntity); + } + } + } + } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml index e8a2685e37..6fcc5979f5 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml @@ -119,3 +119,7 @@ pagehelper: helper-dialect: mysql reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 +#feign 日志需要该配置 +logging: + level: + com.epmet: debug \ No newline at end of file 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..7eeef44d42 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,13 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/customerstaff/getstaffbasicinfo") Result getStaffBasicInfo(@RequestBody StaffBasicInfoFromDTO fromDTO); + + /** + * @Description 根据角色key查询具有该key的所有角色列表 + * @return + * @author wxz + * @date 2020.11.17 16:20 + */ + @PostMapping("/epmetuser/govstaffrole/list-roles-by-rolekey/{role-key}") + Result> listRolesByRoleKey(@PathVariable("role-key") String roleKey); } 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..a76e847ff4 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> listRolesByRoleKey(String roleKey) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "listRolesByRoleKey", roleKey); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 81a79972c0..40cab6cb5a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -100,4 +100,16 @@ public class GovStaffRoleController { return new Result(); } + /** + * @Description 根据角色key查询具有该key的所有角色列表 + * @return + * @author wxz + * @date 2020.11.17 16:20 + */ + @PostMapping("list-roles-by-rolekey/{role-key}") + public Result> listRolesByRoleKey(@PathVariable("role-key") String roleKey) { + List roles = govStaffRoleService.listRolesByRoleKey(roleKey); + return new Result>().ok(roles); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index aab3c4ae30..f7875d63d5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -75,4 +75,6 @@ public interface GovStaffRoleDao extends BaseDao { int updateColumnsById(@Param("roleId") String roleId, @Param("roleName") String roleName); int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort); + + List listRolesByRoleKey(@Param("roleKey") String roleKey); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index eef3e6f0b0..346fad61b2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -138,4 +138,6 @@ public interface GovStaffRoleService extends BaseService { int updateRole(String roleId, String roleName); void saveSortOrder(List roleIdList); + + List listRolesByRoleKey(String roleKey); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 6a22460731..726be2370d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -222,4 +222,15 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByRoleKey(String roleKey) { + return govStaffRoleDao.listRolesByRoleKey(roleKey); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 1a8c27b7d0..40539c565f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -103,4 +103,12 @@ ) + + + \ No newline at end of file From 858e1b58c9e1e329ebd61aa07d0f4b63e9f5255d Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 18 Nov 2020 13:50:07 +0800 Subject: [PATCH 21/38] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=9D=83=E9=99=90=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=EF=BC=8Capi=E5=92=8C=E6=96=B9=E6=B3=95=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aultFormDTO.java => AccessConfigAdd4RoletFormDTO.java} | 2 +- .../java/com/epmet/controller/AccessConfigController.java | 8 ++++---- .../main/java/com/epmet/service/AccessConfigService.java | 2 +- .../com/epmet/service/impl/AccessConfigServiceImpl.java | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) rename epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/{AccessConfigAsyncDefaultFormDTO.java => AccessConfigAdd4RoletFormDTO.java} (87%) diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java similarity index 87% rename from epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java rename to epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java index cf458aa878..85b9e9d68d 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAsyncDefaultFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigAdd4RoletFormDTO.java @@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank; import java.util.List; @Data -public class AccessConfigAsyncDefaultFormDTO { +public class AccessConfigAdd4RoletFormDTO { @NotBlank(message = "角色Key不能为空") private String roleKey; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java index 39d1305138..76a7886947 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java @@ -118,19 +118,19 @@ public class AccessConfigController { } /** - * @Description 将默认的角色操作和范围同步给具体的角色 + * @Description 给角色添加操作权限和操作范围 * @return * @author wxz * @date 2020.11.17 17:41 */ - @PostMapping("role-ope-and-scopes/async-from-default") - public Result asyncRoleOpeAndScopesFromDefault(@RequestBody AccessConfigAsyncDefaultFormDTO form ) { + @PostMapping("add-ope-and-scopes-4role") + public Result addOpeAndScopes4Role(@RequestBody AccessConfigAdd4RoletFormDTO form) { ValidatorUtils.validateEntity(form); String roleKey = form.getRoleKey(); String operationKey = form.getOperationKey(); List scopeKeys = form.getScopeKeys(); - accessConfigService.asyncRoleOpeAndScopesFromDefault(roleKey, operationKey, scopeKeys); + accessConfigService.addOpeAndScopes4Role(roleKey, operationKey, scopeKeys); return new Result(); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java index 2c2c1518d3..508f3ad45f 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java @@ -26,5 +26,5 @@ public interface AccessConfigService { void saveOpeDefaultScopes(String roleKey, String operationKey, List scopeKeys); - void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys); + void addOpeAndScopes4Role(String roleKey, String operationKey, List scopeKeys); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java index bc53201ce0..79d35436a8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java @@ -203,13 +203,13 @@ public class AccessConfigServiceImpl implements AccessConfigService { } /** - * @Description 将默认的角色操作和范围同步给具体的角色 + * @Description 给角色添加操作权限和操作范围 * @return * @author wxz * @date 2020.11.17 17:41 */ @Override - public void asyncRoleOpeAndScopesFromDefault(String roleKey, String operationKey, List scopeKeys) { + public void addOpeAndScopes4Role(String roleKey, String operationKey, List scopeKeys) { Result> rolesResult = epmetUserOpenFeignClient.listRolesByRoleKey(roleKey); if (!rolesResult.success()) { String msg = "调用user服务,根据key查询角色列表失败"; @@ -219,7 +219,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { List roles = rolesResult.getData(); List roleIds2Add = roles.stream().map(GovStaffRoleResultDTO::getRoleId).collect(Collectors.toList()); - asyncRoleOpeAndScopesFromDefault(roleIds2Add, operationKey, scopeKeys); + addOpeAndScopes4Role(roleIds2Add, operationKey, scopeKeys); } /** @@ -229,7 +229,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { * @date 2020.11.17 17:38 */ @Transactional(rollbackFor = Exception.class) - public void asyncRoleOpeAndScopesFromDefault(List roleIds, String operationKey, List scopeKeys) { + public void addOpeAndScopes4Role(List roleIds, String operationKey, List scopeKeys) { for (String roleId : roleIds) { // 只给没有添加该权限的用户赋予该权限,已经添加了和添加了又取消的不操作 RoleOperationEntity roleOpe = roleOperationDao.getRoleOpe(roleId, operationKey); From d037b228fc9f0e867215be1ba2bf28ddbd1e4c0c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 20 Nov 2020 09:51:06 +0800 Subject: [PATCH 22/38] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=B1=8F=E8=94=BD=E4=BF=A1=E6=81=AF?= =?UTF-8?q?,=E5=B1=8F=E8=94=BD=E7=90=86=E7=94=B1=E5=89=8D=E9=9D=A2?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=20"=E8=AF=9D=E9=A2=98=E5=B7=B2=E5=B1=8F?= =?UTF-8?q?=E8=94=BD=EF=BC=9A"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/topic/service/impl/ResiTopicServiceImpl.java | 2 +- .../src/main/java/com/epmet/modules/utils/ModuleConstant.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 a6a4139ffc..0188bb1a92 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 @@ -707,7 +707,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl records = resiTopicOperationDao.selectList(queryWrapper); if(null != records && records.size() > NumConstant.ZERO){ - hiddenDetailDTO.setHiddenReason(records.get(0).getOperationReason()); + hiddenDetailDTO.setHiddenReason(String.format("%s%s",ModuleConstant.HIDDEN_TOPIC_REASON_PREFIX,records.get(0).getOperationReason())); hiddenDetailDTO.setHiddenDateTime(records.get(0).getCreatedTime().getTime()/NumConstant.ONE_THOUSAND); ResiGroupMemberInfoRedisDTO hiddenBy = resiGroupMemberRedis.get(topicDetail.getGroupId(),records.get(0).getCreatedBy()); 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 9fa1359bdf..94cc6c4caf 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 @@ -329,5 +329,7 @@ public interface ModuleConstant extends Constant { String CLOSED_TOPIC_REASON_PREFIX = "话题已关闭:"; + String HIDDEN_TOPIC_REASON_PREFIX = "话题已屏蔽:"; + String CREATE_ISSUE_ERROR = "创建议题失败"; } From 7608d289570746f94fedf3e05ced83c8eacad2ee Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 10:02:01 +0800 Subject: [PATCH 23/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/UserIdAndBadgeIdResultDTO.java | 17 +++++++++++++++++ .../java/com/epmet/dao/ResiUserBadgeDao.java | 3 ++- .../service/impl/UserBadgeServiceImpl.java | 10 ++++++++-- .../main/resources/mapper/ResiUserBadgeDao.xml | 4 ++-- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserIdAndBadgeIdResultDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserIdAndBadgeIdResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserIdAndBadgeIdResultDTO.java new file mode 100644 index 0000000000..e4bbba6566 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserIdAndBadgeIdResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/20 上午9:54 + */ +@Data +public class UserIdAndBadgeIdResultDTO implements Serializable { + + private String userId; + + private String badgeId; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java index 0ff7ee2c0d..310adb2330 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ResiUserBadgeDTO; +import com.epmet.dto.result.UserIdAndBadgeIdResultDTO; import com.epmet.entity.ResiUserBadgeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -43,6 +44,6 @@ public interface ResiUserBadgeDao extends BaseDao { */ void insertResiUserBadge(@Param("badges")List badges); - List selectUserIds(); + List selectUserIds(); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 44e1ac34ff..d6f7cfb7b8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -150,7 +150,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { */ @Override public void initPartyMemberBadge(String userId,TokenDto tokenDto){ - List userIds = resiUserBadgeDao.selectUserIds(); + List userIds = resiUserBadgeDao.selectUserIds(); List badges = new ArrayList<>(); String partyBadgeId = badgeDao.getPartyBadgeId(null); if (StringUtils.isEmpty(userId)) { @@ -159,7 +159,13 @@ public class UserBadgeServiceImpl implements UserBadgeService { return; } if (!CollectionUtils.isEmpty(userIds)) { - userIds.stream().forEach(u -> partyMemberUserIds.stream().filter(p -> u.equals(p.getUserId())).forEach(p -> p.setReStatus(true))); + userIds.forEach(u -> { + partyMemberUserIds.forEach(p -> { + if (u.getUserId().equals(p.getUserId()) && u.getBadgeId().equals(partyBadgeId)){ + p.setReStatus(true); + } + }); + }); } List reUserIds = partyMemberUserIds.stream().filter(p -> !p.getReStatus()).map(p -> p.getUserId()).collect(Collectors.toList()); List userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(reUserIds); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml index d67b6d08d0..912e6ed558 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml @@ -41,8 +41,8 @@ - + SELECT USER_ID,BADGE_ID FROM resi_user_badge WHERE DEL_FLAG = 0 From aad2545c730ace162c5b173e5cac0d5cd0314e32 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 10:04:08 +0800 Subject: [PATCH 24/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/UserBadgeServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index d6f7cfb7b8..1cb0b2dbe8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -168,6 +168,9 @@ public class UserBadgeServiceImpl implements UserBadgeService { }); } List reUserIds = partyMemberUserIds.stream().filter(p -> !p.getReStatus()).map(p -> p.getUserId()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(reUserIds)){ + return; + } List userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(reUserIds); if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) { log.error("未查询到党员基本信息......"); From 873faa606f97a42ad6d8b98e1157973975fdc56d Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Fri, 20 Nov 2020 10:17:35 +0800 Subject: [PATCH 25/38] =?UTF-8?q?=E4=B8=8B=E8=B0=83=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E7=9A=84=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/WxmpMessageServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java index d8e6a43485..0d390bfc31 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java @@ -278,12 +278,12 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { decrease = wxmpWorkUserSubscribeDao.decreaseWorkSubscribeCount(openId, templateId, customerId, 1,userId); } if (decrease == 0) { - logger.error("消息{}发送成功但订阅条数-1失败", JSON.toJSONString(msg)); + logger.warn("消息{}发送成功但订阅条数-1失败", JSON.toJSONString(msg)); } //存表 int saveRes = wxmpMsgSendRecordService.saveRecord(initRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS)); if (saveRes == 0) { - logger.error("消息{}发送成功但存入记录表失败", JSON.toJSONString(msg)); + logger.warn("消息{}发送成功但存入记录表失败", JSON.toJSONString(msg)); } } else { //发送失败 @@ -296,7 +296,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { clear = wxmpWorkUserSubscribeDao.clearWorkSubscribeCount(openId, templateId, customerId,userId); } if (clear == 0) { - logger.error("消息{}发送失败且清空订阅条数失败", JSON.toJSONString(msg)); + logger.warn("消息{}发送失败且清空订阅条数失败", JSON.toJSONString(msg)); } } @@ -316,11 +316,11 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { wxmpMsgSendRecordEntity.setReason(errMsg); int saveRes = wxmpMsgSendRecordService.saveRecord(wxmpMsgSendRecordEntity); if (saveRes == 0) { - logger.error("消息{}发送失败且存入记录表失败", JSON.toJSONString(msg)); + logger.warn("消息{}发送失败且存入记录表失败", JSON.toJSONString(msg)); } } - logger.error("消息:{}发送失败,原因是:{}", JSON.toJSONString(msg), errMsg); + logger.warn("消息:{}发送失败,原因是:{}", JSON.toJSONString(msg), errMsg); continue; } } From 5311a12228d1fc480d1330ecfcabda701aed793d Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Nov 2020 10:54:13 +0800 Subject: [PATCH 26/38] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/UserBadgeServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 1cb0b2dbe8..208611a01f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -278,7 +278,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { private void validateParams(CertificationAddFormDTO certificationAddFormDTO, AuthFieldFormDTO authFieldFormDTO) { List authFieldResultDTOS = this.authField(authFieldFormDTO); if (CollectionUtils.isEmpty(authFieldResultDTOS)) { - throw new RenException("该徽章配置配置错误"); + throw new RenException("该徽章配置配置错误,参数参数:{}", JSON.toJSONString(authFieldFormDTO)); } Set requiredColumns = authFieldResultDTOS.stream() .filter(o -> NumConstant.ONE_STR.equals(o.getIsRequired())) From 01a42497c34f0af8efe6b1f1a80ce7d5f4da0281 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 14:05:55 +0800 Subject: [PATCH 27/38] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=BE=BD=E7=AB=A0?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/redis/UserBadgeRedis.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index 16644fa332..13a8dd8b2c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -178,7 +178,7 @@ public class UserBadgeRedis { * @date 2020.11.05 13:37 */ public long pushOrRemoveUserBadge4List(String userId, String badgeId, String customerId) { - List orient = obtainUserBadge2List(userId,customerId); + List orient = redisUtils.lrange(UserRedisKeys.getResiUserBadgeKey(customerId,userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); UserBadgeUnitFormDTO unit = null; if (!CollectionUtils.isEmpty(orient)) { @@ -206,7 +206,7 @@ public class UserBadgeRedis { if (poolOpt.isPresent()) unit = ConvertUtils.sourceToTarget(poolOpt.get(), UserBadgeUnitFormDTO.class); else return NumConstant.ZERO; } - redisUtils.leftPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId), unit); + redisUtils.leftPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId), unit,-1); return NumConstant.ONE; } From 2c7e78572d55d1e990c03c840067c166be1eedc4 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 20 Nov 2020 14:46:09 +0800 Subject: [PATCH 28/38] =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/group/service/impl/ResiGroupServiceImpl.java | 1 + 1 file changed, 1 insertion(+) 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 04718f2add..e5507ab766 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 @@ -526,6 +526,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Fri, 20 Nov 2020 14:48:57 +0800 Subject: [PATCH 29/38] =?UTF-8?q?=E5=88=A0=E9=99=A4x=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiGroupServiceImpl.java | 1358 ----------------- 1 file changed, 1358 deletions(-) delete mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.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 deleted file mode 100644 index e5507ab766..0000000000 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ /dev/null @@ -1,1358 +0,0 @@ -/** - * 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.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.AppClientConstant; -import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; -import com.epmet.commons.tools.constant.FieldConstant; -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.scan.param.ImgScanParamDTO; -import com.epmet.commons.tools.scan.param.ImgTaskDTO; -import com.epmet.commons.tools.scan.param.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; -import com.epmet.commons.tools.scan.result.SyncScanResult; -import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.*; -import com.epmet.constant.ReadFlagConstant; -import com.epmet.dto.form.*; -import com.epmet.dto.result.UserResiInfoResultDTO; -import com.epmet.dto.result.UserRoleResultDTO; -import com.epmet.feign.EpmetMessageOpenFeignClient; -import com.epmet.modules.constant.UserMessageConstant; -import com.epmet.modules.feign.EpmetMessageFeignClient; -import com.epmet.modules.feign.EpmetUserFeignClient; -import com.epmet.modules.feign.GovOrgFeignClient; -import com.epmet.modules.group.dao.GroupEditSubmitRecordDao; -import com.epmet.modules.group.dao.ResiGroupDao; -import com.epmet.modules.group.dao.ResiGroupOperationDao; -import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity; -import com.epmet.modules.group.entity.ResiGroupEntity; -import com.epmet.modules.group.entity.ResiGroupOperationEntity; -import com.epmet.modules.group.redis.ResiGroupRedis; -import com.epmet.modules.group.service.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; -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.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.github.pagehelper.PageHelper; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 群组信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-28 - */ -@Service -public class ResiGroupServiceImpl extends BaseServiceImpl implements ResiGroupService { - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private ResiGroupMemberService resiGroupMemberService; - - @Autowired - private ResiGroupOperationService resiGroupOperationService; - - @Autowired - private EpmetUserFeignClient epmetUserFeignClient; - - @Autowired - private GroupMemeberOperationService groupMemeberOperationService; - - @Autowired - private ResiGroupStatisticalService resiGroupStatisticalService; - - @Autowired - private ResiGroupOperationDao resiGroupOperationDao; - - @Autowired - private ResiGroupMemberDao resiGroupMemberDao; - - @Autowired - private GroupMemeberOperationDao groupMemeberOperationDao; - - @Autowired - private ResiGroupRedis resiGroupRedis; - - @Autowired - private ResiGroupMemberRedis resiGroupMemberRedis; - - @Autowired - private GovOrgFeignClient govOrgFeignClient; - - @Autowired - private EpmetMessageFeignClient epmetMessageFeignClient; - - @Autowired - private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; - - @Autowired - private ResiGroupDao resiGroupDao; - - @Autowired - private GroupEditSubmitRecordDao groupEditSubmitRecordDao; - - @Autowired - private LoginUserUtil loginUserUtil; - - @Autowired - private CpUserDetailRedis sysUserInfoRedis; - - @Value("${openapi.scan.server.url}") - private String scanApiUrl; - - @Value("${openapi.scan.method.textSyncScan}") - private String textSyncScanMethod; - - @Value("${openapi.scan.method.imgSyncScan}") - private String imgSyncScanMethod; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ResiGroupDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ResiGroupDTO.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 ResiGroupDTO get(String id) { - ResiGroupEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ResiGroupDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ResiGroupDTO dto) { - ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ResiGroupDTO dto) { - ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * @param myGroupFormDTO - * @return com.epmet.commons.tools.utils.Result> - * @Author yinzuomei - * @Description 我的小组查询(包含我创建的小组+我加入的小组),以各组的最新话题时间有近到远排序) - * @Date 2020/3/28 20:37 - **/ - @Override - public List getMyGroup(MyGroupFormDTO myGroupFormDTO) { - int pageIndex = (myGroupFormDTO.getPageNo() - NumConstant.ONE) * myGroupFormDTO.getPageSize(); - myGroupFormDTO.setPageNo(pageIndex); - List myGroupList = baseDao.selectListMyGroup(myGroupFormDTO); - if (null == myGroupList || myGroupList.size() < 1) { - logger.info(String.format("我的小组查询为空,selectListMyGroup入参%s", JSON.toJSONString(myGroupFormDTO))); - return new ArrayList<>(); - } - return myGroupList; - } - - /** - * @param recommendGroupFormDTO - * @return com.epmet.commons.tools.utils.Result> - * @Author yinzuomei - * @Description 推荐组列表查询 - * @Date 2020/3/28 19:53 - **/ - @Override - public List getRecommendGroup(RecommendGroupFormDTO recommendGroupFormDTO) { - int pageIndex = (recommendGroupFormDTO.getPageNo() - NumConstant.ONE) * recommendGroupFormDTO.getPageSize(); - recommendGroupFormDTO.setPageNo(pageIndex); - //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以最新话题的时间有近到远排序 - List recommendGroupList = baseDao.selectListRecommendGroup(recommendGroupFormDTO); - if (null == recommendGroupList || recommendGroupList.size() == 0) { - logger.info(String.format("推荐小组查询为空,selectListRecommendGroup入参%s", JSON.toJSONString(recommendGroupFormDTO))); - return new ArrayList<>(); - } - for (RecommendGroupResultDTO recommendGroupResultDTO : recommendGroupList) { - GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(recommendGroupResultDTO.getGroupId(), - recommendGroupFormDTO.getUserId()); - if (null != groupMemeberOperationDTO) { - recommendGroupResultDTO.setStatus(groupMemeberOperationDTO.getOperateStatus()); - } - } - return recommendGroupList; - } - - /** - * @param createdFormDTO - * @return com.epmet.commons.tools.utils.Result> - * @Author yinzuomei - * @Description 我创建的小组 - * @Date 2020/3/28 22:01 - **/ - @Override - public List getCreated(CreatedFormDTO createdFormDTO) { - int pageIndex = (createdFormDTO.getPageNo() - NumConstant.ONE) * createdFormDTO.getPageSize(); - createdFormDTO.setPageNo(pageIndex); - List createdResultDTOList = baseDao.selectListMyCreated(createdFormDTO); - if (null == createdResultDTOList || createdResultDTOList.size() == 0) { - logger.info(String.format("我创建的小组查询为空,selectListMyCreated入参%s", JSON.toJSONString(createdFormDTO))); - return new ArrayList<>(); - } - return createdResultDTOList; - } - - /** - * @param modifyGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 修改组信息 - * @Date 2020/3/28 22:27 - **/ - @Transactional(rollbackFor = Exception.class) - @Override - public void modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO) { - //校验是否是群主 - ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getResiGroupMember(modifyGroupFormDTO.getGroupId(), modifyGroupFormDTO.getUserId()); - if (null == groupMemberDTO || ModuleConstant.GROUP_MEMBER.equals(groupMemberDTO.getGroupLeaderFlag())) { - logger.info(String.format("修改小组信息异常:%s",EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg())); - throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode()); - } - if (StringUtils.isBlank(modifyGroupFormDTO.getGroupHeadPhoto()) - && StringUtils.isBlank(modifyGroupFormDTO.getGroupName()) - && StringUtils.isBlank(modifyGroupFormDTO.getGroupIntroduction())) { - logger.info("小组信息未发生变更,无需更改"); - return; - } - int updatedRows = baseDao.modifyGroupInfo(modifyGroupFormDTO); - if (1 == updatedRows) { - logger.info("修改小组信息成功"); - }else{ - logger.error(String.format("修改小组信息失败,updatedRows=%s",updatedRows)); - } - } - - /** - * @param groupSummarizeFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 查看小组管理界面信息 - * @Date 2020/3/29 17:52 - **/ - @Override - public GroupSummarizeResultDTO getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) { - GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO); - if (null == groupSummarizeResultDTO) { - logger.warn(String.format("查看小组管理界面信息异常,userId=%s,groupId=%s",groupSummarizeFormDTO.getUserId(),groupSummarizeFormDTO.getGroupId())); - return new GroupSummarizeResultDTO(); - } - //获取组长信息 - Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); - if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { - groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); - } else { - logger.warn(String.format("查看小组管理界面信息错误,获取组长注册信息失败,接口返参%s",JSON.toJSONString(groupLeaderUserInfo))); - groupSummarizeResultDTO.setLeaderName(""); - } - return groupSummarizeResultDTO; - } - - /** - * @param groupId - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 根据组id查询组长信息 - * @Date 2020/3/30 15:07 - **/ - private Result getGroupLeaderUserInfo(String groupId) { - //群主名称需要调用feign查询 - ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId); - if (null == resiGroupEntity) { - return new Result<>(); - } - ResiGroupMemberDTO groupMemberDTO = baseDao.selectGroupLeader(groupId); - if (null == groupMemberDTO) { - return new Result<>(); - } - UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); - resiUserInfoFormDTO.setCustomerId(resiGroupEntity.getCustomerId()); - resiUserInfoFormDTO.setUserId(groupMemberDTO.getCustomerUserId()); - return epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); - } - - /** - * @param applyCreateGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 创建小组 - * @Date 2020/3/29 19:26 - **/ - @Transactional(rollbackFor = Exception.class) - @Override - public void applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { - //1、校验是否同名 - List resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO); - if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) { - logger.info(String.format("创建小组异常:%s",EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg())); - throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode()); - } - - //2.内容检查 - scanGroupEditContent(applyCreateGroupFormDTO.getGroupName(), - applyCreateGroupFormDTO.getGroupIntroduction(), - applyCreateGroupFormDTO.getGroupHeadPhoto()); - - //3.1、查询当前申请人的身份,生成对应格式的消息内容 - UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(), - applyCreateGroupFormDTO.getUserId(), - applyCreateGroupFormDTO.getCustomerId(), - applyCreateGroupFormDTO.getGridId()); - if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { - logger.info(String.format("创建小组异常:%s",EpmetErrorCode.CANNOT_CREATE_GROUP.getMsg())); - throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode()); - } - String roleName = ""; - if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){ - roleName = ModuleConstant.PARTYMEMBER; - }else if(NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())){ - roleName = ModuleConstant.WAREMHEARTED_RESI; - } - - //3.2、插入一条待审核的组信息 - ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO); - insert(resiGroupEntity); - //4.获取居民注册信息 - UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); - resiParam.setCustomerId(applyCreateGroupFormDTO.getCustomerId()); - resiParam.setUserId(applyCreateGroupFormDTO.getUserId()); - Result resiResult = - epmetUserFeignClient.getUserResiInfoDTO(resiParam); - String userName = ""; - if(resiResult.success() && null != resiResult.getData()){ - userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) - + (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName()); - } - userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; - String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName()); - //4.2、插入一条待审核的操作记录 - ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); - resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); - resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); - resiGroupOperation.setOperateUserId(applyCreateGroupFormDTO.getUserId()); - resiGroupOperation.setMessageText(msg); - resiGroupOperation.setReadFlag(ModuleConstant.UNREAD); - resiGroupOperationService.save(resiGroupOperation); - //5、插入一群成员信息(群主) - ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO(); - resiGroupMemberDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId()); - resiGroupMemberDTO.setResiGroupId(resiGroupEntity.getId()); - resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER); - resiGroupMemberDTO.setStatus(MemberStateConstant.UNDER_AUDITTING); - resiGroupMemberDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED); - resiGroupMemberService.save(resiGroupMemberDTO); - //6、插入一条入群记录(群主的) - GroupMemeberOperationDTO groupMemeberOperationDTO = new GroupMemeberOperationDTO(); - groupMemeberOperationDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId()); - groupMemeberOperationDTO.setGroupId(resiGroupEntity.getId()); - groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.UNDER_AUDITTING); - groupMemeberOperationDTO.setOperateUserId(applyCreateGroupFormDTO.getUserId()); - groupMemeberOperationDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED); - groupMemeberOperationService.save(groupMemeberOperationDTO); - //7、群初始统计记录 - /*UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(), - applyCreateGroupFormDTO.getUserId(), - applyCreateGroupFormDTO.getCustomerId(), - applyCreateGroupFormDTO.getGridId());*/ - ResiGroupStatisticalDTO resiGroupStatisticalDTO = new ResiGroupStatisticalDTO(); - resiGroupStatisticalDTO.setResiGroupId(resiGroupEntity.getId()); - resiGroupStatisticalDTO.setTotalMembers(NumConstant.ONE); - resiGroupStatisticalDTO.setTotalNormalMemebers(NumConstant.ONE); - resiGroupStatisticalDTO.setTotalTopics(NumConstant.ZERO); - resiGroupStatisticalDTO.setTotalIssues(NumConstant.ZERO); - if (NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())) { - resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ONE); - } else { - resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ZERO); - } - if (NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { - resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ONE); - } else { - resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO); - } - resiGroupStatisticalService.save(resiGroupStatisticalDTO); - //发送消息:创建小组 - sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId()); - //更新政府端:工作-基层治理-群组管理reddot - resiGroupRedis.addWorkGrassrootsGroupRedDotValue(applyCreateGroupFormDTO.getGridId()); - } - - - private void setWorkGrassrootsGroupRedDot(String gridId) { - try{ - - }catch(Exception e){ - e.printStackTrace(); - } - } - - /** - * @param applyCreateGroupFormDTO - * @return java.util.List - * @Author yinzuomei - * @Description 查询是否存在相同名字的群 - * @Date 2020/3/30 16:01 - **/ - private List getResiGroupEntityList(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { - List list = baseDao.checkResiGroupName(applyCreateGroupFormDTO); - return list; - } - - /** - * @param initApplyGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 加入小组界面初始化 - * @Date 2020/3/30 10:17 - **/ - @Override - public void initApplyGroup(InitApplyGroupFormDTO initApplyGroupFormDTO) { - UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); - resiUserInfoFormDTO.setUserId(initApplyGroupFormDTO.getUserId()); - resiUserInfoFormDTO.setCustomerId(initApplyGroupFormDTO.getCustomerId()); - Result result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); - if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) { - logger.info(String.format("加入小组界面初始化查询成功,当前用户非注册居民,epmet-user-server接口入参%s,返回%s",JSON.toJSONString(resiUserInfoFormDTO),JSON.toJSONString(result))); - throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode()); - } - } - - private ResiGroupEntity structureResiGroupEntity(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { - ResiGroupEntity resiGroupEntity = new ResiGroupEntity(); - resiGroupEntity.setCustomerId(applyCreateGroupFormDTO.getCustomerId()); - resiGroupEntity.setGridId(applyCreateGroupFormDTO.getGridId()); - resiGroupEntity.setGroupHeadPhoto(applyCreateGroupFormDTO.getGroupHeadPhoto()); - resiGroupEntity.setGroupName(applyCreateGroupFormDTO.getGroupName()); - resiGroupEntity.setGroupIntroduction(applyCreateGroupFormDTO.getGroupIntroduction()); - resiGroupEntity.setCreatedBy(applyCreateGroupFormDTO.getUserId()); - resiGroupEntity.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); - return resiGroupEntity; - } - - /** - * @param initApplyCreatedGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 校验用户是否是热心居民或者党员 - * @Date 2020/3/30 15:50 - **/ - @Override - public void initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) { - UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(initApplyCreatedGroupFormDTO.getApp(), - initApplyCreatedGroupFormDTO.getUserId(), - initApplyCreatedGroupFormDTO.getCustomerId(), - initApplyCreatedGroupFormDTO.getGridId()); - if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { - logger.info(String.format("创建小组界面初始化查询成功,用户角色列表%s",JSON.toJSONString(userRoleDTO))); - throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode()); - } - } - - - /** - * @param agreeApplyGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 审核群申请-测试用后面会放到政府端 - * @Date 2020/3/31 12:44 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { - //1、更新组的状态 - ResiGroupDTO resiGroupDTO = this.get(agreeApplyGroupFormDTO.getGroupId()); - resiGroupDTO.setState(GroupStateConstant.GROUP_APPROVED); - this.update(resiGroupDTO); - //2、更新组的申请记录改为已通过 - ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(agreeApplyGroupFormDTO.getGroupId()); - resiGroupOperation.setState(GroupStateConstant.GROUP_APPROVED); - resiGroupOperation.setOperateUserId(agreeApplyGroupFormDTO.getUserId()); - resiGroupOperationService.update(resiGroupOperation); - //3、将群主在群成员的状态改为已通过 - ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(agreeApplyGroupFormDTO.getGroupId()); - resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED); - resiGroupMemberService.update(resiGroupMemberDTO); - //4、更新群主的出入群记录改为已通过 - GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(agreeApplyGroupFormDTO.getGroupId()); - groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED); - groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId()); - groupMemeberOperationService.update(groupMemeberOperationDTO); - //5、给用户发送消息???待定 - //6、新增小组缓存信息、组员缓存信息 - Map param = new HashMap<>(); - param.put(ModuleConstant.RESI_GROUP_ID, 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(ModuleConstant.GROUP_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()); - memberRedis.setMemberMobile(userInfo.getData().getRegMobile()); - }else{ - logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); - } - resiGroupMemberRedis.set(memberRedis); - } else { - /* - 当没有查询到组统计信息时,需要自己封装统计信息 - @param UserRoleFormDTO::getApp - @param UserRoleFormDTO::getCustomerId - @param UserRoleFormDTO::getUserId - @param UserRoleFormDTO::getGridId - 查询用户身份信息[热心居民/党员] - epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); - */ - logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); - } - //发送消息 - UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); - userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); - userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); - userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); - userMessageFormDTO.setApp(ModuleConstant.APP_RESI); - userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); - userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())); - if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ - logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()))); - } - //发送微信订阅消息 - WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); - wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); - wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); - wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId()); - wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR); - wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())); - wxSubscribeMessageFormDTO.setMessageTime(new Date()); - List msgList = new ArrayList<>(); - msgList.add(wxSubscribeMessageFormDTO); - epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); - //更新政府端:工作-基层治理-党员认证reddot - resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId()); - return new Result(); - } - - /** - * @param disAgreeApplyGroupFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 审核(拒绝)群申请-测试用后面会放到政府端 - * @Date 2020/3/31 13:22 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { - //1、更新组的状态 - ResiGroupDTO resiGroupDTO = this.get(disAgreeApplyGroupFormDTO.getGroupId()); - resiGroupDTO.setState(GroupStateConstant.GROUP_REJECTED); - this.update(resiGroupDTO); - //2、更新组的申请记录改为已通过 - ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(disAgreeApplyGroupFormDTO.getGroupId()); - resiGroupOperation.setState(GroupStateConstant.GROUP_REJECTED); - resiGroupOperation.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId()); - resiGroupOperation.setOperateReason(disAgreeApplyGroupFormDTO.getRejectReason()); - resiGroupOperationService.update(resiGroupOperation); - //3、将群主在群成员的状态改为已通过 - ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(disAgreeApplyGroupFormDTO.getGroupId()); - resiGroupMemberDTO.setStatus(MemberStateConstant.REJECTED); - resiGroupMemberService.update(resiGroupMemberDTO); - //4、更新群主的出入群记录改为已通过 - GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(disAgreeApplyGroupFormDTO.getGroupId()); - groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.REJECTED); - groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId()); - groupMemeberOperationService.update(groupMemeberOperationDTO); - //5、给用户发送消息???待定 - UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); - userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); - userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); - userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); - userMessageFormDTO.setApp(ModuleConstant.APP_RESI); - userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); - userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())); - if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ - logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()))); - } - - //发送微信订阅消息 - WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); - wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); - wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); - wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId()); - wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR); - wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())); - wxSubscribeMessageFormDTO.setMessageTime(new Date()); - List msgList = new ArrayList<>(); - msgList.add(wxSubscribeMessageFormDTO); - epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); - - //更新政府端:工作-基层治理-党员认证reddot - resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId()); - return new Result(); - } - - /** - * @param app - * @param userId - * @param customerId - * @param gridId - * @return boolean - * @Author yinzuomei - * @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false - * @Date 2020/3/30 16:33 - **/ - @Override - public UserRoleDTO checkPartyMemberOrWarmHeated(String app, String userId, String customerId, String gridId) { - UserRoleDTO userRoleDTO = new UserRoleDTO(); - UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); - userRoleFormDTO.setApp(app); - userRoleFormDTO.setCustomerId(customerId); - userRoleFormDTO.setUserId(userId); - userRoleFormDTO.setGridId(gridId); - logger.info(String.format("用户同意邀请进组,获取当前用户所有角色入参:%s", JSON.toJSONString(userRoleFormDTO))); - Result> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); - if (!userRoleListResult.success()) { - logger.error("获取用户角色feign调用失败" + userRoleListResult.getMsg()); - return userRoleDTO; - } - List userRoleList = userRoleListResult.getData(); - if (null == userRoleList || userRoleList.size() == 0) { - return userRoleDTO; - } - for (UserRoleResultDTO userRoleResultDTO : userRoleList) { - if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey())) { - userRoleDTO.setPartymemberFlag(NumConstant.ONE_STR); - } - if (EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) { - userRoleDTO.setWarmHeartedFlag(NumConstant.ONE_STR); - } - if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(userRoleResultDTO.getRoleKey())) { - userRoleDTO.setRegisteredResiFlag(NumConstant.ONE_STR); - } - } - logger.info(String.format("用户同意邀请进组,获取当前用户所有角色返参:%s",JSON.toJSONString(userRoleDTO))); - return userRoleDTO; - } - - @Override - public Result> audited(GroupAuditedFromDTO formDTO) { - Result> result = new Result<>(); - //查询条件 - int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); - formDTO.setPageNo(pageIndex); - //获取审核列表 - List resultList = baseDao.selectAuditedGroupList(formDTO); - - return result.ok(resultList); - } - - @Override - public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { - List resultList = new ArrayList<>(); - //查询条件 - int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); - formDTO.setPageNo(pageIndex); - List list = baseDao.selectGroupsByGridId(formDTO); - list.forEach(group -> { - GroupsInGridResultDTO groupsInGridResultDTO = new GroupsInGridResultDTO(); - if (MemberStateConstant.REJECTED.equals(group.getState())) { - groupsInGridResultDTO.setGroupId(group.getId()); - groupsInGridResultDTO.setGroupName(group.getGroupName()); - groupsInGridResultDTO.setGroupHeadPhoto(group.getGroupHeadPhoto()); - groupsInGridResultDTO.setStatus(group.getState()); - groupsInGridResultDTO.setTotalMember(NumConstant.ZERO); - groupsInGridResultDTO.setTotalPartyMember(NumConstant.ZERO); - resultList.add(groupsInGridResultDTO); - } else if(MemberStateConstant.APPROVED.equals(group.getState())) { - //缓存中获取组信息 - ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(group.getId()); - groupsInGridResultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); - groupsInGridResultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); - groupsInGridResultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); - groupsInGridResultDTO.setStatus(resiGroupInfoRedisDTO.getGroupState()); - groupsInGridResultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); - groupsInGridResultDTO.setTotalPartyMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalPartyMembers()); - resultList.add(groupsInGridResultDTO); - } - - - }); - - return new Result>().ok(resultList); - } - - @Override - public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { - GovGroupSummarizeResultDTO resultDTO = new GovGroupSummarizeResultDTO(); - //从缓存中获取组相关信息 - ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(formDTO.getGroupId()); - resultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); - resultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); - resultDTO.setGroupIntroduction(resiGroupInfoRedisDTO.getGroupIntroduction()); - resultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); - resultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); - resultDTO.setTotalTopics(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalTopics()); - - //获取组长信息 - Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(formDTO.getGroupId()); - if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { - resultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); - } else { - logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); - } - - return new Result().ok(resultDTO); - } - - /** - * @return ResiGroupInfoRedisDTO - * @Description 将ResiGroupDTO与ResiGroupStatisticalDTO转换成ResiGroupInfoRedisDTO - * @Param ResiGroupDTO - * @Param ResiGroupStatisticalDTO - * @Author wangc - * @Date 2020.04.13 16:36 - **/ - private ResiGroupInfoRedisDTO transferToGroupInfoRedis(ResiGroupDTO groupDTO, ResiGroupStatisticalDTO statisticalDTO) { - - ResiGroupStatisticalInfoRedisDTO statisticalObjct = - ConvertUtils.sourceToTarget(statisticalDTO, ResiGroupStatisticalInfoRedisDTO.class); - statisticalObjct.setTotalEarnestMembers(statisticalDTO.getTotalEarnestMemebers()); - statisticalObjct.setTotalNormalMembers(statisticalDTO.getTotalNormalMemebers()); - ResiGroupInfoRedisDTO targetObject = - ConvertUtils.sourceToTarget(groupDTO, ResiGroupInfoRedisDTO.class); - targetObject.setGroupId(groupDTO.getId()); - targetObject.setGroupState(groupDTO.getState()); - SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); - if (null != groupDTO.getLatestTopicPublishDate()) { - targetObject.setLatestTopicPublishDate(format.format(groupDTO.getLatestTopicPublishDate())); - } - targetObject.setGroupStatisticalInfo(statisticalObjct); - return targetObject; - } - - /** - * @Description 查询待审核的小组 (不从缓存中取,这时还没有成功建组,缓存中没有组数据) - * @Param ApplyingGroupsFormDTO - * @return Result> - * @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.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()); - StringBuffer buffer = new StringBuffer(detail.getStreet()); - buffer.append(StringUtils.isBlank(buffer) ? "" : "-"); - detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString()); - }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(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class)); - } - - @Override - public List queryGroupProcessingCount(List gridIdList) { - List list=new ArrayList<>(); - for(String gridId:gridIdList){ - GroupProcessingCountResultDTO resultDTO=new GroupProcessingCountResultDTO(); - resultDTO.setGridId(gridId); - Integer auditingCreateGroupCount=resiGroupRedis.getWorkGrassrootsGroupRedDotValue(gridId); - Integer auditingGroupEditRecordCount=groupEditSubmitRecordDao.selectCountAuditingRec(gridId); - Integer auditingCount=auditingCreateGroupCount+auditingGroupEditRecordCount; - if (null == auditingCount) { - resultDTO.setCount(0); - } else { - resultDTO.setCount(auditingCount); - } - list.add(resultDTO); - } - return list; - } - - - /** - * @Description 查询一个网格下面所有组Id - * @param gridId - * @return List - * @author wangc - * @date 2020.05.14 10:54 - **/ - @Override - public List getGroupIdByGridId(String gridId) { - if(StringUtils.isBlank(gridId)) return null; - return baseDao.getGroupIdByGridId(gridId); - } - - /** - * @Description 返回 Map> - * @param gridIdList - * @return Map> - * @author wangc - * @date 2020.05.22 09:27 - **/ - @Override - public Map> getGroupIdsByGridIdList(List gridIdList) { - if(null == gridIdList || gridIdList.size() < NumConstant.ONE) - return null; - Map> result = new HashMap<>(); - List groups = new ArrayList<>(); - Map> groupMap - = groups.stream().collect(Collectors.groupingBy(ResiGroupDTO::getGridId)); - groupMap.forEach((k,v)->{ - Set groupIds = - v.stream().map(ResiGroupDTO::getId).collect(Collectors.toSet()); - result.put(k,groupIds); - }); - - return result; - } - - /** - * @Description 校验用户是否加入小组 - * @param gridId - * @author zxc - */ - @Override - public CheckJoinTeamResultDTO checkjointeam(GridIdFormDTO gridId) { - CheckJoinTeamResultDTO checkJoinTeamResultDTO = new CheckJoinTeamResultDTO(); - Integer joinTeamCounts = baseDao.checkjointeam(gridId); - if (joinTeamCounts==NumConstant.ZERO){//未加入任何小组(当前网格下) - checkJoinTeamResultDTO.setVoteAuthorization(false); - }else { - checkJoinTeamResultDTO.setVoteAuthorization(true); - } - return checkJoinTeamResultDTO; - } - - /** - * @Description 获取应表决数 - * @param formDTO - * @author zxc - */ - @Override - public ShouldVoteCountResultDTO shouldVoteCount(ShouldVoteCountFormDTO formDTO) { - //网格下所有加过组的人数 - Integer shouldVoteCount = baseDao.shouldVoteCount(formDTO).getShouldVoteCount(); - Integer outGroupCount = baseDao.getOutGroupCount(formDTO); - ShouldVoteCountResultDTO result = new ShouldVoteCountResultDTO(); - result.setShouldVoteCount(shouldVoteCount-outGroupCount); - return result; - } - - @Override - public List recommendedList(RecommendedListFormDTO formDTO) { - - //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以话题数由多到少排序 - List recommendGroupList = baseDao.selectListRecommendList(formDTO); - recommendGroupList.forEach(dto -> { - Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(dto.getGroupId()); - if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { - dto.setLeaderName(groupLeaderUserInfo.getData().getShowName()); - } else { - logger.warn("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); - } - }); - return recommendGroupList; - } - - /** - * @Description 给加入此网格的网格长发送消息 - * @param msg - * @param gridId - * @param userId - * @author wangc - * @date 2020.04.29 22:49 - **/ - private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){ - //1.查询加入当前网格下的人员 customer_staff_grid - CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO(); - commonGridIdFormDTO.setGridId(gridId); - commonGridIdFormDTO.setUserId(userId); - Result> gridstaffs = - govOrgFeignClient.getGridStaffs(commonGridIdFormDTO); - //2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff - if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){ - RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO(); - rolesUsersListFormDTO.setCustomerId(customerId); - List roleKeys = new ArrayList(); - roleKeys.add(ModuleConstant.STAFF_ROLE_GRID_MANAGER); - rolesUsersListFormDTO.setRoleKeys(roleKeys); - rolesUsersListFormDTO.setUserIds(gridstaffs.getData()); - Result> staffRoles = - epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO); - //3.发送消息 - if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){ - List msgList = new ArrayList<>(); - List subscribeList = new ArrayList<>(); - for(String to : staffRoles.getData()){ - //站内信 - UserMessageFormDTO msgObj = new UserMessageFormDTO(); - msgObj.setApp(ModuleConstant.APP_GOV); - msgObj.setCustomerId(customerId); - msgObj.setGridId(gridId); - msgObj.setMessageContent(msg); - msgObj.setReadFlag(ReadFlagConstant.UN_READ); - msgObj.setTitle(title); - msgObj.setUserId(to); - msgList.add(msgObj); - //微信订阅 - WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO(); - subscribeDTO.setClientType(ModuleConstant.APP_GOV); - subscribeDTO.setGridId(gridId); - subscribeDTO.setCustomerId(customerId); - subscribeDTO.setUserId(to); - subscribeDTO.setBehaviorType(UserMessageConstant.WX_CREATE_GROUP_BEHAVIOR); - subscribeDTO.setMessageContent(msg); - subscribeDTO.setMessageTime(new Date()); - subscribeList.add(subscribeDTO); - } - if (subscribeList.size() > NumConstant.ZERO){ - epmetMessageOpenFeignClient.sendWxSubscribeMessage(subscribeList); - } - Result result = epmetMessageFeignClient.saveUserMessageList(msgList); - if(result.success()){ - return; - } - } - } - logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg)); - - } - - @Override - public GroupDetailResultDTO getGroupDetail(String groupId) { - GroupDetailResultDTO groupDetail = new GroupDetailResultDTO(); - - // 1.拼装组基本信息 - GroupEditSubmitRecordEntity ler = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId); - - if (ler != null) { - groupDetail.setAuditStatus(ler.getAuditStatus()); - groupDetail.setRemark(ler.getRemark()); - } - - if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) { - // 审核中,显示待审核内容 - groupDetail.setGroupHeadPhoto(ler.getGroupHeadPhoto()); - groupDetail.setGroupName(ler.getGroupName()); - groupDetail.setGroupIntroduction(ler.getGroupIntroduction()); - } else { - // 不在审核中,直接显示组信息 - ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupId); - if (resiGroupEntity == null) { - return null; - } - - groupDetail.setGroupHeadPhoto(resiGroupEntity.getGroupHeadPhoto()); - groupDetail.setGroupName(resiGroupEntity.getGroupName()); - groupDetail.setGroupIntroduction(resiGroupEntity.getGroupIntroduction()); - } - - // 2.编辑次数及其限制 - groupDetail.setEditNumLimit(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH); - Date now = new Date(); - int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now)); - groupDetail.setAvaliableEditNum(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH - usedEditNum); - - // 审核状态 - // 是否可编辑 - boolean editable = true; - - if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) { - // 达到最大编辑次数了 - editable = false; - } - - if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) { - // 提交了,还没审核完 - editable = false; - } - - groupDetail.setEditable(editable); - return groupDetail; - } - - @Override - public void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId) { - // 1.判断小组是否存在,判断是否已经在"待审核"状态 - ResiGroupEntity group = resiGroupDao.selectById(groupId); - if (group == null) { - throw new RenException(EpmetErrorCode.GROUP_NOT_EXISTS.getCode(), EpmetErrorCode.GROUP_NOT_EXISTS.getMsg()); - } - - // 判断是否是组长 - ResiGroupMemberDTO groupLeader = resiGroupMemberDao.selectLeaderMember(groupId); - if (groupLeader == null || !groupLeader.getCustomerUserId().equals(editUserId)) { - String msg = "只有该组的组长才可以编辑组信息"; - throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), msg, msg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL); - } - - // 2.判断是否可以提交编辑 - GroupEditSubmitRecordEntity lre = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId); - if (lre != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(lre.getAuditStatus())) { - // 在待审核状态,不允许再次提交编辑 - throw new RenException(EpmetErrorCode.GROUP_IN_AUDITING.getCode(), EpmetErrorCode.GROUP_IN_AUDITING.getMsg()); - } - - if (resiGroupDao.countExistsGroupNameBeforeEdit(groupId, group.getGridId(), groupName) > 0) { - // 已存在组名,拒绝提交 - throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(), EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg()); - } - - Date now = new Date(); - int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now)); - if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) { - // 达到最大编辑次数了 - throw new RenException(EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getCode(), EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getMsg()); - } - - // 3.内容检查 - scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto); - - String app = loginUserUtil.getLoginUserApp(); - String userId = loginUserUtil.getLoginUserId(); - String messageText = generateGroupEditMessageText(app, userId, group.getCustomerId(), group.getGridId(), groupName); - - // 4.创建编辑提交记录 - GroupEditSubmitRecordEntity editRecord = new GroupEditSubmitRecordEntity(); - editRecord.setAuditStatus(GroupAuditStatusConstant.UNDER_AUDITING); - editRecord.setCustomerId(group.getCustomerId()); - editRecord.setGridId(group.getGridId()); - editRecord.setGroupHeadPhoto(groupHeadPhoto); - editRecord.setGroupIntroduction(groupIntroduction); - editRecord.setGroupId(groupId); - editRecord.setGroupName(groupName); - editRecord.setReadFlag(ReadFlagConstant.UN_READ); - editRecord.setMessageText(messageText); - - if (groupEditSubmitRecordDao.insert(editRecord) == 0) { - throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), EpmetErrorCode.GROUP_EDIT_ERROR.getMsg()); - } - - resiGroupRedis.addWorkGrassrootsGroupRedDotValue(group.getGridId()); - - } - - /** - * 生成组信息编辑简介文本:xxx申请编辑组信息,请审核 - * @param app - * @param userId - * @param customerId - * @param gridId - * @param groupName - * @return - */ - private String generateGroupEditMessageText(String app, String userId, String customerId, String gridId, String groupName) { - List resiRoles = getResiRoles(app, customerId, userId, gridId); - boolean isPartymember = false; - boolean isWarmhearted = false; - for (UserRoleResultDTO role : resiRoles) { - if (EpmetRoleKeyConstant.WARMHEARTED.equals(role.getRoleKey())) { - isWarmhearted = true; - } - if (EpmetRoleKeyConstant.PARTYMEMBER.equals(role.getRoleKey())) { - isPartymember = true; - } - } - if (!isWarmhearted && isPartymember) { - throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode(), "只有党员和热心居民才能创建和编辑小组"); - } - String roleName = ""; - if (isPartymember) { - roleName = ModuleConstant.PARTYMEMBER; - } else if (isWarmhearted) { - roleName = ModuleConstant.WAREMHEARTED_RESI; - } - - //3.获取居民注册信息 - UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); - resiParam.setCustomerId(customerId); - resiParam.setUserId(userId); - Result resiResult = - epmetUserFeignClient.getUserResiInfoDTO(resiParam); - String userName = ""; - if (resiResult.success() && null != resiResult.getData()) { - userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) - + (StringUtils.isBlank(resiResult.getData().getName()) ? "" : resiResult.getData().getName()); - } - userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; - return String.format(UserMessageConstant.EDIT_OF_GROUP_MESSAGE_TEMPLATE, roleName, userName, groupName); - } - - /** - * 查询居民的角色列表 - * @param app - * @param customerId - * @param userId - * @param gridId - * @return - */ - private List getResiRoles(String app, String customerId, String userId, String gridId) { - UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); - userRoleFormDTO.setApp(app); - userRoleFormDTO.setCustomerId(customerId); - userRoleFormDTO.setUserId(userId); - userRoleFormDTO.setGridId(gridId); - Result> rolesResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); - - if (! rolesResult.success()) { - logger.error("修改组信息:查询居民角色失败,详情:{}", rolesResult.getInternalMsg()); - throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "查询居民角色失败"); - } else { - List roles = rolesResult.getData(); - if (CollectionUtils.isEmpty(roles)) { - roles = new ArrayList<>(); - } - return roles; - } - } - - /** - * 内容检查 - * @param groupName - * @param groupIntroduction - * @param groupHeadPhoto - */ - private void scanGroupEditContent(String groupName, String groupIntroduction, String groupHeadPhoto) { - // 文本内容审核 - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - String content = groupName.concat("-").concat(groupIntroduction); - taskDTO.setContent(content); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()) { - logger.error("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); - } - } - - // 图片内容审核 - ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); - ImgTaskDTO task = new ImgTaskDTO(); - task.setDataId(UUID.randomUUID().toString().replace("-", "")); - task.setUrl(groupHeadPhoto); - imgScanParamDTO.getTasks().add(task); - - Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); - if (!imgScanResult.success()){ - logger.error("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); - } - } - } - - /** - * @Description 工作端 查询组变更待审核列表 - * @param param - * @return - * @author wangc - * @date 2020.11.03 10:19 - */ - @Override - public List getEditAuditingList(CommonGridAndPageFormDTO param) { - return Optional.ofNullable(PageHelper.startPage(null == param.getPageNo() ? NumConstant.ONE : param.getPageNo() , null == param.getPageSize() ? NumConstant.TWELVE : param.getPageSize()) - .doSelectPage(() -> { - groupEditSubmitRecordDao.selectGroupEditApplyList(param.getGridId());}).getResult()).orElse(new LinkedList<>()) - .stream().map(o -> { return (ApplyingGroupResultDTO)o; }).collect(Collectors.toList()); - } - - /** - * @Description 查询小组修改信息的详情内容 不加事务! - * @param param - * @return com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO - * @author wangc - * @date 2020.11.03 14:10 - */ - @Override - public GroupEditionDetailResultDTO getEditAuditingDetail(GovGroupSummarizeFromDTO param) { - GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null); - if(null == edit) { - logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.getEditAuditingDetail,未找到小组变更信息记录,传参:{}",JSON.toJSONString(param)); - return null;} - //取消未读状态 - GroupEditSubmitRecordEntity _update = new GroupEditSubmitRecordEntity(); - _update.setId(edit.getId());_update.setReadFlag(ModuleConstant.READ); - groupEditSubmitRecordDao.updateById(_update); - GroupEditionDetailResultDTO result = ConvertUtils.sourceToTarget(edit, GroupEditionDetailResultDTO.class); - result.setGroupLeaderName(resiGroupRedis.getFullName(edit.getCreatedBy())); - return result; - } - - /** - * @Description 工作人员提交审核 - * @param param - * @return void - * @author wangc - * @date 2020.11.03 16:02 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void auditEdit(GroupEditionAuditFormDTO param) { - if(StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT) && StringUtils.isBlank(param.getRemark())){ - throw new RenException("拒绝理由不能为空"); - } - GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null); - if(null == edit){ - logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,找不到待审核的组更新记录,传参:{}",JSON.toJSONString(param)); - throw new RenException("找不到待审核的组更新记录"); - } - - int affectedRows = groupEditSubmitRecordDao.updateAuditResult(param.getGroupId(),param.getStaffId(),param.getAuditResult(),param.getRemark()); - if(affectedRows <= NumConstant.ZERO){ - logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,更新组编辑记录时受影响行数小于1,传参:{}",JSON.toJSONString(param)); - throw new RenException("更新组编辑记录时受影响行数小于1"); - } - if(!StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT)){ - //同意 - ResiGroupEntity _update = ConvertUtils.sourceToTarget(edit,ResiGroupEntity.class); - _update.setId(param.getGroupId()); - baseDao.updateById(_update); - } - resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(edit.getGridId()); - resiGroupRedis.delGroup(param.getGroupId()); - } - -} From d95d31f073e3cde9f6d4cc5e6203d43a7cf37748 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 20 Nov 2020 14:51:06 +0800 Subject: [PATCH 30/38] =?UTF-8?q?=E6=81=A2=E5=A4=8Dx=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiGroupServiceImpl.java | 1358 +++++++++++++++++ 1 file changed, 1358 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.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 new file mode 100644 index 0000000000..e5507ab766 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -0,0 +1,1358 @@ +/** + * 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.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.AppClientConstant; +import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; +import com.epmet.commons.tools.constant.FieldConstant; +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.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.*; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.dto.form.*; +import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.dto.result.UserRoleResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.modules.constant.UserMessageConstant; +import com.epmet.modules.feign.EpmetMessageFeignClient; +import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.feign.GovOrgFeignClient; +import com.epmet.modules.group.dao.GroupEditSubmitRecordDao; +import com.epmet.modules.group.dao.ResiGroupDao; +import com.epmet.modules.group.dao.ResiGroupOperationDao; +import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity; +import com.epmet.modules.group.entity.ResiGroupEntity; +import com.epmet.modules.group.entity.ResiGroupOperationEntity; +import com.epmet.modules.group.redis.ResiGroupRedis; +import com.epmet.modules.group.service.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; +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.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.github.pagehelper.PageHelper; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 群组信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-28 + */ +@Service +public class ResiGroupServiceImpl extends BaseServiceImpl implements ResiGroupService { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private ResiGroupMemberService resiGroupMemberService; + + @Autowired + private ResiGroupOperationService resiGroupOperationService; + + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + @Autowired + private GroupMemeberOperationService groupMemeberOperationService; + + @Autowired + private ResiGroupStatisticalService resiGroupStatisticalService; + + @Autowired + private ResiGroupOperationDao resiGroupOperationDao; + + @Autowired + private ResiGroupMemberDao resiGroupMemberDao; + + @Autowired + private GroupMemeberOperationDao groupMemeberOperationDao; + + @Autowired + private ResiGroupRedis resiGroupRedis; + + @Autowired + private ResiGroupMemberRedis resiGroupMemberRedis; + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + @Autowired + private EpmetMessageFeignClient epmetMessageFeignClient; + + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + + @Autowired + private ResiGroupDao resiGroupDao; + + @Autowired + private GroupEditSubmitRecordDao groupEditSubmitRecordDao; + + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private CpUserDetailRedis sysUserInfoRedis; + + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiGroupDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiGroupDTO.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 ResiGroupDTO get(String id) { + ResiGroupEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ResiGroupDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResiGroupDTO dto) { + ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResiGroupDTO dto) { + ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param myGroupFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 我的小组查询(包含我创建的小组+我加入的小组),以各组的最新话题时间有近到远排序) + * @Date 2020/3/28 20:37 + **/ + @Override + public List getMyGroup(MyGroupFormDTO myGroupFormDTO) { + int pageIndex = (myGroupFormDTO.getPageNo() - NumConstant.ONE) * myGroupFormDTO.getPageSize(); + myGroupFormDTO.setPageNo(pageIndex); + List myGroupList = baseDao.selectListMyGroup(myGroupFormDTO); + if (null == myGroupList || myGroupList.size() < 1) { + logger.info(String.format("我的小组查询为空,selectListMyGroup入参%s", JSON.toJSONString(myGroupFormDTO))); + return new ArrayList<>(); + } + return myGroupList; + } + + /** + * @param recommendGroupFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 推荐组列表查询 + * @Date 2020/3/28 19:53 + **/ + @Override + public List getRecommendGroup(RecommendGroupFormDTO recommendGroupFormDTO) { + int pageIndex = (recommendGroupFormDTO.getPageNo() - NumConstant.ONE) * recommendGroupFormDTO.getPageSize(); + recommendGroupFormDTO.setPageNo(pageIndex); + //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以最新话题的时间有近到远排序 + List recommendGroupList = baseDao.selectListRecommendGroup(recommendGroupFormDTO); + if (null == recommendGroupList || recommendGroupList.size() == 0) { + logger.info(String.format("推荐小组查询为空,selectListRecommendGroup入参%s", JSON.toJSONString(recommendGroupFormDTO))); + return new ArrayList<>(); + } + for (RecommendGroupResultDTO recommendGroupResultDTO : recommendGroupList) { + GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(recommendGroupResultDTO.getGroupId(), + recommendGroupFormDTO.getUserId()); + if (null != groupMemeberOperationDTO) { + recommendGroupResultDTO.setStatus(groupMemeberOperationDTO.getOperateStatus()); + } + } + return recommendGroupList; + } + + /** + * @param createdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 我创建的小组 + * @Date 2020/3/28 22:01 + **/ + @Override + public List getCreated(CreatedFormDTO createdFormDTO) { + int pageIndex = (createdFormDTO.getPageNo() - NumConstant.ONE) * createdFormDTO.getPageSize(); + createdFormDTO.setPageNo(pageIndex); + List createdResultDTOList = baseDao.selectListMyCreated(createdFormDTO); + if (null == createdResultDTOList || createdResultDTOList.size() == 0) { + logger.info(String.format("我创建的小组查询为空,selectListMyCreated入参%s", JSON.toJSONString(createdFormDTO))); + return new ArrayList<>(); + } + return createdResultDTOList; + } + + /** + * @param modifyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 修改组信息 + * @Date 2020/3/28 22:27 + **/ + @Transactional(rollbackFor = Exception.class) + @Override + public void modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO) { + //校验是否是群主 + ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getResiGroupMember(modifyGroupFormDTO.getGroupId(), modifyGroupFormDTO.getUserId()); + if (null == groupMemberDTO || ModuleConstant.GROUP_MEMBER.equals(groupMemberDTO.getGroupLeaderFlag())) { + logger.info(String.format("修改小组信息异常:%s",EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg())); + throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode()); + } + if (StringUtils.isBlank(modifyGroupFormDTO.getGroupHeadPhoto()) + && StringUtils.isBlank(modifyGroupFormDTO.getGroupName()) + && StringUtils.isBlank(modifyGroupFormDTO.getGroupIntroduction())) { + logger.info("小组信息未发生变更,无需更改"); + return; + } + int updatedRows = baseDao.modifyGroupInfo(modifyGroupFormDTO); + if (1 == updatedRows) { + logger.info("修改小组信息成功"); + }else{ + logger.error(String.format("修改小组信息失败,updatedRows=%s",updatedRows)); + } + } + + /** + * @param groupSummarizeFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 查看小组管理界面信息 + * @Date 2020/3/29 17:52 + **/ + @Override + public GroupSummarizeResultDTO getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) { + GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO); + if (null == groupSummarizeResultDTO) { + logger.warn(String.format("查看小组管理界面信息异常,userId=%s,groupId=%s",groupSummarizeFormDTO.getUserId(),groupSummarizeFormDTO.getGroupId())); + return new GroupSummarizeResultDTO(); + } + //获取组长信息 + Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); + if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { + groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); + } else { + logger.warn(String.format("查看小组管理界面信息错误,获取组长注册信息失败,接口返参%s",JSON.toJSONString(groupLeaderUserInfo))); + groupSummarizeResultDTO.setLeaderName(""); + } + return groupSummarizeResultDTO; + } + + /** + * @param groupId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据组id查询组长信息 + * @Date 2020/3/30 15:07 + **/ + private Result getGroupLeaderUserInfo(String groupId) { + //群主名称需要调用feign查询 + ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId); + if (null == resiGroupEntity) { + return new Result<>(); + } + ResiGroupMemberDTO groupMemberDTO = baseDao.selectGroupLeader(groupId); + if (null == groupMemberDTO) { + return new Result<>(); + } + UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); + resiUserInfoFormDTO.setCustomerId(resiGroupEntity.getCustomerId()); + resiUserInfoFormDTO.setUserId(groupMemberDTO.getCustomerUserId()); + return epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); + } + + /** + * @param applyCreateGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 创建小组 + * @Date 2020/3/29 19:26 + **/ + @Transactional(rollbackFor = Exception.class) + @Override + public void applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { + //1、校验是否同名 + List resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO); + if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) { + logger.info(String.format("创建小组异常:%s",EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg())); + throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode()); + } + + //2.内容检查 + scanGroupEditContent(applyCreateGroupFormDTO.getGroupName(), + applyCreateGroupFormDTO.getGroupIntroduction(), + applyCreateGroupFormDTO.getGroupHeadPhoto()); + + //3.1、查询当前申请人的身份,生成对应格式的消息内容 + UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(), + applyCreateGroupFormDTO.getUserId(), + applyCreateGroupFormDTO.getCustomerId(), + applyCreateGroupFormDTO.getGridId()); + if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { + logger.info(String.format("创建小组异常:%s",EpmetErrorCode.CANNOT_CREATE_GROUP.getMsg())); + throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode()); + } + String roleName = ""; + if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){ + roleName = ModuleConstant.PARTYMEMBER; + }else if(NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())){ + roleName = ModuleConstant.WAREMHEARTED_RESI; + } + + //3.2、插入一条待审核的组信息 + ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO); + insert(resiGroupEntity); + //4.获取居民注册信息 + UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); + resiParam.setCustomerId(applyCreateGroupFormDTO.getCustomerId()); + resiParam.setUserId(applyCreateGroupFormDTO.getUserId()); + Result resiResult = + epmetUserFeignClient.getUserResiInfoDTO(resiParam); + String userName = ""; + if(resiResult.success() && null != resiResult.getData()){ + userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) + + (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName()); + } + userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; + String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName()); + //4.2、插入一条待审核的操作记录 + ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); + resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); + resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); + resiGroupOperation.setOperateUserId(applyCreateGroupFormDTO.getUserId()); + resiGroupOperation.setMessageText(msg); + resiGroupOperation.setReadFlag(ModuleConstant.UNREAD); + resiGroupOperationService.save(resiGroupOperation); + //5、插入一群成员信息(群主) + ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO(); + resiGroupMemberDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId()); + resiGroupMemberDTO.setResiGroupId(resiGroupEntity.getId()); + resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER); + resiGroupMemberDTO.setStatus(MemberStateConstant.UNDER_AUDITTING); + resiGroupMemberDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED); + resiGroupMemberService.save(resiGroupMemberDTO); + //6、插入一条入群记录(群主的) + GroupMemeberOperationDTO groupMemeberOperationDTO = new GroupMemeberOperationDTO(); + groupMemeberOperationDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId()); + groupMemeberOperationDTO.setGroupId(resiGroupEntity.getId()); + groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.UNDER_AUDITTING); + groupMemeberOperationDTO.setOperateUserId(applyCreateGroupFormDTO.getUserId()); + groupMemeberOperationDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED); + groupMemeberOperationService.save(groupMemeberOperationDTO); + //7、群初始统计记录 + /*UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(), + applyCreateGroupFormDTO.getUserId(), + applyCreateGroupFormDTO.getCustomerId(), + applyCreateGroupFormDTO.getGridId());*/ + ResiGroupStatisticalDTO resiGroupStatisticalDTO = new ResiGroupStatisticalDTO(); + resiGroupStatisticalDTO.setResiGroupId(resiGroupEntity.getId()); + resiGroupStatisticalDTO.setTotalMembers(NumConstant.ONE); + resiGroupStatisticalDTO.setTotalNormalMemebers(NumConstant.ONE); + resiGroupStatisticalDTO.setTotalTopics(NumConstant.ZERO); + resiGroupStatisticalDTO.setTotalIssues(NumConstant.ZERO); + if (NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())) { + resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ONE); + } else { + resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ZERO); + } + if (NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { + resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ONE); + } else { + resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO); + } + resiGroupStatisticalService.save(resiGroupStatisticalDTO); + //发送消息:创建小组 + sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId()); + //更新政府端:工作-基层治理-群组管理reddot + resiGroupRedis.addWorkGrassrootsGroupRedDotValue(applyCreateGroupFormDTO.getGridId()); + } + + + private void setWorkGrassrootsGroupRedDot(String gridId) { + try{ + + }catch(Exception e){ + e.printStackTrace(); + } + } + + /** + * @param applyCreateGroupFormDTO + * @return java.util.List + * @Author yinzuomei + * @Description 查询是否存在相同名字的群 + * @Date 2020/3/30 16:01 + **/ + private List getResiGroupEntityList(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { + List list = baseDao.checkResiGroupName(applyCreateGroupFormDTO); + return list; + } + + /** + * @param initApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 加入小组界面初始化 + * @Date 2020/3/30 10:17 + **/ + @Override + public void initApplyGroup(InitApplyGroupFormDTO initApplyGroupFormDTO) { + UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); + resiUserInfoFormDTO.setUserId(initApplyGroupFormDTO.getUserId()); + resiUserInfoFormDTO.setCustomerId(initApplyGroupFormDTO.getCustomerId()); + Result result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); + if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) { + logger.info(String.format("加入小组界面初始化查询成功,当前用户非注册居民,epmet-user-server接口入参%s,返回%s",JSON.toJSONString(resiUserInfoFormDTO),JSON.toJSONString(result))); + throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode()); + } + } + + private ResiGroupEntity structureResiGroupEntity(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { + ResiGroupEntity resiGroupEntity = new ResiGroupEntity(); + resiGroupEntity.setCustomerId(applyCreateGroupFormDTO.getCustomerId()); + resiGroupEntity.setGridId(applyCreateGroupFormDTO.getGridId()); + resiGroupEntity.setGroupHeadPhoto(applyCreateGroupFormDTO.getGroupHeadPhoto()); + resiGroupEntity.setGroupName(applyCreateGroupFormDTO.getGroupName()); + resiGroupEntity.setGroupIntroduction(applyCreateGroupFormDTO.getGroupIntroduction()); + resiGroupEntity.setCreatedBy(applyCreateGroupFormDTO.getUserId()); + resiGroupEntity.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); + return resiGroupEntity; + } + + /** + * @param initApplyCreatedGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 校验用户是否是热心居民或者党员 + * @Date 2020/3/30 15:50 + **/ + @Override + public void initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) { + UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(initApplyCreatedGroupFormDTO.getApp(), + initApplyCreatedGroupFormDTO.getUserId(), + initApplyCreatedGroupFormDTO.getCustomerId(), + initApplyCreatedGroupFormDTO.getGridId()); + if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) { + logger.info(String.format("创建小组界面初始化查询成功,用户角色列表%s",JSON.toJSONString(userRoleDTO))); + throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode()); + } + } + + + /** + * @param agreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 审核群申请-测试用后面会放到政府端 + * @Date 2020/3/31 12:44 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + //1、更新组的状态 + ResiGroupDTO resiGroupDTO = this.get(agreeApplyGroupFormDTO.getGroupId()); + resiGroupDTO.setState(GroupStateConstant.GROUP_APPROVED); + this.update(resiGroupDTO); + //2、更新组的申请记录改为已通过 + ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(agreeApplyGroupFormDTO.getGroupId()); + resiGroupOperation.setState(GroupStateConstant.GROUP_APPROVED); + resiGroupOperation.setOperateUserId(agreeApplyGroupFormDTO.getUserId()); + resiGroupOperationService.update(resiGroupOperation); + //3、将群主在群成员的状态改为已通过 + ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(agreeApplyGroupFormDTO.getGroupId()); + resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED); + resiGroupMemberService.update(resiGroupMemberDTO); + //4、更新群主的出入群记录改为已通过 + GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(agreeApplyGroupFormDTO.getGroupId()); + groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED); + groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId()); + groupMemeberOperationService.update(groupMemeberOperationDTO); + //5、给用户发送消息???待定 + //6、新增小组缓存信息、组员缓存信息 + Map param = new HashMap<>(); + param.put(ModuleConstant.RESI_GROUP_ID, 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(ModuleConstant.GROUP_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()); + memberRedis.setMemberMobile(userInfo.getData().getRegMobile()); + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + resiGroupMemberRedis.set(memberRedis); + } else { + /* + 当没有查询到组统计信息时,需要自己封装统计信息 + @param UserRoleFormDTO::getApp + @param UserRoleFormDTO::getCustomerId + @param UserRoleFormDTO::getUserId + @param UserRoleFormDTO::getGridId + 查询用户身份信息[热心居民/党员] + epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + */ + logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); + } + //发送消息 + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); + userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); + userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); + userMessageFormDTO.setApp(ModuleConstant.APP_RESI); + userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); + userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); + userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())); + if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ + logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()))); + } + //发送微信订阅消息 + WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); + wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); + wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); + wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); + wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId()); + wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR); + wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())); + wxSubscribeMessageFormDTO.setMessageTime(new Date()); + List msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); + //更新政府端:工作-基层治理-党员认证reddot + resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId()); + return new Result(); + } + + /** + * @param disAgreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 审核(拒绝)群申请-测试用后面会放到政府端 + * @Date 2020/3/31 13:22 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + //1、更新组的状态 + ResiGroupDTO resiGroupDTO = this.get(disAgreeApplyGroupFormDTO.getGroupId()); + resiGroupDTO.setState(GroupStateConstant.GROUP_REJECTED); + this.update(resiGroupDTO); + //2、更新组的申请记录改为已通过 + ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(disAgreeApplyGroupFormDTO.getGroupId()); + resiGroupOperation.setState(GroupStateConstant.GROUP_REJECTED); + resiGroupOperation.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId()); + resiGroupOperation.setOperateReason(disAgreeApplyGroupFormDTO.getRejectReason()); + resiGroupOperationService.update(resiGroupOperation); + //3、将群主在群成员的状态改为已通过 + ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(disAgreeApplyGroupFormDTO.getGroupId()); + resiGroupMemberDTO.setStatus(MemberStateConstant.REJECTED); + resiGroupMemberService.update(resiGroupMemberDTO); + //4、更新群主的出入群记录改为已通过 + GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(disAgreeApplyGroupFormDTO.getGroupId()); + groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.REJECTED); + groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId()); + groupMemeberOperationService.update(groupMemeberOperationDTO); + //5、给用户发送消息???待定 + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); + userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); + userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); + userMessageFormDTO.setApp(ModuleConstant.APP_RESI); + userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); + userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); + userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())); + if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ + logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()))); + } + + //发送微信订阅消息 + WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); + wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); + wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); + wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); + wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId()); + wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR); + wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())); + wxSubscribeMessageFormDTO.setMessageTime(new Date()); + List msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); + + //更新政府端:工作-基层治理-党员认证reddot + resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId()); + return new Result(); + } + + /** + * @param app + * @param userId + * @param customerId + * @param gridId + * @return boolean + * @Author yinzuomei + * @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false + * @Date 2020/3/30 16:33 + **/ + @Override + public UserRoleDTO checkPartyMemberOrWarmHeated(String app, String userId, String customerId, String gridId) { + UserRoleDTO userRoleDTO = new UserRoleDTO(); + UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); + userRoleFormDTO.setApp(app); + userRoleFormDTO.setCustomerId(customerId); + userRoleFormDTO.setUserId(userId); + userRoleFormDTO.setGridId(gridId); + logger.info(String.format("用户同意邀请进组,获取当前用户所有角色入参:%s", JSON.toJSONString(userRoleFormDTO))); + Result> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + if (!userRoleListResult.success()) { + logger.error("获取用户角色feign调用失败" + userRoleListResult.getMsg()); + return userRoleDTO; + } + List userRoleList = userRoleListResult.getData(); + if (null == userRoleList || userRoleList.size() == 0) { + return userRoleDTO; + } + for (UserRoleResultDTO userRoleResultDTO : userRoleList) { + if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey())) { + userRoleDTO.setPartymemberFlag(NumConstant.ONE_STR); + } + if (EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) { + userRoleDTO.setWarmHeartedFlag(NumConstant.ONE_STR); + } + if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(userRoleResultDTO.getRoleKey())) { + userRoleDTO.setRegisteredResiFlag(NumConstant.ONE_STR); + } + } + logger.info(String.format("用户同意邀请进组,获取当前用户所有角色返参:%s",JSON.toJSONString(userRoleDTO))); + return userRoleDTO; + } + + @Override + public Result> audited(GroupAuditedFromDTO formDTO) { + Result> result = new Result<>(); + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //获取审核列表 + List resultList = baseDao.selectAuditedGroupList(formDTO); + + return result.ok(resultList); + } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + List resultList = new ArrayList<>(); + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List list = baseDao.selectGroupsByGridId(formDTO); + list.forEach(group -> { + GroupsInGridResultDTO groupsInGridResultDTO = new GroupsInGridResultDTO(); + if (MemberStateConstant.REJECTED.equals(group.getState())) { + groupsInGridResultDTO.setGroupId(group.getId()); + groupsInGridResultDTO.setGroupName(group.getGroupName()); + groupsInGridResultDTO.setGroupHeadPhoto(group.getGroupHeadPhoto()); + groupsInGridResultDTO.setStatus(group.getState()); + groupsInGridResultDTO.setTotalMember(NumConstant.ZERO); + groupsInGridResultDTO.setTotalPartyMember(NumConstant.ZERO); + resultList.add(groupsInGridResultDTO); + } else if(MemberStateConstant.APPROVED.equals(group.getState())) { + //缓存中获取组信息 + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(group.getId()); + groupsInGridResultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); + groupsInGridResultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); + groupsInGridResultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); + groupsInGridResultDTO.setStatus(resiGroupInfoRedisDTO.getGroupState()); + groupsInGridResultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); + groupsInGridResultDTO.setTotalPartyMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalPartyMembers()); + resultList.add(groupsInGridResultDTO); + } + + + }); + + return new Result>().ok(resultList); + } + + @Override + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + GovGroupSummarizeResultDTO resultDTO = new GovGroupSummarizeResultDTO(); + //从缓存中获取组相关信息 + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(formDTO.getGroupId()); + resultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); + resultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); + resultDTO.setGroupIntroduction(resiGroupInfoRedisDTO.getGroupIntroduction()); + resultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); + resultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); + resultDTO.setTotalTopics(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalTopics()); + + //获取组长信息 + Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(formDTO.getGroupId()); + if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { + resultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); + } else { + logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); + } + + return new Result().ok(resultDTO); + } + + /** + * @return ResiGroupInfoRedisDTO + * @Description 将ResiGroupDTO与ResiGroupStatisticalDTO转换成ResiGroupInfoRedisDTO + * @Param ResiGroupDTO + * @Param ResiGroupStatisticalDTO + * @Author wangc + * @Date 2020.04.13 16:36 + **/ + private ResiGroupInfoRedisDTO transferToGroupInfoRedis(ResiGroupDTO groupDTO, ResiGroupStatisticalDTO statisticalDTO) { + + ResiGroupStatisticalInfoRedisDTO statisticalObjct = + ConvertUtils.sourceToTarget(statisticalDTO, ResiGroupStatisticalInfoRedisDTO.class); + statisticalObjct.setTotalEarnestMembers(statisticalDTO.getTotalEarnestMemebers()); + statisticalObjct.setTotalNormalMembers(statisticalDTO.getTotalNormalMemebers()); + ResiGroupInfoRedisDTO targetObject = + ConvertUtils.sourceToTarget(groupDTO, ResiGroupInfoRedisDTO.class); + targetObject.setGroupId(groupDTO.getId()); + targetObject.setGroupState(groupDTO.getState()); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); + if (null != groupDTO.getLatestTopicPublishDate()) { + targetObject.setLatestTopicPublishDate(format.format(groupDTO.getLatestTopicPublishDate())); + } + targetObject.setGroupStatisticalInfo(statisticalObjct); + return targetObject; + } + + /** + * @Description 查询待审核的小组 (不从缓存中取,这时还没有成功建组,缓存中没有组数据) + * @Param ApplyingGroupsFormDTO + * @return Result> + * @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.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()); + StringBuffer buffer = new StringBuffer(detail.getStreet()); + buffer.append(StringUtils.isBlank(buffer) ? "" : "-"); + detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString()); + }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(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class)); + } + + @Override + public List queryGroupProcessingCount(List gridIdList) { + List list=new ArrayList<>(); + for(String gridId:gridIdList){ + GroupProcessingCountResultDTO resultDTO=new GroupProcessingCountResultDTO(); + resultDTO.setGridId(gridId); + Integer auditingCreateGroupCount=resiGroupRedis.getWorkGrassrootsGroupRedDotValue(gridId); + Integer auditingGroupEditRecordCount=groupEditSubmitRecordDao.selectCountAuditingRec(gridId); + Integer auditingCount=auditingCreateGroupCount+auditingGroupEditRecordCount; + if (null == auditingCount) { + resultDTO.setCount(0); + } else { + resultDTO.setCount(auditingCount); + } + list.add(resultDTO); + } + return list; + } + + + /** + * @Description 查询一个网格下面所有组Id + * @param gridId + * @return List + * @author wangc + * @date 2020.05.14 10:54 + **/ + @Override + public List getGroupIdByGridId(String gridId) { + if(StringUtils.isBlank(gridId)) return null; + return baseDao.getGroupIdByGridId(gridId); + } + + /** + * @Description 返回 Map> + * @param gridIdList + * @return Map> + * @author wangc + * @date 2020.05.22 09:27 + **/ + @Override + public Map> getGroupIdsByGridIdList(List gridIdList) { + if(null == gridIdList || gridIdList.size() < NumConstant.ONE) + return null; + Map> result = new HashMap<>(); + List groups = new ArrayList<>(); + Map> groupMap + = groups.stream().collect(Collectors.groupingBy(ResiGroupDTO::getGridId)); + groupMap.forEach((k,v)->{ + Set groupIds = + v.stream().map(ResiGroupDTO::getId).collect(Collectors.toSet()); + result.put(k,groupIds); + }); + + return result; + } + + /** + * @Description 校验用户是否加入小组 + * @param gridId + * @author zxc + */ + @Override + public CheckJoinTeamResultDTO checkjointeam(GridIdFormDTO gridId) { + CheckJoinTeamResultDTO checkJoinTeamResultDTO = new CheckJoinTeamResultDTO(); + Integer joinTeamCounts = baseDao.checkjointeam(gridId); + if (joinTeamCounts==NumConstant.ZERO){//未加入任何小组(当前网格下) + checkJoinTeamResultDTO.setVoteAuthorization(false); + }else { + checkJoinTeamResultDTO.setVoteAuthorization(true); + } + return checkJoinTeamResultDTO; + } + + /** + * @Description 获取应表决数 + * @param formDTO + * @author zxc + */ + @Override + public ShouldVoteCountResultDTO shouldVoteCount(ShouldVoteCountFormDTO formDTO) { + //网格下所有加过组的人数 + Integer shouldVoteCount = baseDao.shouldVoteCount(formDTO).getShouldVoteCount(); + Integer outGroupCount = baseDao.getOutGroupCount(formDTO); + ShouldVoteCountResultDTO result = new ShouldVoteCountResultDTO(); + result.setShouldVoteCount(shouldVoteCount-outGroupCount); + return result; + } + + @Override + public List recommendedList(RecommendedListFormDTO formDTO) { + + //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以话题数由多到少排序 + List recommendGroupList = baseDao.selectListRecommendList(formDTO); + recommendGroupList.forEach(dto -> { + Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(dto.getGroupId()); + if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { + dto.setLeaderName(groupLeaderUserInfo.getData().getShowName()); + } else { + logger.warn("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); + } + }); + return recommendGroupList; + } + + /** + * @Description 给加入此网格的网格长发送消息 + * @param msg + * @param gridId + * @param userId + * @author wangc + * @date 2020.04.29 22:49 + **/ + private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){ + //1.查询加入当前网格下的人员 customer_staff_grid + CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO(); + commonGridIdFormDTO.setGridId(gridId); + commonGridIdFormDTO.setUserId(userId); + Result> gridstaffs = + govOrgFeignClient.getGridStaffs(commonGridIdFormDTO); + //2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff + if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){ + RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO(); + rolesUsersListFormDTO.setCustomerId(customerId); + List roleKeys = new ArrayList(); + roleKeys.add(ModuleConstant.STAFF_ROLE_GRID_MANAGER); + rolesUsersListFormDTO.setRoleKeys(roleKeys); + rolesUsersListFormDTO.setUserIds(gridstaffs.getData()); + Result> staffRoles = + epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO); + //3.发送消息 + if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){ + List msgList = new ArrayList<>(); + List subscribeList = new ArrayList<>(); + for(String to : staffRoles.getData()){ + //站内信 + UserMessageFormDTO msgObj = new UserMessageFormDTO(); + msgObj.setApp(ModuleConstant.APP_GOV); + msgObj.setCustomerId(customerId); + msgObj.setGridId(gridId); + msgObj.setMessageContent(msg); + msgObj.setReadFlag(ReadFlagConstant.UN_READ); + msgObj.setTitle(title); + msgObj.setUserId(to); + msgList.add(msgObj); + //微信订阅 + WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO(); + subscribeDTO.setClientType(ModuleConstant.APP_GOV); + subscribeDTO.setGridId(gridId); + subscribeDTO.setCustomerId(customerId); + subscribeDTO.setUserId(to); + subscribeDTO.setBehaviorType(UserMessageConstant.WX_CREATE_GROUP_BEHAVIOR); + subscribeDTO.setMessageContent(msg); + subscribeDTO.setMessageTime(new Date()); + subscribeList.add(subscribeDTO); + } + if (subscribeList.size() > NumConstant.ZERO){ + epmetMessageOpenFeignClient.sendWxSubscribeMessage(subscribeList); + } + Result result = epmetMessageFeignClient.saveUserMessageList(msgList); + if(result.success()){ + return; + } + } + } + logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg)); + + } + + @Override + public GroupDetailResultDTO getGroupDetail(String groupId) { + GroupDetailResultDTO groupDetail = new GroupDetailResultDTO(); + + // 1.拼装组基本信息 + GroupEditSubmitRecordEntity ler = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId); + + if (ler != null) { + groupDetail.setAuditStatus(ler.getAuditStatus()); + groupDetail.setRemark(ler.getRemark()); + } + + if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) { + // 审核中,显示待审核内容 + groupDetail.setGroupHeadPhoto(ler.getGroupHeadPhoto()); + groupDetail.setGroupName(ler.getGroupName()); + groupDetail.setGroupIntroduction(ler.getGroupIntroduction()); + } else { + // 不在审核中,直接显示组信息 + ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupId); + if (resiGroupEntity == null) { + return null; + } + + groupDetail.setGroupHeadPhoto(resiGroupEntity.getGroupHeadPhoto()); + groupDetail.setGroupName(resiGroupEntity.getGroupName()); + groupDetail.setGroupIntroduction(resiGroupEntity.getGroupIntroduction()); + } + + // 2.编辑次数及其限制 + groupDetail.setEditNumLimit(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH); + Date now = new Date(); + int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now)); + groupDetail.setAvaliableEditNum(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH - usedEditNum); + + // 审核状态 + // 是否可编辑 + boolean editable = true; + + if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) { + // 达到最大编辑次数了 + editable = false; + } + + if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) { + // 提交了,还没审核完 + editable = false; + } + + groupDetail.setEditable(editable); + return groupDetail; + } + + @Override + public void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId) { + // 1.判断小组是否存在,判断是否已经在"待审核"状态 + ResiGroupEntity group = resiGroupDao.selectById(groupId); + if (group == null) { + throw new RenException(EpmetErrorCode.GROUP_NOT_EXISTS.getCode(), EpmetErrorCode.GROUP_NOT_EXISTS.getMsg()); + } + + // 判断是否是组长 + ResiGroupMemberDTO groupLeader = resiGroupMemberDao.selectLeaderMember(groupId); + if (groupLeader == null || !groupLeader.getCustomerUserId().equals(editUserId)) { + String msg = "只有该组的组长才可以编辑组信息"; + throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), msg, msg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL); + } + + // 2.判断是否可以提交编辑 + GroupEditSubmitRecordEntity lre = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId); + if (lre != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(lre.getAuditStatus())) { + // 在待审核状态,不允许再次提交编辑 + throw new RenException(EpmetErrorCode.GROUP_IN_AUDITING.getCode(), EpmetErrorCode.GROUP_IN_AUDITING.getMsg()); + } + + if (resiGroupDao.countExistsGroupNameBeforeEdit(groupId, group.getGridId(), groupName) > 0) { + // 已存在组名,拒绝提交 + throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(), EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg()); + } + + Date now = new Date(); + int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now)); + if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) { + // 达到最大编辑次数了 + throw new RenException(EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getCode(), EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getMsg()); + } + + // 3.内容检查 + scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto); + + String app = loginUserUtil.getLoginUserApp(); + String userId = loginUserUtil.getLoginUserId(); + String messageText = generateGroupEditMessageText(app, userId, group.getCustomerId(), group.getGridId(), groupName); + + // 4.创建编辑提交记录 + GroupEditSubmitRecordEntity editRecord = new GroupEditSubmitRecordEntity(); + editRecord.setAuditStatus(GroupAuditStatusConstant.UNDER_AUDITING); + editRecord.setCustomerId(group.getCustomerId()); + editRecord.setGridId(group.getGridId()); + editRecord.setGroupHeadPhoto(groupHeadPhoto); + editRecord.setGroupIntroduction(groupIntroduction); + editRecord.setGroupId(groupId); + editRecord.setGroupName(groupName); + editRecord.setReadFlag(ReadFlagConstant.UN_READ); + editRecord.setMessageText(messageText); + + if (groupEditSubmitRecordDao.insert(editRecord) == 0) { + throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), EpmetErrorCode.GROUP_EDIT_ERROR.getMsg()); + } + + resiGroupRedis.addWorkGrassrootsGroupRedDotValue(group.getGridId()); + + } + + /** + * 生成组信息编辑简介文本:xxx申请编辑组信息,请审核 + * @param app + * @param userId + * @param customerId + * @param gridId + * @param groupName + * @return + */ + private String generateGroupEditMessageText(String app, String userId, String customerId, String gridId, String groupName) { + List resiRoles = getResiRoles(app, customerId, userId, gridId); + boolean isPartymember = false; + boolean isWarmhearted = false; + for (UserRoleResultDTO role : resiRoles) { + if (EpmetRoleKeyConstant.WARMHEARTED.equals(role.getRoleKey())) { + isWarmhearted = true; + } + if (EpmetRoleKeyConstant.PARTYMEMBER.equals(role.getRoleKey())) { + isPartymember = true; + } + } + if (!isWarmhearted && isPartymember) { + throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode(), "只有党员和热心居民才能创建和编辑小组"); + } + String roleName = ""; + if (isPartymember) { + roleName = ModuleConstant.PARTYMEMBER; + } else if (isWarmhearted) { + roleName = ModuleConstant.WAREMHEARTED_RESI; + } + + //3.获取居民注册信息 + UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO(); + resiParam.setCustomerId(customerId); + resiParam.setUserId(userId); + Result resiResult = + epmetUserFeignClient.getUserResiInfoDTO(resiParam); + String userName = ""; + if (resiResult.success() && null != resiResult.getData()) { + userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname()) + + (StringUtils.isBlank(resiResult.getData().getName()) ? "" : resiResult.getData().getName()); + } + userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName; + return String.format(UserMessageConstant.EDIT_OF_GROUP_MESSAGE_TEMPLATE, roleName, userName, groupName); + } + + /** + * 查询居民的角色列表 + * @param app + * @param customerId + * @param userId + * @param gridId + * @return + */ + private List getResiRoles(String app, String customerId, String userId, String gridId) { + UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); + userRoleFormDTO.setApp(app); + userRoleFormDTO.setCustomerId(customerId); + userRoleFormDTO.setUserId(userId); + userRoleFormDTO.setGridId(gridId); + Result> rolesResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + + if (! rolesResult.success()) { + logger.error("修改组信息:查询居民角色失败,详情:{}", rolesResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "查询居民角色失败"); + } else { + List roles = rolesResult.getData(); + if (CollectionUtils.isEmpty(roles)) { + roles = new ArrayList<>(); + } + return roles; + } + } + + /** + * 内容检查 + * @param groupName + * @param groupIntroduction + * @param groupHeadPhoto + */ + private void scanGroupEditContent(String groupName, String groupIntroduction, String groupHeadPhoto) { + // 文本内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + String content = groupName.concat("-").concat(groupIntroduction); + taskDTO.setContent(content); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + + // 图片内容审核 + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(groupHeadPhoto); + imgScanParamDTO.getTasks().add(task); + + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + logger.error("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); + } + } + } + + /** + * @Description 工作端 查询组变更待审核列表 + * @param param + * @return + * @author wangc + * @date 2020.11.03 10:19 + */ + @Override + public List getEditAuditingList(CommonGridAndPageFormDTO param) { + return Optional.ofNullable(PageHelper.startPage(null == param.getPageNo() ? NumConstant.ONE : param.getPageNo() , null == param.getPageSize() ? NumConstant.TWELVE : param.getPageSize()) + .doSelectPage(() -> { + groupEditSubmitRecordDao.selectGroupEditApplyList(param.getGridId());}).getResult()).orElse(new LinkedList<>()) + .stream().map(o -> { return (ApplyingGroupResultDTO)o; }).collect(Collectors.toList()); + } + + /** + * @Description 查询小组修改信息的详情内容 不加事务! + * @param param + * @return com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO + * @author wangc + * @date 2020.11.03 14:10 + */ + @Override + public GroupEditionDetailResultDTO getEditAuditingDetail(GovGroupSummarizeFromDTO param) { + GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null); + if(null == edit) { + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.getEditAuditingDetail,未找到小组变更信息记录,传参:{}",JSON.toJSONString(param)); + return null;} + //取消未读状态 + GroupEditSubmitRecordEntity _update = new GroupEditSubmitRecordEntity(); + _update.setId(edit.getId());_update.setReadFlag(ModuleConstant.READ); + groupEditSubmitRecordDao.updateById(_update); + GroupEditionDetailResultDTO result = ConvertUtils.sourceToTarget(edit, GroupEditionDetailResultDTO.class); + result.setGroupLeaderName(resiGroupRedis.getFullName(edit.getCreatedBy())); + return result; + } + + /** + * @Description 工作人员提交审核 + * @param param + * @return void + * @author wangc + * @date 2020.11.03 16:02 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void auditEdit(GroupEditionAuditFormDTO param) { + if(StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT) && StringUtils.isBlank(param.getRemark())){ + throw new RenException("拒绝理由不能为空"); + } + GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null); + if(null == edit){ + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,找不到待审核的组更新记录,传参:{}",JSON.toJSONString(param)); + throw new RenException("找不到待审核的组更新记录"); + } + + int affectedRows = groupEditSubmitRecordDao.updateAuditResult(param.getGroupId(),param.getStaffId(),param.getAuditResult(),param.getRemark()); + if(affectedRows <= NumConstant.ZERO){ + logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,更新组编辑记录时受影响行数小于1,传参:{}",JSON.toJSONString(param)); + throw new RenException("更新组编辑记录时受影响行数小于1"); + } + if(!StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT)){ + //同意 + ResiGroupEntity _update = ConvertUtils.sourceToTarget(edit,ResiGroupEntity.class); + _update.setId(param.getGroupId()); + baseDao.updateById(_update); + } + resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(edit.getGridId()); + resiGroupRedis.delGroup(param.getGroupId()); + } + +} From 2f034a045c841fa14db67f3fca9fc9a8bfc789bc Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 15:00:18 +0800 Subject: [PATCH 31/38] =?UTF-8?q?=E6=88=91=E5=8F=91=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E8=AE=AE=E9=A2=98=E8=A1=A8=E5=86=B3=E4=B8=AD=20url=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../person/controller/IssueController.java | 2 +- .../service/impl/UserBadgeServiceImpl.java | 25 ------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java index 1119d95bc3..e4757758f7 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/controller/IssueController.java @@ -63,7 +63,7 @@ public class IssueController { * @author zxc * @date 2020/11/11 9:24 上午 */ - @PostMapping("my-pub-issues/auditing") + @PostMapping("my-pub-issues/voting") public Result> myPubIssuesAuditing(@LoginUser TokenDto tokenDto, @RequestBody MyPubIssuesAuditingFormDTO myPubIssuesAuditingFormDTO){ ValidatorUtils.validateEntity(myPubIssuesAuditingFormDTO, MyPubIssuesAuditingFormDTO.MyPubIssuesAuditing.class); return new Result>().ok(issueService.myPubIssuesAuditing(tokenDto,myPubIssuesAuditingFormDTO)); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 208611a01f..a0d4b75a41 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -289,31 +289,6 @@ public class UserBadgeServiceImpl implements UserBadgeService { } } - /** - * @Description 站内信发送——提交徽章认证 - * @Param form - * @author zxc - * @date 2020/11/10 9:04 上午 - */ - public void sendMessageByUser(UserBadgeCertificateRecordDTO form) { - List msgList = new ArrayList<>(); - UserMessageFormDTO formDTO = new UserMessageFormDTO(); - formDTO.setApp(BadgeConstant.RESI); - formDTO.setCustomerId(form.getCustomerId()); - formDTO.setGridId(form.getGridId()); - UserBadgeListResultDTO userBadgeListResultDTO = userBadgeDao.selectBadgeByBadgeId(form.getCustomerId(), form.getBadgeId()); - if (null == userBadgeListResultDTO){ - log.error(BadgeConstant.GET_BADGE_NAME_FAILURE); - return; - } - formDTO.setMessageContent(String.format(BadgeConstant.MESSAGE_CONTENT,userBadgeListResultDTO.getBadgeName())); - formDTO.setTitle(BadgeConstant.AUTH_TITLE); - formDTO.setReadFlag(BadgeConstant.READ_FLAG); - formDTO.setUserId(form.getUserId()); - msgList.add(formDTO); - Result result = messageFeignClient.saveUserMessageList(msgList); - } - /** * @Description 发送验证码 * @Param badgeSendCodeFormDTO From 0a40ab20884c0a665e5cc443a625f85d8b4d79eb Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 15:14:59 +0800 Subject: [PATCH 32/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/UserBadgeDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index dfb53c3363..74183a1073 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -52,10 +52,10 @@ sort FROM ( SELECT * FROM badge - WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' + WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' AND BADGE_STATUS = 'online' UNION ALL SELECT * FROM badge a - WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND BADGE_STATUS = 'online' + WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND NOT EXISTS ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)) t ORDER BY From 4e117ec2d0e44c364fa8cadaf481d689d1b2e99d Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 20 Nov 2020 15:35:35 +0800 Subject: [PATCH 33/38] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=94=A8=E6=88=B7=E5=BE=BD=E7=AB=A0=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E7=94=A8=E6=88=B7=E6=98=AF=E7=82=B9=E4=BA=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E4=BD=86=E6=98=AF=E5=AE=A2=E6=88=B7=E7=9A=84?= =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E8=A2=AB=E4=B8=8B=E7=BA=BF=EF=BC=8C=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E4=B8=AD=E4=B8=8D=E4=BC=9A=E5=87=BA=E7=8E=B0=E6=AD=A4?= =?UTF-8?q?=E5=BE=BD=E7=AB=A0=EF=BC=8C=E4=BD=86=E6=98=AF=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=B8=AD=E4=BE=9D=E7=84=B6=E5=AD=98=E5=9C=A8=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E6=98=AF=E7=82=B9=E4=BA=AE=E7=8A=B6=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/UserBadgeDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index 74183a1073..5a7e8e6c6b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -219,7 +219,7 @@ badgeInfo.BADGE_ICON FROM resi_user_badge userBadge - LEFT JOIN ( + INNER JOIN ( SELECT id AS badgeId, CUSTOMER_ID, From 4c9f872ecf5a43275272922f3e109dcae5249c79 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Nov 2020 15:51:06 +0800 Subject: [PATCH 34/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/UserBadgeServiceImpl.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index a0d4b75a41..5995748dc9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -88,20 +88,12 @@ public class UserBadgeServiceImpl implements UserBadgeService { userBadgeListResultDTOS.forEach(badge -> { if (u.getBadgeId().equals(badge.getBadgeId())){ badge.setBadgeIcon(u.getBadgeIcon()); + u.setUpdatedTime(badge.getUpdatedTime()); u.setStatus(true); } }); }); - List noOpenBadge = new ArrayList<>(); - redisUserBadgeList.forEach(u -> { - if (!u.getStatus()){ - noOpenBadge.add(u); - } - }); - if (!CollectionUtils.isEmpty(noOpenBadge)){ - userBadgeListResultDTOS.addAll(noOpenBadge); - } - return userBadgeListResultDTOS.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getIsOpened,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getUpdatedTime,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList()); + return redisUserBadgeList.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getStatus,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getUpdatedTime,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList()); } /** From de55c796427e7c00f7889fbd7988fc853c9d3374 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 23 Nov 2020 10:03:15 +0800 Subject: [PATCH 35/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8F=90=E4=BA=A4=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dao/UserBadgeCertificateRecordDao.java | 12 +++++++++++- .../epmet/service/impl/UserBadgeServiceImpl.java | 16 +++++++++++++++- .../mapper/UserBadgeCertificateRecordDao.xml | 12 ++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java index f7f4dba91c..2d73b4bac6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.UserBadgeCertificateRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 用户认证徽章记录表 @@ -29,5 +30,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface UserBadgeCertificateRecordDao extends BaseDao { - + + /** + * @Description 查询是否已存在记录 + * @Param badgeId + * @Param userId + * @author zxc + * @date 2020/11/23 上午9:50 + */ + Integer selectIsExist(@Param("badgeId")String badgeId,@Param("userId")String userId); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 5995748dc9..6edee9eff0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -65,6 +65,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private BadgeCertificationConfigDao badgeCertificationConfigDao; + @Autowired + private UserBadgeCertificateRecordDao userBadgeCertificateRecordDao; /** * @Description 查询已经点亮的徽章 @@ -84,6 +86,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){ return redisUserBadgeList.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList()); } + List result = new ArrayList<>(); + result.addAll(userBadgeListResultDTOS); redisUserBadgeList.forEach(u -> { userBadgeListResultDTOS.forEach(badge -> { if (u.getBadgeId().equals(badge.getBadgeId())){ @@ -93,7 +97,13 @@ public class UserBadgeServiceImpl implements UserBadgeService { } }); }); - return redisUserBadgeList.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getStatus,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getUpdatedTime,Comparator.reverseOrder()).thenComparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList()); + Map> collect = redisUserBadgeList.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getStatus)); + List noIsLight = collect.get(false); + if (CollectionUtils.isEmpty(noIsLight)){ + return result; + } + result.addAll(noIsLight.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList())); + return result; } /** @@ -233,6 +243,10 @@ public class UserBadgeServiceImpl implements UserBadgeService { @Override @Transactional(rollbackFor = Exception.class) public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) { + Integer recordCount = userBadgeCertificateRecordDao.selectIsExist(certificationAddFormDTO.getBadgeId(), certificationAddFormDTO.getUserId()); + if (recordCount>NumConstant.ZERO){ + throw new RenException("不允许重复提交审核"); + } log.info(JSON.toJSONString(certificationAddFormDTO)); AuthFieldFormDTO authFieldFormDTO = new AuthFieldFormDTO(); authFieldFormDTO.setCustomerId(certificationAddFormDTO.getCustomerId()); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml index a2f59e8b8e..2a58027d9c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml @@ -28,5 +28,17 @@ + + + \ No newline at end of file From 8a9d6e1909725691551c18a291a83ccc58b27a63 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 23 Nov 2020 10:07:21 +0800 Subject: [PATCH 36/38] =?UTF-8?q?=E6=97=A7=E6=8E=A5=E5=8F=A3=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/CustomerGridServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 1d6676e96f..df895b4f11 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -566,6 +566,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> getGridListByGridIds(List gridIdList) { Result> result = new Result>(); + if (gridIdList.size() < NumConstant.ONE) { + logger.error("根据网格Id集合获取网格列表信息-传入的网格Id集合为空数组!"); + return result; + } List list = baseDao.selectGridByIds(gridIdList); return result.ok(list); } From 0c9515018d77a55f4f19f622a1b9e9ebe8350eda Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 23 Nov 2020 10:57:26 +0800 Subject: [PATCH 37/38] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index 5a7e8e6c6b..80ea8028b6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -37,6 +37,7 @@ AND ub.CERTIFICATION_AUTID_STATUS = 'approved' AND b.CUSTOMER_ID = 'default' AND b.BADGE_STATUS = 'online' + AND ub.IS_OPENED = 1 AND ub.USER_ID = #{userId} ORDER BY ub.UPDATED_TIME DESC From cd014fc47ef9b68aa1a08c82ec0b554b65319e51 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 23 Nov 2020 13:35:21 +0800 Subject: [PATCH 38/38] =?UTF-8?q?=E6=96=87=E6=A1=88=E5=86=99=E9=94=99(?= =?UTF-8?q?=E5=B7=B2=E8=BD=AC=E9=A1=B9=E7=9B=AE=E5=86=99=E6=88=90=E5=B7=B2?= =?UTF-8?q?=E8=BD=AC=E8=AE=AE=E9=A2=98)=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/modules/person/service/impl/TopicServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/TopicServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/TopicServiceImpl.java index fe816108c1..a978c0563d 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/TopicServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/person/service/impl/TopicServiceImpl.java @@ -64,7 +64,7 @@ public class TopicServiceImpl implements TopicService { Result> rst = govOrgOpenFeignClient.getGridListByGridIds(gridIds); if (!rst.success()) { - logger.error("查询我创建的话题列表(已转议题),根据网格id查询网格名称失败, InternalMsg:{},Msg:{}", rst.getInternalMsg(), rst.getMsg()); + logger.error("查询我创建的话题列表(已转项目),根据网格id查询网格名称失败, InternalMsg:{},Msg:{}", rst.getInternalMsg(), rst.getMsg()); } else { List gridInfos = rst.getData(); HashMap gridIdAndNames = new HashMap<>();