diff --git a/deploy.bat b/deploy.bat
new file mode 100644
index 0000000..c4025e2
--- /dev/null
+++ b/deploy.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: 1. 运行 Maven 打包
+echo Running mvn clean package...
+:: call mvn clean package -P thin-jar
+call mvn clean package
+
+:: 检查是否打包成功
+IF %ERRORLEVEL% NEQ 0 (
+ echo Maven build failed, exiting...
+ exit /b %ERRORLEVEL%
+)
+
+:: 2. 将 JAR 包传输到 Linux 服务器
+echo Copying JAR file to Linux server...
+call scp target\AdvisorServer-2.6.7.jar root@8.138.144.54:/root
+
+:: 检查 SCP 命令是否成功
+IF %ERRORLEVEL% NEQ 0 (
+ echo File transfer failed, exiting...
+ exit /b %ERRORLEVEL%
+)
+
+:: 3. 通过 SSH 运行 start.sh 脚本
+echo Running start.sh script on Linux server...
+call ssh root@8.138.144.54 'bash /root/start.sh'
+
+:: 检查 SSH 命令是否成功
+IF %ERRORLEVEL% NEQ 0 (
+ echo Failed to start the application, exiting...
+ exit /b %ERRORLEVEL%
+)
+
+echo Deployment successful!
diff --git a/pom.xml b/pom.xml
index c8a0eba..f9dfed4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -185,4 +185,27 @@
+
+
+ thin-jar
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ com.upchina.startup.Main
+ ZIP
+
+
+ nothing
+ nothing
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/upchina/common/config/cache/CacheKey.java b/src/main/java/com/upchina/common/config/cache/CacheKey.java
index a05fe2a..7a0be3c 100644
--- a/src/main/java/com/upchina/common/config/cache/CacheKey.java
+++ b/src/main/java/com/upchina/common/config/cache/CacheKey.java
@@ -324,6 +324,7 @@ public class CacheKey {
public static final String COMMENT_BLACK = "comment_black";
public static class CommentBlackKey {
+ public static final String ALL_BLACK_COMMENT = "all_black_comment";
public static final String ALL_BLACK_USER = "all_black_user";
}
diff --git a/src/main/java/com/upchina/common/constant/CommentBlackScope.java b/src/main/java/com/upchina/common/constant/CommentBlackScope.java
new file mode 100644
index 0000000..d7d6417
--- /dev/null
+++ b/src/main/java/com/upchina/common/constant/CommentBlackScope.java
@@ -0,0 +1,28 @@
+package com.upchina.common.constant;
+
+// 范围类型 1产品 2产品类型 3全局
+public enum CommentBlackScope {
+
+ PRODUCT(1, "产品"),
+ PRODUCT_TYPE(2, "产品类型"),
+ GLOBAL(3, "全局"),
+ ;
+
+ public final Integer value;
+
+ public final String name;
+
+ CommentBlackScope(Integer value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
diff --git a/src/main/java/com/upchina/common/controller/CommentBlackController.java b/src/main/java/com/upchina/common/controller/CommentBlackController.java
index 6adb843..6484b94 100644
--- a/src/main/java/com/upchina/common/controller/CommentBlackController.java
+++ b/src/main/java/com/upchina/common/controller/CommentBlackController.java
@@ -2,6 +2,7 @@ package com.upchina.common.controller;
import com.upchina.common.query.AddCommentBlackQuery;
import com.upchina.common.query.CommentBlackQuery;
+import com.upchina.common.query.RemoveCommentBlackQuery;
import com.upchina.common.result.CommonResult;
import com.upchina.common.result.Pager;
import com.upchina.common.service.CommentBlackService;
@@ -27,18 +28,20 @@ public class CommentBlackController {
@ApiOperation("添加用户禁言")
@PostMapping("/admin/comment/addCommentBlack")
public CommonResult addCommentBlack(@RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO,
- @Validated @RequestBody AddCommentBlackQuery addCommentBlackQuery) {
- Integer id = commentBlackService.addCommentBlack(backendUserVO, addCommentBlackQuery);
+ @Validated @RequestBody AddCommentBlackQuery query) {
+ Integer id = commentBlackService.addCommentBlack(backendUserVO, query);
return CommonResult.success(id);
}
@ApiOperation("解除用户禁言")
@GetMapping("/admin/comment/removeCommentBlack")
- public CommonResult removeCommentBlack(@NotNull @ApiParam(value = "用户手机号") @RequestParam("phone") String phone) {
- commentBlackService.removeCommentBlack(phone);
+ public CommonResult removeCommentBlack(@RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO,
+ @Validated @RequestBody RemoveCommentBlackQuery query) {
+ commentBlackService.removeCommentBlack(backendUserVO, query);
return CommonResult.success();
}
+
@ApiOperation("中台查询禁言列表")
@PostMapping("/admin/comment/queryCommentBlackList")
public CommonResult> queryCommentBlackList(@RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO,
diff --git a/src/main/java/com/upchina/common/entity/CommentBlack.java b/src/main/java/com/upchina/common/entity/CommentBlack.java
index 01b6f66..e14747e 100644
--- a/src/main/java/com/upchina/common/entity/CommentBlack.java
+++ b/src/main/java/com/upchina/common/entity/CommentBlack.java
@@ -63,10 +63,15 @@ public class CommentBlack implements Serializable {
private String attachment;
/**
- * 禁言类型:0次日解禁 1一个月之后解禁 2永久禁言
+ * 时间类型:0次日解禁 1一个月之后解禁 2永久禁言
*/
private Integer type;
+ /**
+ * 范围类型 1产品 2产品类型 3全局
+ */
+ private Integer scope;
+
/**
* 禁言开始时间
*/
@@ -174,6 +179,14 @@ public class CommentBlack implements Serializable {
this.type = type;
}
+ public Integer getScope() {
+ return scope;
+ }
+
+ public void setScope(Integer scope) {
+ this.scope = scope;
+ }
+
public LocalDateTime getStartTime() {
return startTime;
}
diff --git a/src/main/java/com/upchina/common/interceptor/WebSocketAuthHandler.java b/src/main/java/com/upchina/common/interceptor/WebSocketAuthHandler.java
index d0541b9..827188b 100644
--- a/src/main/java/com/upchina/common/interceptor/WebSocketAuthHandler.java
+++ b/src/main/java/com/upchina/common/interceptor/WebSocketAuthHandler.java
@@ -27,40 +27,30 @@ public class WebSocketAuthHandler {
private Set VALID_PRODUCT_TYPES = ImmutableSet.of(ProductType.VIDEO_SINGLE.value, ProductType.GROUP.value);
public Message> handleConnect(Message> message, StompHeaderAccessor header) {
- validateHeaders(header);
Map attributes = header.getSessionAttributes();
-
+ if (attributes == null) {
+ throw new BizException(ResponseStatus.PARM_ERROR, "header里没有包含attributes");
+ }
String userId = authenticateUser(header);
if (userId == null) {
throw new BizException(ResponseStatus.SESSION_EXPIRY);
}
-
String sessionId = header.getFirstNativeHeader("sessionId");
+ if (StrUtil.isEmpty(sessionId)) {
+ throw new BizException(ResponseStatus.PARM_ERROR, "sessionId错误" + sessionId);
+ }
Integer productType = getInteger(header, "productType");
if (productType == null || !VALID_PRODUCT_TYPES.contains(productType)) {
throw new BizException(ResponseStatus.PARM_ERROR, "产品类型错误" + productType);
}
Integer productId = getInteger(header, "productId");
+ if (productId == null) {
+ throw new BizException(ResponseStatus.PARM_ERROR, "产品ID错误" + productId);
+ }
populateAttributes(attributes, userId, sessionId, productType, productId);
return message;
}
- private void validateHeaders(StompHeaderAccessor header) {
- String sessionId = header.getFirstNativeHeader("sessionId");
- if (StrUtil.isEmpty(sessionId)) {
- throw new BizException(ResponseStatus.PARM_ERROR, "header里没有包含sessionId");
- }
-
- String groupId = header.getFirstNativeHeader("GroupId");
- if (StrUtil.isEmpty(groupId)) {
- throw new BizException(ResponseStatus.PARM_ERROR, "header里没有包含videoId");
- }
-
- if (header.getSessionAttributes() == null) {
- throw new BizException(ResponseStatus.PARM_ERROR, "header里没有包含attributes");
- }
- }
-
private String authenticateUser(StompHeaderAccessor header) {
String authorization = header.getFirstNativeHeader("Authorization");
if (StrUtil.isNotEmpty(authorization)) {
diff --git a/src/main/java/com/upchina/common/query/AddCommentBlackQuery.java b/src/main/java/com/upchina/common/query/AddCommentBlackQuery.java
index 67b2592..217b7bc 100644
--- a/src/main/java/com/upchina/common/query/AddCommentBlackQuery.java
+++ b/src/main/java/com/upchina/common/query/AddCommentBlackQuery.java
@@ -40,10 +40,17 @@ public class AddCommentBlackQuery {
@Max(2)
private Integer type;
+ @ApiModelProperty("范围类型 1产品 2产品类型 3全局")
+ @NotNull
+ @Min(1)
+ @Max(3)
+ private Integer scope;
+
public String getUserPhone() {
return userPhone;
}
+
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
@@ -103,4 +110,12 @@ public class AddCommentBlackQuery {
public void setType(Integer type) {
this.type = type;
}
+
+ public Integer getScope() {
+ return scope;
+ }
+
+ public void setScope(Integer scope) {
+ this.scope = scope;
+ }
}
diff --git a/src/main/java/com/upchina/common/query/CommentBlackQuery.java b/src/main/java/com/upchina/common/query/CommentBlackQuery.java
index 33da84a..1276407 100644
--- a/src/main/java/com/upchina/common/query/CommentBlackQuery.java
+++ b/src/main/java/com/upchina/common/query/CommentBlackQuery.java
@@ -48,8 +48,15 @@ public class CommentBlackQuery extends PageQuery {
private String endOpTime;
@ApiModelProperty("禁言类型:0次日解禁 1一个月之后解禁 2永久禁言,不传查全部")
+ @Min(0)
+ @Max(2)
private Integer type;
+ @ApiModelProperty("范围类型 1产品 2产品类型 3全局")
+ @Min(1)
+ @Max(3)
+ private Integer scope;
+
public String getUserName() {
return userName;
}
@@ -153,4 +160,12 @@ public class CommentBlackQuery extends PageQuery {
public void setType(Integer type) {
this.type = type;
}
+
+ public Integer getScope() {
+ return scope;
+ }
+
+ public void setScope(Integer scope) {
+ this.scope = scope;
+ }
}
diff --git a/src/main/java/com/upchina/common/query/RemoveCommentBlackQuery.java b/src/main/java/com/upchina/common/query/RemoveCommentBlackQuery.java
new file mode 100644
index 0000000..27e90dd
--- /dev/null
+++ b/src/main/java/com/upchina/common/query/RemoveCommentBlackQuery.java
@@ -0,0 +1,46 @@
+package com.upchina.common.query;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class RemoveCommentBlackQuery {
+
+ @ApiModelProperty("产品id")
+ @NotNull
+ private Integer productId;
+
+ @ApiModelProperty("产品类型")
+ @NotNull
+ private Integer productType;
+
+ @ApiModelProperty("用户手机号")
+ @NotBlank
+ private String userPhone;
+
+ public Integer getProductId() {
+ return productId;
+ }
+
+ public void setProductId(Integer productId) {
+ this.productId = productId;
+ }
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public String getUserPhone() {
+ return userPhone;
+ }
+
+ public void setUserPhone(String userPhone) {
+ this.userPhone = userPhone;
+ }
+
+}
diff --git a/src/main/java/com/upchina/common/service/CommentBlackService.java b/src/main/java/com/upchina/common/service/CommentBlackService.java
index 29ab5dc..62f9131 100644
--- a/src/main/java/com/upchina/common/service/CommentBlackService.java
+++ b/src/main/java/com/upchina/common/service/CommentBlackService.java
@@ -1,6 +1,5 @@
package com.upchina.common.service;
-import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -9,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Table;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
+import com.upchina.common.constant.CommentBlackScope;
import com.upchina.common.constant.CommentBlackStatus;
import com.upchina.common.constant.CommentBlackType;
import com.upchina.common.entity.CommentBlack;
@@ -17,6 +17,7 @@ import com.upchina.common.mapper.CommentBlackMapper;
import com.upchina.common.query.AddCommentBlackQuery;
import com.upchina.common.query.BaseProductQuery;
import com.upchina.common.query.CommentBlackQuery;
+import com.upchina.common.query.RemoveCommentBlackQuery;
import com.upchina.common.result.Pager;
import com.upchina.common.result.ResponseStatus;
import com.upchina.common.util.HideUtils;
@@ -26,11 +27,9 @@ import com.upchina.common.vo.CommentBlackVO;
import com.upchina.common.vo.MergeProductInfoVO;
import com.upchina.rbac.entity.Dept;
import com.upchina.rbac.entity.UserDept;
-import com.upchina.rbac.service.AuthService;
import com.upchina.rbac.service.DeptService;
import com.upchina.rbac.service.UserService;
import ma.glasnost.orika.MapperFacade;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -42,17 +41,12 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.upchina.common.config.cache.CacheKey.COMMENT_BLACK;
+import static com.upchina.common.config.cache.CacheKey.CommentBlackKey.ALL_BLACK_COMMENT;
import static com.upchina.common.config.cache.CacheKey.CommentBlackKey.ALL_BLACK_USER;
@Service
public class CommentBlackService {
- @Value("${rsa.priKey}")
- private String ypPriKey;
-
- @Value("${rsa.pubKey}")
- private String ypPubKey;
-
@Resource
private MapperFacade mapperFacade;
@@ -71,40 +65,14 @@ public class CommentBlackService {
@Resource
private CacheService cacheService;
- @Resource
- private AuthService authService;
-
@Resource
private DeptService deptService;
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- public Set getAllBlackUser() {
- LocalDateTime now = LocalDateTime.now();
- List list = cacheService.get(COMMENT_BLACK, ALL_BLACK_USER, () -> {
- QueryWrapper wrapper = Wrappers.query();
- wrapper.in("status", Arrays.asList(CommentBlackStatus.EFFECT.value, CommentBlackStatus.EXPIRED.value));
- List commentBlackList = commentBlackMapper.selectList(wrapper);
- LoggerUtil.info("db当前黑名单用户:" + JSONObject.toJSONString(commentBlackList));
- if (CollectionUtils.isEmpty(commentBlackList)) {
- return null;
- }
- return commentBlackList;
- });
- if (CollUtil.isEmpty(list)) {
- return null;
- }
- Set set = list.stream()
- .filter(black -> now.isAfter(black.getStartTime()) && now.isBefore(black.getEndTime()))
- .map(CommentBlack::getPhone).collect(Collectors.toSet());
- LoggerUtil.info("当前黑名单用户:" + JSONObject.toJSONString(set));
- return set;
- }
-
@Transactional(rollbackFor = Exception.class)
- public Integer addCommentBlack(BackendUserVO backendUserVO, AddCommentBlackQuery addCommentBlackQuery) {
-// String userPhone = RsaUtil.priKeyDecryption(ypPriKey, addCommentBlackQuery.getUserPhone());
- String userPhone = addCommentBlackQuery.getUserPhone();
+ public Integer addCommentBlack(BackendUserVO backendUserVO, AddCommentBlackQuery query) {
+ String userPhone = query.getUserPhone();
LocalDateTime now = LocalDateTime.now();
//禁言开始时间-1s
now = now.minusSeconds(1L);
@@ -117,8 +85,8 @@ public class CommentBlackService {
if (validSize > 0) {
throw new BizException(ResponseStatus.REPETITIVE_ERROR);
}
- CommentBlack commentBlack = mapperFacade.map(addCommentBlackQuery, CommentBlack.class);
- commentBlack.setUserName(addCommentBlackQuery.getUserName());
+ CommentBlack commentBlack = mapperFacade.map(query, CommentBlack.class);
+ commentBlack.setUserName(query.getUserName());
commentBlack.setPhone(userPhone);
commentBlack.setStartTime(now);
commentBlack.setStatus(CommentBlackStatus.EFFECT.value);
@@ -136,15 +104,17 @@ public class CommentBlackService {
if (count < 1) {
throw new BizException(ResponseStatus.DB_SAVE_ERROR);
}
- this.clearCache(Collections.singletonList(ALL_BLACK_USER));
+ this.clearCache(ALL_BLACK_USER, ALL_BLACK_COMMENT);
return commentBlack.getId();
}
@Transactional(rollbackFor = Exception.class)
- public void removeCommentBlack(String phone) {
+ public void removeCommentBlack(BackendUserVO backendUserVO, RemoveCommentBlackQuery query) {
LocalDateTime now = LocalDateTime.now();
QueryWrapper wrapper = Wrappers.query();
- wrapper.eq("phone", phone)
+ wrapper.eq("phone", query.getUserPhone())
+ .eq("product_id", query.getProductId())
+ .eq("product_type", query.getProductType())
.in("status", Arrays.asList(CommentBlackStatus.EFFECT.value, CommentBlackStatus.EXPIRED.value))
.lt("start_time", now)
.ge("end_time", now);
@@ -163,46 +133,41 @@ public class CommentBlackService {
throw new BizException(ResponseStatus.DB_SAVE_ERROR);
}
}
- this.clearCache(Collections.singletonList(ALL_BLACK_USER));
+ this.clearCache(ALL_BLACK_USER, ALL_BLACK_COMMENT);
}
- public Pager queryCommentBlackList(BackendUserVO backendUserVO, CommentBlackQuery commentBlackQuery) {
+ public Pager queryCommentBlackList(BackendUserVO backendUserVO, CommentBlackQuery query) {
LocalDateTime startTime = null;
LocalDateTime endTime = null;
LocalDateTime startOpTime = null;
LocalDateTime endOpTime = null;
- if (StrUtil.isNotEmpty(commentBlackQuery.getStartTime())) {
- startTime = LocalDateTime.parse(commentBlackQuery.getStartTime(), formatter);
+ if (StrUtil.isNotEmpty(query.getStartTime())) {
+ startTime = LocalDateTime.parse(query.getStartTime(), formatter);
}
- if (StrUtil.isNotEmpty(commentBlackQuery.getEndTime())) {
- endTime = LocalDateTime.parse(commentBlackQuery.getEndTime(), formatter);
+ if (StrUtil.isNotEmpty(query.getEndTime())) {
+ endTime = LocalDateTime.parse(query.getEndTime(), formatter);
}
- if (StrUtil.isNotEmpty(commentBlackQuery.getStartOpTime())) {
- startOpTime = LocalDateTime.parse(commentBlackQuery.getStartOpTime(), formatter);
+ if (StrUtil.isNotEmpty(query.getStartOpTime())) {
+ startOpTime = LocalDateTime.parse(query.getStartOpTime(), formatter);
}
- if (StrUtil.isNotEmpty(commentBlackQuery.getEndOpTime())) {
- endOpTime = LocalDateTime.parse(commentBlackQuery.getEndOpTime(), formatter);
+ if (StrUtil.isNotEmpty(query.getEndOpTime())) {
+ endOpTime = LocalDateTime.parse(query.getEndOpTime(), formatter);
}
- /*Set advisorIdSet = authService.getAccessibleAdviserSet(null, backendUserVO, UserType.fromValue(commentBlackQuery.getUserType()));
- if (advisorIdSet != null && advisorIdSet.isEmpty()) {
- return Pager.emptyPager();
- }*/
QueryWrapper wrapper = Wrappers.query();
- wrapper.like(StrUtil.isNotEmpty(commentBlackQuery.getUserName()), "user_name", commentBlackQuery.getUserName())
- .eq(StrUtil.isNotEmpty(commentBlackQuery.getPhone()), "phone", commentBlackQuery.getPhone())
- .eq(commentBlackQuery.getType() != null, "type", commentBlackQuery.getType())
- //.in(!CollectionUtils.isEmpty(advisorIdSet), "advisor_id", advisorIdSet)
- .eq(commentBlackQuery.getProductType() != null, "product_type", commentBlackQuery.getProductType())
- .eq(commentBlackQuery.getProductType() != null && commentBlackQuery.getProductId() != null, "product_id", commentBlackQuery.getProductId())
- .like(StrUtil.isNotBlank(commentBlackQuery.getContent()), "content", commentBlackQuery.getContent())
- .like(StrUtil.isNotEmpty(commentBlackQuery.getReason()), "reason", commentBlackQuery.getReason())
- .eq(commentBlackQuery.getOperatorId() != null, "operator_id", commentBlackQuery.getOperatorId())
+ wrapper.like(StrUtil.isNotEmpty(query.getUserName()), "user_name", query.getUserName())
+ .eq(StrUtil.isNotEmpty(query.getPhone()), "phone", query.getPhone())
+ .eq(query.getType() != null, "type", query.getType())
+ .eq(query.getProductType() != null, "product_type", query.getProductType())
+ .eq(query.getProductType() != null && query.getProductId() != null, "product_id", query.getProductId())
+ .like(StrUtil.isNotBlank(query.getContent()), "content", query.getContent())
+ .like(StrUtil.isNotEmpty(query.getReason()), "reason", query.getReason())
+ .eq(query.getOperatorId() != null, "operator_id", query.getOperatorId())
.ge(startTime != null, "start_time", startTime)
.lt(endTime != null, "start_time", endTime)
.ge(startOpTime != null, "end_time", startOpTime)
.lt(endOpTime != null, "end_time", endOpTime);
wrapper.orderByDesc("start_time");
- Page page = commentBlackMapper.selectPage(commentBlackQuery.toPage(), wrapper);
+ Page page = commentBlackMapper.selectPage(query.toPage(), wrapper);
List list = page.getRecords();
if (CollectionUtils.isEmpty(list)) {
return Pager.emptyPager();
@@ -246,7 +211,7 @@ public class CommentBlackService {
return new Pager<>(voList, page.getTotal());
}
- private void clearCache(List cacheKeys) {
+ private void clearCache(String... cacheKeys) {
IMap cacheMap = hazelcastInstance.getMap(COMMENT_BLACK);
for (String key : cacheKeys) {
cacheMap.remove(key);
@@ -256,12 +221,50 @@ public class CommentBlackService {
/**
* 校验是否禁言
*/
- public void check(String phone) {
+ public boolean checkIsBlack(String phone, Integer productId, Integer productType) {
// 判断是否禁言用户
Set blackUsers = getAllBlackUser();
- if (CollUtil.isNotEmpty(blackUsers) && blackUsers.contains(phone)) {
- throw new BizException("禁言用户,禁止发言");
+ if (!blackUsers.contains(phone)) {
+ return false;
}
+ List blackComments = getAllBlackComment();
+ if (CollectionUtils.isEmpty(blackComments)) {
+ return false;
+ }
+ for (CommentBlack commentBlack : blackComments) {
+ if (commentBlack.getPhone().equals(phone)) {
+ if (CommentBlackScope.PRODUCT.value.equals(commentBlack.getScope())) {
+ if (commentBlack.getProductId().equals(productId) && commentBlack.getProductType().equals(productType)) {
+ return true;
+ }
+ } else if (CommentBlackScope.PRODUCT_TYPE.value.equals(commentBlack.getScope())) {
+ if (commentBlack.getProductType().equals(productType)) {
+ return true;
+ }
+ } else if (CommentBlackScope.GLOBAL.value.equals(commentBlack.getScope())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private Set getAllBlackUser() {
+ return cacheService.get(COMMENT_BLACK, ALL_BLACK_USER, () ->
+ getAllBlackComment().stream().map(CommentBlack::getPhone).collect(Collectors.toSet()));
+ }
+
+ private List getAllBlackComment() {
+ LocalDateTime now = LocalDateTime.now();
+ return cacheService.get(COMMENT_BLACK, ALL_BLACK_COMMENT, () -> {
+ QueryWrapper wrapper = Wrappers.query()
+ .in("status", Arrays.asList(CommentBlackStatus.EFFECT.value, CommentBlackStatus.EXPIRED.value))
+ .lt("start_time", now)
+ .gt("end_time", now);
+ List commentBlackList = commentBlackMapper.selectList(wrapper);
+ LoggerUtil.info("db当前黑名单用户:" + JSONObject.toJSONString(commentBlackList));
+ return commentBlackList;
+ });
}
}
diff --git a/src/main/java/com/upchina/common/service/CommentService.java b/src/main/java/com/upchina/common/service/CommentService.java
index 6c9eace..491d5fe 100644
--- a/src/main/java/com/upchina/common/service/CommentService.java
+++ b/src/main/java/com/upchina/common/service/CommentService.java
@@ -29,7 +29,6 @@ import com.upchina.rbac.entity.UserDept;
import com.upchina.rbac.service.DeptService;
import com.upchina.rbac.service.UserService;
import ma.glasnost.orika.MapperFacade;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -47,9 +46,6 @@ import static com.upchina.common.config.cache.CacheKey.CommentKey.APP_COMMENT_SO
@Service
public class CommentService {
- @Value("${rsa.pubKey}")
- private String ypPubKey;
-
@Resource
private CommentMapper commentMapper;
@@ -87,7 +83,9 @@ public class CommentService {
// 敏感词判断
sensitiveWordService.check(query.getCommentContent());
// 判断是否禁言用户
- commentBlackService.check(frontUserVO.getUserId());
+ if (commentBlackService.checkIsBlack(frontUserVO.getUserId(), query.getProductId(), query.getProductType())) {
+ throw new BizException(ResponseStatus.COMMENT_BLACK_USER_ERROR);
+ }
Comment comment = new Comment();
mapperFacade.map(frontUserVO, comment);
mapperFacade.map(query, comment);
@@ -201,16 +199,11 @@ public class CommentService {
Table productTable = mergeProductService.queryMergeProductInfo(baseProductQueryList);
Map userMap = userService.getUserMap();
// 判断是否禁言用户
- Set blackUsers = commentBlackService.getAllBlackUser();
Map deptMap = deptService.getDeptMap();
Map userIdAdvisorMap = advisorInfoService.getUserIdAdvisorMap();
List result = list.stream().map(comment -> {
CommentVO commentVO = mapperFacade.map(comment, CommentVO.class);
- if (!CollectionUtils.isEmpty(blackUsers) && blackUsers.contains(commentVO.getPhone())) {
- commentVO.setTaboo(IsOrNot.IS.value);
- } else {
- commentVO.setTaboo(IsOrNot.NOT.value);
- }
+ commentVO.setTaboo(commentBlackService.checkIsBlack(commentVO.getPhone(), commentVO.getProductId(), commentVO.getProductType()) ? IsOrNot.IS.value : IsOrNot.NOT.value);
if (commentVO.getReplyUserId() != null) {
UserDept user = userMap.get(commentVO.getReplyUserId());
if (user != null) {
diff --git a/src/main/java/com/upchina/common/vo/CommentBlackVO.java b/src/main/java/com/upchina/common/vo/CommentBlackVO.java
index 474d29e..11aea47 100644
--- a/src/main/java/com/upchina/common/vo/CommentBlackVO.java
+++ b/src/main/java/com/upchina/common/vo/CommentBlackVO.java
@@ -54,6 +54,9 @@ public class CommentBlackVO extends CommonPhoneVO {
@ApiModelProperty("禁言类型:0次日解禁 1一个月之后解禁 2永久禁言")
private Integer type;
+ @ApiModelProperty("范围类型 1产品 2产品类型 3全局")
+ private Integer scope;
+
public String getContent() {
return content;
}
@@ -181,4 +184,12 @@ public class CommentBlackVO extends CommonPhoneVO {
public void setType(Integer type) {
this.type = type;
}
+
+ public Integer getScope() {
+ return scope;
+ }
+
+ public void setScope(Integer scope) {
+ this.scope = scope;
+ }
}
diff --git a/src/main/java/com/upchina/group/controller/admin/AdminGroupInfoController.java b/src/main/java/com/upchina/group/controller/admin/AdminGroupInfoController.java
index 9082b98..4c83158 100644
--- a/src/main/java/com/upchina/group/controller/admin/AdminGroupInfoController.java
+++ b/src/main/java/com/upchina/group/controller/admin/AdminGroupInfoController.java
@@ -9,6 +9,7 @@ import com.upchina.common.vo.BackendUserVO;
import com.upchina.common.vo.InsertIdVO;
import com.upchina.group.query.ListGroupQuery;
import com.upchina.group.query.SaveGroupQuery;
+import com.upchina.group.query.SetNoticeQuery;
import com.upchina.group.query.UpdateGroupQuery;
import com.upchina.group.query.UpdateGroupStatusQuery;
import com.upchina.group.service.GroupInfoService;
@@ -73,4 +74,12 @@ public class AdminGroupInfoController {
GroupVO vo = groupInfoService.get(query, backendUserVO);
return CommonResult.success(vo);
}
+
+ @ApiOperation("后台设置交易圈公告")
+ @PostMapping("/admin/group/info/setNotice")
+ public CommonResult setNotice(@Validated @RequestBody @ApiParam(required = true) SetNoticeQuery query,
+ @RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO) {
+ groupInfoService.setNotice(query, backendUserVO);
+ return CommonResult.success();
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/upchina/group/controller/admin/AdminGroupMessageController.java b/src/main/java/com/upchina/group/controller/admin/AdminGroupMessageController.java
index 8dafbbd..4b00495 100644
--- a/src/main/java/com/upchina/group/controller/admin/AdminGroupMessageController.java
+++ b/src/main/java/com/upchina/group/controller/admin/AdminGroupMessageController.java
@@ -75,6 +75,15 @@ public class AdminGroupMessageController {
return CommonResult.success(vo);
}
+ @ApiOperation("后台设置消息精选")
+ @PostMapping("/admin/group/message/setMessageRecommend")
+ public CommonResult setMessageRecommend(@Validated @RequestBody @ApiParam(required = true) GroupMessageRecommendQuery query,
+ @RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO) {
+ adminGroupMessageService.setMessageRecommend(query, backendUserVO);
+ return CommonResult.success();
+ }
+
+
@ApiOperation("设置互动状态")
@PostMapping("/admin/group/message/setInteractiveStatus")
public CommonResult setInteractiveStatus(
diff --git a/src/main/java/com/upchina/group/entity/GroupInfo.java b/src/main/java/com/upchina/group/entity/GroupInfo.java
index 0c7059e..ed0c7e9 100644
--- a/src/main/java/com/upchina/group/entity/GroupInfo.java
+++ b/src/main/java/com/upchina/group/entity/GroupInfo.java
@@ -58,6 +58,11 @@ public class GroupInfo implements Serializable {
@TableField("welcome_message")
private String welcomeMessage;
+ /**
+ * 公告
+ */
+ private String notice;
+
/**
* 互动状态 1:开启 2:关闭
*/
@@ -207,6 +212,7 @@ public class GroupInfo implements Serializable {
public void setId(Integer id) {
this.id = id;
}
+
public Integer getAdvisorId() {
return advisorId;
}
@@ -214,6 +220,7 @@ public class GroupInfo implements Serializable {
public void setAdvisorId(Integer advisorId) {
this.advisorId = advisorId;
}
+
public String getName() {
return name;
}
@@ -221,6 +228,7 @@ public class GroupInfo implements Serializable {
public void setName(String name) {
this.name = name;
}
+
public String getRemark() {
return remark;
}
@@ -228,6 +236,7 @@ public class GroupInfo implements Serializable {
public void setRemark(String remark) {
this.remark = remark;
}
+
public String getApplicableUser() {
return applicableUser;
}
@@ -235,6 +244,7 @@ public class GroupInfo implements Serializable {
public void setApplicableUser(String applicableUser) {
this.applicableUser = applicableUser;
}
+
public String getDetail() {
return detail;
}
@@ -242,6 +252,7 @@ public class GroupInfo implements Serializable {
public void setDetail(String detail) {
this.detail = detail;
}
+
public String getWelcomeMessage() {
return welcomeMessage;
}
@@ -249,6 +260,15 @@ public class GroupInfo implements Serializable {
public void setWelcomeMessage(String welcomeMessage) {
this.welcomeMessage = welcomeMessage;
}
+
+ public String getNotice() {
+ return notice;
+ }
+
+ public void setNotice(String notice) {
+ this.notice = notice;
+ }
+
public Integer getInteractiveStatus() {
return interactiveStatus;
}
@@ -256,6 +276,7 @@ public class GroupInfo implements Serializable {
public void setInteractiveStatus(Integer interactiveStatus) {
this.interactiveStatus = interactiveStatus;
}
+
public Integer getPrivateChatStatus() {
return privateChatStatus;
}
@@ -263,6 +284,7 @@ public class GroupInfo implements Serializable {
public void setPrivateChatStatus(Integer privateChatStatus) {
this.privateChatStatus = privateChatStatus;
}
+
public Integer getShowMemberCount() {
return showMemberCount;
}
@@ -270,6 +292,7 @@ public class GroupInfo implements Serializable {
public void setShowMemberCount(Integer showMemberCount) {
this.showMemberCount = showMemberCount;
}
+
public Integer getShowNickName() {
return showNickName;
}
@@ -277,6 +300,7 @@ public class GroupInfo implements Serializable {
public void setShowNickName(Integer showNickName) {
this.showNickName = showNickName;
}
+
public Integer getFirstAudit() {
return firstAudit;
}
@@ -284,6 +308,7 @@ public class GroupInfo implements Serializable {
public void setFirstAudit(Integer firstAudit) {
this.firstAudit = firstAudit;
}
+
public Integer getPageId() {
return pageId;
}
@@ -291,6 +316,7 @@ public class GroupInfo implements Serializable {
public void setPageId(Integer pageId) {
this.pageId = pageId;
}
+
public BigDecimal getOriginalPrice() {
return originalPrice;
}
@@ -298,6 +324,7 @@ public class GroupInfo implements Serializable {
public void setOriginalPrice(BigDecimal originalPrice) {
this.originalPrice = originalPrice;
}
+
public BigDecimal getActivityPrice() {
return activityPrice;
}
@@ -305,6 +332,7 @@ public class GroupInfo implements Serializable {
public void setActivityPrice(BigDecimal activityPrice) {
this.activityPrice = activityPrice;
}
+
public String getPaymentUrl() {
return paymentUrl;
}
@@ -312,6 +340,7 @@ public class GroupInfo implements Serializable {
public void setPaymentUrl(String paymentUrl) {
this.paymentUrl = paymentUrl;
}
+
public String getAuthorityId() {
return authorityId;
}
@@ -319,6 +348,7 @@ public class GroupInfo implements Serializable {
public void setAuthorityId(String authorityId) {
this.authorityId = authorityId;
}
+
public Integer getMemberLimit() {
return memberLimit;
}
@@ -326,6 +356,7 @@ public class GroupInfo implements Serializable {
public void setMemberLimit(Integer memberLimit) {
this.memberLimit = memberLimit;
}
+
public String getCoverImage() {
return coverImage;
}
@@ -333,6 +364,7 @@ public class GroupInfo implements Serializable {
public void setCoverImage(String coverImage) {
this.coverImage = coverImage;
}
+
public Integer getStatus() {
return status;
}
@@ -340,6 +372,7 @@ public class GroupInfo implements Serializable {
public void setStatus(Integer status) {
this.status = status;
}
+
public String getReason() {
return reason;
}
@@ -347,6 +380,7 @@ public class GroupInfo implements Serializable {
public void setReason(String reason) {
this.reason = reason;
}
+
public Integer getRiskLevel() {
return riskLevel;
}
@@ -354,6 +388,7 @@ public class GroupInfo implements Serializable {
public void setRiskLevel(Integer riskLevel) {
this.riskLevel = riskLevel;
}
+
public LocalDateTime getCreateTime() {
return createTime;
}
@@ -361,6 +396,7 @@ public class GroupInfo implements Serializable {
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
+
public LocalDateTime getUpdateTime() {
return updateTime;
}
@@ -368,6 +404,7 @@ public class GroupInfo implements Serializable {
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
+
public LocalDateTime getAuditTime() {
return auditTime;
}
@@ -375,6 +412,7 @@ public class GroupInfo implements Serializable {
public void setAuditTime(LocalDateTime auditTime) {
this.auditTime = auditTime;
}
+
public Integer getCreateUserId() {
return createUserId;
}
@@ -382,6 +420,7 @@ public class GroupInfo implements Serializable {
public void setCreateUserId(Integer createUserId) {
this.createUserId = createUserId;
}
+
public Integer getAuditUserId() {
return auditUserId;
}
@@ -389,6 +428,7 @@ public class GroupInfo implements Serializable {
public void setAuditUserId(Integer auditUserId) {
this.auditUserId = auditUserId;
}
+
public Integer getIsRecommend() {
return isRecommend;
}
@@ -396,6 +436,7 @@ public class GroupInfo implements Serializable {
public void setIsRecommend(Integer isRecommend) {
this.isRecommend = isRecommend;
}
+
public Integer getIsDisplay() {
return isDisplay;
}
@@ -403,6 +444,7 @@ public class GroupInfo implements Serializable {
public void setIsDisplay(Integer isDisplay) {
this.isDisplay = isDisplay;
}
+
public String getMainPageText() {
return mainPageText;
}
@@ -410,6 +452,7 @@ public class GroupInfo implements Serializable {
public void setMainPageText(String mainPageText) {
this.mainPageText = mainPageText;
}
+
public Integer getWechatWorkId() {
return wechatWorkId;
}
@@ -421,37 +464,38 @@ public class GroupInfo implements Serializable {
@Override
public String toString() {
return "GroupInfo{" +
- "id=" + id +
- ", advisorId=" + advisorId +
- ", name=" + name +
- ", remark=" + remark +
- ", applicableUser=" + applicableUser +
- ", detail=" + detail +
- ", welcomeMessage=" + welcomeMessage +
- ", interactiveStatus=" + interactiveStatus +
- ", privateChatStatus=" + privateChatStatus +
- ", showMemberCount=" + showMemberCount +
- ", showNickName=" + showNickName +
- ", firstAudit=" + firstAudit +
- ", pageId=" + pageId +
- ", originalPrice=" + originalPrice +
- ", activityPrice=" + activityPrice +
- ", paymentUrl=" + paymentUrl +
- ", authorityId=" + authorityId +
- ", memberLimit=" + memberLimit +
- ", coverImage=" + coverImage +
- ", status=" + status +
- ", reason=" + reason +
- ", riskLevel=" + riskLevel +
- ", createTime=" + createTime +
- ", updateTime=" + updateTime +
- ", auditTime=" + auditTime +
- ", createUserId=" + createUserId +
- ", auditUserId=" + auditUserId +
- ", isRecommend=" + isRecommend +
- ", isDisplay=" + isDisplay +
- ", mainPageText=" + mainPageText +
- ", wechatWorkId=" + wechatWorkId +
- "}";
+ "id=" + id +
+ ", advisorId=" + advisorId +
+ ", name='" + name + '\'' +
+ ", remark='" + remark + '\'' +
+ ", applicableUser='" + applicableUser + '\'' +
+ ", detail='" + detail + '\'' +
+ ", welcomeMessage='" + welcomeMessage + '\'' +
+ ", notice='" + notice + '\'' +
+ ", interactiveStatus=" + interactiveStatus +
+ ", privateChatStatus=" + privateChatStatus +
+ ", showMemberCount=" + showMemberCount +
+ ", showNickName=" + showNickName +
+ ", firstAudit=" + firstAudit +
+ ", pageId=" + pageId +
+ ", originalPrice=" + originalPrice +
+ ", activityPrice=" + activityPrice +
+ ", paymentUrl='" + paymentUrl + '\'' +
+ ", authorityId='" + authorityId + '\'' +
+ ", memberLimit=" + memberLimit +
+ ", coverImage='" + coverImage + '\'' +
+ ", status=" + status +
+ ", reason='" + reason + '\'' +
+ ", riskLevel=" + riskLevel +
+ ", createTime=" + createTime +
+ ", updateTime=" + updateTime +
+ ", auditTime=" + auditTime +
+ ", createUserId=" + createUserId +
+ ", auditUserId=" + auditUserId +
+ ", isRecommend=" + isRecommend +
+ ", isDisplay=" + isDisplay +
+ ", mainPageText='" + mainPageText + '\'' +
+ ", wechatWorkId=" + wechatWorkId +
+ '}';
}
}
diff --git a/src/main/java/com/upchina/group/query/SetNoticeQuery.java b/src/main/java/com/upchina/group/query/SetNoticeQuery.java
new file mode 100644
index 0000000..663e611
--- /dev/null
+++ b/src/main/java/com/upchina/group/query/SetNoticeQuery.java
@@ -0,0 +1,47 @@
+package com.upchina.group.query;
+
+import java.time.LocalDateTime;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+import com.upchina.group.entity.GroupInfo;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class SetNoticeQuery {
+
+ @ApiModelProperty("交易圈ID")
+ @NotNull
+ private Integer id;
+
+ @ApiModelProperty("公告")
+ @NotBlank
+ private String notice;
+
+ public GroupInfo toPO() {
+ GroupInfo groupInfo = new GroupInfo();
+ groupInfo.setId(id);
+ groupInfo.setNotice(notice);
+ groupInfo.setUpdateTime(LocalDateTime.now());
+ return groupInfo;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getNotice() {
+ return notice;
+ }
+
+ public void setNotice(String notice) {
+ this.notice = notice;
+ }
+
+}
diff --git a/src/main/java/com/upchina/group/query/message/GroupMessageRecommendQuery.java b/src/main/java/com/upchina/group/query/message/GroupMessageRecommendQuery.java
new file mode 100644
index 0000000..f9d45f3
--- /dev/null
+++ b/src/main/java/com/upchina/group/query/message/GroupMessageRecommendQuery.java
@@ -0,0 +1,49 @@
+package com.upchina.group.query.message;
+
+import java.time.LocalDateTime;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+import com.upchina.group.entity.GroupMessage;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class GroupMessageRecommendQuery {
+
+ @ApiModelProperty(value = "消息ID")
+ @NotNull
+ private Integer messageId;
+
+ @ApiModelProperty(value = "是否精选 1:是 2:否")
+ @NotNull
+ @Min(1)
+ @Max(2)
+ private Integer isRecommend;
+
+ public GroupMessage toPO() {
+ GroupMessage message = new GroupMessage();
+ message.setId(messageId);
+ message.setIsRecommend(isRecommend);
+ message.setUpdateTime(LocalDateTime.now());
+ return message;
+ }
+
+ public Integer getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(Integer messageId) {
+ this.messageId = messageId;
+ }
+
+ public Integer getIsRecommend() {
+ return isRecommend;
+ }
+
+ public void setIsRecommend(Integer isRecommend) {
+ this.isRecommend = isRecommend;
+ }
+
+}
diff --git a/src/main/java/com/upchina/group/query/message/ListGroupMessageQuery.java b/src/main/java/com/upchina/group/query/message/ListGroupMessageQuery.java
index c7a4972..6749f10 100644
--- a/src/main/java/com/upchina/group/query/message/ListGroupMessageQuery.java
+++ b/src/main/java/com/upchina/group/query/message/ListGroupMessageQuery.java
@@ -1,9 +1,11 @@
package com.upchina.group.query.message;
-import io.swagger.annotations.ApiModelProperty;
-
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
+import io.swagger.annotations.ApiModelProperty;
+
public class ListGroupMessageQuery {
@ApiModelProperty(value = "交易圈ID", required = true)
@@ -11,11 +13,18 @@ public class ListGroupMessageQuery {
private Integer groupId;
@ApiModelProperty("消息状态:1初始;2已审核;3已删除")
+ @Min(1)
+ @Max(3)
private Integer status;
- @ApiModelProperty("查询类型:1全部;2投顾;3用户;4精选")
+ @ApiModelProperty("查询类型:1全部;2投顾;3用户;4精选;5私聊")
+ @Min(1)
+ @Max(5)
private Integer type;
+ @ApiModelProperty("用户ID(私聊时有效)")
+ private String userId;
+
@ApiModelProperty("关键字")
private String keyword;
@@ -23,6 +32,7 @@ public class ListGroupMessageQuery {
private Integer lastId;
@ApiModelProperty("消息数量")
+ @Max(100)
private Integer size;
public Integer getGroupId() {
@@ -49,6 +59,14 @@ public class ListGroupMessageQuery {
this.type = type;
}
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
public String getKeyword() {
return keyword;
}
@@ -72,4 +90,5 @@ public class ListGroupMessageQuery {
public void setSize(Integer size) {
this.size = size;
}
+
}
\ No newline at end of file
diff --git a/src/main/java/com/upchina/group/query/message/SendGroupMessageAdminQuery.java b/src/main/java/com/upchina/group/query/message/SendGroupMessageAdminQuery.java
index c74cd21..0933082 100644
--- a/src/main/java/com/upchina/group/query/message/SendGroupMessageAdminQuery.java
+++ b/src/main/java/com/upchina/group/query/message/SendGroupMessageAdminQuery.java
@@ -60,7 +60,7 @@ public class SendGroupMessageAdminQuery {
message.setToUserId(toUserId);
message.setPrivateUserId(toUserId);
}
- message.setStatus(GroupMessageStatus.INITIAL.value);
+ message.setStatus(GroupMessageStatus.AUDITED.value);
message.setCreateUserId(userVO.getUserId().toString());
message.setCreateTime(LocalDateTime.now());
message.setIsRecommend(isRecommend);
diff --git a/src/main/java/com/upchina/group/query/message/SendGroupMessageAppQuery.java b/src/main/java/com/upchina/group/query/message/SendGroupMessageAppQuery.java
index ec890cb..632ef13 100644
--- a/src/main/java/com/upchina/group/query/message/SendGroupMessageAppQuery.java
+++ b/src/main/java/com/upchina/group/query/message/SendGroupMessageAppQuery.java
@@ -30,7 +30,7 @@ public class SendGroupMessageAppQuery {
@Max(2)
private Integer interactiveType;
- public GroupMessage toPO(FrontUserVO userVO) {
+ public GroupMessage toPO(FrontUserVO userVO, GroupMessageStatus status) {
GroupMessage message = new GroupMessage();
message.setGroupId(groupId);
message.setMsgType(GroupMessageType.NORMAL.value);
@@ -41,7 +41,7 @@ public class SendGroupMessageAppQuery {
message.setContentType(GroupMessageContentType.TEXT.value);
message.setInteractiveType(interactiveType);
message.setPrivateUserId(userVO.getUserId());
- message.setStatus(GroupMessageStatus.INITIAL.value);
+ message.setStatus(status.value);
message.setCreateUserId(userVO.getUserId());
message.setCreateTime(LocalDateTime.now());
return message;
diff --git a/src/main/java/com/upchina/group/service/GroupInfoService.java b/src/main/java/com/upchina/group/service/GroupInfoService.java
index be10da6..b4c1efd 100644
--- a/src/main/java/com/upchina/group/service/GroupInfoService.java
+++ b/src/main/java/com/upchina/group/service/GroupInfoService.java
@@ -171,6 +171,16 @@ public class GroupInfoService {
);
}
+ public void setNotice(SetNoticeQuery query, BackendUserVO backendUserVO) {
+ GroupInfo groupInDB = groupInfoMapper.selectById(query.getId());
+ if (groupInDB == null) {
+ throw new BizException(ResponseStatus.ID_NOT_EXIST_ERROR);
+ }
+ GroupInfo groupInfo = query.toPO();
+ groupInfoMapper.updateById(groupInfo);
+ clearCache(query.getId());
+ }
+
/**
* APP端查询交易圈详情
*/
@@ -283,7 +293,8 @@ public class GroupInfoService {
return advisorId;
}
- private void clearCache(Integer id) {
+ public void clearCache(Integer id) {
groupCache.delete(CacheKey.GroupKey.GROUP_INFO + id);
}
+
}
\ No newline at end of file
diff --git a/src/main/java/com/upchina/group/service/admin/AdminGroupMessageService.java b/src/main/java/com/upchina/group/service/admin/AdminGroupMessageService.java
index 1119dba..06ee47b 100644
--- a/src/main/java/com/upchina/group/service/admin/AdminGroupMessageService.java
+++ b/src/main/java/com/upchina/group/service/admin/AdminGroupMessageService.java
@@ -1,6 +1,19 @@
package com.upchina.group.service.admin;
-import cn.hutool.core.util.StrUtil;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import com.hazelcast.map.IMap;
+import com.upchina.common.config.cache.CacheKey;
+import com.upchina.group.service.GroupInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -14,24 +27,27 @@ import com.upchina.common.result.ResponseStatus;
import com.upchina.common.state.StateMachine;
import com.upchina.common.vo.BackendUserVO;
import com.upchina.common.vo.OnlyIdVO;
-import com.upchina.group.constant.*;
+import com.upchina.group.constant.GroupMessageChannel;
+import com.upchina.group.constant.GroupMessageContentType;
+import com.upchina.group.constant.GroupMessageStatus;
+import com.upchina.group.constant.GroupMessageType;
+import com.upchina.group.constant.GroupMessageUserType;
+import com.upchina.group.constant.QueryGroupMessageType;
import com.upchina.group.entity.GroupInfo;
import com.upchina.group.entity.GroupMessage;
import com.upchina.group.mapper.GroupInfoMapper;
import com.upchina.group.mapper.GroupMessageMapper;
-import com.upchina.group.query.message.*;
+import com.upchina.group.query.message.GroupMessageProductQuery;
+import com.upchina.group.query.message.GroupMessageRecommendQuery;
+import com.upchina.group.query.message.GroupMessageStatusQuery;
+import com.upchina.group.query.message.ListGroupMessageQuery;
+import com.upchina.group.query.message.SendGroupMessageAdminQuery;
+import com.upchina.group.query.message.UpdateGroupMessageStatusQuery;
import com.upchina.group.service.common.GroupCacheService;
import com.upchina.group.service.common.GroupMessageService;
import com.upchina.group.vo.message.GroupMessageVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import javax.annotation.Resource;
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
+import cn.hutool.core.util.StrUtil;
@Service
public class AdminGroupMessageService {
@@ -54,6 +70,12 @@ public class AdminGroupMessageService {
@Resource
private AdvisorInfoService advisorInfoService;
+ @Resource
+ private GroupInfoService groupInfoService;
+
+ @Resource
+ private IMap groupCache;
+
@Transactional(rollbackFor = Exception.class)
public OnlyIdVO sendAdvisorMessage(SendGroupMessageAdminQuery query, BackendUserVO backendUser) {
GroupInfo group = groupInfoMapper.selectById(query.getGroupId());
@@ -63,9 +85,7 @@ public class AdminGroupMessageService {
GroupMessage message = query.toPO(backendUser);
groupMessageMapper.insert(message);
- groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.NORMAL, query.getGroupId(), message.getContent());
- groupCacheService.addMessage(message);
-
+ publishGroupMessage(message);
return new OnlyIdVO(message.getId());
}
@@ -92,8 +112,7 @@ public class AdminGroupMessageService {
groupCacheService.removeMessage(groupMessageInDB);
} else if (GroupMessageStatus.AUDITED.equals(targetStatus)) {
if (!IsOrNot.IS.value.equals(group.getFirstAudit())) {
- groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.NORMAL, groupId, groupMessageInDB.getContent());
- groupCacheService.addMessage(groupMessageInDB);
+ publishGroupMessage(groupMessageInDB);
}
}
}
@@ -102,6 +121,7 @@ public class AdminGroupMessageService {
Integer groupId = query.getGroupId();
Integer status = query.getStatus();
Integer type = query.getType();
+ String userId = query.getUserId();
String keyword = query.getKeyword();
Integer lastId = query.getLastId();
Integer size = query.getSize();
@@ -112,8 +132,10 @@ public class AdminGroupMessageService {
.in(QueryGroupMessageType.ADVISOR.value.equals(type), GroupMessage::getUserType, GroupMessageUserType.ADVISOR.value, GroupMessageUserType.ASSISTANT.value)
.eq(QueryGroupMessageType.CUSTOMER.value.equals(type), GroupMessage::getUserType, GroupMessageUserType.CUSTOMER.value)
.eq(QueryGroupMessageType.SELECTED.value.equals(type), GroupMessage::getIsRecommend, IsOrNot.IS.value)
+ .eq(QueryGroupMessageType.PRIVATE.value.equals(type) && StrUtil.isNotEmpty(userId), GroupMessage::getPrivateUserId, userId)
.eq(status != null, GroupMessage::getStatus, query.getStatus())
.like(StrUtil.isNotEmpty(keyword),GroupMessage::getContent, keyword)
+
.eq(StrUtil.isNotEmpty(keyword), GroupMessage::getContentType, GroupMessageContentType.TEXT.value)
.lt(lastId != null, GroupMessage::getId, lastId)
.orderByDesc(GroupMessage::getId)
@@ -161,6 +183,19 @@ public class AdminGroupMessageService {
return new OnlyIdVO(message.getId());
}
+ public void setMessageRecommend(GroupMessageRecommendQuery query, BackendUserVO backendUserVO) {
+ GroupMessage messageInDB = groupMessageMapper.selectById(query.getMessageId());
+ if (messageInDB == null) {
+ throw new BizException(ResponseStatus.ID_NOT_EXIST_ERROR);
+ }
+
+ GroupMessage message = query.toPO();
+ groupMessageMapper.updateById(message);
+
+ groupCacheService.addMessage(message);
+ clearCache(query.getMessageId());
+ }
+
/**
* 发送开启/关闭互动消息
*/
@@ -175,6 +210,8 @@ public class AdminGroupMessageService {
groupInfoMapper.updateById(group);
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.OPEN_INTERACTIVE, groupId, query.getStatus());
+
+ groupInfoService.clearCache(groupId);
}
/**
@@ -191,6 +228,8 @@ public class AdminGroupMessageService {
groupInfoMapper.updateById(group);
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.OPEN_PRIVATE_CHAT, groupId, query.getStatus());
+
+ groupInfoService.clearCache(groupId);
}
/**
@@ -207,6 +246,8 @@ public class AdminGroupMessageService {
groupInfoMapper.updateById(group);
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.SHOW_GROUP_MEMBER_COUNT, groupId, query.getStatus());
+
+ groupInfoService.clearCache(groupId);
}
public void setShowNickName(GroupMessageStatusQuery query, BackendUserVO backendUser) {
@@ -219,8 +260,9 @@ public class AdminGroupMessageService {
GroupInfo group = query.toShowNickNamePO();
groupInfoMapper.updateById(group);
-
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.SHOW_FULL_NICKNAME, groupId, query.getStatus());
+
+ groupInfoService.clearCache(groupId);
}
public void setFirstAudit(GroupMessageStatusQuery query, BackendUserVO backendUser) {
@@ -234,6 +276,20 @@ public class AdminGroupMessageService {
groupInfoMapper.updateById(group);
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.PRE_CHECK_SEND, groupId, query.getStatus());
+
+ groupInfoService.clearCache(groupId);
+ }
+
+ private void publishGroupMessage(GroupMessage message) {
+ Map advisorMap = advisorInfoService.getAdvisorVoMap();
+ GroupMessageVO vo = groupCacheService.getMessage(message, advisorMap);
+
+ groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.NORMAL, message.getGroupId(), vo);
+ groupCacheService.addMessage(message);
+ }
+
+ private void clearCache(Integer messageId) {
+ groupCache.remove(CacheKey.GroupKey.GROUP_MESSAGE_DETAIL + messageId);
}
}
\ No newline at end of file
diff --git a/src/main/java/com/upchina/group/service/app/AppGroupMessageService.java b/src/main/java/com/upchina/group/service/app/AppGroupMessageService.java
index 08dd724..e7f7505 100644
--- a/src/main/java/com/upchina/group/service/app/AppGroupMessageService.java
+++ b/src/main/java/com/upchina/group/service/app/AppGroupMessageService.java
@@ -3,6 +3,7 @@ package com.upchina.group.service.app;
import com.upchina.advisor.service.AdvisorInfoService;
import com.upchina.advisor.vo.AdvisorBasicVO;
import com.upchina.common.constant.IsOrNot;
+import com.upchina.common.constant.ProductType;
import com.upchina.common.handler.BizException;
import com.upchina.common.query.OnlyIdQuery;
import com.upchina.common.result.AppPager;
@@ -12,6 +13,7 @@ import com.upchina.common.service.SensitiveWordService;
import com.upchina.common.util.TextUtil;
import com.upchina.common.vo.FrontUserVO;
import com.upchina.group.constant.GroupMessageChannel;
+import com.upchina.group.constant.GroupMessageStatus;
import com.upchina.group.constant.GroupMessageType;
import com.upchina.group.constant.QueryGroupMessageType;
import com.upchina.group.entity.GroupMessage;
@@ -107,14 +109,17 @@ public class AppGroupMessageService {
}
// 禁言check
- commentBlackService.check(frontUser.getUserId());
+ if (commentBlackService.checkIsBlack(frontUser.getUserId(), groupId, ProductType.GROUP.value)) {
+ throw new BizException(ResponseStatus.COMMENT_BLACK_USER_ERROR);
+ }
- GroupMessage message = query.toPO(frontUser);
+ GroupMessageStatus status = IsOrNot.IS.value.equals(groupVO.getFirstAudit()) ? GroupMessageStatus.INITIAL : GroupMessageStatus.AUDITED;
+ GroupMessage message = query.toPO(frontUser, status);
message.setContent(TextUtil.cleanUnsafeHtml(content));
groupMessageMapper.insert(message);
Map advisorMap = advisorInfoService.getAdvisorVoMap();
- GroupMessageVO vo = new GroupMessageVO(message, advisorMap.get(message.getAdvisorId()));
+ GroupMessageVO vo = groupCacheService.getMessage(message, advisorMap);
if (!IsOrNot.IS.value.equals(groupVO.getFirstAudit())) {
groupMessageService.publishGroupMessage(GroupMessageChannel.ALL, GroupMessageType.NORMAL, groupId, vo);
diff --git a/src/main/java/com/upchina/group/service/common/GroupCacheService.java b/src/main/java/com/upchina/group/service/common/GroupCacheService.java
index 80a12f0..9d7c525 100644
--- a/src/main/java/com/upchina/group/service/common/GroupCacheService.java
+++ b/src/main/java/com/upchina/group/service/common/GroupCacheService.java
@@ -50,9 +50,6 @@ public class GroupCacheService {
// }
public NavigableSet getMessageIdSet(Integer groupId, String userId, QueryGroupMessageType type) {
- if (QueryGroupMessageType.CUSTOMER.equals(type)) {
- throw new BizException(ResponseStatus.PARM_ERROR, "查询类型错误");
- }
String cacheKey = buildMessageIdSetKey(userId, type);
return cacheService.get(groupCache, cacheKey, () -> {
LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
@@ -134,10 +131,17 @@ public class GroupCacheService {
if (message == null) {
return null;
}
- return new GroupMessageVO(message, advisorMap.get(message.getAdvisorId()));
+ return getMessage(message, advisorMap);
});
}
+ public GroupMessageVO getMessage(GroupMessage message, Map advisorMap) {
+ GroupMessageVO vo = new GroupMessageVO(message, advisorMap.get(message.getAdvisorId()));
+ vo.setReplyMessage(getMessage(message.getReplyId(), advisorMap));
+ vo.setQuoteMessage(getMessage(message.getQuoteId(), advisorMap));
+ return vo;
+ }
+
public IMap getTotalOnlineMap(Integer groupId) {
return cacheService.getMap(CacheKey.GroupKey.USER_TOTAL_ONLINE + groupId, () -> {
synchronized (GroupCacheService.class) {
diff --git a/src/main/java/com/upchina/group/service/common/GroupMessageService.java b/src/main/java/com/upchina/group/service/common/GroupMessageService.java
index b179af1..d08fb5c 100644
--- a/src/main/java/com/upchina/group/service/common/GroupMessageService.java
+++ b/src/main/java/com/upchina/group/service/common/GroupMessageService.java
@@ -1,5 +1,6 @@
package com.upchina.group.service.common;
+import cn.hutool.json.JSONUtil;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.topic.ITopic;
import com.upchina.common.config.cache.CacheKey;
@@ -100,6 +101,7 @@ public class GroupMessageService {
if (containSessionId) {
destination += "/" + payload.getSessionId();
}
+ System.out.println("===Listener destination:" + destination + ", payload" + JSONUtil.toJsonStr(payload));
simpMessagingTemplate.convertAndSend(destination, payload);
});
return topic;
diff --git a/src/main/java/com/upchina/group/vo/GroupVO.java b/src/main/java/com/upchina/group/vo/GroupVO.java
index 625336a..ed3c22e 100644
--- a/src/main/java/com/upchina/group/vo/GroupVO.java
+++ b/src/main/java/com/upchina/group/vo/GroupVO.java
@@ -36,6 +36,9 @@ public class GroupVO implements Serializable {
@ApiModelProperty("欢迎语")
private String welcomeMessage;
+ @ApiModelProperty("公告")
+ private String notice;
+
@ApiModelProperty("互动状态 1:开启 2:关闭")
private Integer interactiveStatus;
@@ -122,6 +125,7 @@ public class GroupVO implements Serializable {
this.applicableUser = groupInfo.getApplicableUser();
this.detail = groupInfo.getDetail();
this.welcomeMessage = groupInfo.getWelcomeMessage();
+ this.notice = groupInfo.getNotice();
this.privateChatStatus = groupInfo.getPrivateChatStatus();
this.interactiveStatus = groupInfo.getInteractiveStatus();
this.showMemberCount = groupInfo.getShowMemberCount();
@@ -212,10 +216,19 @@ public class GroupVO implements Serializable {
this.welcomeMessage = welcomeMessage;
}
+ public String getNotice() {
+ return notice;
+ }
+
+ public void setNotice(String notice) {
+ this.notice = notice;
+ }
+
public Integer getInteractiveStatus() {
return interactiveStatus;
}
+
public void setInteractiveStatus(Integer interactiveStatus) {
this.interactiveStatus = interactiveStatus;
}
diff --git a/src/main/java/com/upchina/group/vo/message/GroupMessageVO.java b/src/main/java/com/upchina/group/vo/message/GroupMessageVO.java
index 7d45b8a..f77bf59 100644
--- a/src/main/java/com/upchina/group/vo/message/GroupMessageVO.java
+++ b/src/main/java/com/upchina/group/vo/message/GroupMessageVO.java
@@ -21,7 +21,7 @@ public class GroupMessageVO implements Serializable {
@ApiModelProperty("交互类型:1群聊;2私聊;3会话消息")
private Integer interactiveType;
- @ApiModelProperty("用户类型")
+ @ApiModelProperty("用户类型:1投顾;2用户;3助教;4运营人员")
private Integer userType;
@ApiModelProperty("用户ID")
@@ -33,7 +33,7 @@ public class GroupMessageVO implements Serializable {
@ApiModelProperty("消息内容")
private String content;
- @ApiModelProperty("发布类型")
+ @ApiModelProperty("发布类型 1:文本 2:图片 3:文件 4:产品 5:问卷")
private Integer contentType;
@ApiModelProperty("回复消息ID")
@@ -48,7 +48,7 @@ public class GroupMessageVO implements Serializable {
@ApiModelProperty("引用消息")
private GroupMessageVO quoteMessage;
- @ApiModelProperty("状态")
+ @ApiModelProperty("状态:1初始;2已审核;3已删除")
private Integer status;
@ApiModelProperty("创建时间")
@@ -57,6 +57,9 @@ public class GroupMessageVO implements Serializable {
@ApiModelProperty("投顾ID")
private Integer advisorId;
+ @ApiModelProperty("是否精选 1是 2否")
+ private Integer isRecommend;
+
@ApiModelProperty("投顾")
private AdvisorBasicVO advisor;
@@ -78,6 +81,7 @@ public class GroupMessageVO implements Serializable {
this.status = message.getStatus();
this.createTime = message.getCreateTime();
this.advisorId = message.getAdvisorId();
+ this.isRecommend = message.getIsRecommend();
this.advisor = advisor;
}
@@ -209,6 +213,14 @@ public class GroupMessageVO implements Serializable {
this.advisorId = advisorId;
}
+ public Integer getIsRecommend() {
+ return isRecommend;
+ }
+
+ public void setIsRecommend(Integer isRecommend) {
+ this.isRecommend = isRecommend;
+ }
+
public AdvisorBasicVO getAdvisor() {
return advisor;
}
diff --git a/src/main/java/com/upchina/video/service/admin/AdminVideoMessageService.java b/src/main/java/com/upchina/video/service/admin/AdminVideoMessageService.java
index 1ac20fa..718fe19 100644
--- a/src/main/java/com/upchina/video/service/admin/AdminVideoMessageService.java
+++ b/src/main/java/com/upchina/video/service/admin/AdminVideoMessageService.java
@@ -194,7 +194,7 @@ public class AdminVideoMessageService {
List prdList = videoCommonService.getMergeProductList(vo.getVideoId(), new String[]{message.getRecommendProduct()});
vo.setProductBasic(prdList.isEmpty() ? null : prdList.get(0));
}
- vo.setIsForbid(videoCommonService.checkAppForbidden(message.getUserId()) ? IsOrNot.IS.value : IsOrNot.NOT.value);
+ vo.setIsForbid(videoCommonService.checkAppForbidden(message.getUserId(), videoId) ? IsOrNot.IS.value : IsOrNot.NOT.value);
vo.setIsCurrentUser(backendUser != null && backendUser.getAdvisorId() != null && backendUser.getAdvisorId().toString().equals(message.getUserId()) ? IsOrNot.IS.value : IsOrNot.NOT.value);
// 手机号及用户名脱敏
if (VideoHelper.isPhone(message.getUserId())) {
diff --git a/src/main/java/com/upchina/video/service/app/AppVideoMessageService.java b/src/main/java/com/upchina/video/service/app/AppVideoMessageService.java
index 0a58740..33a1017 100644
--- a/src/main/java/com/upchina/video/service/app/AppVideoMessageService.java
+++ b/src/main/java/com/upchina/video/service/app/AppVideoMessageService.java
@@ -169,7 +169,7 @@ public class AppVideoMessageService {
VideoLiveMessage message = videoCacheService.getVideoMessageInfo(messageId);
VideoMessageAppVO vo = new VideoMessageAppVO(message);
if (StrUtil.isNotBlank(message.getUserId())) {
- vo.setIsForbid(videoCommonService.checkAppForbidden(message.getUserId()) ? IsOrNot.IS.value : IsOrNot.NOT.value);
+ vo.setIsForbid(videoCommonService.checkAppForbidden(message.getUserId(), vo.getVideoId()) ? IsOrNot.IS.value : IsOrNot.NOT.value);
}
if (message.getReplyId() != null) {
VideoLiveMessage replyMessage = videoCacheService.getVideoMessageInfo(message.getReplyId());
@@ -259,7 +259,7 @@ public class AppVideoMessageService {
commentService.saveComment(commentQuery, frontUser);
} else {
// 直播走消息接口
- if (videoCommonService.checkAppForbidden(userId)) {
+ if (videoCommonService.checkAppForbidden(userId, videoId)) {
throw new BizException(ResponseStatus.COMMENT_BLACK_USER_ERROR, "您已被禁言");
}
message.setContent(TextUtil.cleanUnsafeHtml(message.getContent()));
@@ -268,7 +268,7 @@ public class AppVideoMessageService {
videoLiveMessageMapper.insert(message);
VideoMessageAppVO vo = new VideoMessageAppVO(message);
if (StrUtil.isNotBlank(message.getUserId())) {
- if (videoCommonService.checkAppForbidden(message.getUserId())) {
+ if (videoCommonService.checkAppForbidden(message.getUserId(), videoId)) {
vo.setIsForbid(IsOrNot.IS.value);
} else {
vo.setIsForbid(IsOrNot.NOT.value);
diff --git a/src/main/java/com/upchina/video/service/common/VideoCommonService.java b/src/main/java/com/upchina/video/service/common/VideoCommonService.java
index c7e8c71..5c17208 100644
--- a/src/main/java/com/upchina/video/service/common/VideoCommonService.java
+++ b/src/main/java/com/upchina/video/service/common/VideoCommonService.java
@@ -331,12 +331,8 @@ public class VideoCommonService {
*
* @param phone 客户手机号
*/
- public boolean checkAppForbidden(String phone) {
- Set blackUser = commentBlackService.getAllBlackUser();
- if (blackUser == null || StrUtil.isEmpty(phone)) {
- return false;
- }
- return blackUser.contains(phone);
+ public boolean checkAppForbidden(String phone, Integer videoId) {
+ return commentBlackService.checkIsBlack(phone, videoId, ProductType.VIDEO_SINGLE.value);
}
/**
diff --git a/src/main/java/com/upchina/video/service/common/VideoMessageService.java b/src/main/java/com/upchina/video/service/common/VideoMessageService.java
index ec7a9c5..c798e7b 100644
--- a/src/main/java/com/upchina/video/service/common/VideoMessageService.java
+++ b/src/main/java/com/upchina/video/service/common/VideoMessageService.java
@@ -276,7 +276,7 @@ public class VideoMessageService {
// vo.setUserName(VideoHelper.maskUserName(message.getUserName()));
}
if (StrUtil.isNotBlank(message.getUserId())) {
- if (videoCommonService.checkAppForbidden(message.getUserId())) {
+ if (videoCommonService.checkAppForbidden(message.getUserId(), message.getVideoId())) {
vo.setIsForbid(IsOrNot.IS.value);
} else {
vo.setIsForbid(IsOrNot.NOT.value);
diff --git a/src/main/resources/conf/advisorServer.yaml b/src/main/resources/conf/advisorServer.yaml
index 707a857..5e69983 100644
--- a/src/main/resources/conf/advisorServer.yaml
+++ b/src/main/resources/conf/advisorServer.yaml
@@ -15,16 +15,16 @@ hazelcast:
serverPort: 5709 #自己作为缓存服务器监听的端口号
scheduledEnable: true
cron:
- saveVideoCount: "10 * * * * ?" #从cache刷新视频播放量到DB 每分钟的第10s执行
- refreshTranscodeStatus: "2 3/5 * * * ?" #从腾讯云拉取录播上传视频信息更新到DB
- updateLiveStatus: "3 1 * * * ?" #更新视频录播状态
+ collectLivingVideo: "30 1/5 * * * ?" #每分钟统计已开始但未结束的视频直播数据
+ saveVideoCount: "30 2/2 * * * ?" #从cache刷新视频播放量到DB 每分钟的第10s执行
+ saveVideoUserDataToDB: "30 3/5 * * * ?"
+ saveCustomerDataToDB: "30 4/5 * * * ?" #收集用户信息
+ refreshTranscodeStatus: "30 0/5 * * * ?" #从腾讯云拉取录播上传视频信息更新到DB
+ updateLiveStatus: "0 1 * * * ?" #更新视频录播状态
stopLivingVideo: "0 1-5 0 * * ?" #结束前一天直播中/暂停中的视频直播
- saveVideoUserDataToDB: "20 * * * * ?"
- saveCustomerDataToDB: "50 * * * * ?" #收集用户信息
- saveWatchSeconds: "5 4/5 * * * ?" #保存短视频观看时长
+ saveWatchSeconds: "0 0/5 * * * ?" #保存短视频观看时长
collectLastWeek: "0 30 3 * * ?" #统计一周内的数据
- collectLivingVideo: "0 * * * * ?" #每分钟统计已开始但未结束的视频直播数据
- collectRecentEndVideo: "8 */5 * * * ?" #每5分钟统计已结束48小时以内的视频直播数据
+ collectRecentEndVideo: "0 2/5 * * * ?" #每5分钟统计已结束48小时以内的视频直播数据
user:
admin:
roles: 1,3,4,5 #管理员角色id,用逗号隔开
@@ -45,7 +45,7 @@ aes:
iv: gbb9qknndntteqc1
resizeUrl:
main: http://8.138.144.54:8080/s/ #生产配置 http://s.upchina.com/s/
- original: http://8.138.144.54:8080/syzbh5/videoPlay
+ original: http://8.138.144.54:8080/syzbh5
urlMain: /videoPlay?id=
shortVideoUrl: /shotVideoPlay?id=
pc: