Browse Source

Merge remote-tracking branch 'remotes/origin/dev_group_msg' into dev

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java
#	epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java
dev_shibei_match
jianjun 4 years ago
parent
commit
1f2b644e4c
  1. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java
  3. 14
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java
  4. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java
  5. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  6. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  7. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  8. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  9. 170
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java
  10. 8
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java
  11. 11
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java
  12. 12
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/StaffMessageResultDTO.java
  13. 8
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml
  14. 14
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java
  15. 21
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java
  16. 59
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java
  17. 23
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java
  18. 25
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java
  19. 285
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java
  20. 46
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml
  21. 21
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  22. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java
  23. 39
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  24. 23
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java
  25. 22
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  26. 126
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActCommentAttachmentDTO.java
  27. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/CommentFormDTO.java
  28. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/CommentResultDTO.java
  29. 8
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/comment/result/ResiCommentResultDTO.java
  30. 74
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java
  31. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupsByMemberFormDTO.java
  32. 28
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/CommentFileDTO.java
  33. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java
  34. 8
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java
  35. 11
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RankingResultDTO.java
  36. 126
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeCommentAttachmentDTO.java
  37. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/NoticeCommentFormDTO.java
  38. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/result/NoticeCommentListResultDTO.java
  39. 126
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentAttachmentDTO.java
  40. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiPublishCommentFormDTO.java
  41. 22
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/enums/SearchScopeTypeEnum.java
  42. 32
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  43. 15
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  44. 85
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/ActCommentAttachmentController.java
  45. 43
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCommentAttachmentDao.java
  46. 93
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/entity/ActCommentAttachmentEntity.java
  47. 103
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCommentAttachmentService.java
  48. 110
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentAttachmentServiceImpl.java
  49. 65
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCommentServiceImpl.java
  50. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java
  51. 1
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java
  52. 55
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  53. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  54. 37
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  55. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  56. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/GroupInvitationService.java
  57. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java
  58. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java
  59. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java
  60. 24
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  61. 85
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentAttachmentController.java
  62. 43
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeCommentAttachmentDao.java
  63. 93
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeCommentAttachmentEntity.java
  64. 103
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentAttachmentService.java
  65. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/NoticeCommentService.java
  66. 110
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentAttachmentServiceImpl.java
  67. 108
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeCommentServiceImpl.java
  68. 17
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  69. 85
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicCommentAttachmentController.java
  70. 43
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentAttachmentDao.java
  71. 93
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicCommentAttachmentEntity.java
  72. 102
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicCommentAttachmentService.java
  73. 110
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentAttachmentServiceImpl.java
  74. 73
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  75. 65
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.25__comment_attachment_.sql
  76. 26
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml
  77. 34
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  78. 26
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml
  79. 26
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml
  80. 5
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java
  81. 15
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java
  82. 17
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java
  83. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java
  84. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  85. 7
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

12
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);
}
}

12
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;
}

14
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));
}
}

2
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<String> staffIds;
//token中用户Id
private String staffId;
//人员是否禁用【未禁用enable,已禁用disabled】
private String enableFlag = "enable";
public interface OrgStaff extends CustomerClientShowGroup {}
}

14
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<String,String> roleMap = staffInfoCache.getRoleMap();
if (roleMap.containsKey("root_manager") || roleMap.containsKey("manager")) {
formDTO.setEnableFlag("disabled");
}
//2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】
List<ListStaffResultDTO> staffList = epmetUserService.getStaffInfoList(formDTO);

11
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 =
<choose>
<when test="orgType != null and orgType == 'agency' ">
'agency_leader'
@ -73,9 +73,14 @@
'grid_manager'
</otherwise>
</choose>
then 1 else 0 end is_first<!-- 有单位领导角色的人赋值为1,没有的赋值为0 -->
then 0
when cs.enable_flag = 'enable' AND gsr.role_key != 'agency_leader'
then 1 else 2 end is_first<!-- 未禁用有相应角色人员赋值0,未禁用无相应角色人员赋值1,禁用人员赋值2 -->
FROM staff_role sr
INNER JOIN customer_staff cs ON sr.staff_id = cs.user_id
<if test="enableFlag != null and enableFlag != '' and enableFlag == 'enable' ">
AND cs.enable_flag = 'enable' <!-- 非超级管理员、管理员只允许查看未禁用人员信息 -->
</if>
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 @@
</choose>
) t
GROUP BY t.staff_id
ORDER BY t.is_first <![CDATA[<>]]> 1, t.created_time desc<!-- 标注有单位领导角色的人不参与排序也就是默认拍在前边,再按创建时间降序 -->
ORDER BY t.is_first <![CDATA[<>]]> 0, t.is_first asc, t.created_time desc<!-- 标注有相应角色的人不参与排序也就是默认拍在前边,没有相对于角色的排在后边,禁用人员排在最后 -->
LIMIT #{pageNo}, #{pageSize}
</select>

7
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();

6
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("审核成功,已成功发送站内信");

170
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";
}

8
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;
}

11
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;
}

12
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;
}

8
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

14
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;
}

21
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;
}

59
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<BizPointTotalDetailDTO>().ok(result);
}
/**
* @description 小组排名- 网格范围内
*
* @param formDTO
* @return
* @author wxz
* @date 2021.09.07 13:35:45
*/
@PostMapping("grouppointranking/gridscope")
public Result<List<GroupPointRankingResultDTO>> 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<GroupPointRankingResultDTO> page = bizPointTotalDetailService.listGroupPointRandingInPercificScope(SearchScopeTypeEnum.GRID, gridId,pageNo, pageSize, loginUser.getUserId());
return new Result<List<GroupPointRankingResultDTO>>().ok(page);
}
/**
* @description 小组排名- 客户范围内
*
* @param formDTO
* @return
* @author wxz
* @date 2021.09.08 09:18:37
*/
@PostMapping("grouppointranking/customerscope")
public Result<List<GroupPointRankingResultDTO>> 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<GroupPointRankingResultDTO> page = bizPointTotalDetailService.listGroupPointRandingInPercificScope(SearchScopeTypeEnum.CUSTOMER, customerId, pageNo, pageSize, loginUser.getUserId());
return new Result<List<GroupPointRankingResultDTO>>().ok(page);
}
/**
* @description 小组排名- 列出我所在的小组的积分排名
*
* @param formDTO
* @return
* @author wxz
* @date 2021.09.08 13:31:09
*/
@PostMapping("grouppointranking/mygroups")
public Result<List<GroupPointRankingResultDTO>> listMyGroupPointRanding(@LoginUser TokenDto loginInfo, @RequestBody GroupPointFormDTO formDTO) {
String userId = loginInfo.getUserId();
ValidatorUtils.validateEntity(formDTO, GroupPointFormDTO.MyGroupRank.class);
String gridId = formDTO.getGridId();
List<GroupPointRankingResultDTO> list = bizPointTotalDetailService.listMyGroupPointRanding(userId, gridId);
return new Result<List<GroupPointRankingResultDTO>>().ok(list);
}
}

23
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java

