Compare commits

...

15 Commits

Author SHA1 Message Date
yang ecc03229bd refactor(resource): 接口放行 2025-02-20 15:35:18 +08:00
yang 477d1c0dea refactor(resource): 调整用户身份获取方法 2025-02-20 14:47:33 +08:00
Diyu0904 7597e9d74d 修改bug 2025-02-20 14:43:11 +08:00
Diyu0904 cb2f059fff 新增obs配置文件 2025-02-20 14:32:17 +08:00
Diyu0904 097ecfa023 修改token过期时间 2025-02-20 14:21:45 +08:00
Diyu0904 91b2ade9f8 Merge branch 'feature/admin' into preview
# Conflicts:
#	mcwl-admin/src/main/resources/application-druid.yml
#	mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageLikeServiceImpl.java
2025-02-20 14:20:37 +08:00
yang e26568d0df feat(resource): 用户作品数量统计、配置文件调整 2025-02-20 09:33:11 +08:00
yang cecfc17172 build(mcwl-admin): 更新数据库配置和证书 2025-02-18 17:46:23 +08:00
yang deabcf1b37 refactor(mcwl-pay): 重构支付宝支付功能,由秘钥改为证书 2025-02-18 16:09:42 +08:00
Diyu0904 aacf29a3db Merge remote-tracking branch 'origin/preview' into preview 2025-02-18 13:17:54 +08:00
yang af0638438c feat(resource): 已读和一键已读 2025-02-18 09:12:55 +08:00
yang 2efdbfe773 refactor(resource): 调整消息通知 2025-02-17 10:06:09 +08:00
yang afc35ca586 feat(resource): 关注消息 2025-02-16 10:53:36 +08:00
yang 5a5ab268dd feat(resource): 点赞消息 2025-02-15 23:21:57 +08:00
yang 7e40833bb7 feat(resource): 评论通知功能 2025-02-15 18:01:24 +08:00
63 changed files with 1479 additions and 523 deletions

View File

@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.FileNotFoundException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@ -88,7 +89,7 @@ public class AliPayController extends BaseController {
* @param authCode
*/
@GetMapping("/callback")
public String callback(@RequestParam("auth_code") String authCode, String state) {
public String callback(@RequestParam("auth_code") String authCode, String state) throws FileNotFoundException {
System.out.println("authCode = " + authCode);
String result = aliPayService.bindingCallback(authCode, state);

View File

@ -48,9 +48,9 @@ public class ModelCommentController {
@RepeatSubmit
@GetMapping("/modelLike")
public R<Object> like(@Valid
@NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true)
Long modelId) {
@NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true)
Long modelId) {
modelLikeService.like(modelId);
return R.ok();
}
@ -73,9 +73,9 @@ public class ModelCommentController {
@RepeatSubmit
@GetMapping("/commentLike")
public R<Object> commentLike(@Valid
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
modelCommentLikeService.like(commentId);
return R.ok();
}
@ -85,16 +85,16 @@ public class ModelCommentController {
*
*/
@ApiOperation(value = "获取模型评论")
@GetMapping("/comment")
@GetMapping("/getComment")
@Valid
public R<List<ModelCommentVo>> getComment(@Valid
@NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true)
Long modelId,
@NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true)
Long modelId,
@Valid
@NotNull(message = "排序方式不能为空")
@ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) {
@NotNull(message = "排序方式不能为空")
@ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) {
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType);
return R.ok(modelCommentList);
}
@ -106,9 +106,9 @@ public class ModelCommentController {
@ApiOperation(value = "删除模型评论")
@GetMapping("/commentDelete")
public R<Object> commentDelete(@Valid
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
modelCommentService.removeById(commentId);
return R.ok();
}

View File

@ -51,9 +51,9 @@ public class ModelImageCommentController {
@RepeatSubmit(interval = 1000)
@GetMapping("/commentLike")
public R<Object> commentLike(@Valid
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true)
Long commentId) {
modelImageCommentLikeService.like(commentId);
return R.ok();
}
@ -64,8 +64,8 @@ public class ModelImageCommentController {
@ApiOperation(value = "删除图片评论")
@GetMapping("/commentDelete")
public R<Object> commentDelete(@Valid
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) Long commentId) {
@NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) Long commentId) {
modelImageCommentService.removeById(commentId);
return R.ok();
}
@ -74,16 +74,16 @@ public class ModelImageCommentController {
*
*/
@ApiOperation(value = "获取图片评论")
@GetMapping("/comment")
@GetMapping("/getComment")
@Valid
public R<List<ModelImageCommentVo>> getComment(@Valid
@NotNull(message = "图片id不能为空")
@ApiParam(value = "评论id", required = true)
Long imageId,
@NotNull(message = "图片id不能为空")
@ApiParam(value = "评论id", required = true)
Long imageId,
@Valid
@NotNull(message = "排序方式不能为空")
@ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) {
@NotNull(message = "排序方式不能为空")
@ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) {
List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType);
return R.ok(modelImageCommentVoList);
}

View File

@ -0,0 +1,105 @@
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);
}
}

View File

@ -7,6 +7,7 @@ import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.SysUserAttentionService;
import com.mcwl.resource.service.impl.SysUserAttentionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -25,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
public class SysUserAttentionController {
@Autowired
private SysUserAttentionServiceImpl sysUserAttentionService;
private SysUserAttentionService sysUserAttentionService;
/**
* /
@ -61,9 +62,9 @@ public class SysUserAttentionController {
*/
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
@GetMapping("/selectUserInfo")
public R<SysUserInfo> selectUserInfo(){
public R<SysUserInfo> selectUserInfo(Long userId){
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo();
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo(userId);
return R.ok(sysUserInfo);
}

View File

@ -84,7 +84,7 @@ public class WorkFlowCommentController {
*
*/
@ApiOperation(value = "获取工作流评论")
@GetMapping("/comment")
@GetMapping("/getComment")
public R<List<WorkFlowCommentVo>> getComment(@Valid
@NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true)

View File

@ -1,57 +0,0 @@
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);
}
}

View File

@ -0,0 +1,147 @@
# 数据源配置
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/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wA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BbSM8gPzdWQqkHoos0icu3cj0GhN3MU7+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

View File

@ -2,7 +2,7 @@
spring:
#mq
rabbitmq:
host: 1.13.246.108
host: 113.45.74.175
port: 5672
username: guest
password: guest
@ -23,9 +23,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://1.13.246.108:3306/mcwl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://113.45.74.175:3306/mcwl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: ybl123456@
password: Leng1128
# 从库数据源
slave:
# 从数据源开关/默认关闭
@ -79,7 +79,7 @@ spring:
# redis 配置
redis:
# 地址
host: 1.13.246.108
host: 113.45.74.175
# 端口默认为6379
port: 6370
# 数据库索引
@ -115,24 +115,28 @@ aliyun:
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: 9021000143684202
# 沙箱应用私钥
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
# 沙箱支付宝公钥证书路径
alipayCertPath: cert/alipay/alipayCertPublicKey_RSA2.crt
# 沙箱支付宝根证书路径
alipayRootCertPath: cert/alipay/alipayRootCert.crt
notifyUrl: https://7d014da8.r27.cpolar.top/ali/pay/notify
# 沙箱支付宝网关
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
# 线上应用id
appId: 2021005119630093
# 线上应用私钥
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQuhRU5iHoabfzJS40A+moMKzb5rmi5XbL59K98CW65Oq/rnzQnj6sCYggIXOLCLKUykZ1XIVa+4V7bGFkMDF0236ncPumnVY/tfCSebLyKl+up1mGeH4mAR6ily7nXAhRnXL+A0015bpCa5FCg2ReN68MEmquB/mHfeLqJfRupwzDWnIWxYSKkFCJ0i47KTFYhM93LHHQ8GrZNNae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QRdtk9R/UcnwK23WOFdVqnoCRygrXx0/wb3ZTFou2tc2Fmfqu8QML19E67zjfwMHNitYjNaAYwi6ewKvg8sjo1wWXs34k7GquYGNjw+w9Wv/pBAoGAUlVHfZ4RncAiiH/x3EDgqmmVikFpLoM2xXxM16nplrjdBE6IzkpgWb/x2ZI6JCMDyoV2kvF6owW2+QEQ81MrHQMtBRpAvd8nI03gXA5VF3uwp4UjfGpoIAGDBrqQv9DM8vx6C6VJNTT5esZWZSw/+PZ4D19l0/n7gICGx3ugw0Q=
# 线上应用公钥证书
appCertPath: appCertPublicKey_2021005119630093.crt
# 线上支付宝公钥证书路径
alipayCertPath: cert/alipayCertPublicKey_RSA2.crt
# 线上支付宝根证书路径
alipayRootCertPath: cert/alipayRootCert.crt
# 线上支付宝公钥
notifyUrl: https://253d7236.r27.cpolar.top/ali/pay/notify
# 线上支付宝网关
gatewayUrl: https://openapi.alipay.com/gateway.do
huawei:
obs:
ak: NWXJ93POA9NCDVV1WQYJ
@ -142,25 +146,3 @@ huawei:
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+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ncAiiH/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

View File

@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:
@ -74,7 +74,7 @@ token:
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 43200
expireTime: 30
# MyBatis Plus配置
mybatis-plus:

View File

@ -1,43 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDnTCCAoWgAwIBAgIQICUCFPTaqv/ZUGkFjQNMjTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
YXNzIDIgUjEwHhcNMjUwMjE0MDkxMDAxWhcNMzAwMjEzMDkxMDAxWjB+MQswCQYDVQQGEwJDTjEZ
MBcGA1UECgwQMjA4ODk0Mjk4OTQ4MjU3OTEPMA0GA1UECwwGQWxpcGF5MUMwQQYDVQQDDDrmlK/k
u5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0yMDg4OTQyOTg5NDgyNTc5MIIB
IjANBgkqhkiG9w0BAQEFA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odM9lG4XIVe13X2h+1ecTQyQzLW
mnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ
/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMB
AAGjEjAQMA4GA1UdDwEB/wQEAwIE8DANBgkqhkiG9w0BAQsFAAOCAQEAZmMSaD7s3aervdACl0cN
YRcUHMGBA4DwzeLKaF0iqcsQxzJHBQRSGbAeQ9n5l1U5V0Pos92V7eqEJqtC52l6sK5T4YE6zAxf
49RKyo00qVFCbcGMHnRy0F/AkEhz+qhan1R3Dm7Ty6UtgAaeF6emD35EIKXziCvqS1nBt+nniYYB
0O2UntrJ3lYucuLun7TeYou/kPMTnZItzSmvCmG181e5IpSB3qGwBnIgkmB+Ge0kGIFAoV9+MucT
4YOffum8yC0oF7aMtTL9whm5gb+Udj+lBrHYYw8VPNpcvBmRlXEKEJLbWQrGtJi6+URReWqO52UP
fGHB0r4r575H4Y1QkA==
-----END CERTIFICATE-----

View File

@ -42,14 +42,11 @@ public class SecurityUtils
public static Long getUserIdMax(){
Long userId = null;
Long userId;
try {
userId = SecurityUtils.getUserId();
if (userId == null){
userId = 0L;
}
}catch (Exception e){
log.error(e.getMessage());
userId = 0L;
}
return userId;

View File

@ -30,8 +30,7 @@ import org.springframework.web.filter.CorsFilter;
*/
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Configuration
public class SecurityConfig
{
public class SecurityConfig {
/**
*
*/
@ -79,8 +78,7 @@ public class SecurityConfig
*
*/
@Bean
public AuthenticationManager authenticationManager()
{
public AuthenticationManager authenticationManager() {
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
@ -112,48 +110,67 @@ public class SecurityConfig
* authenticated | 访
*/
@Bean
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
{
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
return httpSecurity
// CSRF禁用因为不使用session
.csrf(csrf -> csrf.disable())
// 禁用HTTP响应标头
.headers((headersCustomizer) -> {
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
})
// 认证失败处理类
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
// 基于token所以不需要session
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
// 注解标记允许匿名访问的url
.authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage","/ali/pay/doPay","/ali/pay/notify",
"/ali/pay/callback","/file/**","/model/modelSquare","/image/imageList","/WorkFlow/workFlowList",
"/system/dict/data/type/**","").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();
// CSRF禁用因为不使用session
.csrf(csrf -> csrf.disable())
// 禁用HTTP响应标头
.headers((headersCustomizer) -> {
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
})
// 认证失败处理类
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
// 基于token所以不需要session
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
// 注解标记允许匿名访问的url
.authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login",
"/register",
"/captchaImage",
"/ali/pay/doPay",
"/ali/pay/notify",
"/ali/pay/callback",
"/file/**",
"/model/modelSquare",
"/model/selectModelById",
"/model/finbyid",
"/ModelVersion/finbyid",
"/ModelComment/getComment",
"/ModelComment/commentCount",
"/WorkFlow/workFlowList",
"/WorkFlow/selectWorkFlowById",
"/WorkFlowComment/getComment",
"/image/imageList",
"/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
public BCryptPasswordEncoder bCryptPasswordEncoder()
{
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
}

View File

@ -45,6 +45,12 @@
<artifactId>spring-boot-starter-amqp</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>com.mcwl</groupId>
<artifactId>mcwl-resource</artifactId>
<version>3.8.8</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -2,12 +2,10 @@ package com.mcwl.memberCenter.consumer;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.memberCenter.domain.Member;
import com.mcwl.memberCenter.service.MemberService;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.service.ISysAdviceService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysAdviceService;
import com.mcwl.system.service.ISysUserService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

View File

@ -3,9 +3,9 @@ package com.mcwl.memberCenter.consumer;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.memberCenter.domain.Member;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysAdviceService;
import com.mcwl.resource.service.ISysAdviceService;
import com.mcwl.system.service.ISysUserService;
import com.rabbitmq.client.Channel;
import lombok.RequiredArgsConstructor;

View File

@ -11,14 +11,24 @@ import org.springframework.stereotype.Component;
@Configuration
@Component
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}")
private String appId;
@Value("${mall.mgt.aliPayConfig.privateKey}")
private String privateKey;
@Value("${mall.mgt.aliPayConfig.appCertPath}")
private String appCertPath;
@Value("${mall.mgt.aliPayConfig.alipayCertPath}")
private String alipayCertPath;
@Value("${mall.mgt.aliPayConfig.alipayRootCertPath}")
private String alipayRootCertPath;
@Value("${mall.mgt.aliPayConfig.gatewayUrl}")
private String gatewayUrl;
@Value("${mall.mgt.aliPayConfig.notifyUrl}")
private String notifyUrl;
}

View File

@ -7,20 +7,19 @@ import com.mcwl.pay.domain.OrderTradeDto;
import com.mcwl.pay.domain.vo.PayVo;
import javax.validation.constraints.NotNull;
import java.io.FileNotFoundException;
public interface AliPayService {
String bindingCallback(String authCode, String state);
String bindingCallback(String authCode, String state) throws FileNotFoundException;
PayVo memberPay(OrderTradeDto orderTradeDto) throws Exception;
PayVo pointsPay(Double paymentAmount) throws Exception;
R<String> fetch(String amount) throws AlipayApiException;
R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException;
// 查询订单状态
R<Object> queryTradeStatus(String outTradeNo) throws Exception;
String balance() throws AlipayApiException;
PayVo walletPay(Double amount) throws Exception;
}

View File

@ -52,10 +52,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ResourceUtils;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -98,7 +99,18 @@ public class AliPayServiceImpl implements AliPayService {
private final int MAX_RETRY = 3; // 最大重试次数
public AliPayServiceImpl(Config config) {
public AliPayServiceImpl(AliConfig aliConfig) {
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);
}
@ -277,12 +289,13 @@ public class AliPayServiceImpl implements AliPayService {
/**
*
* @param amount
*
* @param amount
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R<String> fetch(String amount) throws AlipayApiException {
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
Long userId = SecurityUtils.getUserId();
SysUser sysUser = sysUserService.selectUserById(userId);
if (sysUser.getWallet() < Double.parseDouble(amount)) {
@ -353,7 +366,7 @@ public class AliPayServiceImpl implements AliPayService {
MailUtil.send(tos, "上海辰风互娱", content, false);
throw new ServiceException("网络连接出错,请稍后再试");
}
System.out.println("提现失败:" + response.getSubMsg());
System.out.println("用户" + SecurityUtils.getUsername() + "提现失败:" + response.getSubMsg());
throw new ServiceException("提现失败");
}
@ -414,37 +427,8 @@ public class AliPayServiceImpl implements AliPayService {
return R.ok(orderTrade.getOrderStatus());
}
@Override
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) {
public String bindingCallback(String authCode, String state) throws FileNotFoundException {
try {
Long userId = ShareCodeUtils.codeToId(state);
if (Objects.isNull(userId)) {
@ -514,7 +498,6 @@ public class AliPayServiceImpl implements AliPayService {
}
private Object getTradStatus(String outTradeNo) throws Exception {
Factory.setOptions(config);
AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo);
Map<String, Object> map = JSONUtils.jsonToMap(query.getHttpBody());
@ -541,7 +524,8 @@ public class AliPayServiceImpl implements AliPayService {
sysUserPayAccountLog.setAccount("支付宝");
sysUserPayAccountLogService.save(sysUserPayAccountLog);
}
public AlipayConfig getAlipayConfig() {
public AlipayConfig getAlipayConfig() throws FileNotFoundException {
AlipayConfig config = new AlipayConfig();
@ -557,14 +541,16 @@ public class AliPayServiceImpl implements AliPayService {
// 设置支付宝公钥,因为配置了证书,所以不需要设置支付宝公钥
// config.setAlipayPublicKey(aliConfig.getPublicKey());
// 设置应用公钥证书路径
config.setAppCertPath(getClass().getResource("/certs/appCertPublicKey.crt").getPath());
// 设置应用公钥证书路径(线上)
// config.setAppCertPath(getClass().getResource("/cert/appCertPublicKey.crt").getPath());
// 设置应用公钥证书路径(沙箱)
config.setAppCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAppCertPath()).getAbsolutePath());
// 设置支付宝公钥证书路径
config.setAlipayPublicCertPath(getClass().getResource(aliConfig.getAlipayCertPath()).getPath());
config.setAlipayPublicCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAlipayCertPath()).getAbsolutePath());
// 设置支付宝根证书路径
config.setRootCertPath(getClass().getResource(aliConfig.getAlipayRootCertPath()).getPath());
config.setRootCertPath(ResourceUtils.getFile("classpath:"+aliConfig.getAlipayRootCertPath()).getAbsolutePath());
// 设置字符编码格式
config.setCharset("UTF-8");

View File

@ -32,5 +32,12 @@
<artifactId>mcwl-system</artifactId>
</dependency>
<!-- rabbitmq依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +1,4 @@
package com.mcwl.system.domain;
package com.mcwl.resource.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -28,11 +28,6 @@ public class SysAdvice extends BaseEntity {
*/
private Long receiverId;
/**
*
*/
private AdviceEnum type;
/**
*
*/
@ -44,9 +39,29 @@ public class SysAdvice extends BaseEntity {
private String content;
/**
* 0 1
* id
*/
private String isRead;
private Long productId;
/**
* 0 1 2
*/
private Integer productType;
/**
* id
*/
private Long commentId;
/**
* 0 1
*/
private Integer isRead;
/**
*
*/
private AdviceEnum type;

View File

@ -58,4 +58,10 @@ public class SysUserInfo {
@ApiModelProperty(value = "图片点赞次数")
private Long imageLikeNum = 0L;
/**
*
*/
@ApiModelProperty(value = "作品数量")
private Long productNum = 0L;
}

View File

@ -33,7 +33,7 @@ public class ModelCommentRes {
/**
*
*/
@ApiModelProperty(value = "回复人")
@ApiModelProperty(value = "回复人", required = true)
private Long replyUserId;
}

View File

@ -19,6 +19,12 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true)
public class ModelImagePageRes extends PageDomain {
/**
* id
*/
@ApiModelProperty(value = "用户id")
private Long userId;
/**
*
*/

View File

@ -0,0 +1,46 @@
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;
}

View File

@ -0,0 +1,45 @@
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;
}

View File

@ -0,0 +1,64 @@
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;
}

View File

@ -0,0 +1,19 @@
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;
}

View File

@ -20,4 +20,5 @@ public interface ModelImageMapper extends BaseMapper<ModelImage> {
List<ResponseModelImage> imageList(PageVo pageVo);
Long sumImageNumber(Long userId);
}

View File

@ -39,4 +39,5 @@ public interface ModelMapper extends BaseMapper<ModelProduct> {
List<ResponseModelProduct> modelSquare(PageVo pageVo);
Long sumModelNumber(Long userId);
}

View File

@ -1,12 +1,9 @@
package com.mcwl.system.mapper;
package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.SysConfig;
import com.mcwl.resource.domain.SysAdvice;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
*
*/

View File

@ -27,4 +27,5 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
List<ResponseWorkFlow> workFlowList(PageVo pageVo);
Long sumWorkFlowNumber(Long userId);
}

View File

@ -0,0 +1,35 @@
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();
}

