Browse Source

发送积分的文案拼接 积分规则脚本修改

dev_shibei_match
wangchao 5 years ago
parent
commit
a25380dc1e
  1. 4
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql
  2. 17
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  3. 90
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  4. 35
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java

4
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql

@ -23,13 +23,13 @@ INSERT INTO point_rule_default (
VALUES VALUES
( (
'3','发布话题', '3','发布话题',
'对小组内话题进行15字以上评论','publish_one_topic', '楼院小组内通过我有话说功能发布话题','publish_one_topic',
'1','plus', '1','plus',
15,'每天上限为15分',null,'day',5,'time','0','0',0,'APP_USER',now(),'APP_USER',now() 15,'每天上限为15分',null,'day',5,'time','0','0',0,'APP_USER',now(),'APP_USER',now()
), ),
( (
'4','参与话题', '4','参与话题',
'楼院小组内通过我有话说功能发布话题','participate_one_topic', '对小组内话题进行15字以上评论','participate_one_topic',
'1','plus', '1','plus',
6,'每天上限为6分',null,'day',2,'time','0','0',0,'APP_USER',now(),'APP_USER',now() 6,'每天上限为6分',null,'day',2,'time','0','0',0,'APP_USER',now(),'APP_USER',now()
), ),

17
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java

@ -43,6 +43,7 @@ import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.comment.entity.ResiTopicCommentEntity; import com.epmet.modules.comment.entity.ResiTopicCommentEntity;
import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.constant.ResiGroupRedisKeys;
import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.redis.ResiGroupMemberRedis;
import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.ResiGroupMemberService;
@ -97,6 +98,9 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Autowired @Autowired
ResiGroupMemberRedis resiGroupMemberRedis; ResiGroupMemberRedis resiGroupMemberRedis;
@Autowired
ResiGroupRedis groupRedis;
@Autowired @Autowired
ResiGroupMemberDao resiGroupMemberDao; ResiGroupMemberDao resiGroupMemberDao;
@ -229,7 +233,7 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
// 话题评论前3次,加积分【对小组内话题进行15字以上评论】 // 话题评论前3次,加积分【对小组内话题进行15字以上评论】
Integer commentCount = baseDao.selectCommentCountByUserId(tokenDto.getUserId()); Integer commentCount = baseDao.selectCommentCountByUserId(tokenDto.getUserId());
if (null != commentCount && commentCount <= NumConstant.THREE){ if (null == commentCount || commentCount <= NumConstant.THREE){
if (StringUtils.isNotBlank(commentContent) && commentContent.length() > NumConstant.FIFTEEN){ if (StringUtils.isNotBlank(commentContent) && commentContent.length() > NumConstant.FIFTEEN){
//mq的事件类型 //mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
@ -248,6 +252,17 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
pointEventMsg.setActionFlag(MqConstant.PLUS); pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false); pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag()); pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag());
//某某小组中评论话题“某某某…”
StringBuilder builder = new StringBuilder(groupRedis.get(topic.getGroupId()).getGroupName()).append("小组中评论");
if(StringUtils.isNotBlank(topic.getTopicContent())){
builder.append("\"");
builder.append(
topic.getTopicContent().length() > NumConstant.TEN ?
(topic.getTopicContent().substring(NumConstant.TEN) + "…") :
topic.getTopicContent());
builder.append("\"");
}
pointEventMsg.setRemark(builder.toString());
pointEventMsgList.add(pointEventMsg); pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));