@ -40,4 +40,27 @@ public interface BizPointTotalDetailDao extends BaseDao<BizPointTotalDetailEntit
* @return com.epmet.dto.BizPointTotalDetailDTO
*/
BizPointTotalDetailDTO selectDataByObject(@Param("type")String type, @Param("objectId")String objectId);
/**
* @description 查询object在指定范围内的排名
*
* @param bizType
* @param groupId
* @param scope
* @return
* @author wxz
* @date 2021.09.08 17:36:17
*/
Integer getRanking(@Param("bizType") String bizType, @Param("groupId") String groupId, @Param("scope") String scope);
/**
* @description 搜索指定范围内最低名次
*
* @param scope
* @param scopeId
* @return
* @author wxz
* @date 2021.09.09 09:53:37
*/
Integer getMinRanking(@Param("bizType") String bizType,@Param("searchScope") String scope, @Param("searchScopeId") String scopeId);
}

25
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java

@ -24,6 +24,7 @@ import com.epmet.dto.form.GroupPointFormDTO;
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.enums.SearchScopeTypeEnum;
import java.util.List;
import java.util.Map;
@ -135,4 +136,28 @@ public interface BizPointTotalDetailService extends BaseService<BizPointTotalDet
* @return com.epmet.dto.BizPointTotalDetailDTO
*/
BizPointTotalDetailDTO getGroupPoint(GroupPointFormDTO formDTO);
/**
* @description 网格范围内查询小组排名
*
* @param searchScopeType 搜索小组的范围类型:GroupFormDTO.SearchScopeTypeEnum.GRID/GroupFormDTO.SearchScopeTypeEnum.CUSTOMER
* @param searchScopeId 搜索小组的范围id
* @param pageNo 页码默认0
* @param pageSize 单页条数默认10
* @return
* @author wxz
* @date 2021.09.07 14:18:08
*/
List<GroupPointRankingResultDTO> 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<GroupPointRankingResultDTO> listMyGroupPointRanding(String userId, String gridId);
}

285
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<BizPointTotalDetailDao, BizPointTotalDetailEntity> implements BizPointTotalDetailService {
public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTotalDetailDao, BizPointTotalDetailEntity> implements BizPointTotalDetailService, ResultDataResolver {
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@ -65,6 +84,10 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTota
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Autowired
private UserPointActionLogService userPointActionLogService;
@Autowired
private RedisTemplate<String, ?> redisTemplate;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<BizPointTotalDetailDTO> page(Map<String, Object> params) {
@ -239,4 +262,264 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTota
return ConvertUtils.sourceToTarget(entity, BizPointTotalDetailDTO.class);
}
@Override
public List<GroupPointRankingResultDTO> listGroupPointRandingInPercificScope(SearchScopeTypeEnum searchScopeType, String searchScopeId,
Integer pageNo, Integer pageSize,
String currentUserId) {
// 1.查询有积分的小组得分排名
PageInfo<BizPointTotalDetailEntity> entityPageInfo = PageHelper.startPage(pageNo, pageSize).doSelectPageInfo(() -> {
LambdaQueryWrapper<BizPointTotalDetailEntity> 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<BizPointTotalDetailEntity> groupList = entityPageInfo.getList();
List<String> groupIds = groupList.stream().map(g -> g.getObjectId()).collect(Collectors.toList());
// 2.将列表填充基本信息并且转换为dto
List<GroupPointRankingResultDTO> rankingInfoDTOs = convertGroupRankingInfoEntity2DTOs(groupIds, groupList, currentUserId);
Page page = new Page(pageNo, pageSize);
// 3.如果不满一页,则填充分数为0的
if (pageSize > groupIds.size()) {
// 查出网格下已有积分的小组id
LambdaQueryWrapper<BizPointTotalDetailEntity> 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<String> 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<GroupPointRankingResultDTO> 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<GroupPointRankingResultDTO> 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<GroupPointRankingResultDTO> fillGroupPageGap(List<String> 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<List<GroupDetailResultDTO>> result = resiGroupOpenFeignClient.listGroupDetailsExcludeGroupIds(form);
List<GroupDetailResultDTO> 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<GroupPointRankingResultDTO> convertGroupRankingInfoEntity2DTOs(List<String> groupIds, List<BizPointTotalDetailEntity> groupList, String currentUserId) {
if (CollectionUtils.isEmpty(groupIds)) {
return new ArrayList<>();
}
// 查询这些小组的基本信息
Result<List<GroupDetailResultDTO>> listResult = resiGroupOpenFeignClient.listGroupDetailsByGroupIds(groupIds);
List<GroupDetailResultDTO> groupInfos = getResultDataOrThrowsException(listResult, ServiceConstant.RESI_GROUP_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【小组排行】批量查询小组信息出错");
// 将小组基本信息转化为map
HashMap<String, GroupDetailResultDTO> groupMap = new HashMap<>();
groupInfos.stream().forEach(g -> groupMap.put(g.getGroupId(), g));
// 将小组信息填充到排名列表中
List<GroupPointRankingResultDTO> 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<String, String, Object> ope = redisTemplate.opsForHash();
Map<String, Object> 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<CustomerGridDTO> 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<GroupPointRankingResultDTO> listMyGroupPointRanding(String userId, String gridId) {
// 1.查询网格内我所在的小组
GroupsByMemberFormDTO form = new GroupsByMemberFormDTO();
form.setGridId(gridId);
form.setUserId(userId);
List<GroupDetailResultDTO> 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<GroupPointRankingResultDTO> groupDtoList = groupList.stream().map(g -> {
// 积分
Integer point = 0;
// 网格内的排名
Integer gridRanking = null;
// 客户下的排名
Integer customerRanking = null;
LambdaQueryWrapper<BizPointTotalDetailEntity> 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;
}
}

46
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml

@ -29,5 +29,51 @@
and OBJECT_ID = #{objectId}
</select>
<!--查询object在指定范围内的排名-->
<select id="getRanking" resultType="java.lang.Integer">
select count(distinct p_2.TOTAL_POINT) + 1 as ranking
from biz_point_total_detail point
inner join biz_point_total_detail p_2
on (point.BIZ_TYPE = p_2.BIZ_TYPE and p_2.DEL_FLAG = 0 and
point.TOTAL_POINT &lt; p_2.TOTAL_POINT
<if test="scope == 'grid'">
and point.GRID_ID = p_2.GRID_ID
</if>
<if test="scope == 'customer'">
and point.CUSTOMER_ID = p_2.CUSTOMER_ID
</if>
)
where
point.OBJECT_ID = #{groupId}
and point.BIZ_TYPE = #{bizType}
and point.DEL_FLAG = 0
</select>
<!--获取指定范围内最低排名。子查询是取最低分的那个对象出来-->
<select id="getMinRanking" resultType="java.lang.Integer">
select count(distinct p.TOTAL_POINT) + 1 as ranking
from biz_point_total_detail p
inner join
(select point.OBJECT_ID, point.BIZ_TYPE, point.GRID_ID, point.CUSTOMER_ID, point.TOTAL_POINT
from biz_point_total_detail point
where point.BIZ_TYPE = #{bizType}
and point.DEL_FLAG = 0
<if test="searchScope == 'grid'">
and point.GRID_ID = #{searchScopeId}
</if>
<if test="searchScope == 'customer'">
and point.CUSTOMER_ID = #{searchScopeId}
</if>
order by point.TOTAL_POINT asc limit 1) t
on (p.BIZ_TYPE = t.BIZ_TYPE
and p.TOTAL_POINT > t.TOTAL_POINT
<if test="searchScope == 'grid'">
and p.GRID_ID = t.GRID_ID
</if>
<if test="searchScope == 'customer'">
and p.CUSTOMER_ID = t.CUSTOMER_ID
</if>
)
</select>
</mapper>

21
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<IssueDao, IssueEntity> 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<IssueDao, IssueEntity> 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<IssueDao, IssueEntity> 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());
}

10
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<ProjectProcessDao
msg.setMessageContent(projectStaffMessage);
msg.setReadFlag(ReadFlagConstant.UN_READ);
msg.setUserId(staff.getStaffId());
//21.09.10:记录消息类型和对应的业务id
msg.setMessageType(UserMessageTypeConstant.PROJECT_TRANSFER);
msg.setTargetId(formDTO.getProjectId());
msgList.add(msg);
map.put(staff.getStaffId(),staff.getStaffId());
}

39
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -31,10 +31,7 @@ import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.*;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserMessageConstant;
import com.epmet.constant.*;
import com.epmet.dao.ProjectDao;
import com.epmet.dao.ProjectOrgRelationDao;
import com.epmet.dao.ProjectSatisfactionStatisticsDao;
@ -513,6 +510,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_CLOSED);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO();
msg.setCustomerId(projectEntity.getCustomerId());
@ -536,6 +538,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_CLOSED);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO();
msg.setCustomerId(projectEntity.getCustomerId());
@ -694,6 +701,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_CLOSED);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO();
msg.setCustomerId(projectEntity.getCustomerId());
@ -717,6 +729,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_CLOSED);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO();
msg.setCustomerId(projectEntity.getCustomerId());
@ -881,6 +898,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_RETURN);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
messageFeignClient.saveUserMessageList(msgList);
//2020.10.26 添加项目退回给勾选人推送微信订阅消息 sun
@ -1705,6 +1727,10 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(title);
messageFormDTO.setMessageContent(msg);
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_REMIND);
msgList.add(messageFormDTO);
//10.29 项目滞留提醒添加推送微信消息 sun
@ -2056,6 +2082,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE);
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle()));
messageFormDTO.setReadFlag(Constant.UNREAD);
//21.09.10:记录消息类型和对应的业务id
messageFormDTO.setMessageType(UserMessageTypeConstant.PROJECT_RETURN);
messageFormDTO.setTargetId(fromDTO.getProjectId());
msgList.add(messageFormDTO);
messageFeignClient.saveUserMessageList(msgList);
//2020.10.26 添加项目退回给勾选人推送微信订阅消息 sun