View File

@ -1,9 +1,12 @@
package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService;
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.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.vo.PageVo;
@ -14,12 +17,12 @@ import com.mcwl.resource.domain.vo.PageVo;
* @apiNote
*/
public interface SysUserAttentionService {
public interface SysUserAttentionService extends IService<SysUserAttention> {
R<Boolean> addAttention(Long userId);
Boolean selectAttention(Long userId);
SysUserInfo selectUserInfo();
SysUserInfo selectUserInfo(Long userId);
PageInfo<SysUser> selectAttentionPage(PageVo pageVo);

View File

@ -1,33 +1,28 @@
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.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelComment;
import com.mcwl.resource.domain.ModelCommentLike;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
import com.mcwl.resource.mapper.ModelCommentMapper;
import com.mcwl.resource.mapper.ModelImageCommentMapper;
import com.mcwl.resource.service.ModelCommentLikeService;
import com.mcwl.system.domain.enums.AdviceEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
/**
*
*/
@Service
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper,ModelCommentLike> implements ModelCommentLikeService {
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper, ModelCommentLike> implements ModelCommentLikeService {
@Autowired
private ModelCommentMapper modelCommentMapper;
@ -50,6 +45,7 @@ public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMap
} else {
modelCommentLike.setDelFlag("0");
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
this.addLikeAdvice(modelComment);
}
// 更新点赞记录
baseMapper.updateDelFlagById(modelCommentLike);
@ -70,6 +66,35 @@ public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMap
// 更新模型点赞数
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
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);
}
}

View File