90
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -1580,42 +1580,55 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
} }
//发送积分 //发送积分
ResiTopicEntity topic = baseDao.selectById(topicTurnIssueFromDTO.getTopicId());
//mq的事件类型 //mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group"); mqBaseMsgDTO.setEventClass("resi_group");
//事件code //事件code 因为楼院小组的事件回调统一入口,外层的EventTag不能够判断具体的事件
//因为可能会一次发送多个事件集合,需要对集合里的对象逐个判断
mqBaseMsgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); mqBaseMsgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag());
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>(); List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
//1.话题被转为议题 组内成员 //1.话题被转为议题 组内成员
group.getTopicAuthorId();
BasePointEventMsg pointEventMsg = new BasePointEventMsg(); BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(groupCache.getCustomerId()); pointEventMsg.setCustomerId(groupCache.getCustomerId());
//pointEventMsg.setUserId(inviter); pointEventMsg.setUserId(group.getTopicAuthorId());
pointEventMsg.setActionFlag(MqConstant.PLUS); pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false); pointEventMsg.setIsCommon(false);
//pointEventMsg.setTargetDate(groupMemeberOperationDTO.getCreatedTime());
pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventTag());
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的")
.append(
StringUtils.isBlank(topic.getTopicContent()) ? "语音话题" :
"\"" +
topic.getTopicContent()
.substring(topic.getTopicContent().length() < NumConstant.TEN ? topic.getTopicContent().length() : NumConstant.TEN)
+ (NumConstant.TEN > topic.getTopicContent().length() ? "\"" : "…\"")
).append("被转为议题").toString());
pointEventMsgList.add(pointEventMsg); pointEventMsgList.add(pointEventMsg);
//2.转话题为议题 组长 //2.转话题为议题 组长
topicTurnIssueFromDTO.getUserId();
pointEventMsg.setCustomerId(groupCache.getCustomerId()); pointEventMsg.setCustomerId(groupCache.getCustomerId());
//pointEventMsg.setUserId(inviter); pointEventMsg.setUserId(topicTurnIssueFromDTO.getUserId());
pointEventMsg.setActionFlag(MqConstant.PLUS); pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false); pointEventMsg.setIsCommon(false);
//pointEventMsg.setTargetDate(groupMemeberOperationDTO.getCreatedTime());
pointEventMsg.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); pointEventMsg.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag());
//将话题“某某某…” (前十个字后面省略号) 转为议题
pointEventMsg.setRemark(new StringBuilder("将话题")
.append(
"\"" +
topic.getTopicContent()
.substring(topic.getTopicContent().length() < NumConstant.TEN ? topic.getTopicContent().length() : NumConstant.TEN)
+ (NumConstant.TEN > topic.getTopicContent().length() ? "\"" : "…\"")
).append("转为议题").toString());
pointEventMsgList.add(pointEventMsg); pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){ if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){
log.error("事件发送失败,参数:{}",JSON.toJSONString(topicTurnIssueFromDTO)); log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(topicTurnIssueFromDTO));
} }
} }
else { else {
@ -1699,6 +1712,59 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
); );
resiGroupRedis.set(groupCache); resiGroupRedis.set(groupCache);
} }
//发送积分
//mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group");
//事件code 因为楼院小组的事件回调统一入口,外层的EventTag不能够判断具体的事件
//因为可能会一次发送多个事件集合,需要对集合里的对象逐个判断
mqBaseMsgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag());
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
//1.话题被转为议题 组内成员
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(groupCache.getCustomerId());
pointEventMsg.setUserId(group.getTopicAuthorId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的")
.append(
StringUtils.isBlank(topic.getTopicContent()) ? "语音话题" :
"\"" +
topic.getTopicContent()
.substring(topic.getTopicContent().length() < NumConstant.TEN ? topic.getTopicContent().length() : NumConstant.TEN)
+ (NumConstant.TEN > topic.getTopicContent().length() ? "\"" : "…\"")
).append("被转为议题").toString());
pointEventMsgList.add(pointEventMsg);
//2.转话题为议题 组长
pointEventMsg.setCustomerId(groupCache.getCustomerId());
pointEventMsg.setUserId(param.getUserId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag());
//将话题“某某某…” (前十个字后面省略号) 转为议题
pointEventMsg.setRemark(new StringBuilder("将话题")
.append(
"\"" +
topic.getTopicContent()
.substring(topic.getTopicContent().length() < NumConstant.TEN ? topic.getTopicContent().length() : NumConstant.TEN)
+ (NumConstant.TEN > topic.getTopicContent().length() ? "\"" : "…\"")
).append("转为议题").toString());
pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){
log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param));
}
} }
return issueInfo; return issueInfo;
} }

35
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java

@ -638,8 +638,15 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED));
topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class));
} }
//发送积分 //发送积分
sendMqMsg(draft.getCreatedBy(), draft.getCustomerId()); StringBuilder breviary = new StringBuilder();
if(!StringUtils.isBlank(draft.getTopicContent())){
breviary.append("\"");
breviary.append(draft.getTopicContent().length() > NumConstant.TEN ? (draft.getTopicContent().substring(NumConstant.TEN) + "…") : draft.getTopicContent());
breviary.append("\"");
}else breviary.append("语音话题");
sendMqMsg(draft.getCreatedBy(), draft.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString());
} }
//记录操作记录 //记录操作记录
entity = baseDao.selectById(formDTO.getTopicDraftId()); entity = baseDao.selectById(formDTO.getTopicDraftId());
@ -750,11 +757,30 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
draftEntity.setId(draftId); draftEntity.setId(draftId);
draftEntity.setTopicId(topic.getId()); draftEntity.setTopicId(topic.getId());
baseDao.updateById(draftEntity); baseDao.updateById(draftEntity);
sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId());
TopicDraftEntity draft = baseDao.selectById(draftId);
StringBuilder breviary = new StringBuilder();
if(!StringUtils.isBlank(draft.getTopicContent())){
breviary.append("\"");
breviary.append(draft.getTopicContent().length() > NumConstant.TEN ? (draft.getTopicContent().substring(NumConstant.TEN) + "…") : draft.getTopicContent());
breviary.append("\"");
}else breviary.append("语音话题");
sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString());
} }
private void sendMqMsg(String userId, String customerId) { /**
* @Description 发送积分事件
* @param userId
* @param customerId
* @param targetDate 可为空
* @param groupName
* @param topicBreviary 话题内容摘要"内容…" 如果没有文字则是"语音话题"
* @return void
* @author wangc
* @date 2020.12.25 15:45
*/
private void sendMqMsg(String userId, String customerId, Date targetDate, String groupName, String topicBreviary) {
//6.发送积分 //6.发送积分
MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO();
//mq的事件类型 //mq的事件类型
@ -767,6 +793,8 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
actPointEventMsg.setUserId(userId); actPointEventMsg.setUserId(userId);
actPointEventMsg.setActionFlag(MqConstant.PLUS); actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false); actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(new StringBuilder(groupName).append("小组中发布话题").append(topicBreviary).toString());
actPointEventMsg.setTargetDate(targetDate);
actPointEventMsgList.add(actPointEventMsg); actPointEventMsgList.add(actPointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList));
@ -840,5 +868,4 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
} }
} }
} }
Loading…
Cancel
Save