Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
d53fd962
提交
d53fd962
authored
1月 28, 2021
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
评论
上级
e4a175f4
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
17 行删除
+23
-17
OrderController.java
.../com/example/afrishop_v3/controllers/OrderController.java
+12
-10
TbCfItemComment.java
.../java/com/example/afrishop_v3/models/TbCfItemComment.java
+11
-7
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/OrderController.java
浏览文件 @
d53fd962
...
...
@@ -560,7 +560,9 @@ public class OrderController extends Controller {
@PostMapping
(
"/add/comment"
)
public
Result
addComment
(
TbCfItemComment
comment
,
@RequestParam
(
value
=
"files"
,
required
=
false
)
MultipartFile
[]
files
)
throws
Exception
{
public
Result
addComment
(
TbCfItemComment
comment
)
throws
Exception
{
logger
.
info
(
"上传files:"
,
comment
.
getFiles
());
TbCfUserInfo
user
=
this
.
user
.
user
();
...
...
@@ -568,16 +570,16 @@ public class OrderController extends Controller {
String
itemId
=
comment
.
getItemId
();
boolean
exists
=
commentRepository
.
existsByUserUserIdAndItemId
(
userId
,
itemId
);
if
(
exists
)
{
//Product reviewed condition
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Already reviewed this product!"
);
}
//
boolean exists = commentRepository.existsByUserUserIdAndItemId(userId, itemId);
//
//
if (exists) {
//
//Product reviewed condition
//
return new Result(ResultCodeEnum.VALIDATE_ERROR.getCode(), "Already reviewed this product!");
//
}
List
<
String
>
urls
=
new
ArrayList
<>();
if
(
files
!=
null
)
{
for
(
MultipartFile
file
:
files
)
{
if
(
comment
.
getFiles
()
!=
null
)
{
for
(
MultipartFile
file
:
comment
.
getFiles
()
)
{
byte
[]
bytes
=
PicUtils
.
compressPicForScale
(
file
.
getBytes
(),
30
);
// ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
String
urlName
=
UUID
.
randomUUID
()
+
".jpg"
;
...
...
@@ -595,7 +597,7 @@ public class OrderController extends Controller {
// comment.setLikeNum(0L);
comment
.
setCreateTime
(
new
Date
());
comment
.
setUpdateTime
(
new
Date
());
comment
.
set
Real
(
1
);
comment
.
set
CommentType
(
1
);
// comment.setType(0);
// if (!StringUtils.isBlank(comment.getUrls())) {
// comment.setType(1);
...
...
src/main/java/com/example/afrishop_v3/models/TbCfItemComment.java
浏览文件 @
d53fd962
...
...
@@ -7,6 +7,7 @@ import org.hibernate.annotations.Formula;
import
org.hibernate.annotations.NotFound
;
import
org.hibernate.annotations.NotFoundAction
;
import
org.hibernate.annotations.Where
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Nullable
;
import
javax.persistence.*
;
...
...
@@ -90,8 +91,8 @@ public class TbCfItemComment {
private
Date
createTime
;
@JsonIgnore
@Transient
private
Integer
real
;
//
@Transient
private
Integer
commentType
;
/**
* 更新时间
*/
...
...
@@ -109,6 +110,10 @@ public class TbCfItemComment {
@Transient
private
boolean
isLike
;
@JsonIgnore
@Transient
private
MultipartFile
[]
files
;
// @Formula(value = "(SELECT IFNULL(COUNT(*),0) FROM tb_cf_item_like lk where lk.comment_id = id)")
@Transient
private
int
likeCount
;
...
...
@@ -118,7 +123,6 @@ public class TbCfItemComment {
private
double
totalScore
;
private
String
attributs
;
public
String
getAttributs
()
{
...
...
@@ -404,12 +408,12 @@ public class TbCfItemComment {
return
user
;
}
public
Integer
get
Real
()
{
return
real
;
public
Integer
get
CommentType
()
{
return
commentType
;
}
public
void
set
Real
(
Integer
real
)
{
this
.
real
=
real
;
public
void
set
CommentType
(
Integer
commentType
)
{
this
.
commentType
=
commentType
;
}
public
String
getAvatar
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论