23
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java

@ -15,10 +15,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.ProjectProcessAttachmentDao;
import com.epmet.dao.ProjectProcessDao;
@ -488,7 +485,7 @@ public class ProjectTraceServiceImpl<ProjectTagService> 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<ProjectTagService> implements ProjectTraceS
* @Description 项目立项给勾选的工作人员推送站内信消息
* @author sun
*/
private Result shiftProjectMessage(ProjectApprovalFormDTO formDTO) {
private Result shiftProjectMessage(ProjectApprovalFormDTO formDTO,String projectId) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
//1.创建项目工作人员消息对象
String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, formDTO.getTitle());
@ -581,6 +578,11 @@ public class ProjectTraceServiceImpl<ProjectTagService> 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<ProjectTagService> 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<ProjectTagService> implements ProjectTraceS
* @Description 项目立项给勾选的工作人员推送站内信消息
* @author yinzuomei
*/
private Result shiftProjectMessage(List<TickStaffFormDTO> staffList,String customerId,String title) {
private Result shiftProjectMessage(List<TickStaffFormDTO> staffList,String customerId,String title,String projectId) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
//1.创建项目工作人员消息对象
String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, title);
@ -935,6 +937,11 @@ public class ProjectTraceServiceImpl<ProjectTagService> 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());
}

22
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<ArticleDao, ArticleEntit
}
if (!isOk) {
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
//发布文章内容审核
this.sendMsg(draftEntity.getId(),draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.wxmpMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
return null;
@ -1054,7 +1055,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanContent exception", e);
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
//发布文章内容审核
this.sendMsg(draftEntity.getId(),draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.wxmpMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
}
@ -1092,7 +1094,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
//发布文章内容审核
this.sendMsg(draft.getId(),draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
@ -1157,12 +1160,14 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
} else if (titleFail) {
auditMsg = ModuleConstant.DRAFT_TITLE;
}
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
//发布文章内容审核
this.sendMsg(draft.getId(),draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
//发布文章内容审核
this.sendMsg(draft.getId(),draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
@ -1174,7 +1179,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return this.saveOrUpdateContent(tokenDto, fromDTO, false);
}
public Result sendMsg(String customerId, String title, String content) {
public Result sendMsg(String draftId,String customerId, String title, String content) {
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setGridId("");
@ -1183,6 +1188,11 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE, title));
formDTO.setMessageContent(content);
formDTO.setReadFlag(ReadFlagConstant.UN_READ);
//21.09.10:记录消息类型和对应的业务id
formDTO.setMessageType(UserMessageTypeConstant.PARTY_VOICE_PUBLISH);
formDTO.setTargetId(draftId);
return epmetMessageOpenFeignClient.saveUserMessage(formDTO);
}
/**

126
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/ActCommentAttachmentDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
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;
}

10
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<NoticeFileDTO> imageList;
/**
* 当前用户id

10
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<CommentFileDTO> imageList = new ArrayList<>();
}

8
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<CommentFileDTO> imageList = new ArrayList<>();
}

74
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<String> 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;
}
}
}

17
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;
}

28
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;
}

10
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;
}

8
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(){

11
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;
}

126
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
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;
}

10
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<NoticeFileDTO> imageList;
public interface Comment{}
public interface UserShow extends CustomerClientShowGroup {}
}

9
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<CommentFileDTO> imageList = new ArrayList<>();
}

126
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
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;
}

9
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<NoticeFileDTO> imageList;
}

22
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;
}
}

32
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<List<TopicInfoResultDTO>> getTopicInfos(@RequestBody List<String> issueIds);
/**
* @description 根据组id列表批量查询组信息列表
*
* @param groupIds
* @return
* @author wxz
* @date 2021.09.07 15:33:58
*/
@PostMapping("/resi/group/group/list-groupinfos-by-groupids")
Result<List<GroupDetailResultDTO>> listGroupDetailsByGroupIds(@RequestBody List<String> groupIds);
/**
* @description 排除指定的组id之后按照指定顺序取指定个数的组信息
*
* @param form
* @return
* @author wxz
* @date 2021.09.07 17:15:55
*/
@PostMapping("/resi/group/group/list-groupinfos-exclude-groupids")
Result<List<GroupDetailResultDTO>> 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<List<GroupDetailResultDTO>> listGroupsByMember(@RequestBody GroupsByMemberFormDTO formDTO);
}

15
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<List<TopicInfoResultDTO>> getTopicInfos(List<String> issueIds) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getTopicInfos", issueIds);
}
@Override
public Result<List<GroupDetailResultDTO>> listGroupDetailsByGroupIds(List<String> groupIds) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupDetailsByGroupIds", groupIds);
}
@Override
public Result<List<GroupDetailResultDTO>> listGroupDetailsExcludeGroupIds(GroupFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupDetailsExcludeGroupIds", form);
}
@Override
public Result<List<GroupDetailResultDTO>> listGroupsByMember(GroupsByMemberFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupsByMember", formDTO);
}
}

