Commit ba6b4927 authored by 胡定国's avatar 胡定国

Merge branch 'v2.2.10' of 47.100.44.39:tp-backend/tanpu-community into v2.2.10

parents 22baff5b 81ba524f
...@@ -96,7 +96,7 @@ public class RankService { ...@@ -96,7 +96,7 @@ public class RankService {
LocalDateTime start = LocalDateTime.now(); LocalDateTime start = LocalDateTime.now();
//7天内所有主题进行热度值排序 //7天内所有主题进行热度值排序
List<ThemeEntity> themeEntities = themeService.queryRecentdays(30); List<ThemeEntity> themeEntities = themeService.queryRecentdays(60);
if (CollectionUtils.isEmpty(themeEntities)) { if (CollectionUtils.isEmpty(themeEntities)) {
return; return;
} }
......
...@@ -87,8 +87,9 @@ public class ThemeService { ...@@ -87,8 +87,9 @@ public class ThemeService {
//根据id返回主题详情(未删) //根据id返回主题详情(未删)
public ThemeEntity queryByThemeIdIgnoreDelete(String themeId) { public ThemeEntity queryByThemeIdIgnoreDelete(String themeId) {
return themeMapper.selectOne(new LambdaQueryWrapper<ThemeEntity>() ThemeEntity themeEntity = themeMapper.selectOne(new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getThemeId, themeId)); .eq(ThemeEntity::getThemeId, themeId));
return themeEntity;
} }
//根据用户id查询主题list //根据用户id查询主题list
...@@ -141,7 +142,8 @@ public class ThemeService { ...@@ -141,7 +142,8 @@ public class ThemeService {
.in(ThemeEntity::getThemeId, themeIds) .in(ThemeEntity::getThemeId, themeIds)
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()); .eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper); List<ThemeEntity> themeEntities = themeMapper.selectList(queryWrapper);
return themeEntities;
} }
......
...@@ -47,7 +47,8 @@ public class ConvertUtil { ...@@ -47,7 +47,8 @@ public class ConvertUtil {
themeQO.setCreateTime(TimeUtils.getTimestampOfDateTime(themeEntity.getCreateTime())); themeQO.setCreateTime(TimeUtils.getTimestampOfDateTime(themeEntity.getCreateTime()));
themeQO.setUpToNowTime(TimeUtils.calUpToNowTime(themeEntity.getCreateTime())); themeQO.setUpToNowTime(TimeUtils.calUpToNowTime(themeEntity.getCreateTime()));
themeQO.setFormatTime(TimeUtils.format(themeEntity.getCreateTime())); themeQO.setFormatTime(TimeUtils.format(themeEntity.getCreateTime()));
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() { // 屏蔽手机号和邮箱
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(OtherUtil.blockPhoneAndEmail(themeEntity.getContent()), new TypeReference<List<ThemeContentQo>>() {
}); });
themeQO.setContent(themeContentQos); themeQO.setContent(themeContentQos);
return themeQO; return themeQO;
...@@ -279,13 +280,13 @@ public class ConvertUtil { ...@@ -279,13 +280,13 @@ public class ConvertUtil {
themeNotifyQo.setFormerThemeId(entity.getTargetId()); themeNotifyQo.setFormerThemeId(entity.getTargetId());
themeNotifyQo.setFormerUserName(entity.getNotifiedUserId()); themeNotifyQo.setFormerUserName(entity.getNotifiedUserId());
if (!StringUtils.isEmpty(entity.getContent())) { if (!StringUtils.isEmpty(entity.getContent())) {
try{ try {
NotificationForwardDO forwardDO = JsonUtil.toBean(entity.getContent(), NotificationForwardDO.class); NotificationForwardDO forwardDO = JsonUtil.toBean(entity.getContent(), NotificationForwardDO.class);
themeNotifyQo.setContent(forwardDO.getContent()); themeNotifyQo.setContent(forwardDO.getContent());
themeNotifyQo.setTopicId(forwardDO.getTopicId()); themeNotifyQo.setTopicId(forwardDO.getTopicId());
themeNotifyQo.setForwardThemeId(forwardDO.getThemeId()); themeNotifyQo.setForwardThemeId(forwardDO.getThemeId());
}catch (Exception e){ } catch (Exception e) {
throw new BizException("消息通知-转发类型-反序列化异常:"+ entity.getContent()); throw new BizException("消息通知-转发类型-反序列化异常:" + entity.getContent());
} }
} }
} }
...@@ -298,10 +299,10 @@ public class ConvertUtil { ...@@ -298,10 +299,10 @@ public class ConvertUtil {
NotificationLikeDO notificationLikeDO = JsonUtil.toBean(entity.getContent(), NotificationLikeDO.class); NotificationLikeDO notificationLikeDO = JsonUtil.toBean(entity.getContent(), NotificationLikeDO.class);
themeNotifyQo.setLikeUserCount(notificationLikeDO.getCount()); themeNotifyQo.setLikeUserCount(notificationLikeDO.getCount());
ArrayList<UserBriefInfoQO> likeUsers = new ArrayList<>(); ArrayList<UserBriefInfoQO> likeUsers = new ArrayList<>();
notificationLikeDO.getSet().stream().forEach(o->likeUsers.add(UserBriefInfoQO.builder().userId(o).build())); notificationLikeDO.getSet().stream().forEach(o -> likeUsers.add(UserBriefInfoQO.builder().userId(o).build()));
themeNotifyQo.setLikeUsers(likeUsers); themeNotifyQo.setLikeUsers(likeUsers);
}catch (Exception e){ } catch (Exception e) {
throw new BizException("消息通知-点赞类型-反序列化异常:"+ entity.getContent()); throw new BizException("消息通知-点赞类型-反序列化异常:" + entity.getContent());
} }
} }
} }
......
package com.tanpu.community.util;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
public class OtherUtil {
private final static String numberPattern = "^[0-9]*[1-9][0-9]*$";
private final static String phonePattern = "(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}";
private final static String emailPattern = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.com";
public static String getRequestUrl(HttpServletRequest request) {
String s = request.getRequestURL().toString();
String querystr = request.getQueryString();
if (StringUtils.isNotEmpty(querystr)) {
s = s + "?" + querystr;
}
return s;
}
public static String blockPhoneAndEmail(String line) {
// 屏蔽手机号
line = line.replaceAll(phonePattern,"**********");
// 屏蔽邮箱
line = line.replaceAll(emailPattern,"*@*.com");
return line;
}
/**
* 脱敏手机号
*
* @param mobile
* @return
*/
public static String formatMobile(String mobile) {
if (StringUtils.isNotBlank(mobile)) {
mobile = mobile.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
}
return mobile;
}
public static void main(String[] args) {
System.out.println(OtherUtil.blockPhoneAndEmail("我的手机号是18621088081!,邮箱是123@qq.com。"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment