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 bcbded2bd6..0196f02f44 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 @@ -522,4 +522,16 @@ public class RedisKeys { public static String getCustomerStaffInfoKey(String customerId, String staffId) { return rootPrefix.concat("gov:staff:").concat(customerId).concat(StrConstant.COLON).concat(staffId); } + + /** + * @description 网格信息 + * + * @param gridId + * @return + * @author wxz + * @date 2021.09.08 11:03:48 + */ + public static String getGridInfoKey(String gridId) { + return rootPrefix.concat("gov:grid:").concat(gridId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java new file mode 100644 index 0000000000..2900180581 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java @@ -0,0 +1,12 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +@Data +public class GridInfoCache { + private String gridId; + private String gridNamePath; + private String customerId; + private String pid; + private String pids; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java index 103baa6b0d..331febcfe9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java @@ -31,6 +31,7 @@ public class Pinyin4jUtil { duoyinMap.put('均',new String[]{"jun"}); duoyinMap.put('会', new String[]{"hui"}); duoyinMap.put('属', new String[]{"shu"}); + duoyinMap.put('调', new String[]{"diao"}); } /** @@ -42,7 +43,6 @@ public class Pinyin4jUtil { */ public static String getFirstSpellPinYin(String src, boolean isFullSpell) { String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, 1)); - System.out.println("targetStr="+targetStr); String[] split = targetStr.split(","); if (split.length > 1) { targetStr = split[0]; @@ -59,7 +59,6 @@ public class Pinyin4jUtil { */ public static String getSpellPinYin(String src, boolean isFullSpell,Integer preFont) { String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, preFont)); - System.out.println("targetStr="+targetStr); String[] split = targetStr.split(","); if (split.length > 1) { targetStr = split[0]; @@ -139,8 +138,8 @@ public class Pinyin4jUtil { } else if (((int) c >= 65 && (int) c <= 90) || ((int) c >= 97 && (int) c <= 122)) {//英文 temp[i] = new String[]{String.valueOf(srcChar[i])}; - } else { - temp[i] = new String[]{""}; + } else {//非汉字全盘返回即可 + temp[i] = new String[]{String.valueOf(srcChar[i])}; } } String[] pingyinArray = exchange(temp); @@ -196,9 +195,8 @@ public class Pinyin4jUtil { } public static void main(String[] args) { - //System.out.println(getSpellPinYin("社区超期项目数",true,0)); - System.out.println(getFirstSpellPinYin("区直部门",true)); - //System.out.println(getSpellPinYin("党员提出话题数",false,4)); - //System.out.println(getSpellPinYin("社区超期项目数",false,4)); + System.out.println(getFirstSpellPinYin("区直部门",false)); + System.out.println(getSpellPinYin("党员提出话题数",false,4)); + System.out.println(getSpellPinYin("社区超期项目数",false,4)); } } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java index 7d0ed2f595..391fe968c9 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java @@ -45,6 +45,8 @@ public class OrgStaffListFormDTO implements Serializable { private List staffIds; //token中用户Id private String staffId; + //人员是否禁用【未禁用enable,已禁用disabled】 + private String enableFlag = "enable"; public interface OrgStaff extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index b7b23299ab..8142f4a728 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -3,8 +3,10 @@ package com.epmet.dataaggre.service.govorg.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.govorg.*; @@ -28,10 +30,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -393,6 +392,13 @@ public class GovOrgServiceImpl implements GovOrgService { staffIds.removeIf(s->s.equals(formDTO.getStaffId())); } + //是否具有超级管理员或管理员角色 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + Map roleMap = staffInfoCache.getRoleMap(); + if (roleMap.containsKey("root_manager") || roleMap.containsKey("manager")) { + formDTO.setEnableFlag("disabled"); + } + //2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 List staffList = epmetUserService.getStaffInfoList(formDTO); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 07039eeed0..a4ebcae961 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -61,7 +61,7 @@ SELECT DISTINCT sr.staff_id, cs.created_time, - case when gsr.role_key = + case when cs.enable_flag = 'enable' AND gsr.role_key = 'agency_leader' @@ -73,9 +73,14 @@ 'grid_manager' - then 1 else 0 end is_first + then 0 + when cs.enable_flag = 'enable' AND gsr.role_key != 'agency_leader' + then 1 else 2 end is_first FROM staff_role sr INNER JOIN customer_staff cs ON sr.staff_id = cs.user_id + + AND cs.enable_flag = 'enable' + INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id AND gsr.customer_id = #{customerId} WHERE sr.del_flag = '0' @@ -100,7 +105,7 @@ ) t GROUP BY t.staff_id - ORDER BY t.is_first ]]> 1, t.created_time desc + ORDER BY t.is_first ]]> 0, t.is_first asc, t.created_time desc LIMIT #{pageNo}, #{pageSize} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 15f6ee311f..b552ee29bc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.tools.utils.*; import com.epmet.constant.ActConstant; import com.epmet.constant.ActMessageConstant; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.UserMessageFormDTO; @@ -32,7 +33,6 @@ import com.epmet.entity.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*; -import com.epmet.utils.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -694,6 +694,11 @@ public class WorkActServiceImpl implements WorkActService { userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.ACT_CANCELED, actInfoDTO.getTitle(), formDTO.getCancelReason())); + + //21.09.10:记录消息类型和对应的业务id + userMessageFormDTO.setMessageType(UserMessageTypeConstant.HEART_CANCEL_ACT); + userMessageFormDTO.setTargetId(formDTO.getActId()); + userMessageFormDTOS.add(userMessageFormDTO); //2020.10.26 添加发送微信订阅消息功能 sun WxSubscribeMessageFormDTO dto = new WxSubscribeMessageFormDTO(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 735c82dda1..2a67649019 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ActConstant; import com.epmet.constant.ActMessageConstant; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dao.ActInfoDao; import com.epmet.dao.ActUserLogDao; import com.epmet.dao.ActUserRelationDao; @@ -639,6 +640,11 @@ public class WorkActUserServiceImpl implements WorkActUserService { } else if (ActConstant.ACT_USER_STATUS_REFUSED.equals(type)) { userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.AUDIT_REFUSED, actInfo.getTitle(), actUserRelationEntity.getFailureReason())); } + + //21.09.10:记录消息类型和对应的业务id + userMessageFormDTO.setMessageType(UserMessageTypeConstant.HEART_SIGIN_UP_RES); + userMessageFormDTO.setTargetId(actUserRelationEntity.getId()); + Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); if (result.success()) { logger.info("审核成功,已成功发送站内信"); diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java index 1dcdce9821..adcea05711 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java @@ -16,9 +16,179 @@ public interface UserMessageTypeConstant { /** * 居民端提交热心居民申请,通知网格长 + * targetId:resi_warmhearted_apply.id */ String WARMHEARTED_APPLY="warmhearted_apply"; + /** + * 工作端审核完热心居民申请,通知居民结果 + * targetId:resi_warmhearted_apply.id + */ + String WARMHEARTED_APPLY_RES="warmhearted_apply_res"; + + + /** + * 居民端认证党员时,补充信息填写完成提交后,通知网格长,人工审核党员申请 + * targetId:partymember_info.id + */ + String PARTY_CERTIFY_APPLY="party_certify_apply"; + + /** + * 工作端审核居民是否是党员,通知居民。 + * targetId:partymember_info.id + */ + String PARTY_CERTIFY_APPLY_RES="party_certify_apply_res"; + + + + /** + * 居民端用户申请创建小组,提交小组信息后,通知网格长 + * targetId:resi_group.id + */ + String GROUP_CREATE_GROUP_APPLY="group_create_group_apply"; + + /** + * 工作端审核建群申请后,通知建组人结果 + * targetId:resi_group.id + */ + String GROUP_CREATE_GROUP_RES="group_create_group_res"; + + /** + * 居民单申请入群,通知组长审核 + * targetId:resi_group.id + */ + String GROUP_APPLY_ENTER="group_apply_enter"; + + /** + * 组长审核完入群申请,通知居民结果 + * targetId:resi_group.id + */ + String GROUP_APPLY_ENTER_RES="group_apply_enter_res"; + + /** + * 组员通过连接自动入组的,通知组长 + * targetId:resi_group.id + */ + String GROUP_ENTER_GROUP_BY_LINK_RES="group_enter_group_by_link_res"; + + /** + * 组内发布活动 + * targetId:group_act_info.id + */ + String GROUP_ACT_PUBLISH="group_act_publish"; + /** + * 组内发布活动,进行编辑 + * targetId:group_act_info.id + */ + String GROUP_ACT_CHANGE="group_act_change"; + /** + * 组内活动,取消 + * targetId:group_act_info.id + */ + String GROUP_ACT_CANCEL="group_act_cancel"; + + /** + * 工作端转交组长,通知原组长 + * targetId:resi_group.id + */ + String GROUP_ORIGINAL_LEADER_DOWN="group_original_leader_down"; + /** + * 新任组长,告诉他这个好消息 + * targetId:resi_group.id + */ + String GROUP_NEW_LEADER_UP="group_new_leader_up"; + /** + * 禁言组员 + * targetId:resi_group.id + */ + String GROUP_SLIENT_MEMBER="group_slient_member"; + + /** + * 发布小组内通知 + * targetId:notice.id + */ + String GROUP_MESSAGE_PUBLISH="group_message_publish"; + /** + * 发布小组内通知 + * targetId:notice.id + */ + String GROUP_MESSAGE_EDIT="group_message_edit"; + + + + + /** + * 关闭议题时,已解决或者无需解决,通知议题发起人、话题创建人 + * targetId:issue.id + */ + String ISSUE_CLOSE_ISSUE="issue_close_issue"; + + /** + * 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 + * targetId:居民端用户:issue.id工作端:project.id + */ + String ISSUE_SHIFT_PROJECT="issue_shift_project"; + /** + * 项目流转 + * targetId:project.id + */ + String PROJECT_TRANSFER="project_transfer"; + + /** + * 项目结案 + * targetId:project.id + */ + String PROJECT_CLOSED="project_closed"; + + /** + * 项目退回 + * targetId:project.id + */ + String PROJECT_RETURN="project_return"; + + /** + * 项目立项 + * targetId:project.id + */ + String PROJECT_APPROVAL="project_approval"; + /** + * 事件立项 + * targetId:project.id + */ + String PROJECT_FROM_RESI_EVENT="project_from_resi_event"; + + /** + * 项目滞留超期提醒 + */ + String PROJECT_REMIND="project_remind"; + + + + /** + * 发布党建声音 + * targetId:article.DRAFT_ID + */ + String PARTY_VOICE_PUBLISH="party_voice_publish"; + + + + /** + * 爱心互助:通过审核的用户,发送消息 + * targetId:act_info.id + */ + String HEART_CANCEL_ACT="heart_cancel_act"; + /** + * 活动报名结果通知居民 + * act_user_relation.id + */ + String HEART_SIGIN_UP_RES="heart_sigin_up_res"; + + + /** + * 居民端提交徽章认证申请 + * user_badge_certificate_record.id + */ + String BADGE_AUTH_APPLY="badge_auth_apply"; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java index d44c80ae47..2a86b7a7d3 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java @@ -109,4 +109,12 @@ public class UserMessageDTO implements Serializable { */ private Date updatedTime; + /** + * 消息分类:info-上传下达消息 详见UserMessageTypeConstant + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java index e00bb88342..309a1222cc 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java @@ -1,8 +1,6 @@ package com.epmet.dto.form; -import lombok.Builder; import lombok.Data; -import net.bytebuddy.implementation.bind.annotation.Default; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -61,4 +59,13 @@ public class UserMessageFormDTO implements Serializable { * 调用者 【分内部调用和外部调用,内部调用值为空,外部默认为:外挂-站内信】 */ private String referer; + + /** + * 消息分类:info-上传下达消息 详见UserMessageTypeConstant + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/StaffMessageResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/StaffMessageResultDTO.java index 43a31a5e00..0e29e1175f 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/StaffMessageResultDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/StaffMessageResultDTO.java @@ -35,5 +35,17 @@ public class StaffMessageResultDTO implements Serializable { * 通知时间 */ private Long createdTime; + + + + + /** + * 消息分类:info-上传下达消息 详见UserMessageTypeConstant + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml index fa4266f1e7..7aca569542 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml @@ -35,7 +35,9 @@ customer_id, created_time, grid_id, - message_content + message_content, + message_type, + target_id FROM user_message WHERE @@ -66,7 +68,9 @@ title, message_content as messageContent, read_flag as readFlag, - unix_timestamp(CREATED_TIME) as createdTime + unix_timestamp(CREATED_TIME) as createdTime, + message_type AS messageType, + target_id AS targetId from user_message where diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java index a90e01a1de..ccf55babfa 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.sun.webkit.LoadListenerClient; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -18,8 +19,19 @@ public class GroupPointFormDTO implements Serializable { public interface GroupPoint extends CustomerClientShowGroup {} public interface GridRank extends CustomerClientShowGroup {} public interface PointRank extends CustomerClientShowGroup {} + public interface GridScopeRank {} + public interface CustomerScopeRank {} + public interface MyGroupRank {} @NotBlank(message = "小组Id不能为空", groups = {GroupPoint.class, GridRank.class}) private String groupId; - @NotBlank(message = "网格Id不能为空", groups = {GridRank.class, PointRank.class}) + @NotBlank(message = "网格Id不能为空", groups = {GridRank.class, PointRank.class, GridScopeRank.class, MyGroupRank.class}) private String gridId; + @NotBlank(message = "客户Id不能为空", groups = {CustomerScopeRank.class}) + private String customerId; + + /** 页码 */ + private Integer pageNo = 1; + + /** 单页条数 */ + private Integer pageSize = 10; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java index 275a5917ba..127686b68c 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java @@ -35,4 +35,25 @@ public class GroupPointRankingResultDTO implements Serializable { * 小组ID */ private String groupId; + + /** 头像 */ + private String groupHeadPhoto; + + /** 类型 branch 支部小组;o */ + private String groupType; + + /** 所属网格id */ + private String gridId; + + /** 所属网格名称 */ + private String gridNamePath; + + /** 网格内排名 */ + private Integer gridRanking; + + /** 客户下总排名 */ + private Integer customerRanking; + + /** 我是否是组长 */ + private String groupLeaderFlag; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java index 9fd48f00a1..947741b69d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -10,16 +11,20 @@ import com.epmet.dto.result.GroupPointRankingResultDTO; import com.epmet.dto.result.GroupPointRuleResultDTO; import com.epmet.dto.result.PointRankingResultDTO; import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO; +import com.epmet.resi.group.enums.SearchScopeTypeEnum; import com.epmet.service.BizPointTotalDetailService; import com.epmet.service.BizPointUserTotalDetailService; import com.epmet.service.PointRuleService; import com.epmet.utils.ModuleConstant; +import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.validation.constraints.NotBlank; +import java.lang.management.MemoryManagerMXBean; import java.util.List; /** @@ -113,4 +118,58 @@ public class GroupPointController { return new Result().ok(result); } + /** + * @description 【小组排名】- 网格范围内 + * + * @param formDTO + * @return + * @author wxz + * @date 2021.09.07 13:35:45 + */ + @PostMapping("grouppointranking/gridscope") + public Result> listGroupPointRandingInGridScope(@RequestBody GroupPointFormDTO formDTO, @LoginUser TokenDto loginUser) { + ValidatorUtils.validateEntity(formDTO, GroupPointFormDTO.GridScopeRank.class); + String gridId = formDTO.getGridId(); + Integer pageNo = formDTO.getPageNo(); + Integer pageSize = formDTO.getPageSize(); + + List page = bizPointTotalDetailService.listGroupPointRandingInPercificScope(SearchScopeTypeEnum.GRID, gridId,pageNo, pageSize, loginUser.getUserId()); + return new Result>().ok(page); + } + + /** + * @description 【小组排名】- 客户范围内 + * + * @param formDTO + * @return + * @author wxz + * @date 2021.09.08 09:18:37 + */ + @PostMapping("grouppointranking/customerscope") + public Result> listGroupPointRandingInCustomerScope(@RequestBody GroupPointFormDTO formDTO, @LoginUser TokenDto loginUser) { + ValidatorUtils.validateEntity(formDTO, GroupPointFormDTO.CustomerScopeRank.class); + String customerId = formDTO.getCustomerId(); + Integer pageNo = formDTO.getPageNo(); + Integer pageSize = formDTO.getPageSize(); + + List page = bizPointTotalDetailService.listGroupPointRandingInPercificScope(SearchScopeTypeEnum.CUSTOMER, customerId, pageNo, pageSize, loginUser.getUserId()); + return new Result>().ok(page); + } + + /** + * @description 【小组排名】- 列出我所在的小组的积分排名 + * + * @param formDTO + * @return + * @author wxz + * @date 2021.09.08 13:31:09 + */ + @PostMapping("grouppointranking/mygroups") + public Result> listMyGroupPointRanding(@LoginUser TokenDto loginInfo, @RequestBody GroupPointFormDTO formDTO) { + String userId = loginInfo.getUserId(); + ValidatorUtils.validateEntity(formDTO, GroupPointFormDTO.MyGroupRank.class); + String gridId = formDTO.getGridId(); + List list = bizPointTotalDetailService.listMyGroupPointRanding(userId, gridId); + return new Result>().ok(list); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java index 26e05f5a7b..1fb34f99e7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java @@ -40,4 +40,27 @@ public interface BizPointTotalDetailDao extends BaseDao listGroupPointRandingInPercificScope(SearchScopeTypeEnum searchScopeType, String searchScopeId, Integer pageNo, Integer pageSize, String currentUserId); + + /** + * @description 【小组排名】- 列出我所在的小组的积分排名 + * + * @param userId + * @param gridId + * @return + * @author wxz + * @date 2021.09.08 13:34:49 + */ + List listMyGroupPointRanding(String userId, String gridId); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java index c1a7dbe14b..78d6fd7c81 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java @@ -17,31 +17,50 @@ package com.epmet.service.impl; +import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.NumConstant; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.BizPointTotalDetailDao; import com.epmet.dto.BizPointTotalDetailDTO; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.GroupPointFormDTO; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.resi.group.dto.group.form.GroupFormDTO; import com.epmet.resi.group.dto.group.form.GroupPointDetailFormDTO; +import com.epmet.resi.group.dto.group.form.GroupsByMemberFormDTO; +import com.epmet.resi.group.dto.group.result.GroupDetailResultDTO; import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO; import com.epmet.dto.result.GroupPointRankingResultDTO; import com.epmet.entity.BizPointTotalDetailEntity; import com.epmet.resi.group.dto.group.ResiGroupDTO; +import com.epmet.resi.group.dto.group.result.RankingResultDTO; +import com.epmet.resi.group.enums.SearchScopeTypeEnum; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.BizPointTotalDetailService; import com.epmet.service.BizPointUserTotalDetailService; import com.epmet.service.UserPointActionLogService; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -57,7 +76,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2021-04-20 */ @Service -public class BizPointTotalDetailServiceImpl extends BaseServiceImpl implements BizPointTotalDetailService { +public class BizPointTotalDetailServiceImpl extends BaseServiceImpl implements BizPointTotalDetailService, ResultDataResolver { @Autowired private ResiGroupOpenFeignClient resiGroupOpenFeignClient; @@ -65,6 +84,10 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl redisTemplate; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; @Override public PageData page(Map params) { @@ -239,4 +262,264 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl listGroupPointRandingInPercificScope(SearchScopeTypeEnum searchScopeType, String searchScopeId, + Integer pageNo, Integer pageSize, + String currentUserId) { + + // 1.查询有积分的小组得分排名 + PageInfo entityPageInfo = PageHelper.startPage(pageNo, pageSize).doSelectPageInfo(() -> { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + if (SearchScopeTypeEnum.CUSTOMER == searchScopeType) { + query.eq(BizPointTotalDetailEntity::getCustomerId, searchScopeId); + } else if (SearchScopeTypeEnum.GRID == searchScopeType) { + query.eq(BizPointTotalDetailEntity::getGridId, searchScopeId); + } + query.eq(BizPointTotalDetailEntity::getBizType, "group"); + query.orderByDesc(BizPointTotalDetailEntity::getTotalPoint); + baseDao.selectList(query); + }); + + List groupList = entityPageInfo.getList(); + + List groupIds = groupList.stream().map(g -> g.getObjectId()).collect(Collectors.toList()); + + // 2.将列表填充基本信息并且转换为dto + List rankingInfoDTOs = convertGroupRankingInfoEntity2DTOs(groupIds, groupList, currentUserId); + + Page page = new Page(pageNo, pageSize); + + // 3.如果不满一页,则填充分数为0的 + if (pageSize > groupIds.size()) { + // 查出网格下已有积分的小组id + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + if (SearchScopeTypeEnum.CUSTOMER == searchScopeType) { + query.eq(BizPointTotalDetailEntity::getCustomerId, searchScopeId); + } else if (SearchScopeTypeEnum.GRID == searchScopeType) { + query.eq(BizPointTotalDetailEntity::getGridId, searchScopeId); + } + query.eq(BizPointTotalDetailEntity::getBizType, "group"); + query.select(BizPointTotalDetailEntity::getObjectId); + List existingGroupIds = baseDao.selectObjs(query).stream().map(obj -> obj.toString()).collect(Collectors.toList()); + + int startRow = page.getStartRow() - existingGroupIds.size(); + // 不足0的从0开始 + startRow = Math.max(startRow, 0); + List gap; + gap = fillGroupPageGap(existingGroupIds, searchScopeType, searchScopeId, startRow, pageSize - groupList.size(), currentUserId); + rankingInfoDTOs.addAll(gap); + } + + // 4.排名填充。有积分的按照积分排序,分数一样的名次一样 + Integer ranking = getStartRanking(rankingInfoDTOs, searchScopeType.getScopeType(), searchScopeId); + Integer prevPoint = null; + for (GroupPointRankingResultDTO g : rankingInfoDTOs) { + Integer point = Integer.valueOf(g.getPoint()); + if (prevPoint != null && prevPoint > point) { + // 此举是为了在积分一样的情况下,给与相同的排名 + ranking ++; + } + + GridInfoCache gridInfo = getGridInfo(g.getGridId()); + g.setGridId(g.getGridId()); + if (gridInfo != null) { + g.setGridNamePath(gridInfo.getGridNamePath()); + } else { + // todo 网格被删除了,应该怎么办? + g.setGridNamePath(" "); + } + g.setRanking(String.valueOf(ranking)); + prevPoint = point; + } + return rankingInfoDTOs; + } + + /** + * @description 获取起始排名 + * + * @param points 积分信息分页列表 + * @return + * @author wxz + * @date 2021.09.16 14:50:11 + */ + private Integer getStartRanking(List points, String scopeType, String scopeObjectId) { + if (CollectionUtils.isEmpty(points)) { + return 0; + } + + GroupPointRankingResultDTO firstPoint = points.get(0); + + if (firstPoint.getPoint().equals("0")) { + // 如果第一条积分就是0,那么查询出来有积分的组的最低名次+1(注意:point_total表不能有积分为0的记录,否则计算出来的名次会比实际名次+1) + Integer minRanking = baseDao.getMinRanking("group", scopeType, scopeObjectId); + return minRanking + 1; + } else { + return baseDao.getRanking("group", firstPoint.getGroupId(), scopeType); + } + } + + /** + * @description 获取分页缺口group ranking信息 + * + * @param startRow + * @param rowCount + * @return + * @author wxz + * @date 2021.09.07 16:30:28 + */ + private List fillGroupPageGap(List existingGroupIds, SearchScopeTypeEnum searchScopeType, + String searchScopeObjectId, Integer startRow, Integer rowCount, String currentUserId) { + GroupFormDTO form = new GroupFormDTO(); + form.setExcludeGroupIds(existingGroupIds); + form.setOrder(GroupFormDTO.OrderTypeEnum.DESC); + form.setSort(GroupFormDTO.SortTypeEnum.CREATE_TIME); + form.setStartRow(startRow); + form.setRowCount(rowCount); + form.setSearchScopeType(searchScopeType); + form.setSearchScopeObjectId(searchScopeObjectId); + + Result> result = resiGroupOpenFeignClient.listGroupDetailsExcludeGroupIds(form); + List groups = getResultDataOrThrowsException(result, ServiceConstant.RESI_GROUP_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【小组排名】查询积分为0的小组列表失败"); + if (CollectionUtils.isEmpty(groups)) { + return new ArrayList<>(); + } + return groups.stream().map(g -> { + GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); + dto.setGroupType(g.getGroupType()); + dto.setPoint("0"); + dto.setGroupHeadPhoto(g.getGroupHeadPhoto()); + dto.setGroupName(g.getGroupName()); + dto.setGroupId(g.getGroupId()); + dto.setGridId(g.getGridId()); + dto.setGroupLeaderFlag(g.getLeaderId().equals(currentUserId) ? "leader" : "member"); + return dto; + }).collect(Collectors.toList()); + } + + /** + * @description 将小组排名Entity转化为dto + * + * @param groupList + * @return + * @author wxz + * @date 2021.09.07 15:52:17 + */ + private List convertGroupRankingInfoEntity2DTOs(List groupIds, List groupList, String currentUserId) { + if (CollectionUtils.isEmpty(groupIds)) { + return new ArrayList<>(); + } + + // 查询这些小组的基本信息 + Result> listResult = resiGroupOpenFeignClient.listGroupDetailsByGroupIds(groupIds); + List groupInfos = getResultDataOrThrowsException(listResult, ServiceConstant.RESI_GROUP_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【小组排行】批量查询小组信息出错"); + + // 将小组基本信息转化为map + HashMap groupMap = new HashMap<>(); + groupInfos.stream().forEach(g -> groupMap.put(g.getGroupId(), g)); + + // 将小组信息填充到排名列表中 + List rankingDTOs = groupList.stream().map(g -> { + GroupDetailResultDTO groupInfo = groupMap.get(g.getObjectId()); + GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); + dto.setGroupId(g.getObjectId()); + dto.setGroupName(groupInfo.getGroupName()); + dto.setGroupType(groupInfo.getGroupType()); + dto.setPoint(g.getTotalPoint().toString()); + dto.setGroupHeadPhoto(groupInfo.getGroupHeadPhoto()); + dto.setGridId(g.getGridId()); + dto.setGroupLeaderFlag(groupInfo.getLeaderId().equals(currentUserId) ? "leader" : "member"); + return dto; + }).collect(Collectors.toList()); + return rankingDTOs; + } + + /** + * @description 查询网格信息 + * + * @param gridId + * @return + * @author wxz + * @date 2021.09.08 11:17:17 + */ + public GridInfoCache getGridInfo(String gridId) { + HashOperations ope = redisTemplate.opsForHash(); + Map entries = ope.entries(RedisKeys.getGridInfoKey(gridId)); + if (entries.size() != 0) { + return BeanUtil.mapToBean(entries, GridInfoCache.class, true); + } + + CustomerGridFormDTO form = new CustomerGridFormDTO(); + form.setGridId(gridId); + Result result = govOrgOpenFeignClient.getCustomerGridByGridId(form); + if (result == null || !result.success() || result.getData() == null) { + return null; + } + + GridInfoCache cache = new GridInfoCache(); + cache.setCustomerId(result.getData().getCustomerId()); + cache.setGridId(result.getData().getId()); + cache.setGridNamePath(result.getData().getGridName()); + cache.setPid(result.getData().getPid()); + cache.setPids(result.getData().getPids()); + ope.putAll(RedisKeys.getGridInfoKey(gridId), BeanUtil.beanToMap(cache)); + return cache; + } + + @Override + public List listMyGroupPointRanding(String userId, String gridId) { + // 1.查询网格内我所在的小组 + GroupsByMemberFormDTO form = new GroupsByMemberFormDTO(); + form.setGridId(gridId); + form.setUserId(userId); + List groupList = getResultDataOrThrowsException(resiGroupOpenFeignClient.listGroupsByMember(form), + ServiceConstant.RESI_GROUP_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【我所在的小组排名】查询组列表失败"); + + if (CollectionUtils.isEmpty(groupList)) { + return new ArrayList(); + } + + // 2.填充分数和排名 + GroupDetailResultDTO firstGroup = groupList.get(0); + + // 网格和客户下,分别有多少个有积分的小组,后面用于给哪些没有任何积分记录的小组排名 + Integer gridMinRanking = baseDao.getMinRanking("group", "grid", gridId); + Integer customerMinRanking = baseDao.getMinRanking("group", "customer", firstGroup.getCustomerId()); + + List groupDtoList = groupList.stream().map(g -> { + // 积分 + Integer point = 0; + // 网格内的排名 + Integer gridRanking = null; + // 客户下的排名 + Integer customerRanking = null; + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(BizPointTotalDetailEntity::getBizType, "group"); + query.eq(BizPointTotalDetailEntity::getObjectId, g.getGroupId()); + BizPointTotalDetailEntity groupPoint = baseDao.selectOne(query); + if (groupPoint == null) { + // 该小组没有积分 + gridRanking = gridMinRanking + 1; + customerRanking = customerMinRanking + 1; + } else { + // 该小组有积分 + point = groupPoint.getTotalPoint(); + gridRanking = baseDao.getRanking("group", g.getGroupId(), "grid"); + customerRanking = baseDao.getRanking("group", g.getGroupId(), "customer"); + } + + GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); + dto.setGridId(g.getGridId()); + dto.setGroupHeadPhoto(g.getGroupHeadPhoto()); + dto.setGroupType(g.getGroupType()); + dto.setGroupId(g.getGroupId()); + dto.setGroupName(g.getGroupName()); + dto.setPoint(point.toString()); + dto.setGridRanking(gridRanking); + dto.setCustomerRanking(customerRanking); + dto.setGroupLeaderFlag(g.getGroupLeaderFlag()); + return dto; + }).collect(Collectors.toList()); + return groupDtoList; + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml index e1e8202e83..e65cfbabf5 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml @@ -29,5 +29,51 @@ and OBJECT_ID = #{objectId} + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 1a131bb685..7ca7b0551c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.IssueConstant; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserMessageConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dao.IssueDao; import com.epmet.dao.IssueProcessDao; import com.epmet.dao.IssueProjectRelationDao; @@ -755,6 +756,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp msgDTO.setMessageContent(messageContent); msgDTO.setReadFlag(ReadFlagConstant.UN_READ); msgDTO.setUserId(topicDTO.getCreatedBy()); + + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_CLOSE_ISSUE); + msgDTO.setTargetId(entity.getId()); + msgList.add(msgDTO); //话题人和议题人是同一个人时则只发送一条居民消息 if (!topicDTO.getCreatedBy().equals(entity.getCreatedBy())) { @@ -1067,11 +1073,21 @@ public class IssueServiceImpl extends BaseServiceImpl imp msgDTO.setMessageContent(topicIssueMessage); msgDTO.setReadFlag(ReadFlagConstant.UN_READ); msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgDTO.setTargetId(entity.getId()); + msgList.add(msgDTO); //话题人和议题人是同一个人时则只发送一条居民消息 if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class); msgIssue.setUserId(entity.getCreatedBy()); + + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgDTO.setTargetId(entity.getId()); + msgList.add(msgIssue); } //2:创建项目工作人员消息对象 @@ -1088,6 +1104,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp msg.setMessageContent(projectStaffMessage); msg.setReadFlag(ReadFlagConstant.UN_READ); msg.setUserId(staff.getStaffId()); + + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgDTO.setTargetId(issueProjectResultDTO.getProjectId()); + msgList.add(msg); map.put(staff.getStaffId(),staff.getStaffId()); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index ad3fec6959..de0a8347f4 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -36,10 +36,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; -import com.epmet.constant.ProjectConstant; -import com.epmet.constant.ReadFlagConstant; -import com.epmet.constant.SmsTemplateConstant; -import com.epmet.constant.UserMessageConstant; +import com.epmet.constant.*; import com.epmet.dao.ProjectOrgRelationDao; import com.epmet.dao.ProjectDao; import com.epmet.dao.ProjectProcessDao; @@ -451,6 +448,11 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl implements ProjectTraceS //4.推送站内信、微信、短信消息 //4-1.调用epmet-message服务,给工作端勾选的工作人员发送消息 - if (!shiftProjectMessage(formDTO).success()) { + if (!shiftProjectMessage(formDTO,projectEntity.getId()).success()) { throw new RenException("项目立项,推送站内信失败"); } @@ -565,7 +562,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceS * @Description 项目立项给勾选的工作人员推送站内信消息 * @author sun */ - private Result shiftProjectMessage(ProjectApprovalFormDTO formDTO) { + private Result shiftProjectMessage(ProjectApprovalFormDTO formDTO,String projectId) { List msgList = new ArrayList<>(); //1.创建项目工作人员消息对象 String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, formDTO.getTitle()); @@ -581,6 +578,11 @@ public class ProjectTraceServiceImpl implements ProjectTraceS msg.setMessageContent(projectStaffMessage); msg.setReadFlag(ReadFlagConstant.UN_READ); msg.setUserId(staff.getStaffId()); + + //21.09.10:记录消息类型和对应的业务id + msg.setMessageType(UserMessageTypeConstant.PROJECT_APPROVAL); + msg.setTargetId(projectId); + msgList.add(msg); map.put(staff.getStaffId(),staff.getStaffId()); } @@ -789,7 +791,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceS //4.推送站内信、微信、短信消息 //4-1.调用epmet-message服务,给工作端勾选的工作人员发送消息 - if (!shiftProjectMessage(formDTO.getStaffList(),formDTO.getCustomerId(),formDTO.getTitle()).success()) { + if (!shiftProjectMessage(formDTO.getStaffList(),formDTO.getCustomerId(),formDTO.getTitle(),projectEntity.getId()).success()) { throw new RenException("事件转为项目,推送站内信失败"); } @@ -919,7 +921,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceS * @Description 项目立项给勾选的工作人员推送站内信消息 * @author yinzuomei */ - private Result shiftProjectMessage(List staffList,String customerId,String title) { + private Result shiftProjectMessage(List staffList,String customerId,String title,String projectId) { List msgList = new ArrayList<>(); //1.创建项目工作人员消息对象 String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, title); @@ -935,6 +937,11 @@ public class ProjectTraceServiceImpl implements ProjectTraceS msg.setMessageContent(projectStaffMessage); msg.setReadFlag(ReadFlagConstant.UN_READ); msg.setUserId(staff.getStaffId()); + + //21.09.10:记录消息类型和对应的业务id + msg.setTargetId(projectId); + msg.setMessageType(UserMessageTypeConstant.PROJECT_FROM_RESI_EVENT); + msgList.add(msg); map.put(staff.getStaffId(),staff.getStaffId()); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 62274c346b..1d95335423 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -976,7 +976,8 @@ public class ArticleServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.act; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +public class ActCommentAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 活动Id[group_act_info.id] + */ + private String groupActId; + + /** + * 评论Id + */ + private String actCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java index 92fce732ae..6645dce753 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java @@ -1,11 +1,13 @@ package com.epmet.resi.group.dto.act.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; import java.io.Serializable; +import java.util.List; /** * 005、评论活动 @@ -24,9 +26,13 @@ public class CommentFormDTO implements Serializable { @NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class) private String groupActId; - @NotBlank(message = "评论内容不能为空", groups = AddUserShowGroup.class) - @Length(max = 500, message = "评论内容最多输入500字", groups = AddUserShowGroup.class) + //@NotBlank(message = "评论内容不能为空", groups = AddUserShowGroup.class) + @Length(max = 500, message = "评论内容最多输入500字") private String commentContent; + /** + * 图片附件集合 + */ + private List imageList; /** * 当前用户id diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java index efb8066f28..a6053ffc39 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java @@ -1,10 +1,13 @@ package com.epmet.resi.group.dto.act.result; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * 006、活动评论列表查询 @@ -27,4 +30,11 @@ public class CommentResultDTO implements Serializable { private Date commentTime; private String commentUserId; + + /** + * 图片附件集合 + */ + private List imageList = new ArrayList<>(); + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java index c28985e054..57ae73c471 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java @@ -1,11 +1,14 @@ package com.epmet.resi.group.dto.comment.result; import com.alibaba.fastjson.annotation.JSONField; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * @Description @@ -54,4 +57,9 @@ public class ResiCommentResultDTO implements Serializable { * 评论状态 * */ private String commentStatus; + + /** + * 图片附件集合 + */ + private List imageList = new ArrayList<>(); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java index 2fc8ba7b9a..96295879f1 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java @@ -1,8 +1,10 @@ package com.epmet.resi.group.dto.group.form; +import com.epmet.resi.group.enums.SearchScopeTypeEnum; import lombok.Data; - +import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -11,7 +13,77 @@ import java.io.Serializable; */ @Data public class GroupFormDTO implements Serializable { + private static final long serialVersionUID = 5330629771935235995L; + + /** 排除某些指定id之外的组列表 */ + public interface GroupDetailsExcludeGroupIds {} + private String groupId; + private String gridId; + + /** 小组所属范围:grid网格,customer客户 */ + @NotNull(message = "搜索范围类型不能为空", groups = { GroupDetailsExcludeGroupIds.class }) + private SearchScopeTypeEnum searchScopeType; + + @NotNull(message = "搜索范围对象的ID不能为空", groups = { GroupDetailsExcludeGroupIds.class }) + private String searchScopeObjectId; + + private List excludeGroupIds; + + /** 从第几条开始取 */ + private Integer startRow = 0; + + /** 取几条数据 */ + private Integer rowCount = 10; + + @NotNull(message = "排序字段不能为空", groups = { GroupDetailsExcludeGroupIds.class }) + private SortTypeEnum sort; + + @NotNull(message = "排序方式不能为空", groups = { GroupDetailsExcludeGroupIds.class }) + private OrderTypeEnum order; + + /** + * @Description 排序类型 + * @author wxz + * @date 2021.09.07 17:00:24 + */ + public enum SortTypeEnum { + + CREATE_TIME("create_time"); + + private String sortField; + + SortTypeEnum(String sortField) { + this.sortField = sortField; + } + + public String getSortField() { + return sortField; + } + } + + /** + * @Description 排序方式 + * @author wxz + * @date 2021.09.07 17:02:05 + */ + public enum OrderTypeEnum { + + ASC("asc"), + DESC("desc"); + + private String orderType; + + OrderTypeEnum(String orderType) { + this.orderType = orderType; + } + + public String getOrderType() { + return orderType; + } + } + + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupsByMemberFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupsByMemberFormDTO.java new file mode 100644 index 0000000000..806b07629e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupsByMemberFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Description 根据成员查询组列表form + * @author wxz + * @date 2021.09.08 14:12:44 +*/ +@Data +public class GroupsByMemberFormDTO { + private String gridId; + @NotNull(message = "成员用户ID不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/CommentFileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/CommentFileDTO.java new file mode 100644 index 0000000000..dfec88238a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/CommentFileDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.group.dto.group.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 话题、通知、活动评论附件 + */ +@NoArgsConstructor +@Data +public class CommentFileDTO implements Serializable { + + private static final long serialVersionUID = -3930520724652521552L; + private String name; + private String url; + private String type; + private String format; + private Integer size; + private Integer duration; + @JsonIgnore + private String commentId; + @JsonIgnore + private String userId; +} 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 index c7767054d4..7d08176f31 100644 --- 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 @@ -9,7 +9,9 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class GroupDetailResultDTO { + private String gridId; private String groupHeadPhoto; + private String groupId; private String groupName; private String groupIntroduction; private Integer editNumLimit; @@ -17,5 +19,11 @@ public class GroupDetailResultDTO { private String auditStatus; private Boolean editable; private String remark; - + /** 群组类型:branch:支部小组,ordinary:楼院小组 */ + private String groupType; + private String customerId; + /** 组长ID */ + private String leaderId; + /** 当前用户是否是群主 */ + private String groupLeaderFlag; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java index dbf681b90d..28755fffe8 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java @@ -69,6 +69,14 @@ public class GroupSummarizeResultDTO implements Serializable { * 进组审核open开启;close关闭 */ private String auditSwitch; + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + /** + * 小组类型名称 + */ + private String groupTypeName; private String level; public GroupSummarizeResultDTO(){ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RankingResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RankingResultDTO.java new file mode 100644 index 0000000000..99357eb400 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RankingResultDTO.java @@ -0,0 +1,11 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +@Data +public class RankingResultDTO { + + private Integer gridRanking; + private Integer customerRanking; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeCommentAttachmentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeCommentAttachmentDTO.java new file mode 100644 index 0000000000..6e7c7e336f --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeCommentAttachmentDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.notice; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +public class NoticeCommentAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 通知Id + */ + private String noticeId; + + /** + * 评论Id + */ + private String noticeCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java index c543bf7222..4269e86262 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java @@ -5,6 +5,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import java.util.List; /** * @Author sun @@ -21,8 +22,8 @@ public class NoticeCommentFormDTO { /** * 评论内容300 */ - @NotBlank(message = "评论内容不能为空",groups = {NoticeCommentFormDTO.UserShow.class}) - @Length(max = 20, message = "评论内容不能超过300个字符",groups = {NoticeCommentFormDTO.UserShow.class}) + //@NotBlank(message = "评论内容不能为空",groups = {NoticeCommentFormDTO.UserShow.class}) + @Length(max = 300, message = "评论内容不能超过300个字符") private String commentContent; /** @@ -30,6 +31,11 @@ public class NoticeCommentFormDTO { */ private String userId; + /** + * 图片附件集合 + */ + private List imageList; + public interface Comment{} public interface UserShow extends CustomerClientShowGroup {} } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java index 726289e144..45a9c9f694 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java @@ -1,11 +1,13 @@ package com.epmet.resi.group.dto.notice.result; -import com.alibaba.fastjson.annotation.JSONField; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * @Author sun @@ -42,4 +44,9 @@ public class NoticeCommentListResultDTO implements Serializable { * */ private String userId; + /** + * 图片附件集合 + */ + private List imageList = new ArrayList<>(); + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentAttachmentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentAttachmentDTO.java new file mode 100644 index 0000000000..acd1c4e381 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentAttachmentDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +public class ResiTopicCommentAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题Id + */ + private String topicId; + + /** + * 评论Id + */ + private String topicCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiPublishCommentFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiPublishCommentFormDTO.java index 894364fe16..179c53c500 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiPublishCommentFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiPublishCommentFormDTO.java @@ -1,9 +1,11 @@ package com.epmet.resi.group.dto.topic.form; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import lombok.Data; import javax.validation.constraints.NotBlank; import java.io.Serializable; +import java.util.List; /** * @Description @@ -19,6 +21,11 @@ public class ResiPublishCommentFormDTO implements Serializable { @NotBlank(message = "话题Id不能为空") private String topicId; - @NotBlank(message = "评论内容不能为空") + //@NotBlank(message = "评论内容不能为空") private String commentContent; + + /** + * 图片附件集合 + */ + private List imageList; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/enums/SearchScopeTypeEnum.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/enums/SearchScopeTypeEnum.java new file mode 100644 index 0000000000..474a2662a1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/enums/SearchScopeTypeEnum.java @@ -0,0 +1,22 @@ +package com.epmet.resi.group.enums; + +/** + * @Description 搜索范围类型枚举 + * @author wxz + * @date 2021.09.07 20:14:21 + */ +public enum SearchScopeTypeEnum { + + CUSTOMER("customer"), + GRID("grid"); + + private String scopeType; + + SearchScopeTypeEnum(String scopeType) { + this.scopeType = scopeType; + } + + public String getScopeType() { + return scopeType; + } +} \ No newline at end of file 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 16e1d8b0c8..1762b35d97 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 @@ -289,4 +289,36 @@ public interface ResiGroupOpenFeignClient { @PostMapping("resi/group/topic/gettopicinfos") Result> getTopicInfos(@RequestBody List issueIds); + /** + * @description 根据组id列表批量查询组信息列表 + * + * @param groupIds + * @return + * @author wxz + * @date 2021.09.07 15:33:58 + */ + @PostMapping("/resi/group/group/list-groupinfos-by-groupids") + Result> listGroupDetailsByGroupIds(@RequestBody List groupIds); + + /** + * @description 排除指定的组id之后,按照指定顺序取指定个数的组信息 + * + * @param form + * @return + * @author wxz + * @date 2021.09.07 17:15:55 + */ + @PostMapping("/resi/group/group/list-groupinfos-exclude-groupids") + Result> listGroupDetailsExcludeGroupIds(@RequestBody GroupFormDTO form); + + /** + * @description 根据组成员查询所在的小组列表。可选条件包括:grid + * + * @param formDTO + * @return + * @author wxz + * @date 2021.09.08 13:51:05 + */ + @PostMapping("/resi/group/group/list-groups-by-member") + Result> listGroupsByMember(@RequestBody GroupsByMemberFormDTO formDTO); } 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 94f03f3d41..8c2f5303ee 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 @@ -220,4 +220,19 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result> getTopicInfos(List issueIds) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getTopicInfos", issueIds); } + + @Override + public Result> listGroupDetailsByGroupIds(List groupIds) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupDetailsByGroupIds", groupIds); + } + + @Override + public Result> listGroupDetailsExcludeGroupIds(GroupFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupDetailsExcludeGroupIds", form); + } + + @Override + public Result> listGroupsByMember(GroupsByMemberFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupsByMember", formDTO); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentAttachmentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentAttachmentController.java new file mode 100644 index 0000000000..e84a321e4b --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentAttachmentController.java @@ -0,0 +1,85 @@ +/** + * 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.act.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.act.service.ActCommentAttachmentService; +import com.epmet.resi.group.dto.act.ActCommentAttachmentDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@RestController +@RequestMapping("actcommentattachment") +public class ActCommentAttachmentController { + + @Autowired + private ActCommentAttachmentService actCommentAttachmentService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = actCommentAttachmentService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ActCommentAttachmentDTO data = actCommentAttachmentService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ActCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + actCommentAttachmentService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ActCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + actCommentAttachmentService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + actCommentAttachmentService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java new file mode 100644 index 0000000000..07f076a6f5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java @@ -0,0 +1,43 @@ +/** + * 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.act.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.act.entity.ActCommentAttachmentEntity; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Mapper +public interface ActCommentAttachmentDao extends BaseDao { + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + List selectActComFile(@Param("groupActId") String groupActId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java new file mode 100644 index 0000000000..1e290165ee --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java @@ -0,0 +1,93 @@ +/** + * 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.act.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("act_comment_attachment") +public class ActCommentAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 活动Id[group_act_info.id] + */ + private String groupActId; + + /** + * 评论Id + */ + private String actCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentAttachmentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentAttachmentService.java new file mode 100644 index 0000000000..c1faff4a04 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentAttachmentService.java @@ -0,0 +1,103 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.act.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.act.entity.ActCommentAttachmentEntity; +import com.epmet.resi.group.dto.act.ActCommentAttachmentDTO; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; + +import java.util.List; +import java.util.Map; + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +public interface ActCommentAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-09-06 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-09-06 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ActCommentAttachmentDTO + * @author generator + * @date 2021-09-06 + */ + ActCommentAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void save(ActCommentAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void update(ActCommentAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-09-06 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 查询活动评论所有人员的附件信息 + **/ + List getActComFile(String groupActId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentAttachmentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentAttachmentServiceImpl.java new file mode 100644 index 0000000000..916cf5bdda --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentAttachmentServiceImpl.java @@ -0,0 +1,110 @@ +/** + * 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.act.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.act.dao.ActCommentAttachmentDao; +import com.epmet.modules.act.entity.ActCommentAttachmentEntity; +import com.epmet.modules.act.service.ActCommentAttachmentService; +import com.epmet.resi.group.dto.act.ActCommentAttachmentDTO; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 活动评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Service +public class ActCommentAttachmentServiceImpl extends BaseServiceImpl implements ActCommentAttachmentService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ActCommentAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ActCommentAttachmentDTO.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 ActCommentAttachmentDTO get(String id) { + ActCommentAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ActCommentAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ActCommentAttachmentDTO dto) { + ActCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ActCommentAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ActCommentAttachmentDTO dto) { + ActCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ActCommentAttachmentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + @Override + public List getActComFile(String groupActId) { + return baseDao.selectActComFile(groupActId); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java index c249c4ec28..422f86d34b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java @@ -18,6 +18,7 @@ package com.epmet.modules.act.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +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.scan.param.TextScanParamDTO; @@ -28,23 +29,32 @@ import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.act.dao.ActCommentDao; +import com.epmet.modules.act.entity.ActCommentAttachmentEntity; import com.epmet.modules.act.entity.ActCommentEntity; +import com.epmet.modules.act.service.ActCommentAttachmentService; import com.epmet.modules.act.service.ActCommentService; import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.modules.constant.GroupActConstant; +import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.form.CommentFormDTO; import com.epmet.resi.group.dto.act.form.CommentQueryFormDTO; import com.epmet.resi.group.dto.act.result.CommentResultDTO; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import com.github.pagehelper.PageHelper; +import org.apache.commons.lang3.StringUtils; 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.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -65,6 +75,10 @@ public class ActCommentServiceImpl extends BaseServiceImpl imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); + noticeCommentService.safetyCheck(new ArrayList<>(), imageList); + } + //3、插入记录 ActCommentEntity actCommentEntity = new ActCommentEntity(); actCommentEntity.setCustomerId(formDTO.getCustomerId()); @@ -103,6 +127,33 @@ public class ActCommentServiceImpl extends BaseServiceImpl AttachmentEntityList = new ArrayList<>(); + //图片 + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(formDTO.getImageList())) { + AtomicInteger sort = new AtomicInteger(); + formDTO.getImageList().forEach(img -> { + ActCommentAttachmentEntity attachment = new ActCommentAttachmentEntity(); + attachment.setCustomerId(formDTO.getCustomerId()); + attachment.setGroupActId(formDTO.getGroupActId()); + attachment.setActCommentId(actCommentEntity.getId()); + attachment.setFileName(img.getName()); + attachment.setAttachmentName(""); + attachment.setAttachmentSize(img.getSize()); + attachment.setAttachmentFormat(img.getFormat()); + attachment.setAttachmentType(img.getType()); + attachment.setAttachmentUrl(img.getUrl()); + attachment.setSort(sort.get()); + attachment.setDuration(img.getDuration()); + sort.getAndIncrement(); + AttachmentEntityList.add(attachment); + }); + } + if (AttachmentEntityList.size() > NumConstant.ZERO) { + actCommentAttachmentService.insertBatch(AttachmentEntityList); + } + } /** @@ -124,8 +175,12 @@ public class ActCommentServiceImpl extends BaseServiceImpl fileList = actCommentAttachmentService.getActComFile(formDTO.getGroupActId()); + if (!CollectionUtils.isEmpty(result.getData())) { - //3.遍历封装数据并返回 + //4.遍历封装数据并返回 list.forEach(l -> { result.getData().forEach(user -> { if (l.getCommentUserId().equals(user.getUserId())) { @@ -133,6 +188,14 @@ public class ActCommentServiceImpl extends BaseServiceImpl imageList = new ArrayList<>(); + for (CommentFileDTO f : fileList) { + if (l.getCommentId().equals(f.getCommentId()) && l.getCommentUserId().equals(f.getUserId())) { + imageList.add(f); + } + } + l.setImageList(imageList); }); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java index 326380d48f..62ea68fdca 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java @@ -35,6 +35,7 @@ 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.constant.UserMessageTypeConstant; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; @@ -265,9 +266,17 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl initAchievement(@RequestParam String customerId) { return new Result().ok(statsAchievementService.initAllGroupAchievement(customerId)); } + + /** + * @description 根据组id列表批量查询组信息列表 + * + * @param groupIds + * @return + * @author wxz + * @date 2021.09.07 15:33:58 + */ + @PostMapping("list-groupinfos-by-groupids") + public Result> listGroupDetailsByGroupIds(@RequestBody List groupIds) { + List groupDetails = resiGroupService.listGroupsByGroupIds(groupIds); + return new Result>().ok(groupDetails); + } + + /** + * @description 排除指定的组id之后,按照指定顺序取指定个数的组信息 + * + * @param form + * @return + * @author wxz + * @date 2021.09.07 17:15:55 + */ + @PostMapping("list-groupinfos-exclude-groupids") + public Result> listGroupDetailsExcludeGroupIds(@RequestBody GroupFormDTO form) { + ValidatorUtils.validateEntity(form, GroupFormDTO.GroupDetailsExcludeGroupIds.class); + Integer startRow = form.getStartRow(); + Integer rowCount = form.getRowCount(); + List excludeGroupIds = form.getExcludeGroupIds(); + GroupFormDTO.SortTypeEnum sort = form.getSort(); + GroupFormDTO.OrderTypeEnum order = form.getOrder(); + SearchScopeTypeEnum searchScopeType = form.getSearchScopeType(); + String searchScopeObjectId = form.getSearchScopeObjectId(); + + List groups = resiGroupService.listGroupDetailsExcludeGroupIds(excludeGroupIds, startRow, rowCount, searchScopeType.getScopeType(), searchScopeObjectId, sort.getSortField(), order.getOrderType()); + return new Result>().ok(groups); + } + + /** + * @description 根据组成员查询所在的小组列表。可选条件包括:grid + * + * @param formDTO + * @return + * @author wxz + * @date 2021.09.08 13:51:05 + */ + @PostMapping("list-groups-by-member") + public Result> listGroupsByMember(@RequestBody GroupsByMemberFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + String gridId = formDTO.getGridId(); + String userId = formDTO.getUserId(); + List groups = resiGroupService.listGroupsByMember(userId, gridId); + return new Result>().ok(groups); + } } 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 44f8312d9c..3a0b47c336 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 @@ -335,4 +335,15 @@ public interface ResiGroupDao extends BaseDao { * @return java.util.List */ List selectRecentGroupAchievements(@Param("userId") String userId, @Param("gridId") String gridId); + + /** + * @description 根据组成员查询所在组列表。如有需要,可以增加其他if条件,或者增加排序参数 + * + * @param memberUserId + * @param gridId + * @return + * @author wxz + * @date 2021.09.08 14:00:52 + */ + List listGroupsByMember(@Param("memberUserId") String memberUserId, @Param("gridId") 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 d7761738d8..122083cceb 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 @@ -435,4 +435,41 @@ public interface ResiGroupService extends BaseService { * @return com.epmet.resi.group.dto.group.ResiGroupDTO */ ResiGroupDTO getGroupInfoAndGroupMember(String groupId); + + /** + * @description 根据id列表查询组信息 + * + * @param groupIds + * @return + * @author wxz + * @date 2021.09.07 15:27:35 + */ + List listGroupsByGroupIds(List groupIds); + + /** + * @description 排除指定的组id之后,按照指定顺序取指定个数的组信息 + * + * @param excludeGroupIds 排序的组id列表 + * @param startRow + * @param rowCount + * @param searchScopeObjectId 小组所属的范围对象id,如果是网格,那就是网格id,如果是客户那就是客户id + * @param searchScopeType 小组所属的范围,grid网格,customer客户 + * @param sortType 排序字段 + * @param orderType 排序类型 + * @return + * @author wxz + * @date 2021.09.07 17:17:09 + */ + List listGroupDetailsExcludeGroupIds(List excludeGroupIds, Integer startRow, Integer rowCount, String searchScopeType,String searchScopeObjectId, String sortType, String orderType); + + /** + * @description 根据成员查询组列表 + * + * @param memberUserId + * @param gridId + * @return + * @author wxz + * @date 2021.09.08 13:59:31 + */ + List listGroupsByMember(String memberUserId, String 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 122fafce0d..ee2f844d04 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 @@ -18,11 +18,14 @@ package com.epmet.modules.group.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg; import com.epmet.commons.tools.constant.*; +import com.epmet.commons.tools.enums.AchievementTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -38,6 +41,7 @@ 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.constant.UserMessageTypeConstant; import com.epmet.dto.form.*; import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -45,7 +49,6 @@ import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.constant.UserMessageConstant; -import com.epmet.commons.tools.enums.AchievementTypeEnum; import com.epmet.modules.feign.EpmetMessageFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; @@ -79,6 +82,7 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.result.AchievementResultDTO; import com.epmet.resi.group.dto.member.result.GroupAchievementDTO; +import com.epmet.resi.group.enums.SearchScopeTypeEnum; import com.epmet.send.SendMqMsgUtil; import com.github.pagehelper.PageHelper; import org.apache.commons.collections4.CollectionUtils; @@ -521,7 +525,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl listGroupsByGroupIds(List groupIds) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(ResiGroupEntity::getId, groupIds); + query.orderByDesc(ResiGroupEntity::getCreatedTime); + query.eq(ResiGroupEntity::getDelFlag, 0); + List groupEntities = baseDao.selectList(query); + List groupDtos = groupEntities.stream().map(ge -> { + ResiGroupMemberDTO leader = resiGroupMemberDao.selectLeaderMember(ge.getId()); + + GroupDetailResultDTO dto = new GroupDetailResultDTO(); + dto.setGroupId(ge.getId()); + dto.setGroupName(ge.getGroupName()); + dto.setGroupHeadPhoto(ge.getGroupHeadPhoto()); + dto.setGroupIntroduction(ge.getGroupIntroduction()); + dto.setGroupType(ge.getGroupType()); + dto.setLeaderId(leader.getCustomerUserId()); + return dto; + }).collect(Collectors.toList()); + return groupDtos; + } + + @Override + public List listGroupDetailsExcludeGroupIds(List excludeGroupIds, Integer startRow, Integer rowCount, String searchScopeType, String searchScopeObjectId, String sortType, String orderType) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + if (CollectionUtils.isNotEmpty(excludeGroupIds)) { + query.notIn(ResiGroupEntity::getId, excludeGroupIds); + } + query.last(String.format("limit %s, %s", startRow, rowCount)); + + // 只显示审核通过且可用的小组 + query.eq(ResiGroupEntity::getState, "approved"); + + SFunction sortFieldFun = null; + if (GroupFormDTO.SortTypeEnum.CREATE_TIME.getSortField().equals(sortType)) { + sortFieldFun = ResiGroupEntity::getCreatedTime; + } + + if (SearchScopeTypeEnum.GRID.getScopeType().equals(searchScopeType)) { + query.eq(ResiGroupEntity::getGridId, searchScopeObjectId); + } else if (SearchScopeTypeEnum.CUSTOMER.getScopeType().equals(searchScopeType)) { + query.eq(ResiGroupEntity::getCustomerId, searchScopeObjectId); + } + + if (GroupFormDTO.OrderTypeEnum.ASC.getOrderType().equals(orderType)) { + query.orderByAsc(sortFieldFun); + } else { + query.orderByDesc(sortFieldFun); + } + List groupList = baseDao.selectList(query); + return groupList.stream().map(ge -> { + // 查询组长id + ResiGroupMemberDTO leader = resiGroupMemberDao.selectLeaderMember(ge.getId()); + + GroupDetailResultDTO dto = new GroupDetailResultDTO(); + dto.setGroupId(ge.getId()); + dto.setGroupName(ge.getGroupName()); + dto.setGroupHeadPhoto(ge.getGroupHeadPhoto()); + dto.setGroupIntroduction(ge.getGroupIntroduction()); + dto.setGroupType(ge.getGroupType()); + dto.setGridId(ge.getGridId()); + dto.setLeaderId(leader.getCustomerUserId()); + return dto; + }).collect(Collectors.toList()); + } + + @Override + public List listGroupsByMember(String memberUserId, String gridId) { + return baseDao.listGroupsByMember(memberUserId, gridId); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java index 4c8897c5f1..8577aa2bd9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java @@ -21,7 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.invitation.entity.GroupInvitationEntity; -import com.epmet.resi.group.dto.UserRoleDTO; +import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.invitation.GroupInvitationDTO; import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO; import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; @@ -143,4 +143,11 @@ public interface GroupInvitationService extends BaseService page(Map params) { @@ -434,7 +434,11 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl + * 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.notice.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.notice.service.NoticeCommentAttachmentService; +import com.epmet.resi.group.dto.notice.NoticeCommentAttachmentDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@RestController +@RequestMapping("noticecommentattachment") +public class NoticeCommentAttachmentController { + + @Autowired + private NoticeCommentAttachmentService noticeCommentAttachmentService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = noticeCommentAttachmentService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + NoticeCommentAttachmentDTO data = noticeCommentAttachmentService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody NoticeCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + noticeCommentAttachmentService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody NoticeCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + noticeCommentAttachmentService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + noticeCommentAttachmentService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java new file mode 100644 index 0000000000..2ad57a60cd --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java @@ -0,0 +1,43 @@ +/** + * 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.notice.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Mapper +public interface NoticeCommentAttachmentDao extends BaseDao { + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + List selectNoticeComFile(@Param("noticeId") String noticeId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java new file mode 100644 index 0000000000..7ab97e6634 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java @@ -0,0 +1,93 @@ +/** + * 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.notice.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("notice_comment_attachment") +public class NoticeCommentAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 通知Id + */ + private String noticeId; + + /** + * 评论Id + */ + private String noticeCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentAttachmentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentAttachmentService.java new file mode 100644 index 0000000000..5baa7d553d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentAttachmentService.java @@ -0,0 +1,103 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.notice.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import com.epmet.resi.group.dto.notice.NoticeCommentAttachmentDTO; + +import java.util.List; +import java.util.Map; + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +public interface NoticeCommentAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-09-06 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-09-06 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return NoticeCommentAttachmentDTO + * @author generator + * @date 2021-09-06 + */ + NoticeCommentAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void save(NoticeCommentAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void update(NoticeCommentAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-09-06 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + List getNoticeComFile(String noticeId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java index 0ac50c21e7..6684e61d80 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java @@ -48,4 +48,11 @@ public interface NoticeCommentService extends BaseService { * @Description 通知评论列表查询 **/ List noticeCommentList(NoticeCommentListFormDTO formDTO); + + /** + * @Author sun + * @Description 文字、图片安全校验 + **/ + void safetyCheck(List wordList, List imageList); + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentAttachmentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentAttachmentServiceImpl.java new file mode 100644 index 0000000000..10c3710894 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentAttachmentServiceImpl.java @@ -0,0 +1,110 @@ +/** + * 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.notice.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.notice.dao.NoticeCommentAttachmentDao; +import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity; +import com.epmet.modules.notice.service.NoticeCommentAttachmentService; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import com.epmet.resi.group.dto.notice.NoticeCommentAttachmentDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 通知评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Service +public class NoticeCommentAttachmentServiceImpl extends BaseServiceImpl implements NoticeCommentAttachmentService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, NoticeCommentAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, NoticeCommentAttachmentDTO.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 NoticeCommentAttachmentDTO get(String id) { + NoticeCommentAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, NoticeCommentAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(NoticeCommentAttachmentDTO dto) { + NoticeCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(NoticeCommentAttachmentDTO dto) { + NoticeCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentAttachmentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + @Override + public List getNoticeComFile(String noticeId) { + return baseDao.selectNoticeComFile(noticeId); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java index 2ab3994891..cc56eb670d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java @@ -17,10 +17,13 @@ package com.epmet.modules.notice.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; 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.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; @@ -30,18 +33,23 @@ import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.notice.dao.NoticeCommentDao; +import com.epmet.modules.notice.entity.NoticeCommentAttachmentEntity; import com.epmet.modules.notice.entity.NoticeCommentEntity; import com.epmet.modules.notice.redis.NoticeCommentRedis; +import com.epmet.modules.notice.service.NoticeCommentAttachmentService; import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.modules.notice.service.NoticeService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.notice.NoticeDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentFormDTO; import com.epmet.resi.group.dto.notice.form.NoticeCommentListFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import com.epmet.resi.group.dto.notice.result.NoticeCommentListResultDTO; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -53,6 +61,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -70,12 +79,16 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl imageList = formDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); + safetyCheck(new ArrayList<>(), imageList); + } //2.判断当前用户是否被禁言、移除、非本组成员 NoticeDTO notice = noticeService.get(formDTO.getNoticeId()); @@ -139,6 +160,33 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl AttachmentEntityList = new ArrayList<>(); + //图片 + if (CollectionUtils.isNotEmpty(formDTO.getImageList())) { + AtomicInteger sort = new AtomicInteger(); + formDTO.getImageList().forEach(img -> { + NoticeCommentAttachmentEntity attachment = new NoticeCommentAttachmentEntity(); + attachment.setCustomerId(notice.getCustomerId()); + attachment.setNoticeId(formDTO.getNoticeId()); + attachment.setNoticeCommentId(entity.getId()); + attachment.setFileName(img.getName()); + attachment.setAttachmentName(""); + attachment.setAttachmentSize(img.getSize()); + attachment.setAttachmentFormat(img.getFormat()); + attachment.setAttachmentType(img.getType()); + attachment.setAttachmentUrl(img.getUrl()); + attachment.setSort(sort.get()); + attachment.setDuration(img.getDuration()); + sort.getAndIncrement(); + AttachmentEntityList.add(attachment); + }); + } + if (AttachmentEntityList.size() > NumConstant.ZERO) { + noticeCommentAttachmentService.insertBatch(AttachmentEntityList); + } + } /** @@ -165,7 +213,10 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl resultDTOList = result.getData(); - //3.封装数据并返回 + //3.查询通知评论所有人员的附件信息 + List fileList = noticeCommentAttachmentService.getNoticeComFile(formDTO.getNoticeId()); + + //4.封装数据并返回 resultList.forEach(l -> { StringBuffer name = new StringBuffer(); resultDTOList.forEach(user -> { @@ -175,9 +226,64 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl imageList = new ArrayList<>(); + for (CommentFileDTO f : fileList) { + if (l.getNoticeCommentId().equals(f.getCommentId()) && l.getUserId().equals(f.getUserId())) { + imageList.add(f); + } + } + l.setImageList(imageList); }); return resultList; } + /** + * @Author sun + * @Description 文字、图片安全校验 + **/ + public void safetyCheck(List wordList, List imageList) { + if (imageList.size() != NumConstant.ZERO) { + wordList.forEach(word -> { + //创建话题内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(word); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("safetyCheck textScan return failed,result:"+ JSON.toJSONString(textSyncScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.warn(EpmetErrorCode.TEXT_SCAN_FAILED.getMsg().concat(String.format(TopicConstant.CREATE_TOPIC, word))); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + }); + } + //创建话题图片审核 + if (imageList.size() != NumConstant.ZERO) { + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + imageList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()) { + logger.error("safetyCheck imgScan return failed,result:"+ JSON.toJSONString(imgScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + if (!imgScanResult.getData().isAllPass()) { + logger.warn(EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); + } + + } + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java index b21c69a4ae..afe0ce523d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java @@ -33,6 +33,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; @@ -58,7 +59,10 @@ import com.epmet.modules.notice.service.NoticeService; import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.notice.NoticeDTO; -import com.epmet.resi.group.dto.notice.form.*; +import com.epmet.resi.group.dto.notice.form.AddNoticeFormDTO; +import com.epmet.resi.group.dto.notice.form.EditNoticeFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeDetailFormDTO; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; @@ -272,6 +276,10 @@ public class NoticeServiceImpl extends BaseServiceImpl userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.GROUP_NOTICE_ADD, groupEntity.getGroupName(), formDTO.getTitle())); + + //21.09.10:记录消息类型和对应的业务id + userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_MESSAGE_PUBLISH); + userMessageFormDTO.setTargetId(messageEntity.getMessageId()); userMessageFormDTOS.add(userMessageFormDTO); } }); @@ -430,6 +438,11 @@ public class NoticeServiceImpl extends BaseServiceImpl userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.GROUP_NOTICE_EDIT, groupEntity.getGroupName(), formDTO.getTitle())); + + //21.09.10:记录消息类型和对应的业务id + userMessageFormDTO.setTargetId(entity.getId()); + userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_MESSAGE_EDIT); + userMessageFormDTOS.add(userMessageFormDTO); } }); @@ -503,7 +516,7 @@ public class NoticeServiceImpl extends BaseServiceImpl * @Description 文字、图片安全校验 **/ private void safetyCheck(List wordList, List imageList) { - if (imageList.size() != NumConstant.ZERO) { + if (wordList.size() != NumConstant.ZERO) { wordList.forEach(word -> { //创建话题内容审核 TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java new file mode 100644 index 0000000000..9c5dd8f841 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java @@ -0,0 +1,85 @@ +/** + * 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.topic.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService; +import com.epmet.resi.group.dto.topic.ResiTopicCommentAttachmentDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@RestController +@RequestMapping("resitopiccommentattachment") +public class ResiTopicCommentAttachmentController { + + @Autowired + private ResiTopicCommentAttachmentService resiTopicCommentAttachmentService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = resiTopicCommentAttachmentService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ResiTopicCommentAttachmentDTO data = resiTopicCommentAttachmentService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ResiTopicCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + resiTopicCommentAttachmentService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ResiTopicCommentAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + resiTopicCommentAttachmentService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + resiTopicCommentAttachmentService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java new file mode 100644 index 0000000000..ab917a7ba5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java @@ -0,0 +1,43 @@ +/** + * 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.topic.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Mapper +public interface ResiTopicCommentAttachmentDao extends BaseDao { + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + List selectTopicComFile(@Param("topicId") String topicId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java new file mode 100644 index 0000000000..d4400a14df --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java @@ -0,0 +1,93 @@ +/** + * 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.topic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_topic_comment_attachment") +public class ResiTopicCommentAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题Id + */ + private String topicId; + + /** + * 评论Id + */ + private String topicCommentId; + + /** + * 文件名 + */ + private String fileName; + + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + + /** + * 文件大小,单位b + */ + private Integer attachmentSize; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicCommentAttachmentService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicCommentAttachmentService.java new file mode 100644 index 0000000000..d29f410d33 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicCommentAttachmentService.java @@ -0,0 +1,102 @@ +/** + * 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.topic.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import com.epmet.resi.group.dto.topic.ResiTopicCommentAttachmentDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +public interface ResiTopicCommentAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-09-06 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-09-06 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ResiTopicCommentAttachmentDTO + * @author generator + * @date 2021-09-06 + */ + ResiTopicCommentAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void save(ResiTopicCommentAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-06 + */ + void update(ResiTopicCommentAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-09-06 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 查询话题评论所有人员的附件信息 + **/ + List getTopicComFile(String topicId); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentAttachmentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentAttachmentServiceImpl.java new file mode 100644 index 0000000000..e44dd792da --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentAttachmentServiceImpl.java @@ -0,0 +1,110 @@ +/** + * 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.topic.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.topic.dao.ResiTopicCommentAttachmentDao; +import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity; +import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; +import com.epmet.resi.group.dto.topic.ResiTopicCommentAttachmentDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 话题评论附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-09-06 + */ +@Service +public class ResiTopicCommentAttachmentServiceImpl extends BaseServiceImpl implements ResiTopicCommentAttachmentService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiTopicCommentAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiTopicCommentAttachmentDTO.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 ResiTopicCommentAttachmentDTO get(String id) { + ResiTopicCommentAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ResiTopicCommentAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResiTopicCommentAttachmentDTO dto) { + ResiTopicCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicCommentAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResiTopicCommentAttachmentDTO dto) { + ResiTopicCommentAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicCommentAttachmentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 查询通知评论所有人员的附件信息 + **/ + @Override + public List getTopicComFile(String topicId) { + return baseDao.selectTopicComFile(topicId); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index dd02ae9142..523f81dc49 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -41,22 +41,25 @@ import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.dto.result.CommonDataFilterResultDTO; +import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.comment.entity.ResiTopicCommentEntity; import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.constant.WxmpSubscribeConstant; import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.entity.ResiGroupEntity; -import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.group.redis.ResiGroupRedis; import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.modules.notice.service.NoticeCommentService; import com.epmet.modules.topic.dao.ResiTopicCommentDao; import com.epmet.modules.topic.dao.ResiTopicDao; +import com.epmet.modules.topic.entity.ResiTopicCommentAttachmentEntity; +import com.epmet.modules.topic.service.ResiTopicCommentAttachmentService; import com.epmet.modules.topic.service.ResiTopicCommentService; import com.epmet.modules.topic.service.ResiTopicService; import com.epmet.modules.utils.ModuleConstant; @@ -64,11 +67,12 @@ import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; -import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; +import com.epmet.resi.group.dto.group.result.CommentFileDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; +import com.epmet.resi.group.dto.notice.form.NoticeFileDTO; import com.epmet.resi.group.dto.topic.ResiTopicCommentDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO; @@ -76,6 +80,7 @@ import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import com.google.common.base.CharMatcher; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -85,6 +90,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -99,32 +105,28 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl imageList = resiCommentFormDTO.getImageList().stream().map(NoticeFileDTO::getUrl).collect(Collectors.toList()); + noticeCommentService.safetyCheck(new ArrayList<>(), imageList); + } + //1.判断当前用户是否被禁言 ResiTopicDTO topic = resiTopicService.get(resiCommentFormDTO.getTopicId()); if(null == topic){ @@ -314,6 +325,32 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl AttachmentEntityList = new ArrayList<>(); + //图片 + if (CollectionUtils.isNotEmpty(resiCommentFormDTO.getImageList())) { + AtomicInteger sort = new AtomicInteger(); + resiCommentFormDTO.getImageList().forEach(img -> { + ResiTopicCommentAttachmentEntity attachment = new ResiTopicCommentAttachmentEntity(); + attachment.setCustomerId(comment.getCustomerId()); + attachment.setTopicId(resiCommentFormDTO.getTopicId()); + attachment.setTopicCommentId(comment.getId()); + attachment.setFileName(img.getName()); + attachment.setAttachmentName(""); + attachment.setAttachmentSize(img.getSize()); + attachment.setAttachmentFormat(img.getFormat()); + attachment.setAttachmentType(img.getType()); + attachment.setAttachmentUrl(img.getUrl()); + attachment.setSort(sort.get()); + attachment.setDuration(img.getDuration()); + sort.getAndIncrement(); + AttachmentEntityList.add(attachment); + }); + } + if (AttachmentEntityList.size() > NumConstant.ZERO) { + resiTopicCommentAttachmentService.insertBatch(AttachmentEntityList); + } + //对所有关注这个话题的人发送微信订阅 resiTopicService.sendWxmpUpdateSubscribe(tokenDto,topic.getId(), WxmpSubscribeConstant.TYPE_COMMENT); return new Result(); @@ -372,6 +409,20 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl fileList = resiTopicCommentAttachmentService.getTopicComFile(commentFormDTO.getTopicId()); + //封装数据并返回 + comments.forEach(l -> { + //每一条评论的附件信息 + List imageList = new ArrayList<>(); + for (CommentFileDTO f : fileList) { + if (l.getCommentId().equals(f.getCommentId()) && l.getUserId().equals(f.getUserId())) { + imageList.add(f); + } + } + l.setImageList(imageList); + }); + } return new Result>().ok(comments); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.25__comment_attachment_.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.25__comment_attachment_.sql new file mode 100644 index 0000000000..9c60580ac9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.25__comment_attachment_.sql @@ -0,0 +1,65 @@ +CREATE TABLE `resi_topic_comment_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `TOPIC_ID` varchar(64) NOT NULL COMMENT '话题Id', + `TOPIC_COMMENT_ID` varchar(64) NOT NULL COMMENT '评论Id', + `FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名', + `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名(uuid随机生成)', + `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', + `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `ATTACHMENT_TYPE` varchar(64) DEFAULT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `DURATION` int(11) unsigned zerofill DEFAULT '00000000000' COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='话题评论附件表'; + +CREATE TABLE `act_comment_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GROUP_ACT_ID` varchar(64) NOT NULL COMMENT '活动Id[group_act_info.id]', + `ACT_COMMENT_ID` varchar(64) NOT NULL COMMENT '评论Id', + `FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名', + `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名(uuid随机生成)', + `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', + `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `ATTACHMENT_TYPE` varchar(64) DEFAULT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `DURATION` int(11) unsigned zerofill DEFAULT '00000000000' COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='活动评论附件表'; + +CREATE TABLE `notice_comment_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `NOTICE_ID` varchar(64) NOT NULL COMMENT '通知Id', + `NOTICE_COMMENT_ID` varchar(64) NOT NULL COMMENT '评论Id', + `FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名', + `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名(uuid随机生成)', + `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', + `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `ATTACHMENT_TYPE` varchar(64) DEFAULT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `DURATION` int(11) unsigned zerofill DEFAULT '00000000000' COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='通知评论附件表'; \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml new file mode 100644 index 0000000000..b74e6adc02 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml @@ -0,0 +1,26 @@ + + + + + + + + \ 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 9dbbf9992f..97f45b4369 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 @@ -230,14 +230,17 @@ AND gmo.OPERATE_STATUS = 'under_auditting' ) AS totalApplyingMember, rgs.TOTAL_TOPICS, - rg.AUDIT_SWITCH + rg.AUDIT_SWITCH, + rg.group_type groupType, + gs.`name` groupTypeName FROM resi_group rg LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID ) LEFT JOIN resi_group_member rgm - ON ( rg.id = rgm.RESI_GROUP_ID - AND rgm.DEL_FLAG='0' - AND rgm.CUSTOMER_USER_ID =#{userId}) + ON ( rg.id = rgm.RESI_GROUP_ID + AND rgm.DEL_FLAG='0' + AND rgm.CUSTOMER_USER_ID =#{userId}) + LEFT JOIN resi_group_setup gs ON rg.GROUP_TYPE = gs.GROUP_TYPE AND gs.CUSTOMER_ID = 'default' WHERE rg.DEL_FLAG = '0' AND rgs.DEL_FLAG = '0' @@ -1045,4 +1048,27 @@ ORDER BY releaseTime DESC + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml new file mode 100644 index 0000000000..d20f434692 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml new file mode 100644 index 0000000000..f4616d1913 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java index 38497917d8..61f1c0f8f5 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java @@ -73,4 +73,9 @@ public class ResiWarmheartedSubmitFormDTO implements Serializable { */ private String messageText; + /** + * 无需前端传入,此列用来数据传值 + */ + private String applyId; + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index 1610de67c6..502a520dc3 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -8,10 +8,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.constant.PartyMemberConstant; -import com.epmet.constant.PartyMemberMessageConstant; -import com.epmet.constant.ReadFlagConstant; -import com.epmet.constant.SmsTemplateConstant; +import com.epmet.constant.*; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -651,6 +648,11 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService userMessageFormDTO.setGridId(formDTO.getGridId()); userMessageFormDTO.setApp(AppClientConstant.APP_RESI); userMessageFormDTO.setTitle(PartyMemberMessageConstant.PARTY_AUTH_TITLE); + + //21.09.10:记录消息类型和对应的业务id + userMessageFormDTO.setMessageType(UserMessageTypeConstant.PARTY_CERTIFY_APPLY_RES); + userMessageFormDTO.setTargetId(formDTO.getId()); + //调用gov-org服务查询网格信息 CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); customerGridFormDTO.setGridId(formDTO.getGridId()); @@ -729,7 +731,12 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService msgDTO.setTitle(PartyMemberMessageConstant.PARTY_AUTH_TITLE); msgDTO.setMessageContent(message); msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.PARTY_CERTIFY_APPLY); + msgDTO.setTargetId(formDTO.getId()); msgList.add(msgDTO); + //微信订阅 WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO(); subscribeDTO.setClientType(AppClientConstant.APP_GOV); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java index 549a5ce8af..553f20bae2 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.PartyMemberConstant; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.UserRoleDTO; @@ -211,7 +212,8 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl - + + + select replace(uuid(),'-','') AS ID + INSERT INTO user_badge_certificate_record ( ID, CUSTOMER_ID, @@ -197,7 +200,7 @@ ) VALUES ( - REPLACE ( UUID(), '-', '' ), + #{id}, #{customerId}, #{gridId}, #{userId},