85
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<ActCommentAttachmentDTO>> page(@RequestParam Map<String, Object> params){
PageData<ActCommentAttachmentDTO> page = actCommentAttachmentService.page(params);
return new Result<PageData<ActCommentAttachmentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ActCommentAttachmentDTO> get(@PathVariable("id") String id){
ActCommentAttachmentDTO data = actCommentAttachmentService.get(id);
return new Result<ActCommentAttachmentDTO>().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();
}
}

43
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ActCommentAttachmentEntity> {
/**
* @Author sun
* @Description 查询通知评论所有人员的附件信息
**/
List<CommentFileDTO> selectActComFile(@Param("groupActId") String groupActId);
}

93
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
private String attachmentFormat;
/**
* 附件类型图片 - image 视频 - video 语音 - voice 文档 - doc
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 排序字段
*/
private Integer sort;
/**
* 语音或视频时长
*/
private Integer duration;
}

103
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ActCommentAttachmentEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ActCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
PageData<ActCommentAttachmentDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ActCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
List<ActCommentAttachmentDTO> list(Map<String, Object> 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<CommentFileDTO> getActComFile(String groupActId);
}

110
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ActCommentAttachmentDao, ActCommentAttachmentEntity> implements ActCommentAttachmentService {
@Override
public PageData<ActCommentAttachmentDTO> page(Map<String, Object> params) {
IPage<ActCommentAttachmentEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActCommentAttachmentDTO.class);
}
@Override
public List<ActCommentAttachmentDTO> list(Map<String, Object> params) {
List<ActCommentAttachmentEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActCommentAttachmentDTO.class);
}
private QueryWrapper<ActCommentAttachmentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActCommentAttachmentEntity> 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<CommentFileDTO> getActComFile(String groupActId) {
return baseDao.selectActComFile(groupActId);
}
}

65
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<ActCommentDao, ActCom
private GroupActInfoService groupActInfoService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private NoticeCommentService noticeCommentService;
@Autowired
private ActCommentAttachmentService actCommentAttachmentService;
/**
@ -74,7 +88,11 @@ public class ActCommentServiceImpl extends BaseServiceImpl<ActCommentDao, ActCom
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void submitComment(CommentFormDTO formDTO) {
if(StringUtils.isBlank(formDTO.getCommentContent())&& org.apache.commons.collections4.CollectionUtils.isEmpty(formDTO.getImageList())){
throw new RenException("请至少填写评论内容或上传评论图片!");
}
//1、关闭和已取消不能评论
GroupActInfoDTO groupActInfoDTO = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId());
if (GroupActConstant.CLOSED.equals(groupActInfoDTO.getStatus())) {
@ -96,6 +114,12 @@ public class ActCommentServiceImpl extends BaseServiceImpl<ActCommentDao, ActCom
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
//图片安全校验
if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(formDTO.getImageList())){
List<String> 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<ActCommentDao, ActCom
actCommentEntity.setCommentUserId(formDTO.getUserId());
actCommentEntity.setGroupActId(formDTO.getGroupActId());
baseDao.insert(actCommentEntity);
//4.保存活动评论附件数据
List<ActCommentAttachmentEntity> 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<ActCommentDao, ActCom
if (!result.success()) {
throw new RenException("调用user服务,获取用户基础数据失败");
}
//3.查询活动评论所有人员的附件信息
List<CommentFileDTO> 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<ActCommentDao, ActCom
l.setCommentUserName(user.getSurname().concat(user.getName()));
}
});
//每一条评论的附件信息
List<CommentFileDTO> imageList = new ArrayList<>();
for (CommentFileDTO f : fileList) {
if (l.getCommentId().equals(f.getCommentId()) && l.getCommentUserId().equals(f.getUserId())) {
imageList.add(f);
}
}
l.setImageList(imageList);
});
}

14
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<GroupActInfoDao, Gr
if(StringUtils.isNotBlank(formDTO.getGroupActId())){
// 活动修改后,站内信通知全组成员“您有一条小组消息 【某某小组】更新了********活动详情,请查看。
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.CHANGED_GROUP_ACT, resiGroupDTO.getGroupName(), groupActInfoEntity.getTitle()));
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_ACT_PUBLISH);
userMessageFormDTO.setTargetId(groupActInfoEntity.getId());
}else{
// 活动发布,站内信通知全组成员“您有一条小组消息 【某某小组】发布了*******活动,请查看。
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.PUBLISH_GROUP_ACT, resiGroupDTO.getGroupName(), groupActInfoEntity.getTitle()));
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_ACT_CHANGE);
userMessageFormDTO.setTargetId(groupActInfoEntity.getId());
}
list.add(userMessageFormDTO);
}
@ -760,6 +769,11 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE);
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.CANCEL_GROUP_ACT, resiGroupDTO.getGroupName(), actInfoEntity.getTitle()));
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_ACT_CANCEL);
userMessageFormDTO.setTargetId(actInfoEntity.getId());
list.add(userMessageFormDTO);
}
});

1
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java

@ -29,6 +29,7 @@ public interface UserMessageConstant {
*/
String INVITED_JOIN_GROUP = "您的好友-【%s】通过邀请连接,加入了【%s】";
String SCANCODE_JOIN_GROUP = "您的好友-【%s】通过扫描二维码,加入了【%s】";
String SHARABLELINK_JOIN_GROUP = "您的好友-【%s】通过分享链接,加入了【%s】";
/**
* 组成员被禁言时会收到消息您已被禁言禁言时间2020.03.20 12:20-2020.03.27 12:20

55
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -33,6 +33,7 @@ import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import com.epmet.resi.group.enums.SearchScopeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
@ -599,4 +600,58 @@ public class ResiGroupController {
public Result<Boolean> initAchievement(@RequestParam String customerId) {
return new Result<Boolean>().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<List<GroupDetailResultDTO>> listGroupDetailsByGroupIds(@RequestBody List<String> groupIds) {
List<GroupDetailResultDTO> groupDetails = resiGroupService.listGroupsByGroupIds(groupIds);
return new Result<List<GroupDetailResultDTO>>().ok(groupDetails);
}
/**
* @description 排除指定的组id之后按照指定顺序取指定个数的组信息
*
* @param form
* @return
* @author wxz
* @date 2021.09.07 17:15:55
*/
@PostMapping("list-groupinfos-exclude-groupids")
public Result<List<GroupDetailResultDTO>> listGroupDetailsExcludeGroupIds(@RequestBody GroupFormDTO form) {
ValidatorUtils.validateEntity(form, GroupFormDTO.GroupDetailsExcludeGroupIds.class);
Integer startRow = form.getStartRow();
Integer rowCount = form.getRowCount();
List<String> excludeGroupIds = form.getExcludeGroupIds();
GroupFormDTO.SortTypeEnum sort = form.getSort();
GroupFormDTO.OrderTypeEnum order = form.getOrder();
SearchScopeTypeEnum searchScopeType = form.getSearchScopeType();
String searchScopeObjectId = form.getSearchScopeObjectId();
List<GroupDetailResultDTO> groups = resiGroupService.listGroupDetailsExcludeGroupIds(excludeGroupIds, startRow, rowCount, searchScopeType.getScopeType(), searchScopeObjectId, sort.getSortField(), order.getOrderType());
return new Result<List<GroupDetailResultDTO>>().ok(groups);
}
/**
* @description 根据组成员查询所在的小组列表可选条件包括:grid
*
* @param formDTO
* @return
* @author wxz
* @date 2021.09.08 13:51:05
*/
@PostMapping("list-groups-by-member")
public Result<List<GroupDetailResultDTO>> listGroupsByMember(@RequestBody GroupsByMemberFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
String gridId = formDTO.getGridId();
String userId = formDTO.getUserId();
List<GroupDetailResultDTO> groups = resiGroupService.listGroupsByMember(userId, gridId);
return new Result<List<GroupDetailResultDTO>>().ok(groups);
}
}