@ -3,20 +3,27 @@ package com.mcwl.resource.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelComment;
import com.mcwl.resource.domain.ModelCommentLike;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.domain.WorkFlowComment;
import com.mcwl.resource.domain.dto.ModelCommentRes;
import com.mcwl.resource.domain.vo.ModelCommentVo;
import com.mcwl.resource.mapper.ModelCommentMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
import com.mcwl.resource.service.ISysAdviceService;
import com.mcwl.resource.service.ModelCommentLikeService;
import com.mcwl.resource.service.ModelCommentService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.function.Function;
@ -37,10 +44,15 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
@Autowired
private ModelCommentLikeService modelCommentLikeService;
@Autowired
private ISysAdviceService sysAdviceService;
@Autowired
private ModelImageMapper modelImageMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void comment(ModelCommentRes modelCommentRes) {
Long parentId = modelCommentRes.getParentId();
@ -52,9 +64,42 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
}
ModelComment modelComment = new ModelComment();
BeanUtil.copyProperties(modelCommentRes, modelComment);
modelComment.setUserId(SecurityUtils.getUserId());
Long userId = SecurityUtils.getUserId();
modelComment.setUserId(userId);
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);
}
/**
@ -101,8 +146,8 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
// 5. 批量查询点赞状态(仅当用户已登录)
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
new HashMap<>();
// 6. 构建评论树结构(传递点赞状态)

View File

@ -3,15 +3,14 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
import com.mcwl.resource.mapper.ModelImageCommentMapper;
import com.mcwl.resource.service.ModelImageCommentLikeService;
import com.mcwl.resource.service.ModelImageCommentService;
import com.mcwl.system.domain.enums.AdviceEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,6 +45,7 @@ public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageComm
} else {
modelImageCommentLike.setDelFlag("0");
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
this.addLikeAdvice(modelImageComment);
}
// 更新点赞记录
baseMapper.updateDelFlagById(modelImageCommentLike);
@ -66,6 +66,36 @@ public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageComm
// 更新图片点赞数
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
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);
}
}

View File

@ -5,18 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.ModelComment;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.WorkFlowComment;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.*;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
import com.mcwl.resource.mapper.ModelImageCommentMapper;
import com.mcwl.resource.service.ISysAdviceService;
import com.mcwl.resource.service.ModelImageCommentLikeService;
import com.mcwl.resource.service.ModelImageCommentService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.function.Function;
@ -33,7 +34,10 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
private final ModelImageCommentLikeService modelImageCommentLikeService;
private final ISysAdviceService sysAdviceService;
@Override
@Transactional(rollbackFor = Exception.class)
public void comment(ModelImageCommentRes modelImageCommentRes) {
Long parentId = modelImageCommentRes.getParentId();
@ -46,9 +50,42 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
ModelImageComment modelImageComment = new ModelImageComment();
BeanUtil.copyProperties(modelImageCommentRes, modelImageComment);
modelImageComment.setUserId(SecurityUtils.getUserId());
Long userId = SecurityUtils.getUserId();
modelImageComment.setUserId(userId);
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);
}
/**
@ -94,8 +131,8 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
// 5. 批量查询点赞状态(仅当用户已登录)
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
new HashMap<>();
// 6. 构建评论树结构(传递点赞状态)

View File

@ -1,6 +1,7 @@
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.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -15,12 +16,14 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.domain.response.ResponseModelImage;
import com.mcwl.resource.domain.vo.ModelImageLikeVo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.ModelImageLikeMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
import com.mcwl.resource.service.ModelImageLikeService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -60,6 +63,7 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
} else {
modelImageLike.setDelFlag("0");
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
this.addLikeAdvice(modelImage);
}
// 更新点赞记录
baseMapper.updateDelFlagById(modelImageLike);
@ -80,6 +84,8 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
// 更新图片点赞数
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
modelImageMapper.updateById(modelImage);
this.addLikeAdvice(modelImage);
}
@Override
@ -162,15 +168,23 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
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) {
String[] split = responseModelImage.getImagePaths().split(",");
responseModelImage.setPath(split[0]);
//查询模型是否点赞
ModelImageLike likeImage = baseMapper.getLikeImage(SecurityUtils.getUserIdMax(), responseModelImage.getId());
if (likeImage == null){
//查询是否点赞
if (!modelImageLikeIds.contains(responseModelImage.getId())){
responseModelImage.setIsLike(0);
}else {
responseModelImage.setIsLike(1);
@ -181,4 +195,31 @@ 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);
}
}

View File

@ -175,7 +175,9 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
*/
@Override
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
if (Objects.isNull(imagePageRes.getUserId())) {
imagePageRes.setUserId(SecurityUtils.getUserId());
}
Page<ModelImage> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
imagePageRes.setOrderByColumn("create_time");
@ -188,7 +190,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelImage::getStatus, imagePageRes.getStatus())
.eq(ModelImage::getUserId, SecurityUtils.getUserId())
.eq(ModelImage::getUserId, imagePageRes.getUserId())
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
@ -234,7 +236,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
BeanUtil.copyProperties(modelImage, modelImageVo);
ModelImageLike modelImageLike = modelImageLikeService.lambdaQuery()
.eq(ModelImageLike::getUserId, SecurityUtils.getUserId())
.eq(ModelImageLike::getUserId, SecurityUtils.getUserIdMax())
.eq(ModelImageLike::getModelImageId, imageId)
.one();
@ -253,8 +255,8 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
modelImageVo.setTags(tagList);
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
modelImageVo.setUserId(SecurityUtils.getUserId());
modelImageVo.setUserName(SecurityUtils.getUsername());
modelImageVo.setUserId(sysUser.getUserId());
modelImageVo.setUserName(sysUser.getUserName());
modelImageVo.setUserAvatar(sysUser.getAvatar());
return modelImageVo;
}

View File

@ -11,11 +11,14 @@ import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.*;
import com.mcwl.resource.domain.ModelLike;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.domain.vo.ModelLikeVo;
import com.mcwl.resource.mapper.ModelMapper;
import com.mcwl.resource.mapper.ModelLikeMapper;
import com.mcwl.resource.mapper.ModelMapper;
import com.mcwl.resource.service.ModelLikeService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -41,7 +44,7 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void like(Long modelId) {
ModelProduct model = modelMapper.selectById(modelId);
if (Objects.isNull(model)) {
@ -58,6 +61,7 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
} else {
modelLike.setDelFlag("0");
model.setLikeNum(model.getLikeNum() + 1);
this.addLikeAdvice(model);
}
// 更新点赞记录
baseMapper.updateDelFlagById(modelLike);
@ -78,6 +82,8 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
// 更新图片点赞数
model.setNumbers(model.getLikeNum() + 1);
modelMapper.updateById(model);
this.addLikeAdvice(model);
}
@Override
@ -126,6 +132,32 @@ 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) {
Page<ModelLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
@ -136,4 +168,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
return page;
}
}

View File

@ -158,6 +158,10 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Override
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
if (Objects.isNull(imagePageRes.getUserId())) {
imagePageRes.setUserId(SecurityUtils.getUserId());
}
Page<ModelProduct> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
imagePageRes.setOrderByColumn("create_time");
@ -170,7 +174,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
.eq( ModelProduct::getUserId, SecurityUtils.getUserId())
.eq( ModelProduct::getUserId, imagePageRes.getUserId())
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
postMapper.selectPage(page, lqw);
@ -488,12 +492,12 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
}
modelProduct.setIsAttention(1);
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), modelProduct.getUserId());
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), modelProduct.getUserId());
if (sysUserAttention == null){
modelProduct.setIsAttention(0);
}
WorkFlowLike workFlowLike = modelLikeMapper.selectModelLikeById(SecurityUtils.getUserId(),modelProduct.getId());
WorkFlowLike workFlowLike = modelLikeMapper.selectModelLikeById(SecurityUtils.getUserIdMax(),modelProduct.getId());
modelProduct.setIsLike(1);
if (workFlowLike == null){
modelProduct.setIsLike(0);

View File

@ -0,0 +1,288 @@
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为用户idvalue为用户信息
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));
}
}

View File

@ -1,19 +1,20 @@
package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
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.entity.SysUser;
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.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo;
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.mapper.*;
import com.mcwl.resource.service.SysUserAttentionService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,7 +31,7 @@ import java.util.List;
*/
@Service
public class SysUserAttentionServiceImpl implements SysUserAttentionService {
public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMapper, SysUserAttention> implements SysUserAttentionService {
@Autowired
@ -45,6 +46,9 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
@Autowired
private ModelImageMapper modelImageMapper;
@Autowired
private WorkFlowMapper workFlowMapper;
@Autowired
private SysUserMapper sysUserMapper;
@ -53,7 +57,7 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
//查看是否已关注
Boolean aBoolean = selectAttention(userId);
if (aBoolean == true) {
if (aBoolean) {
//取关
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId);
return R.ok(false);
@ -66,25 +70,37 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
.createTime(new Date())
.build();
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);
}
@Override
public Boolean selectAttention(Long userId) {
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), userId);
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), userId);
if (sysUserAttention == null) {
return false;
}
return true;
return sysUserAttention != null;
}
@Override
public SysUserInfo selectUserInfo() {
public SysUserInfo selectUserInfo(Long userId) {
if (userId == null) {
userId = SecurityUtils.getUserId();
}
Long userId = SecurityUtils.getUserId();
// 粉丝数
Long userBeanNum = sysUserAttentionMapper.selectBean(userId);
@ -103,12 +119,19 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
// 图片点赞次数
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)
.modelDownloadNum(modelDownloadNum)
.modelRunNum(modelRunNum)
.modelLikeNum(modelLikeNum)
.imageLikeNum(imageLikeNum)
.productNum(modelNumber + imageNumber + workFlowNumber)
.build();
}

View File

@ -3,11 +3,14 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.exception.ServiceException;
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.WorkFlowCommentLike;
import com.mcwl.resource.mapper.WorkFlowCommentLikeMapper;
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
import com.mcwl.resource.service.WorkFlowCommentLikeService;
import com.mcwl.system.domain.enums.AdviceEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -47,6 +50,7 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
} else {
workFlowCommentLike.setDelFlag("0");
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
this.addLikeAdvice(workFlowComment);
}
// 更新点赞记录
baseMapper.updateDelFlagById(workFlowCommentLike);
@ -67,6 +71,34 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
// 更新模型点赞数
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
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);
}
}

View File

@ -5,13 +5,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.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.WorkFlowCommentLike;
import com.mcwl.resource.domain.dto.WorkFlowCommentRes;
import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
import com.mcwl.resource.mapper.WorkFlowCommentMapper;
import com.mcwl.resource.service.ISysAdviceService;
import com.mcwl.resource.service.WorkFlowCommentLikeService;
import com.mcwl.resource.service.WorkFlowCommentService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -43,6 +48,10 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
private WorkFlowCommentLikeService workFlowCommentLikeService;
@Autowired
private ISysAdviceService sysAdviceService;
@Override
public void comment(WorkFlowCommentRes workFlowCommentRes) {
Long parentId = workFlowCommentRes.getParentId();
@ -55,9 +64,43 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
}
WorkFlowComment workFlowComment = new WorkFlowComment();
BeanUtil.copyProperties(workFlowCommentRes, workFlowComment);
workFlowComment.setUserId(SecurityUtils.getUserId());
Long userId = SecurityUtils.getUserId();
workFlowComment.setUserId(userId);
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
@ -99,8 +142,8 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
List<Long> allCommentIds = collectAllCommentIds(parentComments, childComments);
// 5. 批量查询点赞状态(仅当用户已登录)
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserId() != null ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserId()) :
Map<Long, Integer> likeStatusMap = SecurityUtils.getUserIdMax() != 0 ?
batchGetLikeStatus(allCommentIds, SecurityUtils.getUserIdMax()) :
new HashMap<>();
// 6. 构建评论树结构(传递点赞状态)

