Compare commits
No commits in common. "ecc03229bd905dfaacb7063eccc9be0dc36f37c9" and "97a9ebdf56e98e3e93ed79408a8a2f626a13185f" have entirely different histories.
ecc03229bd
...
97a9ebdf56
|
@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -89,7 +88,7 @@ public class AliPayController extends BaseController {
|
||||||
* @param authCode 授权码
|
* @param authCode 授权码
|
||||||
*/
|
*/
|
||||||
@GetMapping("/callback")
|
@GetMapping("/callback")
|
||||||
public String callback(@RequestParam("auth_code") String authCode, String state) throws FileNotFoundException {
|
public String callback(@RequestParam("auth_code") String authCode, String state) {
|
||||||
|
|
||||||
System.out.println("authCode = " + authCode);
|
System.out.println("authCode = " + authCode);
|
||||||
String result = aliPayService.bindingCallback(authCode, state);
|
String result = aliPayService.bindingCallback(authCode, state);
|
||||||
|
|
|
@ -48,9 +48,9 @@ public class ModelCommentController {
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@GetMapping("/modelLike")
|
@GetMapping("/modelLike")
|
||||||
public R<Object> like(@Valid
|
public R<Object> like(@Valid
|
||||||
@NotNull(message = "模型id不能为空")
|
@NotNull(message = "模型id不能为空")
|
||||||
@ApiParam(value = "模型id", required = true)
|
@ApiParam(value = "模型id", required = true)
|
||||||
Long modelId) {
|
Long modelId) {
|
||||||
modelLikeService.like(modelId);
|
modelLikeService.like(modelId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,9 @@ public class ModelCommentController {
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@GetMapping("/commentLike")
|
@GetMapping("/commentLike")
|
||||||
public R<Object> commentLike(@Valid
|
public R<Object> commentLike(@Valid
|
||||||
@NotNull(message = "评论id不能为空")
|
@NotNull(message = "评论id不能为空")
|
||||||
@ApiParam(value = "评论id", required = true)
|
@ApiParam(value = "评论id", required = true)
|
||||||
Long commentId) {
|
Long commentId) {
|
||||||
modelCommentLikeService.like(commentId);
|
modelCommentLikeService.like(commentId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -85,16 +85,16 @@ public class ModelCommentController {
|
||||||
* 获取模型评论
|
* 获取模型评论
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取模型评论")
|
@ApiOperation(value = "获取模型评论")
|
||||||
@GetMapping("/getComment")
|
@GetMapping("/comment")
|
||||||
@Valid
|
@Valid
|
||||||
public R<List<ModelCommentVo>> getComment(@Valid
|
public R<List<ModelCommentVo>> getComment(@Valid
|
||||||
@NotNull(message = "模型id不能为空")
|
@NotNull(message = "模型id不能为空")
|
||||||
@ApiParam(value = "模型id", required = true)
|
@ApiParam(value = "模型id", required = true)
|
||||||
Long modelId,
|
Long modelId,
|
||||||
@Valid
|
@Valid
|
||||||
@NotNull(message = "排序方式不能为空")
|
@NotNull(message = "排序方式不能为空")
|
||||||
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
||||||
Integer sortType) {
|
Integer sortType) {
|
||||||
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType);
|
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType);
|
||||||
return R.ok(modelCommentList);
|
return R.ok(modelCommentList);
|
||||||
}
|
}
|
||||||
|
@ -106,9 +106,9 @@ public class ModelCommentController {
|
||||||
@ApiOperation(value = "删除模型评论")
|
@ApiOperation(value = "删除模型评论")
|
||||||
@GetMapping("/commentDelete")
|
@GetMapping("/commentDelete")
|
||||||
public R<Object> commentDelete(@Valid
|
public R<Object> commentDelete(@Valid
|
||||||
@NotNull(message = "评论id不能为空")
|
@NotNull(message = "评论id不能为空")
|
||||||
@ApiParam(value = "评论id", required = true)
|
@ApiParam(value = "评论id", required = true)
|
||||||
Long commentId) {
|
Long commentId) {
|
||||||
modelCommentService.removeById(commentId);
|
modelCommentService.removeById(commentId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ public class ModelImageCommentController {
|
||||||
@RepeatSubmit(interval = 1000)
|
@RepeatSubmit(interval = 1000)
|
||||||
@GetMapping("/commentLike")
|
@GetMapping("/commentLike")
|
||||||
public R<Object> commentLike(@Valid
|
public R<Object> commentLike(@Valid
|
||||||
@NotNull(message = "评论id不能为空")
|
@NotNull(message = "评论id不能为空")
|
||||||
@ApiParam(value = "评论id", required = true)
|
@ApiParam(value = "评论id", required = true)
|
||||||
Long commentId) {
|
Long commentId) {
|
||||||
modelImageCommentLikeService.like(commentId);
|
modelImageCommentLikeService.like(commentId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ public class ModelImageCommentController {
|
||||||
@ApiOperation(value = "删除图片评论")
|
@ApiOperation(value = "删除图片评论")
|
||||||
@GetMapping("/commentDelete")
|
@GetMapping("/commentDelete")
|
||||||
public R<Object> commentDelete(@Valid
|
public R<Object> commentDelete(@Valid
|
||||||
@NotNull(message = "评论id不能为空")
|
@NotNull(message = "评论id不能为空")
|
||||||
@ApiParam(value = "评论id", required = true) Long commentId) {
|
@ApiParam(value = "评论id", required = true) Long commentId) {
|
||||||
modelImageCommentService.removeById(commentId);
|
modelImageCommentService.removeById(commentId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -74,16 +74,16 @@ public class ModelImageCommentController {
|
||||||
* 获取图片评论
|
* 获取图片评论
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取图片评论")
|
@ApiOperation(value = "获取图片评论")
|
||||||
@GetMapping("/getComment")
|
@GetMapping("/comment")
|
||||||
@Valid
|
@Valid
|
||||||
public R<List<ModelImageCommentVo>> getComment(@Valid
|
public R<List<ModelImageCommentVo>> getComment(@Valid
|
||||||
@NotNull(message = "图片id不能为空")
|
@NotNull(message = "图片id不能为空")
|
||||||
@ApiParam(value = "评论id", required = true)
|
@ApiParam(value = "评论id", required = true)
|
||||||
Long imageId,
|
Long imageId,
|
||||||
@Valid
|
@Valid
|
||||||
@NotNull(message = "排序方式不能为空")
|
@NotNull(message = "排序方式不能为空")
|
||||||
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
||||||
Integer sortType) {
|
Integer sortType) {
|
||||||
List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType);
|
List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType);
|
||||||
return R.ok(modelImageCommentVoList);
|
return R.ok(modelImageCommentVoList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
package com.mcwl.web.controller.resource;
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.R;
|
|
||||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.LikeAdviceVo;
|
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息通知
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("advice")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Api(tags = "消息通知")
|
|
||||||
public class SysAdviceController {
|
|
||||||
|
|
||||||
private final ISysAdviceService sysAdviceService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 已读
|
|
||||||
*/
|
|
||||||
@GetMapping("read")
|
|
||||||
@ApiOperation(value = "已读")
|
|
||||||
public R<String> read(@Valid
|
|
||||||
@NotNull(message = "消息id不能为空")
|
|
||||||
@ApiParam(value = "消息id", required = true)
|
|
||||||
Long adviceId) {
|
|
||||||
sysAdviceService.read(adviceId);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一键已读
|
|
||||||
*/
|
|
||||||
@GetMapping("readAll")
|
|
||||||
@ApiOperation(value = "一键已读")
|
|
||||||
public R<String> readAll() {
|
|
||||||
sysAdviceService.readAll();
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取所有通知
|
|
||||||
*/
|
|
||||||
@GetMapping("getAllMsg")
|
|
||||||
@ApiOperation(value = "获取所有通知")
|
|
||||||
public R<List<AdviceVo>> getAllMsg() {
|
|
||||||
List<AdviceVo> adviceVo = sysAdviceService.getAllMsg();
|
|
||||||
return R.ok(adviceVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取评论通知
|
|
||||||
*/
|
|
||||||
@GetMapping("getCommentMsg")
|
|
||||||
@ApiOperation(value = "获取评论通知")
|
|
||||||
public R<List<CommentAdviceVo>> getCommentMsg(@Valid
|
|
||||||
@NotNull(message = "类型不能为空")
|
|
||||||
@ApiParam(value = "类型 0模型 1工作流 2图片 3全部", required = true)
|
|
||||||
Integer productType) {
|
|
||||||
List<CommentAdviceVo> adviceVo = sysAdviceService.getCommentMsg(productType);
|
|
||||||
return R.ok(adviceVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取点赞通知
|
|
||||||
*/
|
|
||||||
@GetMapping("getLikeMsg")
|
|
||||||
@ApiOperation(value = "获取点赞通知")
|
|
||||||
public R<List<LikeAdviceVo>> getLikeMsg(@Valid
|
|
||||||
@NotNull(message = "类型不能为空")
|
|
||||||
@ApiParam(value = "类型 0模型 1工作流 2图片 3评论 4全部", required = true)
|
|
||||||
Integer productType) {
|
|
||||||
List<LikeAdviceVo> likeAdviceVoList = sysAdviceService.getLikeMsg(productType);
|
|
||||||
return R.ok(likeAdviceVoList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取关注通知
|
|
||||||
*/
|
|
||||||
@GetMapping("getAttentionMsg")
|
|
||||||
@ApiOperation(value = "获取关注通知")
|
|
||||||
public R<List<AttentionAdviceVo>> getAttentionMsg() {
|
|
||||||
List<AttentionAdviceVo> attentionAdviceVoList = sysAdviceService.getAttentionMsg();
|
|
||||||
return R.ok(attentionAdviceVoList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ import com.mcwl.common.core.domain.R;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
import com.mcwl.resource.domain.SysUserInfo;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
import com.mcwl.resource.service.SysUserAttentionService;
|
|
||||||
import com.mcwl.resource.service.impl.SysUserAttentionServiceImpl;
|
import com.mcwl.resource.service.impl.SysUserAttentionServiceImpl;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -26,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
public class SysUserAttentionController {
|
public class SysUserAttentionController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserAttentionService sysUserAttentionService;
|
private SysUserAttentionServiceImpl sysUserAttentionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加/取消关注
|
* 添加/取消关注
|
||||||
|
@ -62,9 +61,9 @@ public class SysUserAttentionController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
|
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
|
||||||
@GetMapping("/selectUserInfo")
|
@GetMapping("/selectUserInfo")
|
||||||
public R<SysUserInfo> selectUserInfo(Long userId){
|
public R<SysUserInfo> selectUserInfo(){
|
||||||
|
|
||||||
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo(userId);
|
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo();
|
||||||
|
|
||||||
return R.ok(sysUserInfo);
|
return R.ok(sysUserInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class WorkFlowCommentController {
|
||||||
* 获取工作流评论
|
* 获取工作流评论
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取工作流评论")
|
@ApiOperation(value = "获取工作流评论")
|
||||||
@GetMapping("/getComment")
|
@GetMapping("/comment")
|
||||||
public R<List<WorkFlowCommentVo>> getComment(@Valid
|
public R<List<WorkFlowCommentVo>> getComment(@Valid
|
||||||
@NotNull(message = "模型id不能为空")
|
@NotNull(message = "模型id不能为空")
|
||||||
@ApiParam(value = "模型id", required = true)
|
@ApiParam(value = "模型id", required = true)
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.mcwl.web.controller.system;
|
||||||
|
|
||||||
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
|
import com.mcwl.system.domain.vo.AdviceVo;
|
||||||
|
import com.mcwl.system.service.ISysAdviceService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("system/advice")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysAdviceController {
|
||||||
|
|
||||||
|
private final ISysAdviceService sysAdviceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前用户获取新消息提醒
|
||||||
|
*/
|
||||||
|
@GetMapping("getUserNewMsg")
|
||||||
|
public AjaxResult getUserNewMsg() {
|
||||||
|
List<AdviceVo> adviceVo = sysAdviceService.getUserNewMsg();
|
||||||
|
return AjaxResult.success(adviceVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前用户获取系统公告
|
||||||
|
*/
|
||||||
|
@GetMapping("getUserSystemNotice")
|
||||||
|
public AjaxResult getUserSystemNotice() {
|
||||||
|
List<AdviceVo> adviceVo = sysAdviceService.getUserSystemNotice();
|
||||||
|
return AjaxResult.success(adviceVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前用户获取所有消息
|
||||||
|
*/
|
||||||
|
@GetMapping("getUserAllMsg")
|
||||||
|
public AjaxResult getUserAllMsg() {
|
||||||
|
List<AdviceVo> adviceVo = sysAdviceService.getUserAllMsg();
|
||||||
|
return AjaxResult.success(adviceVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有消息
|
||||||
|
*/
|
||||||
|
@GetMapping("getAllMsg")
|
||||||
|
public AjaxResult getAllMsg() {
|
||||||
|
List<AdviceVo> adviceVo = sysAdviceService.getAllMsg();
|
||||||
|
return AjaxResult.success(adviceVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,147 +0,0 @@
|
||||||
# 数据源配置
|
|
||||||
spring:
|
|
||||||
#mq
|
|
||||||
rabbitmq:
|
|
||||||
host: 1.13.246.108
|
|
||||||
port: 5672
|
|
||||||
username: guest
|
|
||||||
password: guest
|
|
||||||
virtualHost: /
|
|
||||||
listener:
|
|
||||||
simple:
|
|
||||||
prefetch: 1 # 每次之能获取一条
|
|
||||||
acknowledge-mode: manual # 设置消费端手动ack确认
|
|
||||||
retry:
|
|
||||||
enabled: true # 是否支持重试
|
|
||||||
# 生产者配置
|
|
||||||
publisher-confirm-type: correlated #确认消息已发送到交换机(Exchange)
|
|
||||||
publisher-returns: true #确认消息已发送到队列(Queue)
|
|
||||||
|
|
||||||
datasource:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
druid:
|
|
||||||
# 主库数据源
|
|
||||||
master:
|
|
||||||
url: jdbc:mysql://1.13.246.108:3306/mcwl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: ybl123456@
|
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: false
|
|
||||||
url:
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
# 初始连接数
|
|
||||||
initialSize: 5
|
|
||||||
# 最小连接池数量
|
|
||||||
minIdle: 10
|
|
||||||
# 最大连接池数量
|
|
||||||
maxActive: 20
|
|
||||||
# 配置获取连接等待超时的时间
|
|
||||||
maxWait: 60000
|
|
||||||
# 配置连接超时时间
|
|
||||||
connectTimeout: 30000
|
|
||||||
# 配置网络超时时间
|
|
||||||
socketTimeout: 60000
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
|
||||||
maxEvictableIdleTimeMillis: 900000
|
|
||||||
# 配置检测连接是否有效
|
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
webStatFilter:
|
|
||||||
enabled: true
|
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: mcwl
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
|
||||||
stat:
|
|
||||||
enabled: true
|
|
||||||
# 慢SQL记录
|
|
||||||
log-slow-sql: true
|
|
||||||
slow-sql-millis: 1000
|
|
||||||
merge-sql: true
|
|
||||||
wall:
|
|
||||||
config:
|
|
||||||
multi-statement-allow: true
|
|
||||||
# redis 配置
|
|
||||||
redis:
|
|
||||||
# 地址
|
|
||||||
host: 1.13.246.108
|
|
||||||
# 端口,默认为6379
|
|
||||||
port: 6370
|
|
||||||
# 数据库索引
|
|
||||||
database: 0
|
|
||||||
# 密码
|
|
||||||
password: MuYu_Cloud@Redis
|
|
||||||
# 连接超时时间
|
|
||||||
timeout: 10s
|
|
||||||
lettuce:
|
|
||||||
pool:
|
|
||||||
# 连接池中的最小空闲连接
|
|
||||||
min-idle: 0
|
|
||||||
# 连接池中的最大空闲连接
|
|
||||||
max-idle: 8
|
|
||||||
# 连接池的最大数据库连接数
|
|
||||||
max-active: 8
|
|
||||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
|
||||||
max-wait: -1ms
|
|
||||||
|
|
||||||
# 公众号配置
|
|
||||||
wechat:
|
|
||||||
# 应用ID
|
|
||||||
appid: wx82d4c3c96f0ffa5b
|
|
||||||
# 应用密钥
|
|
||||||
secret: abbabcf1da711a3bbd95387ec83edcac
|
|
||||||
|
|
||||||
# yml版(application.yml)
|
|
||||||
aliyun:
|
|
||||||
oss:
|
|
||||||
bucketName: ybl2112
|
|
||||||
endpoint: oss-cn-beijing.aliyuncs.com
|
|
||||||
accessKeyId: LTAI5tSHZZ8wHJRP8X4r9TXT
|
|
||||||
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
|
|
||||||
accessPre: https://ybl2112.oss-cn-beijing.aliyuncs.com/
|
|
||||||
|
|
||||||
## 沙箱环境
|
|
||||||
mall:
|
|
||||||
mgt:
|
|
||||||
aliPayConfig:
|
|
||||||
protocol: https
|
|
||||||
gatewayHost: openapi-sandbox.dl.alipaydev.com
|
|
||||||
signType: RSA2
|
|
||||||
# 沙箱应用id
|
|
||||||
appId: 9021000135682614
|
|
||||||
# 沙箱应用私钥
|
|
||||||
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZoqyJclAIeb09ut7rY6mWzilA9kWmZnUG7MOWIU70RVRYrfJectCFw/odM9lG4XIVe13X2h+1ecTQyQzLWmnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMBAAECggEAIhaEYLwMSispXo8D2cES9iaOU/z91hUX6Qv2Q4anuqqoEZh8nN91Db6etTjFz1NxURvTklelxTsH97t56n26DRY0MWTYgd0Kw9Iz8MeOpKGb4nnAM97vpUq4QQBGfLRIC2ENdzu+7vA5JBFR88hsky/cWaNmJ/EbJauIIDneE7GigMR2HF7kfzdZzOBN4ZEh/ef5NKeCnEieRJJhWRgrgNXVZ44Tqi67AM7ey9pyUtBe7fgzxXtrWXBN9yKaVxxSXm3KJXFQqA6mcilFVZaxMNlAySc4MPTW8lq0ozOCOCunoeIphNz/OVIxGu3/voXFXlBfOKqOkYMVZxMY6OrvtQKBgQD0nIlXK4VW72VaGpz9kxQkRNzJV/yqaqet1GOSlPM2l0RCRFOVVdnvbQdHGPe6+HxHL1dh5MP8T/aHoP+4UXkkQCc8moS2FZxJvFH2QTSZBcSSdGL7GMpROqs38J+XlJzrhNcB20lrW6D7yMeQa4YEcXwdbD8Er/YaIqODBWYYewKBgQCXg+16RLDArciwwhf0TBWZPor2iYFDdwU5UPu7CKOhU1MLfQhG85gGpXHjB6G8cMUi/ezxh/FEl+sWOZegpkPwL5/BQS9tNYWIaC4kipPF/a5Up4DMYUHVAuuPwNqqXpvgU+rGjCns0wtPRnjrkghLkc3oTSID7o7pzUwIk2whDwKBgAys3+EIfExY82OL5X6uVGjcuKQmTw11oWK8krxRw5iclgjpCXu/ix+BAtOIU634mlgF9/02oYE9k4TLrvSaJDDgsifNyfq1e/fGLmkYT+VuCxWbulVQn4s+AwlPCrYMGWWK6KlL9638fYcOjGjLaZJpXwkXRtyzUYlhKh/r87JpAoGBAIavRp2mi/xrPvgpQQPv0k9L8llfOCHRnjoqC+thrZsNp8eRmJcBmMVnskofEZ2iHQuS71pw/n58EQTLo0ayJbhPjVJL8K3CovXzrfjbmqqoa5xi3bJQTiXdF6rMw1QpD6Uk05E1LVuQ6v/IZFr7kBYlAQWb8z3NhQq+bPU+nyLvAoGAGpBbSM8gPzdWQqkHoos0icu3cj0GhN3MU7+1Eb/rsXyh/lk5wtZTEnHjwhdUOUtwVNjvrv7CzA7unhOoaM6YcE/Zpd4zt8pjqH1Mhds7UHf4Xg+A+J4G6meYnhSwfBpOub02ncsqfBlXE0qhFv6AvcMewWndyLb8EYaUUXTYkG0=
|
|
||||||
# 沙箱应用公钥证书
|
|
||||||
appCertPath: cert/appPublicCert.crt
|
|
||||||
# 沙箱支付宝公钥证书路径
|
|
||||||
alipayCertPath: cert/alipayPublicCert.crt
|
|
||||||
# 沙箱支付宝根证书路径
|
|
||||||
alipayRootCertPath: cert/alipayRootCert.crt
|
|
||||||
notifyUrl: https://53a65908.r27.cpolar.top/ali/pay/notify
|
|
||||||
# 沙箱支付宝网关
|
|
||||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
|
||||||
|
|
||||||
huawei:
|
|
||||||
obs:
|
|
||||||
ak: NWXJ93POA9NCDVV1WQYJ
|
|
||||||
sk: 3aBuzYdUgSsxdNnycD2mESnVwtcyjAKPxqewE79N
|
|
||||||
bucketName: mcwl
|
|
||||||
upload:
|
|
||||||
endPoint: obs.cn-south-1.myhuaweicloud.com
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
spring:
|
spring:
|
||||||
#mq
|
#mq
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 113.45.74.175
|
host: 1.13.246.108
|
||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
@ -23,9 +23,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://113.45.74.175:3306/mcwl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://1.13.246.108:3306/mcwl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: Leng1128
|
password: ybl123456@
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
@ -79,7 +79,7 @@ spring:
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 113.45.74.175
|
host: 1.13.246.108
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6370
|
port: 6370
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
@ -115,28 +115,24 @@ aliyun:
|
||||||
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
|
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
|
||||||
accessPre: https://ybl2112.oss-cn-beijing.aliyuncs.com/
|
accessPre: https://ybl2112.oss-cn-beijing.aliyuncs.com/
|
||||||
|
|
||||||
# 线上环境
|
## 沙箱环境
|
||||||
mall:
|
mall:
|
||||||
mgt:
|
mgt:
|
||||||
aliPayConfig:
|
aliPayConfig:
|
||||||
protocol: https
|
protocol: https
|
||||||
gatewayHost: openapi-sandbox.dl.alipaydev.com
|
gatewayHost: openapi-sandbox.dl.alipaydev.com
|
||||||
signType: RSA2
|
signType: RSA2
|
||||||
# 线上应用id
|
# 沙箱应用id
|
||||||
appId: 2021005119630093
|
appId: 9021000143684202
|
||||||
# 线上应用私钥
|
# 沙箱应用私钥
|
||||||
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQuhRU5iHoabfzJS40A+moMKzb5rmi5XbL59K98CW65Oq/rnzQnj6sCYggIXOLCLKUykZ1XIVa+4V7bGFkMDF0236ncPumnVY/tfCSebLyKl+up1mGeH4mAR6ily7nXAhRnXL+A0015bpCa5FCg2ReN68MEmquB/mHfeLqJfRupwzDWnIWxYSKkFCJ0i47KTFYhM93LHHQ8GrZNNaeiJ6q59MruQI83z0HCxN/DzK4Z2rBWGilwPuYcSEa0STPXYhz8XMXUX/Mlp7dd5zyWeNaxkNRWlhKHvhLVPGvteaEcchs476DIWLCRVXEC1372wMKNrKblzRp7Wi5+l+W14k5AgMBAAECggEAHahkPjmivTPc5FC8NSCQI01GPxH6/Ky1OXfaMd4ifTgn+vvQzBeBlFOnt53jRZyUq/T/l1FMaqacZfyBwLw3hlDslXeLuksHv6qTEBEsYH/ad7oHmIzcnQEhvAPrMrIjakYvqGoYynC3SKEudUjjqoMSthCYF+2+bsuXUpBQlNQLqcJ03U+YhfLswwVVujKvAujoLRqDAWeaa0k0y/1Ua4fr5GJq5M+P8TTBRgZlSK5A7Ee6yxMUncZ9W3lTqZtyG0OQLbz9gkr0c63KPisigaOx9eKlCPWFWUWo+zGvQMVijHDTeoJ3dqNmsPtiIE3rDt8anx4a1R7YK6MQ520hAQKBgQDPFMNl4fRmLSOLNShJm/0mBMoIjPmS3+tPBtCiG4oH9F8vYMJWDA1Im0FdgRa2HlCv6hpiVvvQt824RaUYa7XR6aefXKVEWddHvl3utnghMohjK8o8fTmIxADtU5Q2OlWmPdp1v7yDg8yE5P1GlY+AZ3oggxXOIRVtQrNeL7E3iQKBgQCy6nEaUQUCDDts4o7Pn+N402g3/T9Vz/5JtKmDI01EndK5l/yE8CdgGwdiwN1k3la/Nv8P5kaaX2qVcCGoOIQmMNGOxuNfkKCi+bJKdxmFOI4E3iVYT2H6x27QJwNB6bik1i6b2OWT7ckxeB6xMjefNp1u8Qif+vab60OQZSqoMQKBgESRF3Hwsz/xykcZvtFAuT2RcGQMacbcJcnw87v5ambf33SMkUx0iSF1ZttTFvYOa6ET3tCZBKBDe/Z7+QJxB68NstbtkjtjlAjJW8ji2jwDw20y3q/QtvA2Fih++CBMiHeXG3LJnd3eEiYevE5Wz0ExAhspzFqIUdPvtfyFxiQhAoGBAKgc+iGMN3RxIfVx/FbDGe6SVr8lSrnLMlj3VMBQD26GDVcupKwVLCp1uz7jkiQRdtk9R/UcnwK23WOFdVqnoCRygrXx0/wb3ZTFou2tc2Fmfqu8QML19E67zjfwMHNitYjNaAYwi6ewKvg8sjo1wWXs34k7GquYGNjw+w9Wv/pBAoGAUlVHfZ4RncAiiH/x3EDgqmmVikFpLoM2xXxM16nplrjdBE6IzkpgWb/x2ZI6JCMDyoV2kvF6owW2+QEQ81MrHQMtBRpAvd8nI03gXA5VF3uwp4UjfGpoIAGDBrqQv9DM8vx6C6VJNTT5esZWZSw/+PZ4D19l0/n7gICGx3ugw0Q=
|
privateKey: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCyhwMKnP7oBQ9qKhxke9AXN7ZNcniMnJFcWWFPfs3W6QqKBGFGFYQFyqfmnf2gM4nYtEbvit0CcmSrdniR3aZVb6s0A/KWqD5ejf+zjdnn5XH4GYsm/DXZoBqdAMWQUaQcVB1lC9az1rn13n9UHBJ+s+UAWtFjXMDd78dsE7enU3RjBffyvl/A+r6c0jnSHDNttSXyamxGX8ng8hK5XdCAusOfYpWnLY90sjlyz98snIfVPqAfD3KTP88gRF1KfWZniwMCR/OjCp6jm5d5dvOj8xyk7R1LfZ0CH/fXOcvpCe9JISS9DyzEzW5XpsnO5p8Mo8wFL6TKVBng+Ss0Tr0NAgMBAAECggEAPnaCl+oKPf/XPtvxBy9SxWzWug49I2V8boVPSNMjDfiHmXai2jSY9rXLPSM2JCEkL9ATqag6X6rKkjtnQBH/KpFho1dmP1QqTkb8mkQdY8ehsp6tUzyXUsdzyE8G0NHfy5Gan0ofGtkcQ2xPvIv95JromtErxcokKQLGEYhsj3xL+KVsUh5YedX/6sAiJ1KS5Zs82eh6bbCvUzuSPc4hjyfLSux5AnGBPnwEzWWJiA5z9zK17i8Cb7FnEeRmNvJw7VsXaCMFquZ6+bzlKdSuUqzqNhHMX8AivePTjj7pPHFW3FTh64E20yzl7CIwkScToXT3H7oaHRA1xGySmGNBuQKBgQDXFcg0b8L0A/Zril+4IwfckH1gpUbqlplzfozM/a/0rojQEdS+X7g4ypdPc47cwoLJx08/84L8ZPj49CImoGNdj5K9B2fY/E10SIJJqN5lb9NI4KINvGGM58NDSAl+GjT5mljkPI8jzQ1ACcy9DGV/KVScGHUWUpeLOK22AEcfWwKBgQDUfPFBHc2Bkuv3bRoNT+fnChMw5CI65wD74vR5GKyurh50DB3RZXwhRsAFd9NowINm9B2KAR0IrB+vh3EwfJaWDauh3ykZZtrAphSa11dJXvtathHTuQmXalZv5brh5mHie87yoxMn7vqDi0bwkNlb/b1wwokwc0oc3NSoNsFptwKBgCJhjPs00kkHSSCvodVhZCRRxHjqcoeVQzo/BGrQMow+SghYkVVNH7mUSNOeeTu4rAdtILHsTwfhbBr/i2X5RWjzRlWJFYSN8COiY5E6uTIlyfRgVAc2EbHgakoa/cl2jvlHPuZc99SVNoUCDAQ8Mw08ohXBoxXKZgcPLFVnffb5AoGBAJW5cDmk6WCrCRAwVVIaAtsek0U5CxGcImpakk8d3te7IwQ8YWph6yR7eOSheVrvg+ewjXvnqvCocC877brvnyAeg9isqYYXnn5uyEgPApdVkSFq94bLdIG30S5JnvR8ZG61NK5t0BqsXuL/6b2rIy2Zzrm8qfR02D0cMdBRvNljAoGBAMJG7/TqodrYPYyOZ4/IbbhAitBHWpHYJHSENnuxbQGAQuCt52Jp3eULR2r7uk3dUDuE8mB2QAEStuV/orfdxxRxJIYbEynJFGCa9O5LTevbM4MoNRfLCPPmFK5PJivlJcdrCyQKEmGSLLrVdb3H/Wzu0/4K/ZhwyrtBz4MRkuwD
|
||||||
# 线上应用公钥证书
|
# 沙箱支付宝公钥证书路径
|
||||||
appCertPath: appCertPublicKey_2021005119630093.crt
|
alipayCertPath: cert/alipay/alipayCertPublicKey_RSA2.crt
|
||||||
# 线上支付宝公钥证书路径
|
# 沙箱支付宝根证书路径
|
||||||
alipayCertPath: cert/alipayCertPublicKey_RSA2.crt
|
alipayRootCertPath: cert/alipay/alipayRootCert.crt
|
||||||
# 线上支付宝根证书路径
|
notifyUrl: https://7d014da8.r27.cpolar.top/ali/pay/notify
|
||||||
alipayRootCertPath: cert/alipayRootCert.crt
|
# 沙箱支付宝网关
|
||||||
# 线上支付宝公钥
|
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||||
notifyUrl: https://253d7236.r27.cpolar.top/ali/pay/notify
|
|
||||||
# 线上支付宝网关
|
|
||||||
gatewayUrl: https://openapi.alipay.com/gateway.do
|
|
||||||
|
|
||||||
huawei:
|
huawei:
|
||||||
obs:
|
obs:
|
||||||
ak: NWXJ93POA9NCDVV1WQYJ
|
ak: NWXJ93POA9NCDVV1WQYJ
|
||||||
|
@ -146,3 +142,25 @@ huawei:
|
||||||
endPoint: obs.cn-south-1.myhuaweicloud.com
|
endPoint: obs.cn-south-1.myhuaweicloud.com
|
||||||
|
|
||||||
|
|
||||||
|
## 线上环境
|
||||||
|
#mall:
|
||||||
|
# mgt:
|
||||||
|
# aliPayConfig:
|
||||||
|
# protocol: https
|
||||||
|
# gatewayHost: openapi-sandbox.dl.alipaydev.com
|
||||||
|
# signType: RSA2
|
||||||
|
# # 线上应用id
|
||||||
|
# appId: 2021005119630093
|
||||||
|
# # 线上应用私钥
|
||||||
|
# privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQuhRU5iHoabfzJS40A+moMKzb5rmi5XbL59K98CW65Oq/rnzQnj6sCYggIXOLCLKUykZ1XIVa+4V7bGFkMDF0236ncPumnVY/tfCSebLyKl+up1mGeH4mAR6ily7nXAhRnXL+A0015bpCa5FCg2ReN68MEmquB/mHfeLqJfRupwzDWnIWxYSKkFCJ0i47KTFYhM93LHHQ8GrZNNaeiJ6q59MruQI83z0HCxN/DzK4Z2rBWGilwPuYcSEa0STPXYhz8XMXUX/Mlp7dd5zyWeNaxkNRWlhKHvhLVPGvteaEcchs476DIWLCRVXEC1372wMKNrKblzRp7Wi5+l+W14k5AgMBAAECggEAHahkPjmivTPc5FC8NSCQI01GPxH6/Ky1OXfaMd4ifTgn+vvQzBeBlFOnt53jRZyUq/T/l1FMaqacZfyBwLw3hlDslXeLuksHv6qTEBEsYH/ad7oHmIzcnQEhvAPrMrIjakYvqGoYynC3SKEudUjjqoMSthCYF+2+bsuXUpBQlNQLqcJ03U+YhfLswwVVujKvAujoLRqDAWeaa0k0y/1Ua4fr5GJq5M+P8TTBRgZlSK5A7Ee6yxMUncZ9W3lTqZtyG0OQLbz9gkr0c63KPisigaOx9eKlCPWFWUWo+zGvQMVijHDTeoJ3dqNmsPtiIE3rDt8anx4a1R7YK6MQ520hAQKBgQDPFMNl4fRmLSOLNShJm/0mBMoIjPmS3+tPBtCiG4oH9F8vYMJWDA1Im0FdgRa2HlCv6hpiVvvQt824RaUYa7XR6aefXKVEWddHvl3utnghMohjK8o8fTmIxADtU5Q2OlWmPdp1v7yDg8yE5P1GlY+AZ3oggxXOIRVtQrNeL7E3iQKBgQCy6nEaUQUCDDts4o7Pn+N402g3/T9Vz/5JtKmDI01EndK5l/yE8CdgGwdiwN1k3la/Nv8P5kaaX2qVcCGoOIQmMNGOxuNfkKCi+bJKdxmFOI4E3iVYT2H6x27QJwNB6bik1i6b2OWT7ckxeB6xMjefNp1u8Qif+vab60OQZSqoMQKBgESRF3Hwsz/xykcZvtFAuT2RcGQMacbcJcnw87v5ambf33SMkUx0iSF1ZttTFvYOa6ET3tCZBKBDe/Z7+QJxB68NstbtkjtjlAjJW8ji2jwDw20y3q/QtvA2Fih++CBMiHeXG3LJnd3eEiYevE5Wz0ExAhspzFqIUdPvtfyFxiQhAoGBAKgc+iGMN3RxIfVx/FbDGe6SVr8lSrnLMlj3VMBQD26GDVcupKwVLCp1uz7jkiQRdtk9R/UcnwK23WOFdVqnoCRygrXx0/wb3ZTFou2tc2Fmfqu8QML19E67zjfwMHNitYjNaAYwi6ewKvg8sjo1wWXs34k7GquYGNjw+w9Wv/pBAoGAUlVHfZ4RncAiiH/x3EDgqmmVikFpLoM2xXxM16nplrjdBE6IzkpgWb/x2ZI6JCMDyoV2kvF6owW2+QEQ81MrHQMtBRpAvd8nI03gXA5VF3uwp4UjfGpoIAGDBrqQv9DM8vx6C6VJNTT5esZWZSw/+PZ4D19l0/n7gICGx3ugw0Q=
|
||||||
|
# # 线上支付宝公钥证书路径
|
||||||
|
# alipayCertPath: cert/alipay/alipayCertPublicKey_RSA2.crt
|
||||||
|
# # 线上支付宝根证书路径
|
||||||
|
# alipayRootCertPath: cert/alipay/alipayRootCert.crt
|
||||||
|
# # 线上支付宝公钥
|
||||||
|
# notifyUrl: https://253d7236.r27.cpolar.top/ali/pay/notify
|
||||||
|
# # 线上支付宝网关
|
||||||
|
# gatewayUrl: https://openapi.alipay.com/gateway.do
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ spring:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: druid
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
@ -74,7 +74,7 @@ token:
|
||||||
# 令牌密钥
|
# 令牌密钥
|
||||||
secret: abcdefghijklmnopqrstuvwxyz
|
secret: abcdefghijklmnopqrstuvwxyz
|
||||||
# 令牌有效期(默认30分钟)
|
# 令牌有效期(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 43200
|
||||||
|
|
||||||
# MyBatis Plus配置
|
# MyBatis Plus配置
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDnTCCAoWgAwIBAgIQICUCFPTaqv/ZUGkFjQNMjTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||||
|
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||||
|
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||||
|
YXNzIDIgUjEwHhcNMjUwMjE0MDkxMDAxWhcNMzAwMjEzMDkxMDAxWjB+MQswCQYDVQQGEwJDTjEZ
|
||||||
|
MBcGA1UECgwQMjA4ODk0Mjk4OTQ4MjU3OTEPMA0GA1UECwwGQWxpcGF5MUMwQQYDVQQDDDrmlK/k
|
||||||
|
u5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0yMDg4OTQyOTg5NDgyNTc5MIIB
|
||||||
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa7R9uTM3VJpWZDWiNSUw23AoIlSZ4Y6lgaA
|
||||||
|
xuhKYmUx8P2yCHJ8xEyASRHUggrYoEvkbuLqHPpNPmJsMaqnbuP4uwfkxO9l/D2bnPRFd2e4eQhX
|
||||||
|
L7YHOLRWgHhMBfkMYMq9A8kJHDa9drVbxvp1zbvxakJvEuJ9TVCvHdpsTGbMxBn5PP7qTQYoQAQj
|
||||||
|
FYF6j6eLmrskFgqYGmDV2dbf/tFLaQZSuhut47pb3glvi7g0ECMy+S3v76pZk5+FP42EkBFFsLH1
|
||||||
|
lTREgO1PTSRAEiZkSGRLtmf3u6EMb42pE6EUF4pHHaACEQ3ZRuYK8Mo00A0FmwAoKil2MxkzAX5Z
|
||||||
|
KQIDAQABoxIwEDAOBgNVHQ8BAf8EBAMCA/gwDQYJKoZIhvcNAQELBQADggEBAGsnIGoHjk4+YUJJ
|
||||||
|
nLMggzUmAuKt1rHcUN+3SfsNmnGqwluy4cm4emxj2qwcTzEEQvrES33difh4Ubtf2XyS1MFLkxhG
|
||||||
|
WonCuEUjZqKgWz66gCG3l0l7HRy2VJaaaVlC49yJMOsuUNtAFjh+Pu5XVb7ff8Adf3YGNeFC4Tde
|
||||||
|
gkBgDO8RbPSfdc7bP0Fq+TPj5nMCu64KzBz4RP5da7Q/mSFI2PCvtEquhq/eeDezfHUAz2ehC/bA
|
||||||
|
dSRHytgzrGktk+BIPtEsoYG9zIHBNwA8JCr9Z5q2eauhYvIE1sJVO151Dph1u4LE1voQQ4qr4t6v
|
||||||
|
gU2IoL6w5LvdWDSQCIrPOa4=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIE4jCCAsqgAwIBAgIIYsSr5bKAMl8wDQYJKoZIhvcNAQELBQAwejELMAkGA1UEBhMCQ04xFjAU
|
||||||
|
BgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5MTEw
|
||||||
|
LwYDVQQDDChBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFIxMB4XDTE4MDMy
|
||||||
|
MjE0MzQxNVoXDTM3MTEyNjE0MzQxNVowgYIxCzAJBgNVBAYTAkNOMRYwFAYDVQQKDA1BbnQgRmlu
|
||||||
|
YW5jaWFsMSAwHgYDVQQLDBdDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTE5MDcGA1UEAwwwQW50IEZp
|
||||||
|
bmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBDbGFzcyAyIFIxMIIBIjANBgkqhkiG9w0B
|
||||||
|
AQEFAAOCAQ8AMIIBCgKCAQEAsLMfYaoRoPRbmDcAfXPCmKf43pWRN5yTXa/KJWO0l+mrgQvs89bA
|
||||||
|
NEvbDUxlkGwycwtwi5DgBuBgVhLliXu+R9CYgr2dXs8D8Hx/gsggDcyGPLmVrDOnL+dyeauheARZ
|
||||||
|
fA3du60fwEwwbGcVIpIxPa/4n3IS/ElxQa6DNgqxh8J9Xwh7qMGl0JK9+bALuxf7B541Gr4p0WEN
|
||||||
|
G8fhgjBV4w4ut9eQLOoa1eddOUSZcy46Z7allwowwgt7b5VFfx/P1iKJ3LzBMgkCK7GZ2kiLrL7R
|
||||||
|
iqV+h482J7hkJD+ardoc6LnrHO/hIZymDxok+VH9fVeUdQa29IZKrIDVj65THQIDAQABo2MwYTAf
|
||||||
|
BgNVHSMEGDAWgBRfdLQEwE8HWurlsdsio4dBspzhATAdBgNVHQ4EFgQUSqHkYINtUSAtDPnS8Xoy
|
||||||
|
oP9p7qEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIB
|
||||||
|
AIQ8TzFy4bVIVb8+WhHKCkKNPcJe2EZuIcqvRoi727lZTJOfYy/JzLtckyZYfEI8J0lasZ29wkTt
|
||||||
|
a1IjSo+a6XdhudU4ONVBrL70U8Kzntplw/6TBNbLFpp7taRALjUgbCOk4EoBMbeCL0GiYYsTS0mw
|
||||||
|
7xdySzmGQku4GTyqutIGPQwKxSj9iSFw1FCZqr4VP4tyXzMUgc52SzagA6i7AyLedd3tbS6lnR5B
|
||||||
|
L+W9Kx9hwT8L7WANAxQzv/jGldeuSLN8bsTxlOYlsdjmIGu/C9OWblPYGpjQQIRyvs4Cc/mNhrh+
|
||||||
|
14EQgwuemIIFDLOgcD+iISoN8CqegelNcJndFw1PDN6LkVoiHz9p7jzsge8RKay/QW6C03KNDpWZ
|
||||||
|
EUCgCUdfHfo8xKeR+LL1cfn24HKJmZt8L/aeRZwZ1jwePXFRVtiXELvgJuM/tJDIFj2KD337iV64
|
||||||
|
fWcKQ/ydDVGqfDZAdcU4hQdsrPWENwPTQPfVPq2NNLMyIH9+WKx9Ed6/WzeZmIy5ZWpX1TtTolo6
|
||||||
|
OJXQFeItMAjHxW/ZSZTok5IS3FuRhExturaInnzjYpx50a6kS34c5+c8hYq7sAtZ/CNLZmBnBCFD
|
||||||
|
aMQqT8xFZJ5uolUaSeXxg7JFY1QsYp5RKvj4SjFwCGKJ2+hPPe9UyyltxOidNtxjaknOCeBHytOr
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -1,38 +0,0 @@
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDszCCApugAwIBAgIQICUCGGcg6L5kXzAfaOSi6zANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE
|
|
||||||
BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv
|
|
||||||
biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1
|
|
||||||
dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjUwMjE4MDIwNDM0WhcNMjYwMjE4MDIwNDM0WjCB
|
|
||||||
hDELMAkGA1UEBhMCQ04xHzAdBgNVBAoMFmRicGxmdTEyOTRAc2FuZGJveC5jb20xDzANBgNVBAsM
|
|
||||||
BkFsaXBheTFDMEEGA1UEAww65pSv5LuY5a6dKOS4reWbvSnnvZHnu5zmioDmnK/mnInpmZDlhazl
|
|
||||||
j7gtMjA4ODcyMTAzMjk3MTE0MzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKR5I8B5
|
|
||||||
6FJ2bqm2rPmabrcliH1NligRSnfsBcJQmcraUIVQNeghgDAhqYI8VD6am5jrT8u+MtMMZgxwfSGm
|
|
||||||
DlbFZotkgJdSKn8cFEiJZW3b24wb2RQCEJT2vFP8xyT4HRjRw7fwcKqebgdDpHBiwfT2MgFwRCor
|
|
||||||
us3U7ImZaFKz8IJwUSdIjR2IlqP6DmA/Sn6KSwPg9Z0I6qvJt0oWXuOnnDKOmQh7UCPx7YC/xBoG
|
|
||||||
uSmNszlItFsL4rvMO/UY4833bA5M7uVZwXWkq7uGsA8ohfZwBfrj4AOGTnSypKaBADcLiKKw1vLU
|
|
||||||
+vRsIfpmMfbAyTMSX+1znpHT28pqJosCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3
|
|
||||||
DQEBCwUAA4IBAQC36KH0fCX8t0y/GHRt83Xfr0uNfWlYTTY6fzqqgxlqhuU8yYbt9WmE2JHxuUmB
|
|
||||||
yznEbhCWXqRxpWRInXwhFaZoO7Qn/XJ3rcSJ1NsL3niR94gLcGyNEWyEN2U/L2bPJIXwZYqttW9G
|
|
||||||
41yONL+27ame+g5PvhjUCEb937zktI+zLdfb5uSyd4aAEPQ7F9Nl4Z2p97NlLBhpfcNq7SGhfLD0
|
|
||||||
85/vYGsbyef/ZrTV7IKHcgprhANE/yDY6/FUxYgCV/l4h2KMusX9Yj8V5W+9ncPo58XpfolyuZJK
|
|
||||||
yuVMv1q1h2AIKudxKcr2hK4/T91i/A7A8v4UD+8a3Q5T3Ad6cYw8
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDszCCApugAwIBAgIQIBkIGbgVxq210KxLJ+YA/TANBgkqhkiG9w0BAQsFADCBhDELMAkGA1UE
|
|
||||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxJTAjBgNVBAsMHENlcnRpZmljYXRpb24gQXV0
|
|
||||||
aG9yaXR5IHRlc3QxNjA0BgNVBAMMLUFudCBGaW5hbmNpYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
|
|
||||||
dHkgUjEgdGVzdDAeFw0xOTA4MTkxMTE2MDBaFw0yNDA4MDExMTE2MDBaMIGRMQswCQYDVQQGEwJD
|
|
||||||
TjEbMBkGA1UECgwSQW50IEZpbmFuY2lhbCB0ZXN0MSUwIwYDVQQLDBxDZXJ0aWZpY2F0aW9uIEF1
|
|
||||||
dGhvcml0eSB0ZXN0MT4wPAYDVQQDDDVBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y
|
|
||||||
aXR5IENsYXNzIDIgUjEgdGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMh4FKYO
|
|
||||||
ZyRQHD6eFbPKZeSAnrfjfU7xmS9Yoozuu+iuqZlb6Z0SPLUqqTZAFZejOcmr07ln/pwZxluqplxC
|
|
||||||
5+B48End4nclDMlT5HPrDr3W0frs6Xsa2ZNcyil/iKNB5MbGll8LRAxntsKvZZj6vUTMb705gYgm
|
|
||||||
VUMILwi/ZxKTQqBtkT/kQQ5y6nOZsj7XI5rYdz6qqOROrpvS/d7iypdHOMIM9Iz9DlL1mrCykbBi
|
|
||||||
t25y+gTeXmuisHUwqaRpwtCGK4BayCqxRGbNipe6W73EK9lBrrzNtTr9NaysesT/v+l25JHCL9tG
|
|
||||||
wpNr1oWFzk4IHVOg0ORiQ6SUgxZUTYcCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3
|
|
||||||
DQEBCwUAA4IBAQBWThEoIaQoBX2YeRY/I8gu6TYnFXtyuCljANnXnM38ft+ikhE5mMNgKmJYLHvT
|
|
||||||
yWWWgwHoSAWEuml7EGbE/2AK2h3k0MdfiWLzdmpPCRG/RJHk6UB1pMHPilI+c0MVu16OPpKbg5Vf
|
|
||||||
LTv7dsAB40AzKsvyYw88/Ezi1osTXo6QQwda7uefvudirtb8FcQM9R66cJxl3kt1FXbpYwheIm/p
|
|
||||||
j1mq64swCoIYu4NrsUYtn6CV542DTQMI5QdXkn+PzUUly8F6kDp+KpMNd0avfWNL5+O++z+F5Szy
|
|
||||||
1CPta1D7EQ/eYmMP+mOQ35oifWIoFCpN6qQVBS/Hob1J/UUyg7BW
|
|
||||||
-----END CERTIFICATE-----
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEgjCCA2qgAwIBAgIQICUCFE7HTf+7v9yXtoeyLjANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||||
|
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||||
|
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||||
|
YXNzIDEgUjEwHhcNMjUwMjE0MDkxMDAwWhcNMzAwMjEzMDkxMDAwWjBKMQswCQYDVQQGEwJDTjEP
|
||||||
|
MA0GA1UECgwG5Ya35paMMQ8wDQYDVQQLDAZBbGlwYXkxGTAXBgNVBAMMEDIwODg5NDI5ODk0ODI1
|
||||||
|
NzkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQuhRU5iHoabfzJS40A+moMKzb5rmi
|
||||||
|
5XbL59K98CW65Oq/rnzQnj6sCYggIXOLCLKUykZ1XIVa+4V7bGFkMDF0236ncPumnVY/tfCSebLy
|
||||||
|
Kl+up1mGeH4mAR6ily7nXAhRnXL+A0015bpCa5FCg2ReN68MEmquB/mHfeLqJfRupwzDWnIWxYSK
|
||||||
|
kFCJ0i47KTFYhM93LHHQ8GrZNNaeiJ6q59MruQI83z0HCxN/DzK4Z2rBWGilwPuYcSEa0STPXYhz
|
||||||
|
8XMXUX/Mlp7dd5zyWeNaxkNRWlhKHvhLVPGvteaEcchs476DIWLCRVXEC1372wMKNrKblzRp7Wi5
|
||||||
|
+l+W14k5AgMBAAGjggEpMIIBJTAfBgNVHSMEGDAWgBRxB+IEYRbk5fJl6zEPyeD0PJrVkTAdBgNV
|
||||||
|
HQ4EFgQUqfZMfgxmG9w6m5lXQSdoiPe0vagwQAYDVR0gBDkwNzA1BgdggRwBbgEBMCowKAYIKwYB
|
||||||
|
BQUHAgEWHGh0dHA6Ly9jYS5hbGlwYXkuY29tL2Nwcy5wZGYwDgYDVR0PAQH/BAQDAgbAMC8GA1Ud
|
||||||
|
HwQoMCYwJKAioCCGHmh0dHA6Ly9jYS5hbGlwYXkuY29tL2NybDk4LmNybDBgBggrBgEFBQcBAQRU
|
||||||
|
MFIwKAYIKwYBBQUHMAKGHGh0dHA6Ly9jYS5hbGlwYXkuY29tL2NhNi5jZXIwJgYIKwYBBQUHMAGG
|
||||||
|
Gmh0dHA6Ly9jYS5hbGlwYXkuY29tOjgzNDAvMA0GCSqGSIb3DQEBCwUAA4IBAQAmDOoavQGthLtz
|
||||||
|
WuW1e0g0K2WChYevFcnWWNILTJ0EsB01Ka0FagOo1T3ErGns+G9lbSj9g6DQZ5DVqLCGnl2ZRvBN
|
||||||
|
KwSnA/7Frllf7CebBaW5WWJ3VKWxP929izvywlPeQdmRELNGK4H/IZoW+nCDYjUgXLOLMgBnqmLY
|
||||||
|
wgug/g3iQ+yFSFuvSNE2J84FwPycWweDJ8zrj4aM9S/bjjWoE/Lfe/a86BIYV19A72Ozc/aTGnxP
|
||||||
|
W/D5txDrhO2wWeCzXd7TuBN1Hze5IX/hYeDqM3rjHuQcGcbFJOchqqR5fUEC/SU9MZ4j/KWND83l
|
||||||
|
Y28GbRbP5jxhgckHIKjfKh6b
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -1,19 +0,0 @@
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDmTCCAoGgAwIBAgIQICQEAub4U5TMozibHLcg8zANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE
|
|
||||||
BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv
|
|
||||||
biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1
|
|
||||||
dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjQwNDAyMDUzMjU2WhcNMjUwNDA3MDUzMjU2WjBr
|
|
||||||
MQswCQYDVQQGEwJDTjEfMB0GA1UECgwWZGJwbGZ1MTI5NEBzYW5kYm94LmNvbTEPMA0GA1UECwwG
|
|
||||||
QWxpcGF5MSowKAYDVQQDDCEyMDg4NzIxMDMyOTcxMTQzLTkwMjEwMDAxMzU2ODI2MTQwggEiMA0G
|
|
||||||
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+
|
|
||||||
T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZoqyJc
|
|
||||||
lAIeb09ut7rY6mWzilA9kWmZnUG7MOWIU70RVRYrfJectCFw/odM9lG4XIVe13X2h+1ecTQyQzLW
|
|
||||||
mnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ
|
|
||||||
/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMB
|
|
||||||
AAGjEjAQMA4GA1UdDwEB/wQEAwIE8DANBgkqhkiG9w0BAQsFAAOCAQEAZmMSaD7s3aervdACl0cN
|
|
||||||
YRcUHMGBA4DwzeLKaF0iqcsQxzJHBQRSGbAeQ9n5l1U5V0Pos92V7eqEJqtC52l6sK5T4YE6zAxf
|
|
||||||
49RKyo00qVFCbcGMHnRy0F/AkEhz+qhan1R3Dm7Ty6UtgAaeF6emD35EIKXziCvqS1nBt+nniYYB
|
|
||||||
0O2UntrJ3lYucuLun7TeYou/kPMTnZItzSmvCmG181e5IpSB3qGwBnIgkmB+Ge0kGIFAoV9+MucT
|
|
||||||
4YOffum8yC0oF7aMtTL9whm5gb+Udj+lBrHYYw8VPNpcvBmRlXEKEJLbWQrGtJi6+URReWqO52UP
|
|
||||||
fGHB0r4r575H4Y1QkA==
|
|
||||||
-----END CERTIFICATE-----
|
|
|
@ -42,11 +42,14 @@ public class SecurityUtils
|
||||||
|
|
||||||
public static Long getUserIdMax(){
|
public static Long getUserIdMax(){
|
||||||
|
|
||||||
Long userId;
|
Long userId = null;
|
||||||
try {
|
try {
|
||||||
userId = SecurityUtils.getUserId();
|
userId = SecurityUtils.getUserId();
|
||||||
|
if (userId == null){
|
||||||
|
userId = 0L;
|
||||||
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
userId = 0L;
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return userId;
|
return userId;
|
||||||
|
|
|
@ -30,7 +30,8 @@ import org.springframework.web.filter.CorsFilter;
|
||||||
*/
|
*/
|
||||||
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SecurityConfig {
|
public class SecurityConfig
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* 自定义用户认证逻辑
|
* 自定义用户认证逻辑
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +79,8 @@ public class SecurityConfig {
|
||||||
* 身份验证实现
|
* 身份验证实现
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public AuthenticationManager authenticationManager() {
|
public AuthenticationManager authenticationManager()
|
||||||
|
{
|
||||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
||||||
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
|
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
|
||||||
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||||
|
@ -110,67 +112,48 @@ public class SecurityConfig {
|
||||||
* authenticated | 用户登录后可访问
|
* authenticated | 用户登录后可访问
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
|
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
|
||||||
|
{
|
||||||
return httpSecurity
|
return httpSecurity
|
||||||
// CSRF禁用,因为不使用session
|
// CSRF禁用,因为不使用session
|
||||||
.csrf(csrf -> csrf.disable())
|
.csrf(csrf -> csrf.disable())
|
||||||
// 禁用HTTP响应标头
|
// 禁用HTTP响应标头
|
||||||
.headers((headersCustomizer) -> {
|
.headers((headersCustomizer) -> {
|
||||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||||
})
|
})
|
||||||
// 认证失败处理类
|
// 认证失败处理类
|
||||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||||
// 基于token,所以不需要session
|
// 基于token,所以不需要session
|
||||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
// 注解标记允许匿名访问的url
|
// 注解标记允许匿名访问的url
|
||||||
.authorizeHttpRequests((requests) -> {
|
.authorizeHttpRequests((requests) -> {
|
||||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||||
requests.antMatchers("/login",
|
requests.antMatchers("/login", "/register", "/captchaImage","/ali/pay/doPay","/ali/pay/notify",
|
||||||
"/register",
|
"/ali/pay/callback","/file/**","/model/modelSquare","/image/imageList","/WorkFlow/workFlowList",
|
||||||
"/captchaImage",
|
"/system/dict/data/type/**","").permitAll()
|
||||||
"/ali/pay/doPay",
|
// 静态资源,可匿名访问
|
||||||
"/ali/pay/notify",
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
"/ali/pay/callback",
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
"/file/**",
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
"/model/modelSquare",
|
.anyRequest().authenticated();
|
||||||
"/model/selectModelById",
|
})
|
||||||
"/model/finbyid",
|
// 添加Logout filter
|
||||||
"/ModelVersion/finbyid",
|
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||||
"/ModelComment/getComment",
|
// 添加JWT filter
|
||||||
"/ModelComment/commentCount",
|
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||||
"/WorkFlow/workFlowList",
|
// 添加CORS filter
|
||||||
"/WorkFlow/selectWorkFlowById",
|
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||||
"/WorkFlowComment/getComment",
|
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||||
"/image/imageList",
|
.build();
|
||||||
"/image/detail",
|
|
||||||
"/imageComment/getComment",
|
|
||||||
"/system/user/selectUserById",
|
|
||||||
"/system/dict/data/type/**",
|
|
||||||
"/attention/selectAttention",
|
|
||||||
"/attention/selectUserInfo"
|
|
||||||
).permitAll()
|
|
||||||
// 静态资源,可匿名访问
|
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
|
||||||
.anyRequest().authenticated();
|
|
||||||
})
|
|
||||||
// 添加Logout filter
|
|
||||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
|
||||||
// 添加JWT filter
|
|
||||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
|
||||||
// 添加CORS filter
|
|
||||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
|
||||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 强散列哈希加密实现
|
* 强散列哈希加密实现
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public BCryptPasswordEncoder bCryptPasswordEncoder() {
|
public BCryptPasswordEncoder bCryptPasswordEncoder()
|
||||||
|
{
|
||||||
return new BCryptPasswordEncoder();
|
return new BCryptPasswordEncoder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,6 @@
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mcwl</groupId>
|
|
||||||
<artifactId>mcwl-resource</artifactId>
|
|
||||||
<version>3.8.8</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -2,10 +2,12 @@ package com.mcwl.memberCenter.consumer;
|
||||||
|
|
||||||
import com.mcwl.common.constant.QueueConstants;
|
import com.mcwl.common.constant.QueueConstants;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.memberCenter.domain.Member;
|
import com.mcwl.memberCenter.domain.Member;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
import com.mcwl.memberCenter.service.MemberService;
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
import com.mcwl.system.domain.SysAdvice;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||||
|
import com.mcwl.system.service.ISysAdviceService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.Message;
|
||||||
|
|
|
@ -3,9 +3,9 @@ package com.mcwl.memberCenter.consumer;
|
||||||
import com.mcwl.common.constant.QueueConstants;
|
import com.mcwl.common.constant.QueueConstants;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.memberCenter.domain.Member;
|
import com.mcwl.memberCenter.domain.Member;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
import com.mcwl.system.domain.SysAdvice;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
import com.mcwl.system.service.ISysAdviceService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
|
@ -11,24 +11,14 @@ import org.springframework.stereotype.Component;
|
||||||
@Configuration
|
@Configuration
|
||||||
@Component
|
@Component
|
||||||
public class AliConfig {
|
public class AliConfig {
|
||||||
@Value("${mall.mgt.aliPayConfig.protocol}")
|
|
||||||
private String protocol;
|
|
||||||
@Value("${mall.mgt.aliPayConfig.gatewayHost}")
|
|
||||||
private String gatewayHost;
|
|
||||||
@Value("${mall.mgt.aliPayConfig.signType}")
|
|
||||||
private String signType;
|
|
||||||
@Value("${mall.mgt.aliPayConfig.appId}")
|
@Value("${mall.mgt.aliPayConfig.appId}")
|
||||||
private String appId;
|
private String appId;
|
||||||
@Value("${mall.mgt.aliPayConfig.privateKey}")
|
@Value("${mall.mgt.aliPayConfig.privateKey}")
|
||||||
private String privateKey;
|
private String privateKey;
|
||||||
@Value("${mall.mgt.aliPayConfig.appCertPath}")
|
|
||||||
private String appCertPath;
|
|
||||||
@Value("${mall.mgt.aliPayConfig.alipayCertPath}")
|
@Value("${mall.mgt.aliPayConfig.alipayCertPath}")
|
||||||
private String alipayCertPath;
|
private String alipayCertPath;
|
||||||
@Value("${mall.mgt.aliPayConfig.alipayRootCertPath}")
|
@Value("${mall.mgt.aliPayConfig.alipayRootCertPath}")
|
||||||
private String alipayRootCertPath;
|
private String alipayRootCertPath;
|
||||||
@Value("${mall.mgt.aliPayConfig.gatewayUrl}")
|
@Value("${mall.mgt.aliPayConfig.gatewayUrl}")
|
||||||
private String gatewayUrl;
|
private String gatewayUrl;
|
||||||
@Value("${mall.mgt.aliPayConfig.notifyUrl}")
|
|
||||||
private String notifyUrl;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,20 @@ import com.mcwl.pay.domain.OrderTradeDto;
|
||||||
import com.mcwl.pay.domain.vo.PayVo;
|
import com.mcwl.pay.domain.vo.PayVo;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
|
|
||||||
public interface AliPayService {
|
public interface AliPayService {
|
||||||
String bindingCallback(String authCode, String state) throws FileNotFoundException;
|
String bindingCallback(String authCode, String state);
|
||||||
|
|
||||||
PayVo memberPay(OrderTradeDto orderTradeDto) throws Exception;
|
PayVo memberPay(OrderTradeDto orderTradeDto) throws Exception;
|
||||||
|
|
||||||
PayVo pointsPay(Double paymentAmount) throws Exception;
|
PayVo pointsPay(Double paymentAmount) throws Exception;
|
||||||
|
|
||||||
R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException;
|
R<String> fetch(String amount) throws AlipayApiException;
|
||||||
|
|
||||||
// 查询订单状态
|
// 查询订单状态
|
||||||
R<Object> queryTradeStatus(String outTradeNo) throws Exception;
|
R<Object> queryTradeStatus(String outTradeNo) throws Exception;
|
||||||
|
|
||||||
|
String balance() throws AlipayApiException;
|
||||||
|
|
||||||
PayVo walletPay(Double amount) throws Exception;
|
PayVo walletPay(Double amount) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.ResourceUtils;
|
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -99,18 +98,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
private final int MAX_RETRY = 3; // 最大重试次数
|
private final int MAX_RETRY = 3; // 最大重试次数
|
||||||
|
|
||||||
|
|
||||||
public AliPayServiceImpl(AliConfig aliConfig) {
|
public AliPayServiceImpl(Config config) {
|
||||||
Config config = new Config();
|
|
||||||
config.protocol = "https";
|
|
||||||
config.signType = "RSA2";
|
|
||||||
config.appId = aliConfig.getAppId();
|
|
||||||
config.merchantPrivateKey = aliConfig.getPrivateKey();
|
|
||||||
config.merchantCertPath = aliConfig.getAppCertPath();
|
|
||||||
config.alipayCertPath = aliConfig.getAlipayCertPath();
|
|
||||||
config.alipayRootCertPath = aliConfig.getAlipayRootCertPath();
|
|
||||||
config.gatewayHost = aliConfig.getGatewayHost();
|
|
||||||
config.notifyUrl = aliConfig.getNotifyUrl();
|
|
||||||
|
|
||||||
Factory.setOptions(config);
|
Factory.setOptions(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,13 +277,12 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝转账方法
|
* 支付宝转账方法
|
||||||
*
|
* @param amount 转账金额
|
||||||
* @param amount 转账金额
|
|
||||||
* @return 返回支付宝转账响应的内容
|
* @return 返回支付宝转账响应的内容
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
|
public R<String> fetch(String amount) throws AlipayApiException {
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||||
|
@ -366,7 +353,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
MailUtil.send(tos, "上海辰风互娱", content, false);
|
MailUtil.send(tos, "上海辰风互娱", content, false);
|
||||||
throw new ServiceException("网络连接出错,请稍后再试");
|
throw new ServiceException("网络连接出错,请稍后再试");
|
||||||
}
|
}
|
||||||
System.out.println("用户" + SecurityUtils.getUsername() + "提现失败:" + response.getSubMsg());
|
System.out.println("提现失败:" + response.getSubMsg());
|
||||||
throw new ServiceException("提现失败");
|
throw new ServiceException("提现失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,8 +414,37 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
return R.ok(orderTrade.getOrderStatus());
|
return R.ok(orderTrade.getOrderStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String bindingCallback(String authCode, String state) throws FileNotFoundException {
|
public String balance() throws AlipayApiException {
|
||||||
|
// 初始化SDK
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||||
|
|
||||||
|
// 构造请求参数以调用接口
|
||||||
|
AlipayFundAccountQueryRequest request = new AlipayFundAccountQueryRequest();
|
||||||
|
AlipayFundAccountQueryModel model = new AlipayFundAccountQueryModel();
|
||||||
|
|
||||||
|
// 应用userId
|
||||||
|
model.setAlipayUserId("2088721057420516");
|
||||||
|
|
||||||
|
// 设置查询的账号类型
|
||||||
|
model.setAccountType("ACCTRANS_ACCOUNT");
|
||||||
|
|
||||||
|
request.setBizModel(model);
|
||||||
|
AlipayFundAccountQueryResponse response = alipayClient.execute(request);
|
||||||
|
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
System.out.println("调用成功");
|
||||||
|
return response.getAvailableAmount();
|
||||||
|
} else {
|
||||||
|
System.out.println("调用失败");
|
||||||
|
return "fail";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String bindingCallback(String authCode, String state) {
|
||||||
try {
|
try {
|
||||||
Long userId = ShareCodeUtils.codeToId(state);
|
Long userId = ShareCodeUtils.codeToId(state);
|
||||||
if (Objects.isNull(userId)) {
|
if (Objects.isNull(userId)) {
|
||||||
|
@ -498,6 +514,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getTradStatus(String outTradeNo) throws Exception {
|
private Object getTradStatus(String outTradeNo) throws Exception {
|
||||||
|
Factory.setOptions(config);
|
||||||
AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo);
|
AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo);
|
||||||
Map<String, Object> map = JSONUtils.jsonToMap(query.getHttpBody());
|
Map<String, Object> map = JSONUtils.jsonToMap(query.getHttpBody());
|
||||||
|
|
||||||
|
@ -524,8 +541,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
sysUserPayAccountLog.setAccount("支付宝");
|
sysUserPayAccountLog.setAccount("支付宝");
|
||||||
sysUserPayAccountLogService.save(sysUserPayAccountLog);
|
sysUserPayAccountLogService.save(sysUserPayAccountLog);
|
||||||
}
|
}
|
||||||
|
public AlipayConfig getAlipayConfig() {
|
||||||
public AlipayConfig getAlipayConfig() throws FileNotFoundException {
|
|
||||||
|
|
||||||
AlipayConfig config = new AlipayConfig();
|
AlipayConfig config = new AlipayConfig();
|
||||||
|
|
||||||
|
@ -541,16 +557,14 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
// 设置支付宝公钥,因为配置了证书,所以不需要设置支付宝公钥
|
// 设置支付宝公钥,因为配置了证书,所以不需要设置支付宝公钥
|
||||||
// config.setAlipayPublicKey(aliConfig.getPublicKey());
|
// config.setAlipayPublicKey(aliConfig.getPublicKey());
|
||||||
|
|
||||||
// 设置应用公钥证书路径(线上)
|
// 设置应用公钥证书路径
|
||||||
// config.setAppCertPath(getClass().getResource("/cert/appCertPublicKey.crt").getPath());
|
config.setAppCertPath(getClass().getResource("/certs/appCertPublicKey.crt").getPath());
|
||||||
// 设置应用公钥证书路径(沙箱)
|
|
||||||
config.setAppCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAppCertPath()).getAbsolutePath());
|
|
||||||
|
|
||||||
// 设置支付宝公钥证书路径
|
// 设置支付宝公钥证书路径
|
||||||
config.setAlipayPublicCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAlipayCertPath()).getAbsolutePath());
|
config.setAlipayPublicCertPath(getClass().getResource(aliConfig.getAlipayCertPath()).getPath());
|
||||||
|
|
||||||
// 设置支付宝根证书路径
|
// 设置支付宝根证书路径
|
||||||
config.setRootCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAlipayRootCertPath()).getAbsolutePath());
|
config.setRootCertPath(getClass().getResource(aliConfig.getAlipayRootCertPath()).getPath());
|
||||||
|
|
||||||
// 设置字符编码格式
|
// 设置字符编码格式
|
||||||
config.setCharset("UTF-8");
|
config.setCharset("UTF-8");
|
||||||
|
|
|
@ -32,12 +32,5 @@
|
||||||
<artifactId>mcwl-system</artifactId>
|
<artifactId>mcwl-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- rabbitmq依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
|
||||||
<version>3.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -58,10 +58,4 @@ public class SysUserInfo {
|
||||||
@ApiModelProperty(value = "图片点赞次数")
|
@ApiModelProperty(value = "图片点赞次数")
|
||||||
private Long imageLikeNum = 0L;
|
private Long imageLikeNum = 0L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 作品数量
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "作品数量")
|
|
||||||
private Long productNum = 0L;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ModelCommentRes {
|
||||||
/**
|
/**
|
||||||
* 回复人
|
* 回复人
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "回复人", required = true)
|
@ApiModelProperty(value = "回复人")
|
||||||
private Long replyUserId;
|
private Long replyUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,6 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ModelImagePageRes extends PageDomain {
|
public class ModelImagePageRes extends PageDomain {
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "消息通知")
|
|
||||||
public class AdviceVo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "标题")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读 0否 1是
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "是否已读 0否 1是")
|
|
||||||
private String isRead;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "关注消息")
|
|
||||||
public class AttentionAdviceVo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "通知id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注我的用户头像
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "关注我的用户头像")
|
|
||||||
private String userAvatar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读 0否 1是
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "是否已读 0否 1是")
|
|
||||||
private Integer isRead;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "评论/点赞消息")
|
|
||||||
public class CommentAdviceVo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "通知id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论/点赞用户头像
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "评论/点赞用户头像")
|
|
||||||
private String userAvatar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论/点赞的商品id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "评论/点赞的商品id")
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论/点赞的商品图片
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "商品图片")
|
|
||||||
private String productImag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论/点赞的商品类型 0模型 1工作流 2图片
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "评论/点赞的商品类型 0模型 1工作流 2图片")
|
|
||||||
private Integer productType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读 0否 1是
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "是否已读 0否 1是")
|
|
||||||
private Integer isRead;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel(description = "评论/点赞消息")
|
|
||||||
public class LikeAdviceVo extends CommentAdviceVo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "评论id")
|
|
||||||
private Long commentId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,5 +20,4 @@ public interface ModelImageMapper extends BaseMapper<ModelImage> {
|
||||||
|
|
||||||
List<ResponseModelImage> imageList(PageVo pageVo);
|
List<ResponseModelImage> imageList(PageVo pageVo);
|
||||||
|
|
||||||
Long sumImageNumber(Long userId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,4 @@ public interface ModelMapper extends BaseMapper<ModelProduct> {
|
||||||
|
|
||||||
List<ResponseModelProduct> modelSquare(PageVo pageVo);
|
List<ResponseModelProduct> modelSquare(PageVo pageVo);
|
||||||
|
|
||||||
Long sumModelNumber(Long userId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,4 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
|
||||||
|
|
||||||
List<ResponseWorkFlow> workFlowList(PageVo pageVo);
|
List<ResponseWorkFlow> workFlowList(PageVo pageVo);
|
||||||
|
|
||||||
Long sumWorkFlowNumber(Long userId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.mcwl.resource.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.LikeAdviceVo;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息通知 服务层
|
|
||||||
*
|
|
||||||
* @author mcwl
|
|
||||||
*/
|
|
||||||
public interface ISysAdviceService extends IService<SysAdvice> {
|
|
||||||
|
|
||||||
List<AdviceVo> getAllMsg();
|
|
||||||
|
|
||||||
List<CommentAdviceVo> getCommentMsg(Integer productType);
|
|
||||||
|
|
||||||
List<LikeAdviceVo> getLikeMsg(Integer productType);
|
|
||||||
|
|
||||||
List<AttentionAdviceVo> getAttentionMsg();
|
|
||||||
|
|
||||||
void read(Long adviceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一键已读
|
|
||||||
*/
|
|
||||||
void readAll();
|
|
||||||
}
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.domain.R;
|
import com.mcwl.common.core.domain.R;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.SysUserAttention;
|
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
import com.mcwl.resource.domain.SysUserInfo;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
|
|
||||||
|
@ -17,12 +14,12 @@ import com.mcwl.resource.domain.vo.PageVo;
|
||||||
* @apiNote
|
* @apiNote
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface SysUserAttentionService extends IService<SysUserAttention> {
|
public interface SysUserAttentionService {
|
||||||
R<Boolean> addAttention(Long userId);
|
R<Boolean> addAttention(Long userId);
|
||||||
|
|
||||||
Boolean selectAttention(Long userId);
|
Boolean selectAttention(Long userId);
|
||||||
|
|
||||||
SysUserInfo selectUserInfo(Long userId);
|
SysUserInfo selectUserInfo();
|
||||||
|
|
||||||
PageInfo<SysUser> selectAttentionPage(PageVo pageVo);
|
PageInfo<SysUser> selectAttentionPage(PageVo pageVo);
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,33 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
import com.mcwl.resource.domain.ModelComment;
|
||||||
import com.mcwl.resource.domain.ModelCommentLike;
|
import com.mcwl.resource.domain.ModelCommentLike;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
import com.mcwl.resource.domain.ModelImageComment;
|
||||||
|
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||||
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
|
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
|
||||||
import com.mcwl.resource.mapper.ModelCommentMapper;
|
import com.mcwl.resource.mapper.ModelCommentMapper;
|
||||||
|
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
import com.mcwl.resource.service.ModelCommentLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型评论点赞
|
* 模型评论点赞
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper, ModelCommentLike> implements ModelCommentLikeService {
|
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper,ModelCommentLike> implements ModelCommentLikeService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelCommentMapper modelCommentMapper;
|
private ModelCommentMapper modelCommentMapper;
|
||||||
|
@ -45,7 +50,6 @@ public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMap
|
||||||
} else {
|
} else {
|
||||||
modelCommentLike.setDelFlag("0");
|
modelCommentLike.setDelFlag("0");
|
||||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
||||||
this.addLikeAdvice(modelComment);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateDelFlagById(modelCommentLike);
|
baseMapper.updateDelFlagById(modelCommentLike);
|
||||||
|
@ -66,35 +70,6 @@ public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMap
|
||||||
// 更新模型点赞数
|
// 更新模型点赞数
|
||||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
||||||
modelCommentMapper.updateById(modelComment);
|
modelCommentMapper.updateById(modelComment);
|
||||||
|
|
||||||
this.addLikeAdvice(modelComment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(ModelComment modelComment) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = modelComment.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
|
||||||
SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(modelComment.getModelId());
|
|
||||||
sysAdvice.setProductType(0);
|
|
||||||
sysAdvice.setCommentId(modelComment.getId());
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,27 +3,20 @@ package com.mcwl.resource.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.constant.QueueConstants;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
import com.mcwl.resource.domain.ModelComment;
|
||||||
import com.mcwl.resource.domain.ModelCommentLike;
|
import com.mcwl.resource.domain.ModelCommentLike;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.WorkFlowComment;
|
import com.mcwl.resource.domain.WorkFlowComment;
|
||||||
import com.mcwl.resource.domain.dto.ModelCommentRes;
|
import com.mcwl.resource.domain.dto.ModelCommentRes;
|
||||||
import com.mcwl.resource.domain.vo.ModelCommentVo;
|
import com.mcwl.resource.domain.vo.ModelCommentVo;
|
||||||
import com.mcwl.resource.mapper.ModelCommentMapper;
|
import com.mcwl.resource.mapper.ModelCommentMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
|
||||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
import com.mcwl.resource.service.ModelCommentLikeService;
|
||||||
import com.mcwl.resource.service.ModelCommentService;
|
import com.mcwl.resource.service.ModelCommentService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -44,15 +37,10 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelCommentLikeService modelCommentLikeService;
|
private ModelCommentLikeService modelCommentLikeService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysAdviceService sysAdviceService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelImageMapper modelImageMapper;
|
private ModelImageMapper modelImageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void comment(ModelCommentRes modelCommentRes) {
|
public void comment(ModelCommentRes modelCommentRes) {
|
||||||
Long parentId = modelCommentRes.getParentId();
|
Long parentId = modelCommentRes.getParentId();
|
||||||
|
|
||||||
|
@ -64,42 +52,9 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
|
||||||
}
|
}
|
||||||
ModelComment modelComment = new ModelComment();
|
ModelComment modelComment = new ModelComment();
|
||||||
BeanUtil.copyProperties(modelCommentRes, modelComment);
|
BeanUtil.copyProperties(modelCommentRes, modelComment);
|
||||||
Long userId = SecurityUtils.getUserId();
|
modelComment.setUserId(SecurityUtils.getUserId());
|
||||||
modelComment.setUserId(userId);
|
|
||||||
modelCommentMapper.insert(modelComment);
|
modelCommentMapper.insert(modelComment);
|
||||||
|
|
||||||
|
|
||||||
Long replyUserId = modelCommentRes.getReplyUserId();
|
|
||||||
|
|
||||||
if (Objects.isNull(replyUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelComment mc = modelCommentMapper.selectById(replyUserId);
|
|
||||||
if (Objects.isNull(mc)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.equals(userId, mc.getUserId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String content = StringUtils.format("{}给您的模型发了一条评论:{}",
|
|
||||||
SecurityUtils.getUsername(), modelCommentRes.getContent());
|
|
||||||
|
|
||||||
// 向通知表中插入一条记录
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(mc.getUserId());
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(modelCommentRes.getModelId());
|
|
||||||
sysAdvice.setProductType(0);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.COMMENT_REMIND);
|
|
||||||
sysAdviceService.save(sysAdvice);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,8 +101,8 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
|
||||||
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
||||||
|
|
||||||
// 5. 批量查询点赞状态(仅当用户已登录)
|
// 5. 批量查询点赞状态(仅当用户已登录)
|
||||||
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
|
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
|
||||||
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
|
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
|
|
||||||
// 6. 构建评论树结构(传递点赞状态)
|
// 6. 构建评论树结构(传递点赞状态)
|
||||||
|
|
|
@ -3,14 +3,15 @@ package com.mcwl.resource.service.impl;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelImageComment;
|
import com.mcwl.resource.domain.ModelImageComment;
|
||||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
import com.mcwl.resource.domain.ModelImageLike;
|
||||||
|
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
|
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
import com.mcwl.resource.service.ModelImageCommentService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -45,7 +46,6 @@ public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageComm
|
||||||
} else {
|
} else {
|
||||||
modelImageCommentLike.setDelFlag("0");
|
modelImageCommentLike.setDelFlag("0");
|
||||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||||
this.addLikeAdvice(modelImageComment);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateDelFlagById(modelImageCommentLike);
|
baseMapper.updateDelFlagById(modelImageCommentLike);
|
||||||
|
@ -66,36 +66,6 @@ public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageComm
|
||||||
// 更新图片点赞数
|
// 更新图片点赞数
|
||||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||||
modelImageCommentMapper.updateById(modelImageComment);
|
modelImageCommentMapper.updateById(modelImageComment);
|
||||||
|
|
||||||
this.addLikeAdvice(modelImageComment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(ModelImageComment modelImageComment) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = modelImageComment.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
|
||||||
SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(modelImageComment.getModelImageId());
|
|
||||||
sysAdvice.setProductType(2);
|
|
||||||
sysAdvice.setCommentId(modelImageComment.getId());
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.resource.domain.ModelComment;
|
||||||
import com.mcwl.resource.domain.*;
|
import com.mcwl.resource.domain.ModelImageComment;
|
||||||
|
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||||
|
import com.mcwl.resource.domain.WorkFlowComment;
|
||||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
|
||||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||||
import com.mcwl.resource.service.ModelImageCommentService;
|
import com.mcwl.resource.service.ModelImageCommentService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -34,10 +33,7 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
|
||||||
|
|
||||||
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
||||||
|
|
||||||
private final ISysAdviceService sysAdviceService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void comment(ModelImageCommentRes modelImageCommentRes) {
|
public void comment(ModelImageCommentRes modelImageCommentRes) {
|
||||||
Long parentId = modelImageCommentRes.getParentId();
|
Long parentId = modelImageCommentRes.getParentId();
|
||||||
|
|
||||||
|
@ -50,42 +46,9 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
|
||||||
|
|
||||||
ModelImageComment modelImageComment = new ModelImageComment();
|
ModelImageComment modelImageComment = new ModelImageComment();
|
||||||
BeanUtil.copyProperties(modelImageCommentRes, modelImageComment);
|
BeanUtil.copyProperties(modelImageCommentRes, modelImageComment);
|
||||||
Long userId = SecurityUtils.getUserId();
|
modelImageComment.setUserId(SecurityUtils.getUserId());
|
||||||
modelImageComment.setUserId(userId);
|
|
||||||
baseMapper.insert(modelImageComment);
|
baseMapper.insert(modelImageComment);
|
||||||
|
|
||||||
|
|
||||||
Long replyUserId = modelImageCommentRes.getReplyUserId();
|
|
||||||
|
|
||||||
if (Objects.isNull(replyUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelImageComment mic = baseMapper.selectById(replyUserId);
|
|
||||||
if (Objects.isNull(mic)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.equals(userId, mic.getUserId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String content = StringUtils.format("{}给您的图片发了一条评论:{}",
|
|
||||||
SecurityUtils.getUsername(), modelImageCommentRes.getContent());
|
|
||||||
|
|
||||||
// 向通知表中插入一条记录
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(mic.getUserId());
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(modelImageCommentRes.getModelImageId());
|
|
||||||
sysAdvice.setProductType(0);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.COMMENT_REMIND);
|
|
||||||
sysAdviceService.save(sysAdvice);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,8 +94,8 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
|
||||||
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
||||||
|
|
||||||
// 5. 批量查询点赞状态(仅当用户已登录)
|
// 5. 批量查询点赞状态(仅当用户已登录)
|
||||||
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
|
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
|
||||||
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
|
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
|
|
||||||
// 6. 构建评论树结构(传递点赞状态)
|
// 6. 构建评论树结构(传递点赞状态)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -16,14 +15,12 @@ import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelImageLike;
|
import com.mcwl.resource.domain.ModelImageLike;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.response.ResponseModelImage;
|
import com.mcwl.resource.domain.response.ResponseModelImage;
|
||||||
import com.mcwl.resource.domain.vo.ModelImageLikeVo;
|
import com.mcwl.resource.domain.vo.ModelImageLikeVo;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
import com.mcwl.resource.mapper.ModelImageLikeMapper;
|
import com.mcwl.resource.mapper.ModelImageLikeMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||||
import com.mcwl.resource.service.ModelImageLikeService;
|
import com.mcwl.resource.service.ModelImageLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -63,7 +60,6 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
||||||
} else {
|
} else {
|
||||||
modelImageLike.setDelFlag("0");
|
modelImageLike.setDelFlag("0");
|
||||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||||
this.addLikeAdvice(modelImage);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateDelFlagById(modelImageLike);
|
baseMapper.updateDelFlagById(modelImageLike);
|
||||||
|
@ -84,8 +80,6 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
||||||
// 更新图片点赞数
|
// 更新图片点赞数
|
||||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||||
modelImageMapper.updateById(modelImage);
|
modelImageMapper.updateById(modelImage);
|
||||||
|
|
||||||
this.addLikeAdvice(modelImage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,23 +162,15 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
||||||
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
|
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
|
||||||
|
|
||||||
List<ResponseModelImage> responseModelImageList = modelImageMapper.imageList(pageVo);
|
List<ResponseModelImage> responseModelImageList = modelImageMapper.imageList(pageVo);
|
||||||
|
|
||||||
List<Long> modelImageLikeIds = new ArrayList<>();
|
|
||||||
|
|
||||||
List<ModelImageLike> modelImageLikes = baseMapper.selectList(new LambdaQueryWrapper<ModelImageLike>()
|
|
||||||
.eq(ModelImageLike::getUserId, SecurityUtils.getUserIdMax()));
|
|
||||||
for (ModelImageLike modelImageLike : modelImageLikes) {
|
|
||||||
modelImageLikeIds.add(modelImageLike.getModelImageId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (ResponseModelImage responseModelImage : responseModelImageList) {
|
for (ResponseModelImage responseModelImage : responseModelImageList) {
|
||||||
|
|
||||||
String[] split = responseModelImage.getImagePaths().split(",");
|
String[] split = responseModelImage.getImagePaths().split(",");
|
||||||
responseModelImage.setPath(split[0]);
|
responseModelImage.setPath(split[0]);
|
||||||
|
|
||||||
//查询是否点赞
|
|
||||||
if (!modelImageLikeIds.contains(responseModelImage.getId())){
|
//查询模型是否点赞
|
||||||
|
ModelImageLike likeImage = baseMapper.getLikeImage(SecurityUtils.getUserIdMax(), responseModelImage.getId());
|
||||||
|
if (likeImage == null){
|
||||||
responseModelImage.setIsLike(0);
|
responseModelImage.setIsLike(0);
|
||||||
}else {
|
}else {
|
||||||
responseModelImage.setIsLike(1);
|
responseModelImage.setIsLike(1);
|
||||||
|
@ -195,31 +181,4 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(ModelImage modelImage) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = modelImage.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的图片:{}",
|
|
||||||
SecurityUtils.getUsername(), modelImage.getTitle());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(modelImage.getId());
|
|
||||||
sysAdvice.setProductType(2);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,9 +175,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
||||||
if (Objects.isNull(imagePageRes.getUserId())) {
|
|
||||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
|
||||||
}
|
|
||||||
Page<ModelImage> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
Page<ModelImage> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
||||||
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
|
@ -190,7 +188,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
|
|
||||||
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelImage::getStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelImage::getStatus, imagePageRes.getStatus())
|
||||||
.eq(ModelImage::getUserId, imagePageRes.getUserId())
|
.eq(ModelImage::getUserId, SecurityUtils.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
|
||||||
|
|
||||||
|
@ -236,7 +234,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
BeanUtil.copyProperties(modelImage, modelImageVo);
|
||||||
|
|
||||||
ModelImageLike modelImageLike = modelImageLikeService.lambdaQuery()
|
ModelImageLike modelImageLike = modelImageLikeService.lambdaQuery()
|
||||||
.eq(ModelImageLike::getUserId, SecurityUtils.getUserIdMax())
|
.eq(ModelImageLike::getUserId, SecurityUtils.getUserId())
|
||||||
.eq(ModelImageLike::getModelImageId, imageId)
|
.eq(ModelImageLike::getModelImageId, imageId)
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
|
@ -255,8 +253,8 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
modelImageVo.setTags(tagList);
|
modelImageVo.setTags(tagList);
|
||||||
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||||
modelImageVo.setUserId(sysUser.getUserId());
|
modelImageVo.setUserId(SecurityUtils.getUserId());
|
||||||
modelImageVo.setUserName(sysUser.getUserName());
|
modelImageVo.setUserName(SecurityUtils.getUsername());
|
||||||
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
||||||
return modelImageVo;
|
return modelImageVo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,11 @@ import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
import com.mcwl.resource.domain.*;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.vo.ModelLikeVo;
|
import com.mcwl.resource.domain.vo.ModelLikeVo;
|
||||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelMapper;
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
|
import com.mcwl.resource.mapper.ModelLikeMapper;
|
||||||
import com.mcwl.resource.service.ModelLikeService;
|
import com.mcwl.resource.service.ModelLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -44,7 +41,7 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional
|
||||||
public void like(Long modelId) {
|
public void like(Long modelId) {
|
||||||
ModelProduct model = modelMapper.selectById(modelId);
|
ModelProduct model = modelMapper.selectById(modelId);
|
||||||
if (Objects.isNull(model)) {
|
if (Objects.isNull(model)) {
|
||||||
|
@ -61,7 +58,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
} else {
|
} else {
|
||||||
modelLike.setDelFlag("0");
|
modelLike.setDelFlag("0");
|
||||||
model.setLikeNum(model.getLikeNum() + 1);
|
model.setLikeNum(model.getLikeNum() + 1);
|
||||||
this.addLikeAdvice(model);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateDelFlagById(modelLike);
|
baseMapper.updateDelFlagById(modelLike);
|
||||||
|
@ -82,8 +78,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
// 更新图片点赞数
|
// 更新图片点赞数
|
||||||
model.setNumbers(model.getLikeNum() + 1);
|
model.setNumbers(model.getLikeNum() + 1);
|
||||||
modelMapper.updateById(model);
|
modelMapper.updateById(model);
|
||||||
|
|
||||||
this.addLikeAdvice(model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -132,32 +126,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(ModelProduct model) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = model.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的模型:{}",
|
|
||||||
SecurityUtils.getUsername(), model.getModelName());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(model.getId());
|
|
||||||
sysAdvice.setProductType(0);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Page<ModelLike> initPage(PageDomain pageDomain) {
|
private Page<ModelLike> initPage(PageDomain pageDomain) {
|
||||||
Page<ModelLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
Page<ModelLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||||
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
||||||
|
@ -168,6 +136,4 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,10 +158,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
if (Objects.isNull(imagePageRes.getUserId())) {
|
|
||||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
Page<ModelProduct> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
Page<ModelProduct> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
||||||
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
|
@ -174,7 +170,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
|
|
||||||
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
|
||||||
.eq( ModelProduct::getUserId, imagePageRes.getUserId())
|
.eq( ModelProduct::getUserId, SecurityUtils.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
||||||
postMapper.selectPage(page, lqw);
|
postMapper.selectPage(page, lqw);
|
||||||
|
@ -492,12 +488,12 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
modelProduct.setIsAttention(1);
|
modelProduct.setIsAttention(1);
|
||||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), modelProduct.getUserId());
|
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), modelProduct.getUserId());
|
||||||
if (sysUserAttention == null){
|
if (sysUserAttention == null){
|
||||||
modelProduct.setIsAttention(0);
|
modelProduct.setIsAttention(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkFlowLike workFlowLike = modelLikeMapper.selectModelLikeById(SecurityUtils.getUserIdMax(),modelProduct.getId());
|
WorkFlowLike workFlowLike = modelLikeMapper.selectModelLikeById(SecurityUtils.getUserId(),modelProduct.getId());
|
||||||
modelProduct.setIsLike(1);
|
modelProduct.setIsLike(1);
|
||||||
if (workFlowLike == null){
|
if (workFlowLike == null){
|
||||||
modelProduct.setIsLike(0);
|
modelProduct.setIsLike(0);
|
||||||
|
|
|
@ -1,288 +0,0 @@
|
||||||
package com.mcwl.resource.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.WorkFlow;
|
|
||||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
|
||||||
import com.mcwl.resource.domain.vo.LikeAdviceVo;
|
|
||||||
import com.mcwl.resource.mapper.SysAdviceMapper;
|
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
|
||||||
import com.mcwl.resource.service.ModelImageService;
|
|
||||||
import com.mcwl.resource.service.ModelService;
|
|
||||||
import com.mcwl.resource.service.WorkFlowService;
|
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息管理 业务层处理
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice> implements ISysAdviceService {
|
|
||||||
|
|
||||||
private final ISysUserService sysUserService;
|
|
||||||
|
|
||||||
private final ModelService modelService;
|
|
||||||
|
|
||||||
private final WorkFlowService workFlowService;
|
|
||||||
|
|
||||||
private final ModelImageService modelImageService;
|
|
||||||
|
|
||||||
private final Map<Long, ModelProduct> modelProductMap = new ConcurrentHashMap<>();
|
|
||||||
private final Map<Long, WorkFlow> workFlowMap = new ConcurrentHashMap<>();
|
|
||||||
private final Map<Long, ModelImage> modelImageMap = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AdviceVo> getAllMsg() {
|
|
||||||
|
|
||||||
// 创建分页对象
|
|
||||||
Page<SysAdvice> page = new Page<>(1, 20);
|
|
||||||
|
|
||||||
LambdaQueryWrapper<SysAdvice> lqw = new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.and(wrapper -> wrapper
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId())
|
|
||||||
.or()
|
|
||||||
.isNull(SysAdvice::getReceiverId)
|
|
||||||
)
|
|
||||||
.orderByDesc(SysAdvice::getCreateTime);
|
|
||||||
|
|
||||||
Page<SysAdvice> sysAdvicePage = baseMapper.selectPage(page, lqw);
|
|
||||||
|
|
||||||
|
|
||||||
List<SysAdvice> sysAdvices = sysAdvicePage.getRecords();
|
|
||||||
|
|
||||||
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CommentAdviceVo> getCommentMsg(Integer productType) {
|
|
||||||
|
|
||||||
this.postConstruct();
|
|
||||||
|
|
||||||
List<SysAdvice> sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.eq(SysAdvice::getType, AdviceEnum.COMMENT_REMIND)
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId())
|
|
||||||
.eq(productType != 3, SysAdvice::getProductType, productType)
|
|
||||||
.orderByDesc(SysAdvice::getCreateTime));
|
|
||||||
|
|
||||||
|
|
||||||
List<Long> commentUserIdList = new ArrayList<>();
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
commentUserIdList.add(sysAdvice.getSenderId());
|
|
||||||
}
|
|
||||||
List<SysUser> sysUsers = sysUserService.listByIds(commentUserIdList);
|
|
||||||
|
|
||||||
Map<Long, SysUser> commentUserMap = new HashMap<>();
|
|
||||||
for (SysUser sysUser : sysUsers) {
|
|
||||||
commentUserMap.put(sysUser.getUserId(), sysUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CommentAdviceVo> commentAdviceVoList = new ArrayList<>();
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
CommentAdviceVo commentAdviceVo = BeanUtil.copyProperties(sysAdvice, CommentAdviceVo.class);
|
|
||||||
|
|
||||||
Long senderId = sysAdvice.getSenderId();
|
|
||||||
SysUser senderUser = commentUserMap.get(senderId);
|
|
||||||
if (Objects.nonNull(senderUser)) {
|
|
||||||
commentAdviceVo.setUserAvatar(senderUser.getAvatar());
|
|
||||||
}
|
|
||||||
if (sysAdvice.getProductType() == 0) {
|
|
||||||
ModelProduct modelProduct = modelProductMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(modelProduct)) {
|
|
||||||
commentAdviceVo.setProductImag(modelProduct.getSurfaceUrl());
|
|
||||||
}
|
|
||||||
} else if (sysAdvice.getProductType() == 1) {
|
|
||||||
WorkFlow workFlow = workFlowMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(workFlow)) {
|
|
||||||
commentAdviceVo.setProductImag(workFlow.getCoverPath());
|
|
||||||
}
|
|
||||||
} else if (sysAdvice.getProductType() == 2) {
|
|
||||||
ModelImage modelImage = modelImageMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(modelImage)) {
|
|
||||||
commentAdviceVo.setProductImag(modelImage.getImagePaths().split(",")[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
commentAdviceVoList.add(commentAdviceVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return commentAdviceVoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<LikeAdviceVo> getLikeMsg(Integer productType) {
|
|
||||||
this.postConstruct();
|
|
||||||
List<SysAdvice> sysAdviceList;
|
|
||||||
if (productType == 3) {
|
|
||||||
sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.eq(SysAdvice::getType, AdviceEnum.LIKE_REMIND)
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId())
|
|
||||||
.isNotNull(SysAdvice::getCommentId)
|
|
||||||
.orderByDesc(SysAdvice::getCreateTime));
|
|
||||||
} else {
|
|
||||||
sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.eq(SysAdvice::getType, AdviceEnum.LIKE_REMIND)
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId())
|
|
||||||
.eq(productType != 4, SysAdvice::getProductType, productType)
|
|
||||||
.orderByDesc(SysAdvice::getCreateTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Long> likeUserIdList = new ArrayList<>();
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
likeUserIdList.add(sysAdvice.getSenderId());
|
|
||||||
}
|
|
||||||
List<SysUser> sysUsers = sysUserService.listByIds(likeUserIdList);
|
|
||||||
|
|
||||||
Map<Long, SysUser> likeUserMap = new HashMap<>();
|
|
||||||
for (SysUser sysUser : sysUsers) {
|
|
||||||
likeUserMap.put(sysUser.getUserId(), sysUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
List<LikeAdviceVo> likeAdviceVoList = new ArrayList<>();
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
LikeAdviceVo likeAdviceVo = BeanUtil.copyProperties(sysAdvice, LikeAdviceVo.class);
|
|
||||||
|
|
||||||
Long senderId = sysAdvice.getSenderId();
|
|
||||||
SysUser senderUser = likeUserMap.get(senderId);
|
|
||||||
if (Objects.nonNull(senderUser)) {
|
|
||||||
likeAdviceVo.setUserAvatar(senderUser.getAvatar());
|
|
||||||
}
|
|
||||||
if (sysAdvice.getProductType() == 0) {
|
|
||||||
ModelProduct modelProduct = modelProductMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(modelProduct)) {
|
|
||||||
likeAdviceVo.setProductImag(modelProduct.getSurfaceUrl());
|
|
||||||
}
|
|
||||||
} else if (sysAdvice.getProductType() == 1) {
|
|
||||||
WorkFlow workFlow = workFlowMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(workFlow)) {
|
|
||||||
likeAdviceVo.setProductImag(workFlow.getCoverPath());
|
|
||||||
}
|
|
||||||
} else if (sysAdvice.getProductType() == 2) {
|
|
||||||
ModelImage modelImage = modelImageMap.get(sysAdvice.getProductId());
|
|
||||||
if (Objects.nonNull(modelImage)) {
|
|
||||||
likeAdviceVo.setProductImag(modelImage.getImagePaths().split(",")[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
likeAdviceVoList.add(likeAdviceVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return likeAdviceVoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AttentionAdviceVo> getAttentionMsg() {
|
|
||||||
List<SysAdvice> sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.eq(SysAdvice::getType, AdviceEnum.FANS_REMIND)
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId())
|
|
||||||
.orderByDesc(SysAdvice::getCreateTime));
|
|
||||||
|
|
||||||
List<AttentionAdviceVo> attentionAdviceVoList = new ArrayList<>();
|
|
||||||
List<Long> atentUserIdList = new ArrayList<>();
|
|
||||||
|
|
||||||
// 通知表中获取所有关注我的用户id
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
atentUserIdList.add(sysAdvice.getSenderId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建map, key为用户id,value为用户信息
|
|
||||||
Map<Long, SysUser> attentionUserMap = new HashMap<>();
|
|
||||||
|
|
||||||
// 批量查询用户信息, 并构建映射关系
|
|
||||||
List<SysUser> atentUserList = sysUserService.listByIds(atentUserIdList);
|
|
||||||
for (SysUser sysUser : atentUserList) {
|
|
||||||
attentionUserMap.put(sysUser.getUserId(), sysUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
AttentionAdviceVo attentionAdviceVo = BeanUtil.copyProperties(sysAdvice, AttentionAdviceVo.class);
|
|
||||||
Long senderId = sysAdvice.getSenderId();
|
|
||||||
SysUser attentionUser = attentionUserMap.get(senderId);
|
|
||||||
if (Objects.nonNull(attentionUser)) {
|
|
||||||
attentionAdviceVo.setUserAvatar(attentionUser.getAvatar());
|
|
||||||
}
|
|
||||||
attentionAdviceVoList.add(attentionAdviceVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return attentionAdviceVoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(Long adviceId) {
|
|
||||||
SysAdvice sysAdvice = baseMapper.selectById(adviceId);
|
|
||||||
|
|
||||||
if (Objects.isNull(sysAdvice)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Long receiverId = sysAdvice.getReceiverId();
|
|
||||||
if (!Objects.equals(SecurityUtils.getUserId(), receiverId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sysAdvice.setIsRead(1);
|
|
||||||
baseMapper.updateById(sysAdvice);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readAll() {
|
|
||||||
List<SysAdvice> sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper<SysAdvice>()
|
|
||||||
.eq(SysAdvice::getIsRead, 0)
|
|
||||||
.eq(SysAdvice::getReceiverId, SecurityUtils.getUserId()));
|
|
||||||
for (SysAdvice sysAdvice : sysAdviceList) {
|
|
||||||
sysAdvice.setIsRead(1);
|
|
||||||
baseMapper.updateById(sysAdvice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postConstruct() {
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
|
|
||||||
// 并行加载数据
|
|
||||||
CompletableFuture<List<ModelProduct>> productsFuture = CompletableFuture.supplyAsync(() ->
|
|
||||||
modelService.lambdaQuery().eq(ModelProduct::getUserId, userId).list()
|
|
||||||
);
|
|
||||||
|
|
||||||
CompletableFuture<List<WorkFlow>> workflowsFuture = CompletableFuture.supplyAsync(() ->
|
|
||||||
workFlowService.lambdaQuery().eq(WorkFlow::getUserId, userId).list()
|
|
||||||
);
|
|
||||||
|
|
||||||
CompletableFuture<List<ModelImage>> imagesFuture = CompletableFuture.supplyAsync(() ->
|
|
||||||
modelImageService.lambdaQuery().eq(ModelImage::getUserId, userId).list()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 等待所有任务完成
|
|
||||||
CompletableFuture.allOf(productsFuture, workflowsFuture, imagesFuture).join();
|
|
||||||
|
|
||||||
// 更新缓存
|
|
||||||
modelProductMap.clear();
|
|
||||||
productsFuture.join().forEach(p -> modelProductMap.put(p.getId(), p));
|
|
||||||
|
|
||||||
workFlowMap.clear();
|
|
||||||
workflowsFuture.join().forEach(w -> workFlowMap.put(w.getId(), w));
|
|
||||||
|
|
||||||
modelImageMap.clear();
|
|
||||||
imagesFuture.join().forEach(i -> modelImageMap.put(i.getId(), i));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +1,19 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.domain.R;
|
import com.mcwl.common.core.domain.R;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.SysUserAttention;
|
import com.mcwl.resource.domain.SysUserAttention;
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
import com.mcwl.resource.domain.SysUserInfo;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
import com.mcwl.resource.mapper.*;
|
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||||
|
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||||
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
|
import com.mcwl.resource.mapper.SysUserAttentionMapper;
|
||||||
import com.mcwl.resource.service.SysUserAttentionService;
|
import com.mcwl.resource.service.SysUserAttentionService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.mapper.SysUserMapper;
|
import com.mcwl.system.mapper.SysUserMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -31,7 +30,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMapper, SysUserAttention> implements SysUserAttentionService {
|
public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -46,9 +45,6 @@ public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMap
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelImageMapper modelImageMapper;
|
private ModelImageMapper modelImageMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WorkFlowMapper workFlowMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
@ -57,7 +53,7 @@ public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMap
|
||||||
|
|
||||||
//查看是否已关注
|
//查看是否已关注
|
||||||
Boolean aBoolean = selectAttention(userId);
|
Boolean aBoolean = selectAttention(userId);
|
||||||
if (aBoolean) {
|
if (aBoolean == true) {
|
||||||
//取关
|
//取关
|
||||||
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId);
|
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId);
|
||||||
return R.ok(false);
|
return R.ok(false);
|
||||||
|
@ -70,37 +66,25 @@ public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMap
|
||||||
.createTime(new Date())
|
.createTime(new Date())
|
||||||
.build();
|
.build();
|
||||||
sysUserAttentionMapper.insert(sysUserAttention);
|
sysUserAttentionMapper.insert(sysUserAttention);
|
||||||
|
|
||||||
|
|
||||||
// 添加通知
|
|
||||||
String content = StringUtils.format("{}关注了您,快去看看吧!", SecurityUtils.getUsername());
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(SecurityUtils.getUserId());
|
|
||||||
sysAdvice.setReceiverId(userId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.FANS_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
return R.ok(true);
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean selectAttention(Long userId) {
|
public Boolean selectAttention(Long userId) {
|
||||||
|
|
||||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), userId);
|
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), userId);
|
||||||
|
|
||||||
return sysUserAttention != null;
|
if (sysUserAttention == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUserInfo selectUserInfo(Long userId) {
|
public SysUserInfo selectUserInfo() {
|
||||||
|
|
||||||
if (userId == null) {
|
|
||||||
userId = SecurityUtils.getUserId();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
// 粉丝数
|
// 粉丝数
|
||||||
Long userBeanNum = sysUserAttentionMapper.selectBean(userId);
|
Long userBeanNum = sysUserAttentionMapper.selectBean(userId);
|
||||||
|
|
||||||
|
@ -119,19 +103,12 @@ public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMap
|
||||||
// 图片点赞次数
|
// 图片点赞次数
|
||||||
Long imageLikeNum = modelImageMapper.sumLikeNumber(userId);
|
Long imageLikeNum = modelImageMapper.sumLikeNumber(userId);
|
||||||
|
|
||||||
// 作品数量
|
return SysUserInfo.builder().bean(userBeanNum)
|
||||||
Long modelNumber = modelMapper.sumModelNumber(userId);
|
|
||||||
Long imageNumber = modelImageMapper.sumImageNumber(userId);
|
|
||||||
Long workFlowNumber = workFlowMapper.sumWorkFlowNumber(userId);
|
|
||||||
|
|
||||||
return SysUserInfo.builder()
|
|
||||||
.bean(userBeanNum)
|
|
||||||
.attention(userAttentionNum)
|
.attention(userAttentionNum)
|
||||||
.modelDownloadNum(modelDownloadNum)
|
.modelDownloadNum(modelDownloadNum)
|
||||||
.modelRunNum(modelRunNum)
|
.modelRunNum(modelRunNum)
|
||||||
.modelLikeNum(modelLikeNum)
|
.modelLikeNum(modelLikeNum)
|
||||||
.imageLikeNum(imageLikeNum)
|
.imageLikeNum(imageLikeNum)
|
||||||
.productNum(modelNumber + imageNumber + workFlowNumber)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,11 @@ package com.mcwl.resource.service.impl;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.WorkFlowComment;
|
import com.mcwl.resource.domain.WorkFlowComment;
|
||||||
import com.mcwl.resource.domain.WorkFlowCommentLike;
|
import com.mcwl.resource.domain.WorkFlowCommentLike;
|
||||||
import com.mcwl.resource.mapper.WorkFlowCommentLikeMapper;
|
import com.mcwl.resource.mapper.WorkFlowCommentLikeMapper;
|
||||||
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
|
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
|
||||||
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -50,7 +47,6 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
|
||||||
} else {
|
} else {
|
||||||
workFlowCommentLike.setDelFlag("0");
|
workFlowCommentLike.setDelFlag("0");
|
||||||
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
||||||
this.addLikeAdvice(workFlowComment);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateDelFlagById(workFlowCommentLike);
|
baseMapper.updateDelFlagById(workFlowCommentLike);
|
||||||
|
@ -71,34 +67,6 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
|
||||||
// 更新模型点赞数
|
// 更新模型点赞数
|
||||||
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
||||||
workFlowCommentMapper.updateById(workFlowComment);
|
workFlowCommentMapper.updateById(workFlowComment);
|
||||||
|
|
||||||
this.addLikeAdvice(workFlowComment);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(WorkFlowComment workFlowComment) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = workFlowComment.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
|
||||||
SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(workFlowComment.getWorkFlowId());
|
|
||||||
sysAdvice.setProductType(1);
|
|
||||||
sysAdvice.setCommentId(workFlowComment.getId());
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelImageComment;
|
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.WorkFlowComment;
|
import com.mcwl.resource.domain.WorkFlowComment;
|
||||||
import com.mcwl.resource.domain.WorkFlowCommentLike;
|
import com.mcwl.resource.domain.WorkFlowCommentLike;
|
||||||
import com.mcwl.resource.domain.dto.WorkFlowCommentRes;
|
import com.mcwl.resource.domain.dto.WorkFlowCommentRes;
|
||||||
import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
|
import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
|
||||||
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
|
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
|
||||||
import com.mcwl.resource.service.ISysAdviceService;
|
|
||||||
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
||||||
import com.mcwl.resource.service.WorkFlowCommentService;
|
import com.mcwl.resource.service.WorkFlowCommentService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -48,10 +43,6 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
|
||||||
private WorkFlowCommentLikeService workFlowCommentLikeService;
|
private WorkFlowCommentLikeService workFlowCommentLikeService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysAdviceService sysAdviceService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void comment(WorkFlowCommentRes workFlowCommentRes) {
|
public void comment(WorkFlowCommentRes workFlowCommentRes) {
|
||||||
Long parentId = workFlowCommentRes.getParentId();
|
Long parentId = workFlowCommentRes.getParentId();
|
||||||
|
@ -64,43 +55,9 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
|
||||||
}
|
}
|
||||||
WorkFlowComment workFlowComment = new WorkFlowComment();
|
WorkFlowComment workFlowComment = new WorkFlowComment();
|
||||||
BeanUtil.copyProperties(workFlowCommentRes, workFlowComment);
|
BeanUtil.copyProperties(workFlowCommentRes, workFlowComment);
|
||||||
Long userId = SecurityUtils.getUserId();
|
workFlowComment.setUserId(SecurityUtils.getUserId());
|
||||||
workFlowComment.setUserId(userId);
|
|
||||||
workFlowCommentMapper.insert(workFlowComment);
|
workFlowCommentMapper.insert(workFlowComment);
|
||||||
|
|
||||||
|
|
||||||
Long replyUserId = workFlowCommentRes.getReplyUserId();
|
|
||||||
|
|
||||||
if (Objects.isNull(replyUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorkFlowComment wfc = workFlowCommentMapper.selectById(replyUserId);
|
|
||||||
if (Objects.isNull(wfc)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.equals(userId, wfc.getUserId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String content = StringUtils.format("{}给您的图片发了一条评论:{}",
|
|
||||||
SecurityUtils.getUsername(), workFlowCommentRes.getContent());
|
|
||||||
|
|
||||||
// 向通知表中插入一条记录
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(wfc.getUserId());
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(workFlowCommentRes.getWorkFlowId());
|
|
||||||
sysAdvice.setProductType(0);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.COMMENT_REMIND);
|
|
||||||
sysAdviceService.save(sysAdvice);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,8 +99,8 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
|
||||||
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
|
||||||
|
|
||||||
// 5. 批量查询点赞状态(仅当用户已登录)
|
// 5. 批量查询点赞状态(仅当用户已登录)
|
||||||
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
|
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
|
||||||
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
|
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
|
|
||||||
// 6. 构建评论树结构(传递点赞状态)
|
// 6. 构建评论树结构(传递点赞状态)
|
||||||
|
|
|
@ -12,14 +12,12 @@ import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
|
||||||
import com.mcwl.resource.domain.WorkFlow;
|
import com.mcwl.resource.domain.WorkFlow;
|
||||||
import com.mcwl.resource.domain.WorkFlowLike;
|
import com.mcwl.resource.domain.WorkFlowLike;
|
||||||
import com.mcwl.resource.domain.vo.WorkFlowLikeVo;
|
import com.mcwl.resource.domain.vo.WorkFlowLikeVo;
|
||||||
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
|
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
|
||||||
import com.mcwl.resource.mapper.WorkFlowMapper;
|
import com.mcwl.resource.mapper.WorkFlowMapper;
|
||||||
import com.mcwl.resource.service.WorkFlowLikeService;
|
import com.mcwl.resource.service.WorkFlowLikeService;
|
||||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -67,7 +65,6 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
||||||
} else {
|
} else {
|
||||||
workFlowLike.setDelFlag("0");
|
workFlowLike.setDelFlag("0");
|
||||||
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
|
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
|
||||||
this.addLikeAdvice(workFlow);
|
|
||||||
}
|
}
|
||||||
// 更新点赞记录
|
// 更新点赞记录
|
||||||
baseMapper.updateStatus(workFlowLike);
|
baseMapper.updateStatus(workFlowLike);
|
||||||
|
@ -88,8 +85,6 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
||||||
// 更新图片点赞数
|
// 更新图片点赞数
|
||||||
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
|
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
|
||||||
workFlowMapper.updateById(workFlow);
|
workFlowMapper.updateById(workFlow);
|
||||||
|
|
||||||
this.addLikeAdvice(workFlow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,31 +143,6 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addLikeAdvice(WorkFlow workFlow) {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
Long receiverUserId = workFlow.getUserId();
|
|
||||||
|
|
||||||
if (Objects.equals(userId, receiverUserId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = StringUtils.format("恭喜!{}点赞了您的工作流:{}",
|
|
||||||
SecurityUtils.getUsername(), workFlow.getWorkflowName());
|
|
||||||
|
|
||||||
SysAdvice sysAdvice = new SysAdvice();
|
|
||||||
sysAdvice.setSenderId(userId);
|
|
||||||
sysAdvice.setReceiverId(receiverUserId);
|
|
||||||
sysAdvice.setContent(content);
|
|
||||||
sysAdvice.setProductId(workFlow.getId());
|
|
||||||
sysAdvice.setProductType(1);
|
|
||||||
sysAdvice.setIsRead(0);
|
|
||||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Page<WorkFlowLike> initPage(PageDomain pageDomain) {
|
private Page<WorkFlowLike> initPage(PageDomain pageDomain) {
|
||||||
Page<WorkFlowLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
Page<WorkFlowLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||||
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
||||||
|
|
|
@ -391,12 +391,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
||||||
workFlow.setTypeList(strings);
|
workFlow.setTypeList(strings);
|
||||||
}
|
}
|
||||||
workFlow.setIsAttention(1);
|
workFlow.setIsAttention(1);
|
||||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), workFlow.getUserId());
|
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), workFlow.getUserId());
|
||||||
if (sysUserAttention == null){
|
if (sysUserAttention == null){
|
||||||
workFlow.setIsAttention(0);
|
workFlow.setIsAttention(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkFlowLike workFlowLike = workFlowLikeService.selectWorkFlowLikeById(SecurityUtils.getUserIdMax(),workFlow.getId());
|
WorkFlowLike workFlowLike = workFlowLikeService.selectWorkFlowLikeById(SecurityUtils.getUserId(),workFlow.getId());
|
||||||
workFlow.setIsLike(1);
|
workFlow.setIsLike(1);
|
||||||
if (workFlowLike == null){
|
if (workFlowLike == null){
|
||||||
workFlow.setIsLike(0);
|
workFlow.setIsLike(0);
|
||||||
|
@ -408,10 +408,6 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
if (Objects.isNull(imagePageRes.getUserId())) {
|
|
||||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
Page<WorkFlow> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
Page<WorkFlow> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
||||||
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
|
@ -425,7 +421,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
||||||
|
|
||||||
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
||||||
.eq(WorkFlow::getUserId, imagePageRes.getUserId())
|
.eq(WorkFlow::getUserId, SecurityUtils.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime())
|
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime())
|
||||||
.eq(WorkFlow::getDelFlag, 0);
|
.eq(WorkFlow::getDelFlag, 0);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<update id="updateDelFlagById">
|
<update id="updateDelFlagById">
|
||||||
update model_image_like
|
update model_image_like
|
||||||
set del_flag = #{delFlag}
|
set del_flag = #{delFlag}
|
||||||
where user_id = #{userId} and model_image_id = #{modelImageId}
|
where user_id = #{userId} and model_image_id = #{imageId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getLikeImage" resultMap="ModelImageLikeResult">
|
<select id="getLikeImage" resultMap="ModelImageLikeResult">
|
||||||
|
|
|
@ -35,12 +35,4 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="sumImageNumber" resultType="java.lang.Long">
|
|
||||||
SELECT count(*)
|
|
||||||
FROM model_image
|
|
||||||
where user_id = #{userId}
|
|
||||||
and del_flag = 0
|
|
||||||
and status in (1, 2)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -100,12 +100,5 @@
|
||||||
and m.model_type = #{type}
|
and m.model_type = #{type}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="sumModelNumber" resultType="java.lang.Long">
|
|
||||||
SELECT count(*)
|
|
||||||
FROM model
|
|
||||||
where user_id = #{userId}
|
|
||||||
and del_flag = 0
|
|
||||||
and audit_status in (1, 2)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -56,11 +56,4 @@
|
||||||
and w.type like CONCAT('%', #{type}, '%')
|
and w.type like CONCAT('%', #{type}, '%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="sumWorkFlowNumber" resultType="java.lang.Long">
|
|
||||||
SELECT count(*) sum
|
|
||||||
FROM work_flow
|
|
||||||
where user_id = #{userId}
|
|
||||||
and del_flag = '0'
|
|
||||||
and audit_status in (1, 2)
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.mcwl.resource.domain;
|
package com.mcwl.system.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
@ -28,6 +28,11 @@ public class SysAdvice extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private Long receiverId;
|
private Long receiverId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型 表示新消息提醒,系统公告等
|
||||||
|
*/
|
||||||
|
private AdviceEnum type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
*/
|
*/
|
||||||
|
@ -39,29 +44,9 @@ public class SysAdvice extends BaseEntity {
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品id
|
* 是否已读 0 是 1 否
|
||||||
*/
|
*/
|
||||||
private Long productId;
|
private String isRead;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型 0模型 1工作流 2图片
|
|
||||||
*/
|
|
||||||
private Integer productType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论id
|
|
||||||
*/
|
|
||||||
private Long commentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读 0否 1是
|
|
||||||
*/
|
|
||||||
private Integer isRead;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息类型 表示新消息提醒,系统公告等
|
|
||||||
*/
|
|
||||||
private AdviceEnum type;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,46 +12,42 @@ import lombok.Getter;
|
||||||
public enum AdviceEnum {
|
public enum AdviceEnum {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新消息通知
|
* 新消息提醒
|
||||||
*/
|
*/
|
||||||
NEW_MESSAGE_REMIND("newMessageRemind", "新消息通知"),
|
NEW_MESSAGE_REMIND("newMessageRemind", "新消息提醒"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统公告
|
* 系统公告
|
||||||
*/
|
*/
|
||||||
SYSTEM_NOTICE("systemNotice", "系统通知"),
|
SYSTEM_NOTICE("systemNotice", "系统公告"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮件通知
|
* 邮件提醒
|
||||||
*/
|
*/
|
||||||
EMAIL_REMIND("emailRemind", "邮件通知"),
|
EMAIL_REMIND("emailRemind", "邮件提醒"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信通知
|
* 短信提醒
|
||||||
*/
|
*/
|
||||||
SMS_REMIND("smsRemind", "短信通知"),
|
SMS_REMIND("smsRemind", "短信提醒"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送通知
|
* 推送提醒
|
||||||
*/
|
*/
|
||||||
PUSH_REMIND("pushRemind", "推送通知"),
|
PUSH_REMIND("pushRemind", "推送提醒"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点赞通知
|
* 点赞提醒
|
||||||
*/
|
*/
|
||||||
LIKE_REMIND("likeRemind", "点赞通知"),
|
LIKE_REMIND("likeRemind", "点赞提醒"),
|
||||||
/**
|
/**
|
||||||
* 评论通知
|
* 评论提醒
|
||||||
*/
|
*/
|
||||||
COMMENT_REMIND("commentRemind", "评论回复通知"),
|
COMMENT_REMIND("commentRemind", "评论提醒"),
|
||||||
/**
|
/**
|
||||||
* 粉丝通知
|
* 私信提醒
|
||||||
*/
|
*/
|
||||||
FANS_REMIND("fansRemind", "粉丝通知"),
|
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信提醒");
|
||||||
/**
|
|
||||||
* 私信通知
|
|
||||||
*/
|
|
||||||
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信通知");
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.mcwl.system.domain.vo;
|
||||||
|
|
||||||
|
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AdviceVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型 表示新消息提醒,系统公告等
|
||||||
|
*/
|
||||||
|
private AdviceEnum type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已读 0 是 1 否
|
||||||
|
*/
|
||||||
|
private String isRead;
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
package com.mcwl.resource.mapper;
|
package com.mcwl.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.mcwl.resource.domain.SysAdvice;
|
import com.mcwl.system.domain.SysAdvice;
|
||||||
|
import com.mcwl.system.domain.SysConfig;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息通知
|
* 消息通知
|
||||||
*/
|
*/
|
|
@ -138,6 +138,8 @@ public interface SysUserMapper
|
||||||
|
|
||||||
List<SysUser> listByIds(List<Long> userIdList);
|
List<SysUser> listByIds(List<Long> userIdList);
|
||||||
|
|
||||||
|
List<SysUser> selectUserByIds(@Param("userIds") List<Long> userIds);
|
||||||
|
|
||||||
List<SysUser> selectUserPage(@Param("userId") Long userId);
|
List<SysUser> selectUserPage(@Param("userId") Long userId);
|
||||||
|
|
||||||
List<SysUser> selectToUserPage(@Param("userId") Long userId);
|
List<SysUser> selectToUserPage(@Param("userId") Long userId);
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.mcwl.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.mcwl.system.domain.SysAdvice;
|
||||||
|
import com.mcwl.system.domain.SysConfig;
|
||||||
|
import com.mcwl.system.domain.vo.AdviceVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息通知 服务层
|
||||||
|
*
|
||||||
|
* @author mcwl
|
||||||
|
*/
|
||||||
|
public interface ISysAdviceService extends IService<SysAdvice> {
|
||||||
|
|
||||||
|
List<AdviceVo> getUserNewMsg();
|
||||||
|
|
||||||
|
List<AdviceVo> getUserSystemNotice();
|
||||||
|
|
||||||
|
List<AdviceVo> getUserAllMsg();
|
||||||
|
|
||||||
|
List<AdviceVo> getAllMsg();
|
||||||
|
}
|
|
@ -217,4 +217,6 @@ public interface ISysUserService
|
||||||
AjaxResult updateIdCard(SysUser sysUser);
|
AjaxResult updateIdCard(SysUser sysUser);
|
||||||
|
|
||||||
List<SysUser> listByIds(List<Long> userIdList);
|
List<SysUser> listByIds(List<Long> userIdList);
|
||||||
|
|
||||||
|
List<SysUser> selectUserByIds(List<Long> userIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.mcwl.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
|
import com.mcwl.system.domain.SysAdvice;
|
||||||
|
import com.mcwl.system.domain.SysUserThirdAccount;
|
||||||
|
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||||
|
import com.mcwl.system.domain.vo.AdviceVo;
|
||||||
|
import com.mcwl.system.mapper.SysAdviceMapper;
|
||||||
|
import com.mcwl.system.service.ISysAdviceService;
|
||||||
|
import com.mcwl.system.service.IWXService;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息管理 业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice> implements ISysAdviceService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdviceVo> getUserNewMsg() {
|
||||||
|
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||||
|
.eq(SysAdvice::getReceiverId, userId)
|
||||||
|
.eq(SysAdvice::getType, AdviceEnum.NEW_MESSAGE_REMIND));
|
||||||
|
|
||||||
|
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdviceVo> getUserSystemNotice() {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||||
|
.eq(SysAdvice::getReceiverId, userId)
|
||||||
|
.eq(SysAdvice::getType, AdviceEnum.SYSTEM_NOTICE));
|
||||||
|
|
||||||
|
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdviceVo> getUserAllMsg() {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||||
|
.eq(SysAdvice::getReceiverId, userId));
|
||||||
|
|
||||||
|
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdviceVo> getAllMsg() {
|
||||||
|
|
||||||
|
List<SysAdvice> sysAdvices = baseMapper.selectList(null);
|
||||||
|
|
||||||
|
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -653,9 +653,6 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysUser> listByIds(List<Long> userIdList) {
|
public List<SysUser> listByIds(List<Long> userIdList) {
|
||||||
if (userIdList == null || userIdList.isEmpty()) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
return userMapper.listByIds(userIdList);
|
return userMapper.listByIds(userIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,4 +675,9 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> selectUserByIds(List<Long> userIds) {
|
||||||
|
return userMapper.selectUserByIds(userIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,14 @@
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserByIds" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectUserPage" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
<select id="selectUserPage" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||||
select u.user_id,nick_name,avatar FROM sys_user_attention as a
|
select u.user_id,nick_name,avatar FROM sys_user_attention as a
|
||||||
LEFT JOIN sys_user as u
|
LEFT JOIN sys_user as u
|
||||||
|
|
Loading…
Reference in New Issue