11
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<ResiGroupEntity> {
* @return java.util.List<com.epmet.resi.group.dto.member.result.GroupAchievementDTO>
*/
List<GroupAchievementDTO> 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<GroupDetailResultDTO> listGroupsByMember(@Param("memberUserId") String memberUserId, @Param("gridId") String gridId);
}

37
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<ResiGroupEntity> {
* @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<GroupDetailResultDTO> listGroupsByGroupIds(List<String> 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<GroupDetailResultDTO> listGroupDetailsExcludeGroupIds(List<String> 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<GroupDetailResultDTO> listGroupsByMember(String memberUserId, String gridId);
}

95
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<ResiGroupDao, ResiGrou
}
resiGroupStatisticalService.save(resiGroupStatisticalDTO);
//发送消息:创建小组
sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId());
sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId(), resiGroupEntity.getId());
}
@ -715,6 +719,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()));
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_CREATE_GROUP_RES);
userMessageFormDTO.setTargetId(agreeApplyGroupFormDTO.getGroupId());
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())));
}
@ -779,6 +788,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()));
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_CREATE_GROUP_RES);
userMessageFormDTO.setTargetId(disAgreeApplyGroupFormDTO.getGroupId());
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())));
}
@ -1151,7 +1165,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
* @author wangc
* @date 2020.04.29 22:49
**/
private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){
private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId,String groupId){
//1.查询加入当前网格下的人员 customer_staff_grid
CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO();
commonGridIdFormDTO.setGridId(gridId);
@ -1182,6 +1196,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
msgObj.setReadFlag(ReadFlagConstant.UN_READ);
msgObj.setTitle(title);
msgObj.setUserId(to);
//21.09.10:记录消息类型和对应的业务id
msgObj.setMessageType(UserMessageTypeConstant.GROUP_CREATE_GROUP_APPLY);
msgObj.setTargetId(groupId);
msgList.add(msgObj);
//微信订阅
WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO();
@ -1772,4 +1791,74 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return resultList;
}
@Override
public List<GroupDetailResultDTO> listGroupsByGroupIds(List<String> groupIds) {
LambdaQueryWrapper<ResiGroupEntity> query = new LambdaQueryWrapper<>();
query.in(ResiGroupEntity::getId, groupIds);
query.orderByDesc(ResiGroupEntity::getCreatedTime);
query.eq(ResiGroupEntity::getDelFlag, 0);
List<ResiGroupEntity> groupEntities = baseDao.selectList(query);
List<GroupDetailResultDTO> 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<GroupDetailResultDTO> listGroupDetailsExcludeGroupIds(List<String> excludeGroupIds, Integer startRow, Integer rowCount, String searchScopeType, String searchScopeObjectId, String sortType, String orderType) {
LambdaQueryWrapper<ResiGroupEntity> 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<ResiGroupEntity, ?> 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<ResiGroupEntity> 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<GroupDetailResultDTO> listGroupsByMember(String memberUserId, String gridId) {
return baseDao.listGroupsByMember(memberUserId, gridId);
}
}

9
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<GroupInvitationEntit
* @Description 邀请链接或扫码进组
**/
AcceptInvitationResultDTO accetInvitationV2(AccetInvitationFormDTO formDTO);
/**
* @Author sun
* @Description 将私有化推送站内信微信方法改为公共方法
**/
Result sendMessageToLeader(AccetInvitationFormDTO formDTO, ResiGroupDTO resiGroupDTO, GroupInvitationDTO groupInvitationDTO);
}

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java

@ -28,6 +28,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dto.form.*;
import com.epmet.dto.result.UserInfoOnEnterGridResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
@ -609,7 +610,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
* @Description 用户通过邀请进群之后通知群主您的好友-认证的居民名字 xxx路-王先生通过邀请链接加入了组名
* @Date 2020/4/7 14:46
**/
private Result sendMessageToLeader(AccetInvitationFormDTO formDTO, ResiGroupDTO resiGroupDTO, GroupInvitationDTO groupInvitationDTO) {
@Override
public Result sendMessageToLeader(AccetInvitationFormDTO formDTO, ResiGroupDTO resiGroupDTO, GroupInvitationDTO groupInvitationDTO) {
//1、根据用户id用户认证注册信息
UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO();
userResiInfoFormDTO.setUserId(formDTO.getUserId());
@ -635,12 +637,17 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
}
//分享链接
if(StringUtils.equals(groupInvitationDTO.getInvitationType(),"sharableLink")){
messageContent = String.format(UserMessageConstant.SHARABLELINK_JOIN_GROUP, userResiInfoDTOResult.getData().getShowName(), resiGroupDTO.getGroupName());
}
// end
userMessage.setMessageContent(messageContent);
userMessage.setReadFlag(ReadFlagConstant.UN_READ);
userMessage.setTitle(UserMessageConstant.GROUP_TITLE);
//21.09.10:记录消息类型和对应的业务id
userMessage.setMessageType(UserMessageTypeConstant.GROUP_ENTER_GROUP_BY_LINK_RES);
userMessage.setTargetId(resiGroupDTO.getId());
//通知群主
userMessage.setUserId(groupInvitationDTO.getInviterUserId());
Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessage);

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.modules.constant.UserMessageConstant;
@ -204,6 +205,10 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupL
originalLeader.setCustomerId(formDTO.getCustomerId());
originalLeader.setMessageContent(String.format(UserMessageConstant.ORIGINAL_LEADER_DOWN,resiGroupDTO.getGroupName()));
//21.09.10:记录消息类型和对应的业务id
originalLeader.setMessageType(UserMessageTypeConstant.GROUP_ORIGINAL_LEADER_DOWN);
originalLeader.setTargetId(resiGroupDTO.getId());
msgList.add(originalLeader);
}
//新组长
@ -217,6 +222,10 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupL
newLeader.setCustomerId(formDTO.getCustomerId());
newLeader.setMessageContent(String.format(UserMessageConstant.NEW_LEADER_UP,resiGroupDTO.getGroupName()));
//21.09.10:记录消息类型和对应的业务id
newLeader.setMessageType(UserMessageTypeConstant.GROUP_NEW_LEADER_UP);
newLeader.setTargetId(resiGroupDTO.getId());
msgList.add(newLeader);
if(!epmetMessageOpenFeignClient.saveUserMessageList(msgList).success()){
log.warn("转让组发送站内信失败");

18
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java

@ -22,6 +22,7 @@ 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.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
@ -31,7 +32,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.dto.IssueShareLinkRecordDTO;
@ -43,10 +43,9 @@ import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.invitation.service.GroupInvitationService;
import com.epmet.modules.member.dao.GroupMemeberOperationDao;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.entity.GroupMemeberOperationEntity;
@ -67,17 +66,16 @@ import com.epmet.resi.group.constant.MemberStateConstant;
import com.epmet.resi.group.dto.UserRoleDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO;
import com.epmet.resi.group.dto.invitation.GroupInvitationDTO;
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO;
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.form.JoinGroupByShareLinkFormDTO;
import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO;
import com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
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;
@ -120,6 +118,8 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
private TopicShareLinkVisitRecordDao topicShareLinkVisitRecordDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private GroupInvitationService groupInvitationService;
@Override
public PageData<GroupMemeberOperationDTO> page(Map<String, Object> params) {
@ -434,7 +434,11 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
groupRedis.set(groupCache);
}
//发送消息
//this.sendMessageToLeader(formDTO, resiGroupDTO,groupInvitationDTO);
AccetInvitationFormDTO formDTO = new AccetInvitationFormDTO();
formDTO.setUserId(formDTO.getUserId());
GroupInvitationDTO groupInvitationDTO = new GroupInvitationDTO();
groupInvitationDTO.setInvitationType("sharableLink");
groupInvitationService.sendMessageToLeader(formDTO, resiGroupDTO,groupInvitationDTO);
return result;
}

