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-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/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/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..bb1251bf6a
--- /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,36 @@
+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 {}
+
+ // 提交组编辑校验组
+ public interface SubmitGroupEditVG {}
+
+
+ /**
+ * 组id
+ */
+ @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-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/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-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/constant/UserMessageConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java
index d7da80088c..dcc8e30fce 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/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
index afdce31da0..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
@@ -359,4 +359,29 @@ public class ResiGroupController {
resiGroupStatisticalService.updateWhenAuditedResiRole(resiIdentityFormDTO);
return new Result();
}
+
+ /**
+ * 查询组详情
+ * @param form
+ * @return
+ */
+ @PostMapping("get-detail")
+ public Result getGroupDetail(@RequestBody EditGroupFormDTO form){
+ ValidatorUtils.validateEntity(form, EditGroupFormDTO.GroupDetailVG.class);
+ 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/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..37eb9f366e
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupEditSubmitRecordDao.java
@@ -0,0 +1,52 @@
+/**
+ * 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;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+
+/**
+ * 组编辑提交记录表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-11-02
+ */
+@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/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/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..9f8b5c8816
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java
@@ -0,0 +1,101 @@
+/**
+ * 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 String 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;
+
+ /**
+ * 审核人员查看待审核列表时的文案 如:党员李华申请变更小组【原小组名】,请审核。
+ */
+ private String messageText;
+
+ /**
+ * 已读read 未读unread
+ */
+ private String readFlag;
+
+}
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..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
@@ -293,4 +293,8 @@ public interface ResiGroupService extends BaseService {
* @return java.util.List
*/
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 d24ad2e1c4..e1121d6c9d 100644
--- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
@@ -28,9 +28,16 @@ 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.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;
@@ -40,8 +47,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;
@@ -54,10 +63,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.*;
@@ -71,8 +77,10 @@ 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.*;
@@ -127,6 +135,24 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) {
IPage page = baseDao.selectPage(
@@ -574,18 +600,6 @@ public class ResiGroupServiceImpl extends BaseServiceImpl msgList = new ArrayList<>();
- msgList.add(wxSubscribeMessageFormDTO);
- epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
//更新政府端:工作-基层治理-党员认证reddot
resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId());
return new Result();
@@ -1016,4 +1030,216 @@ public class ResiGroupServiceImpl extends BaseServiceImpl 0) {
+ // 已存在组名,拒绝提交
+ throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "组名已存在");
+ }
+
+ // 2.内容检查
+ //scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto);
+
+ String app = loginUserUtil.getLoginUserApp();
+ String userId = loginUserUtil.getLoginUserId();
+ String messageText = generateGroupEditMessageText(app, userId, group.getCustomerId(), group.getGridId(), groupName);
+
+ // 3.创建编辑提交记录
+ 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());
+ }
+ }
+
+ /**
+ * 生成组信息编辑简介文本: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());
+ }
+ }
+ }
}
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
new file mode 100644
index 0000000000..1b689eb363
--- /dev/null
+++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+ id,
+ group_id,
+ customer_id,
+ grid_id,
+ group_head_photo,
+ group_name,
+ group_introduction,
+ audit_status,
+ staff_id,
+ remark,
+ audit_time,
+ read_flag,
+ message_text,
+ del_flag,
+ revision,
+ created_by,
+ created_time,
+ updated_by,
+ updated_time
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select count(1)
+ from group_edit_submit_record
+ where GROUP_ID = #{groupId}
+ and CREATED_TIME between #{monthStart} and #{monthEnd}
+ and DEL_FLAG=0
+
+
+
+ select
+
+ from group_edit_submit_record
+ where
+ DEL_FLAG=0
+ and group_id = #{groupId}
+ order by CREATED_TIME desc
+ limit 1
+
+
+
+
\ No newline at end of file
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}
+
+
+ select sum(t.c) num
+ from (
+ select count(1) c
+ from resi_group g
+ where g.GROUP_NAME = #{groupName}
+ and g.DEL_FLAG = 0
+ and g.GRID_ID = #{gridId}
+ and g.ID != #{groupId}
+ and g.STATE in ('approved', 'under_auditting')
+ union all
+ select count(1) c
+ from group_edit_submit_record esr
+ where esr.GROUP_ID != #{groupId}
+ and esr.GRID_ID = #{gridId}
+ and esr.GROUP_NAME = #{groupName}
+ and esr.AUDIT_STATUS = 'under_auditting'
+ and esr.DEL_FLAG = 0
+ ) t
+