View File

@ -12,12 +12,14 @@ import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.SysAdvice;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.WorkFlowLike;
import com.mcwl.resource.domain.vo.WorkFlowLikeVo;
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
import com.mcwl.resource.mapper.WorkFlowMapper;
import com.mcwl.resource.service.WorkFlowLikeService;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -65,6 +67,7 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
} else {
workFlowLike.setDelFlag("0");
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
this.addLikeAdvice(workFlow);
}
// 更新点赞记录
baseMapper.updateStatus(workFlowLike);
@ -85,6 +88,8 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
// 更新图片点赞数
workFlow.setLikeCount(workFlow.getLikeCount() + 1);
workFlowMapper.updateById(workFlow);
this.addLikeAdvice(workFlow);
}
@Override
@ -143,6 +148,31 @@ 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) {
Page<WorkFlowLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {

View File

@ -391,12 +391,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
workFlow.setTypeList(strings);
}
workFlow.setIsAttention(1);
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), workFlow.getUserId());
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserIdMax(), workFlow.getUserId());
if (sysUserAttention == null){
workFlow.setIsAttention(0);
}
WorkFlowLike workFlowLike = workFlowLikeService.selectWorkFlowLikeById(SecurityUtils.getUserId(),workFlow.getId());
WorkFlowLike workFlowLike = workFlowLikeService.selectWorkFlowLikeById(SecurityUtils.getUserIdMax(),workFlow.getId());
workFlow.setIsLike(1);
if (workFlowLike == null){
workFlow.setIsLike(0);
@ -408,6 +408,10 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
@Override
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
if (Objects.isNull(imagePageRes.getUserId())) {
imagePageRes.setUserId(SecurityUtils.getUserId());
}
Page<WorkFlow> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
imagePageRes.setOrderByColumn("create_time");
@ -421,7 +425,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, WorkFlow::getAuditStatus, imagePageRes.getStatus())
.eq(WorkFlow::getUserId, SecurityUtils.getUserId())
.eq(WorkFlow::getUserId, imagePageRes.getUserId())
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime())
.eq(WorkFlow::getDelFlag, 0);

View File

@ -32,7 +32,7 @@
<update id="updateDelFlagById">
update model_image_like
set del_flag = #{delFlag}
where user_id = #{userId} and model_image_id = #{imageId}
where user_id = #{userId} and model_image_id = #{modelImageId}
</update>
<select id="getLikeImage" resultMap="ModelImageLikeResult">

View File

@ -35,4 +35,12 @@
</if>
</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>

View File

@ -100,5 +100,12 @@
and m.model_type = #{type}
</if>
</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>

View File

@ -56,4 +56,11 @@
and w.type like CONCAT('%', #{type}, '%')
</if>
</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>

View File

@ -12,42 +12,46 @@ import lombok.Getter;
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", "评论回复通知"),
/**
*
*
*/
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信提醒");
FANS_REMIND("fansRemind", "粉丝通知"),
/**
*
*/
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信通知");
private final String name;

View File

@ -1,29 +0,0 @@
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;
}

View File

@ -138,8 +138,6 @@ public interface SysUserMapper
List<SysUser> listByIds(List<Long> userIdList);
List<SysUser> selectUserByIds(@Param("userIds") List<Long> userIds);
List<SysUser> selectUserPage(@Param("userId") Long userId);
List<SysUser> selectToUserPage(@Param("userId") Long userId);

View File

@ -1,24 +0,0 @@
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();
}

View File

@ -217,6 +217,4 @@ public interface ISysUserService
AjaxResult updateIdCard(SysUser sysUser);
List<SysUser> listByIds(List<Long> userIdList);
List<SysUser> selectUserByIds(List<Long> userIds);
}

View File

@ -1,70 +0,0 @@
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);
}
}

View File

@ -653,6 +653,9 @@ public class SysUserServiceImpl implements ISysUserService
@Override
public List<SysUser> listByIds(List<Long> userIdList) {
if (userIdList == null || userIdList.isEmpty()) {
return Collections.emptyList();
}
return userMapper.listByIds(userIdList);
}
@ -675,9 +678,4 @@ public class SysUserServiceImpl implements ISysUserService
return sb.toString();
}
@Override
public List<SysUser> selectUserByIds(List<Long> userIds) {
return userMapper.selectUserByIds(userIds);
}
}

View File

@ -167,14 +167,6 @@
</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 u.user_id,nick_name,avatar FROM sys_user_attention as a
LEFT JOIN sys_user as u