完善需求和逻辑问题
This commit is contained in:
parent
94383b9e23
commit
9ef12e0a82
34
deploy.bat
Normal file
34
deploy.bat
Normal file
@ -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!
|
||||
23
pom.xml
23
pom.xml
@ -185,4 +185,27 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>thin-jar</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.upchina.startup.Main</mainClass>
|
||||
<layout>ZIP</layout>
|
||||
<includes>
|
||||
<include>
|
||||
<groupId>nothing</groupId>
|
||||
<artifactId>nothing</artifactId>
|
||||
</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<Integer> 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<Void> removeCommentBlack(@NotNull @ApiParam(value = "用户手机号") @RequestParam("phone") String phone) {
|
||||
commentBlackService.removeCommentBlack(phone);
|
||||
public CommonResult<Void> 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<Pager<CommentBlackVO>> queryCommentBlackList(@RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO,
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -27,40 +27,30 @@ public class WebSocketAuthHandler {
|
||||
private Set<Integer> VALID_PRODUCT_TYPES = ImmutableSet.of(ProductType.VIDEO_SINGLE.value, ProductType.GROUP.value);
|
||||
|
||||
public Message<?> handleConnect(Message<?> message, StompHeaderAccessor header) {
|
||||
validateHeaders(header);
|
||||
Map<String, Object> 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)) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<String> getAllBlackUser() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<CommentBlack> list = cacheService.get(COMMENT_BLACK, ALL_BLACK_USER, () -> {
|
||||
QueryWrapper<CommentBlack> wrapper = Wrappers.query();
|
||||
wrapper.in("status", Arrays.asList(CommentBlackStatus.EFFECT.value, CommentBlackStatus.EXPIRED.value));
|
||||
List<CommentBlack> 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<String> 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<CommentBlack> 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<CommentBlackVO> queryCommentBlackList(BackendUserVO backendUserVO, CommentBlackQuery commentBlackQuery) {
|
||||
public Pager<CommentBlackVO> 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<Integer> advisorIdSet = authService.getAccessibleAdviserSet(null, backendUserVO, UserType.fromValue(commentBlackQuery.getUserType()));
|
||||
if (advisorIdSet != null && advisorIdSet.isEmpty()) {
|
||||
return Pager.emptyPager();
|
||||
}*/
|
||||
QueryWrapper<CommentBlack> 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<CommentBlack> page = commentBlackMapper.selectPage(commentBlackQuery.toPage(), wrapper);
|
||||
Page<CommentBlack> page = commentBlackMapper.selectPage(query.toPage(), wrapper);
|
||||
List<CommentBlack> 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<String> cacheKeys) {
|
||||
private void clearCache(String... cacheKeys) {
|
||||
IMap<String, Object> 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<String> blackUsers = getAllBlackUser();
|
||||
if (CollUtil.isNotEmpty(blackUsers) && blackUsers.contains(phone)) {
|
||||
throw new BizException("禁言用户,禁止发言");
|
||||
if (!blackUsers.contains(phone)) {
|
||||
return false;
|
||||
}
|
||||
List<CommentBlack> 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<String> getAllBlackUser() {
|
||||
return cacheService.get(COMMENT_BLACK, ALL_BLACK_USER, () ->
|
||||
getAllBlackComment().stream().map(CommentBlack::getPhone).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
private List<CommentBlack> getAllBlackComment() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return cacheService.get(COMMENT_BLACK, ALL_BLACK_COMMENT, () -> {
|
||||
QueryWrapper<CommentBlack> wrapper = Wrappers.<CommentBlack>query()
|
||||
.in("status", Arrays.asList(CommentBlackStatus.EFFECT.value, CommentBlackStatus.EXPIRED.value))
|
||||
.lt("start_time", now)
|
||||
.gt("end_time", now);
|
||||
List<CommentBlack> commentBlackList = commentBlackMapper.selectList(wrapper);
|
||||
LoggerUtil.info("db当前黑名单用户:" + JSONObject.toJSONString(commentBlackList));
|
||||
return commentBlackList;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<Integer, Integer, MergeProductInfoVO> productTable = mergeProductService.queryMergeProductInfo(baseProductQueryList);
|
||||
Map<Integer, UserDept> userMap = userService.getUserMap();
|
||||
// 判断是否禁言用户
|
||||
Set<String> blackUsers = commentBlackService.getAllBlackUser();
|
||||
Map<String, Dept> deptMap = deptService.getDeptMap();
|
||||
Map<Integer, AdvisorBasic> userIdAdvisorMap = advisorInfoService.getUserIdAdvisorMap();
|
||||
List<CommentVO> 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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Void> setNotice(@Validated @RequestBody @ApiParam(required = true) SetNoticeQuery query,
|
||||
@RequestAttribute(value = "backendUser", required = false) BackendUserVO backendUserVO) {
|
||||
groupInfoService.setNotice(query, backendUserVO);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
@ -75,6 +75,15 @@ public class AdminGroupMessageController {
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("后台设置消息精选")
|
||||
@PostMapping("/admin/group/message/setMessageRecommend")
|
||||
public CommonResult<Void> 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<Void> setInteractiveStatus(
|
||||
|
||||
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
47
src/main/java/com/upchina/group/query/SetNoticeQuery.java
Normal file
47
src/main/java/com/upchina/group/query/SetNoticeQuery.java
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<String, Object> 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<Integer, AdvisorBasicVO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<Integer, AdvisorBasicVO> 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);
|
||||
|
||||
@ -50,9 +50,6 @@ public class GroupCacheService {
|
||||
// }
|
||||
|
||||
public NavigableSet<Integer> 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<GroupMessage> wrapper = Wrappers.<GroupMessage>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<Integer, AdvisorBasicVO> 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<String, OnlineUser> getTotalOnlineMap(Integer groupId) {
|
||||
return cacheService.getMap(CacheKey.GroupKey.USER_TOTAL_ONLINE + groupId, () -> {
|
||||
synchronized (GroupCacheService.class) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ public class AdminVideoMessageService {
|
||||
List<VideoProductInfoVO> 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())) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -331,12 +331,8 @@ public class VideoCommonService {
|
||||
*
|
||||
* @param phone 客户手机号
|
||||
*/
|
||||
public boolean checkAppForbidden(String phone) {
|
||||
Set<String> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user