24
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg;
import com.epmet.commons.tools.constant.*;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.enums.AchievementTypeEnum;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -33,6 +34,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dto.IssueShareLinkVisitRecordDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.*;
@ -45,7 +47,6 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.modules.constant.GroupMemberConstant;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.commons.tools.enums.AchievementTypeEnum;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
@ -61,7 +62,6 @@ import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity;
import com.epmet.modules.topic.service.ResiTopicService;
import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService;
import com.epmet.modules.topic.service.impl.ResiTopicServiceImpl;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.constant.EnterGroupTypeConstant;
import com.epmet.resi.group.constant.LeaderFlagConstant;
@ -315,6 +315,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
userMessage.setTitle(UserMessageConstant.GROUP_TITLE);
//通知群主
userMessage.setUserId(groupLeader.getCustomerUserId());
//21.09.10:记录消息类型和对应的业务id
userMessage.setMessageType(UserMessageTypeConstant.GROUP_APPLY_ENTER);
userMessage.setTargetId(resiGroupDTO.getId());
epmetMessageOpenFeignClient.saveUserMessage(userMessage);
//微信订阅
@ -734,6 +739,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
userMessage.setMessageContent(messageContent);
userMessage.setReadFlag(ReadFlagConstant.UN_READ);
userMessage.setTitle(UserMessageConstant.GROUP_TITLE);
//21.09.10:记录消息类型和对应的业务id
userMessage.setMessageType(UserMessageTypeConstant.GROUP_APPLY_ENTER_RES);
userMessage.setTargetId(resiGroupMemberDTO.getResiGroupId());
//通知群主
userMessage.setUserId(resiGroupMemberDTO.getCustomerUserId());
epmetMessageOpenFeignClient.saveUserMessage(userMessage);
@ -819,6 +829,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
userMessage.setMessageContent(messageContent);
userMessage.setReadFlag(ReadFlagConstant.UN_READ);
userMessage.setTitle(UserMessageConstant.GROUP_TITLE);
//21.09.10:记录消息类型和对应的业务id
userMessage.setMessageType(UserMessageTypeConstant.GROUP_APPLY_ENTER_RES);
userMessage.setTargetId(groupMemeberOperationDTO.getGroupId());
//通知群主
userMessage.setUserId(groupMemeberOperationDTO.getCustomerUserId());
epmetMessageOpenFeignClient.saveUserMessage(userMessage);
@ -920,6 +935,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
String messageContent=String.format(UserMessageConstant.SLIENT_IN_GROUP, dateStr);
userMessageFormDTO.setMessageContent(messageContent);
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.GROUP_SLIENT_MEMBER);
userMessageFormDTO.setTargetId(resiGroupMemberEntity.getResiGroupId());
epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO);
//发送微信订阅
WxSubscribeMessageFormDTO subscribeMessageFormDTO = new WxSubscribeMessageFormDTO();

85
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeCommentAttachmentController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<NoticeCommentAttachmentDTO>> page(@RequestParam Map<String, Object> params){
PageData<NoticeCommentAttachmentDTO> page = noticeCommentAttachmentService.page(params);
return new Result<PageData<NoticeCommentAttachmentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<NoticeCommentAttachmentDTO> get(@PathVariable("id") String id){
NoticeCommentAttachmentDTO data = noticeCommentAttachmentService.get(id);
return new Result<NoticeCommentAttachmentDTO>().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();
}
}

43
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<NoticeCommentAttachmentEntity> {
/**
* @Author sun
* @Description 查询通知评论所有人员的附件信息
**/
List<CommentFileDTO> selectNoticeComFile(@Param("noticeId") String noticeId);
}

93
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
private String attachmentFormat;
/**
* 附件类型图片 - image 视频 - video 语音 - voice 文档 - doc
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 排序字段
*/
private Integer sort;
/**
* 语音或视频时长
*/
private Integer duration;
}

103
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<NoticeCommentAttachmentEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<NoticeCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
PageData<NoticeCommentAttachmentDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<NoticeCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
List<NoticeCommentAttachmentDTO> list(Map<String, Object> 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<CommentFileDTO> getNoticeComFile(String noticeId);
}

7
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<NoticeCommentEntity> {
* @Description 通知评论列表查询
**/
List<NoticeCommentListResultDTO> noticeCommentList(NoticeCommentListFormDTO formDTO);
/**
* @Author sun
* @Description 文字图片安全校验
**/
void safetyCheck(List<String> wordList, List<String> imageList);
}

110
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<NoticeCommentAttachmentDao, NoticeCommentAttachmentEntity> implements NoticeCommentAttachmentService {
@Override
public PageData<NoticeCommentAttachmentDTO> page(Map<String, Object> params) {
IPage<NoticeCommentAttachmentEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, NoticeCommentAttachmentDTO.class);
}
@Override
public List<NoticeCommentAttachmentDTO> list(Map<String, Object> params) {
List<NoticeCommentAttachmentEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, NoticeCommentAttachmentDTO.class);
}
private QueryWrapper<NoticeCommentAttachmentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<NoticeCommentAttachmentEntity> 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<CommentFileDTO> getNoticeComFile(String noticeId) {
return baseDao.selectNoticeComFile(noticeId);
}
}

108
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<NoticeCommentDao,
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired
private NoticeService noticeService;
@Autowired
private ResiGroupMemberService resiGroupMemberService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private NoticeCommentAttachmentService noticeCommentAttachmentService;
/**
@ -87,6 +100,9 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao,
@Override
@Transactional(rollbackFor = Exception.class)
public void noticeComment(NoticeCommentFormDTO formDTO) {
if(StringUtils.isBlank(formDTO.getCommentContent())&&CollectionUtils.isEmpty(formDTO.getImageList())){
throw new RenException("请至少填写评论内容或上传评论图片!");
}
//1.内容安全校验
String commentContent = formDTO.getCommentContent();
if (StringUtils.isNotBlank(commentContent)) {
@ -106,6 +122,11 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao,
}
}
}
//图片安全校验
if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(formDTO.getImageList())){
List<String> 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<NoticeCommentDao,
entity.setNoticeId(formDTO.getNoticeId());
entity.setCommentContent(formDTO.getCommentContent());
insert(entity);
//4.保存通知评论附件数据
List<NoticeCommentAttachmentEntity> 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<NoticeCommentDao,
}
List<UserBaseInfoResultDTO> resultDTOList = result.getData();
//3.封装数据并返回
//3.查询通知评论所有人员的附件信息
List<CommentFileDTO> 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<NoticeCommentDao,
}
});
l.setCommentUserName(name.toString());
//每一条评论的附件信息
List<CommentFileDTO> 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<String> wordList, List<String> 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<SyncScanResult> 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<SyncScanResult> 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());
}
}
}
}

17
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<NoticeDao, NoticeEntity>
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<NoticeDao, NoticeEntity>
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<NoticeDao, NoticeEntity>
* @Description 文字图片安全校验
**/
private void safetyCheck(List<String> wordList, List<String> imageList) {
if (imageList.size() != NumConstant.ZERO) {
if (wordList.size() != NumConstant.ZERO) {
wordList.forEach(word -> {
//创建话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();

85
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<ResiTopicCommentAttachmentDTO>> page(@RequestParam Map<String, Object> params){
PageData<ResiTopicCommentAttachmentDTO> page = resiTopicCommentAttachmentService.page(params);
return new Result<PageData<ResiTopicCommentAttachmentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ResiTopicCommentAttachmentDTO> get(@PathVariable("id") String id){
ResiTopicCommentAttachmentDTO data = resiTopicCommentAttachmentService.get(id);
return new Result<ResiTopicCommentAttachmentDTO>().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();
}
}

43
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiTopicCommentAttachmentEntity> {
/**
* @Author sun
* @Description 查询通知评论所有人员的附件信息
**/
List<CommentFileDTO> selectTopicComFile(@Param("topicId") String topicId);
}

93
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
/**
* 文件格式JPGPNGPDFJPEGBMPMP4WMAM4AMP3DOCDOCXXLS
*/
private String attachmentFormat;
/**
* 附件类型图片 - image 视频 - video 语音 - voice 文档 - doc
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 排序字段
*/
private Integer sort;
/**
* 语音或视频时长
*/
private Integer duration;
}

102
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiTopicCommentAttachmentEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiTopicCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
PageData<ResiTopicCommentAttachmentDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiTopicCommentAttachmentDTO>
* @author generator
* @date 2021-09-06
*/
List<ResiTopicCommentAttachmentDTO> list(Map<String, Object> 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<CommentFileDTO> getTopicComFile(String topicId);
}

110
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiTopicCommentAttachmentDao, ResiTopicCommentAttachmentEntity> implements ResiTopicCommentAttachmentService {
@Override
public PageData<ResiTopicCommentAttachmentDTO> page(Map<String, Object> params) {
IPage<ResiTopicCommentAttachmentEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiTopicCommentAttachmentDTO.class);
}
@Override
public List<ResiTopicCommentAttachmentDTO> list(Map<String, Object> params) {
List<ResiTopicCommentAttachmentEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiTopicCommentAttachmentDTO.class);
}
private QueryWrapper<ResiTopicCommentAttachmentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiTopicCommentAttachmentEntity> 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<CommentFileDTO> getTopicComFile(String topicId) {
return baseDao.selectTopicComFile(topicId);
}
}

73
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<ResiTopicCommen
@Autowired
ResiTopicService resiTopicService;
@Autowired
ResiGroupMemberService resiGroupMemberService;
@Autowired
EpmetUserFeignClient epmetUserFeignClient;
@Autowired
ResiGroupMemberRedis resiGroupMemberRedis;
@Autowired
ResiGroupRedis groupRedis;
@Autowired
ResiGroupMemberDao resiGroupMemberDao;
@Autowired
ResiTopicDao resiTopicdDao;
@Autowired
LoginUserUtil loginUserUtil;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
ResiGroupDao resiGroupDao;
@Autowired
private NoticeCommentService noticeCommentService;
@Autowired
private ResiTopicCommentAttachmentService resiTopicCommentAttachmentService;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -196,6 +198,9 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Override
@Transactional(rollbackFor = Exception.class)
public Result commentTopic(TokenDto tokenDto, ResiPublishCommentFormDTO resiCommentFormDTO) {
if(StringUtils.isBlank(resiCommentFormDTO.getCommentContent())&&CollectionUtils.isEmpty(resiCommentFormDTO.getImageList())){
throw new RenException("请至少填写评论内容或上传评论图片!");
}
String commentContent = resiCommentFormDTO.getCommentContent();
if (StringUtils.isNotBlank(commentContent)) {
//评论话题内容审核
@ -214,6 +219,12 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
}
}
}
//图片安全校验
if(CollectionUtils.isNotEmpty(resiCommentFormDTO.getImageList())){
List<String> 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<ResiTopicCommen
}
}
//保存话题评论附件数据
List<ResiTopicCommentAttachmentEntity> 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<ResiTopicCommen
});
}
//查询话题评论所有人员的附件信息
List<CommentFileDTO> fileList = resiTopicCommentAttachmentService.getTopicComFile(commentFormDTO.getTopicId());
//封装数据并返回
comments.forEach(l -> {
//每一条评论的附件信息
List<CommentFileDTO> 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<List<ResiCommentResultDTO>>().ok(comments);

65
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='通知评论附件表';

26
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentAttachmentDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.act.dao.ActCommentAttachmentDao">
<select id="selectActComFile" resultType="com.epmet.resi.group.dto.group.result.CommentFileDTO">
SELECT
file_name name,
attachment_size size,
attachment_format format,
attachment_type type,
attachment_url url,
sort sort,
duration duration,
act_comment_id commentId,
created_by userId
FROM
act_comment_attachment
WHERE
del_flag = '0'
AND group_act_id = #{groupActId}
ORDER BY
created_by, sort ASC
</select>
</mapper>

34
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
</select>
<select id="listGroupsByMember" resultType="com.epmet.resi.group.dto.group.result.GroupDetailResultDTO">
select resi_group.ID as groupId,
resi_group.GRID_ID,
resi_group.GROUP_HEAD_PHOTO,
resi_group.GROUP_NAME,
resi_group.GROUP_INTRODUCTION,
resi_group.GROUP_TYPE,
resi_group.CUSTOMER_ID,
resi_group_member.GROUP_LEADER_FLAG,
g_leader.CUSTOMER_USER_ID leaderId
from resi_group
inner join resi_group_member
on (resi_group.ID = resi_group_member.RESI_GROUP_ID and resi_group_member.DEL_FLAG = 0)
inner join resi_group_member g_leader on (g_leader.DEL_FLAG = 0 and g_leader.RESI_GROUP_ID = resi_group.ID and
g_leader.GROUP_LEADER_FLAG = 'leader')
where resi_group_member.CUSTOMER_USER_ID = #{memberUserId}
and resi_group.DEL_FLAG = 0
<if test="gridId != null and gridId.trim() != ''">
and resi_group.GRID_ID=#{gridId}
</if>
and resi_group.STATE = 'approved'
order by resi_group.CREATED_TIME desc
</select>
</mapper>

26
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentAttachmentDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.notice.dao.NoticeCommentAttachmentDao">
<select id="selectNoticeComFile" resultType="com.epmet.resi.group.dto.group.result.CommentFileDTO">
SELECT
file_name name,
attachment_size size,
attachment_format format,
attachment_type type,
attachment_url url,
sort sort,
duration duration,
notice_comment_id commentId,
created_by userId
FROM
notice_comment_attachment
WHERE
del_flag = '0'
AND notice_id = #{noticeId}
ORDER BY
created_by, sort ASC<!-- 同一个人各类型文件靠在一起,按sort升序 -->
</select>
</mapper>

26
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentAttachmentDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.topic.dao.ResiTopicCommentAttachmentDao">
<select id="selectTopicComFile" resultType="com.epmet.resi.group.dto.group.result.CommentFileDTO">
SELECT
file_name name,
attachment_size size,
attachment_format format,
attachment_type type,
attachment_url url,
sort sort,
duration duration,
topic_comment_id commentId,
created_by userId
FROM
resi_topic_comment_attachment
WHERE
del_flag = '0'
AND topic_id = #{topicId}
ORDER BY
created_by, sort ASC
</select>
</mapper>

5
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;
}

15
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);

17
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<ResiWarmhea
}
formDTO.setMessageText(messageContent);
//1:将申请记录存入热心居民申请表中
saveResiWarmApply(formDTO);
String applyId=saveResiWarmApply(formDTO);
formDTO.setApplyId(applyId);
//2:将最后一次操作行为更新到热心居民申请行为记录表中
resiWarmheartedVisitService.updateResiWarmVisit(formDTO);
//3:添加消息信息,给网格长发消息
@ -234,7 +236,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
* @param formDTO
* @return
*/
public void saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) {
public String saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) {
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setGridId(formDTO.getGridId());
@ -245,6 +247,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
entity.setReadFlag(ResiWarmheartedVisitConstant.UN_READ);
entity.setMessageText(formDTO.getMessageText());
baseDao.insert(entity);
return entity.getId();
}
/**
* 热心居民申请像网格长发送消息
@ -289,6 +292,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
}
msgDTO.setMessageContent(formDTO.getMessageText());
msgDTO.setReadFlag(ReadFlagConstant.UN_READ);
//21.09.10:记录消息类型和对应的业务id
msgDTO.setMessageType(UserMessageTypeConstant.WARMHEARTED_APPLY);
msgDTO.setTargetId(formDTO.getApplyId());
msgList.add(msgDTO);
//微信订阅
WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO();
@ -466,6 +474,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
userMessageFormDTO.setGridId(formDTO.getGridId());
userMessageFormDTO.setUserId(formDTO.getUserId());
userMessageFormDTO.setApp(AppClientConstant.APP_RESI);
//21.09.10:记录消息类型和对应的业务id
userMessageFormDTO.setMessageType(UserMessageTypeConstant.WARMHEARTED_APPLY_RES);
userMessageFormDTO.setTargetId(formDTO.getId());
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) {
userMessageFormDTO.setTitle("您有一条组长申请消息");
} else {

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java

@ -65,7 +65,7 @@ public interface UserBadgeDao {
* @author zxc
* @date 2020/11/4 2:13 下午
*/
void insertUserBadgeCertificateRecord(UserBadgeCertificateRecordDTO userBadgeCertificateRecordDTO);
int insertUserBadgeCertificateRecord(UserBadgeCertificateRecordDTO userBadgeCertificateRecordDTO);
/**
* @Description 更新认证徽章记录最新

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dao.*;
import com.epmet.dto.ResiUserBadgeDTO;
import com.epmet.dto.UserBadgeCertificateRecordDTO;
@ -53,8 +54,6 @@ public class UserBadgeServiceImpl implements UserBadgeService {
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient messageFeignClient;
@Autowired
private UserRoleDao userRoleDao;
@Autowired
private ResiUserBadgeDao resiUserBadgeDao;
@ -278,11 +277,13 @@ public class UserBadgeServiceImpl implements UserBadgeService {
form.setSurname(certificationAddFormDTO.getSurname());
log.info(JSON.toJSONString(form));
userBadgeDao.insertUserBadgeCertificateRecord(form);
//TODO 站内信发送
String badgeName = badgeDao.selectBadgeName(form.getCustomerId(), form.getBadgeId());
String msg = String.format(BadgeConstant.MESSAGE_CONTENT, userBaseInfoResultDTOS.get(NumConstant.ZERO).getDistrict().concat(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRealName()), badgeName);
sendMessage(BadgeConstant.AUTH_TITLE,msg,form.getGridId(),form.getUserId(),form.getCustomerId());
// 记录待审核id,和消息类型
sendMessage(BadgeConstant.AUTH_TITLE,msg,form.getGridId(),form.getUserId(),form.getCustomerId(),
UserMessageTypeConstant.BADGE_AUTH_APPLY,
form.getId());
return new Result();
}
@ -443,7 +444,7 @@ public class UserBadgeServiceImpl implements UserBadgeService {
* @author zxc
* @date 2020/11/19 上午9:16
*/
public void sendMessage(String title,String msg,String gridId,String userId,String customerId){
public void sendMessage(String title,String msg,String gridId,String userId,String customerId,String messageType,String userBadgeCertificateRecordId){
//1.查询加入当前网格下的人员 customer_staff_grid
CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO();
commonGridIdFormDTO.setGridId(gridId);
@ -474,6 +475,11 @@ public class UserBadgeServiceImpl implements UserBadgeService {
msgObj.setReadFlag(ReadFlagConstant.UN_READ);
msgObj.setTitle(title);
msgObj.setUserId(to);
//21.09.10:记录消息类型和对应的业务id
msgObj.setMessageType(messageType);
msgObj.setTargetId(userBadgeCertificateRecordId);
msgList.add(msgObj);
//微信订阅
WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO();

7
epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

@ -170,7 +170,10 @@
</select>
<!-- 徽章审核记录表插入 -->
<insert id="insertUserBadgeCertificateRecord">
<insert id="insertUserBadgeCertificateRecord" useGeneratedKeys="true" keyColumn="ID" keyProperty="id" parameterType="com.epmet.dto.UserBadgeCertificateRecordDTO">
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
select replace(uuid(),'-','') AS ID
</selectKey>
INSERT INTO user_badge_certificate_record (
ID,
CUSTOMER_ID,
@ -197,7 +200,7 @@
)
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{id},
#{customerId},
#{gridId},
#{userId},

Loading…
Cancel
Save