Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
f2205fe5
提交
f2205fe5
authored
2月 06, 2021
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
评论管理添加 sku
上级
a343cd65
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
63 行增加
和
2 行删除
+63
-2
TbCfItemCommentController.java
...va/com/platform/controller/TbCfItemCommentController.java
+46
-0
TbCfItemCommentServiceImpl.java
...com/platform/service/impl/TbCfItemCommentServiceImpl.java
+15
-0
TbCfItemCommentDao.xml
...rc/main/resources/com/platform/dao/TbCfItemCommentDao.xml
+2
-2
没有找到文件。
platform-admin/src/main/java/com/platform/controller/TbCfItemCommentController.java
浏览文件 @
f2205fe5
...
...
@@ -6,6 +6,7 @@ import com.platform.utils.PageUtils;
import
com.platform.utils.Query
;
import
com.platform.utils.R
;
import
com.platform.vo.SkuVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -63,9 +64,54 @@ public class TbCfItemCommentController {
@RequiresPermissions
(
"tbcfitemcomment:save"
)
@ResponseBody
public
R
save
(
@RequestBody
TbCfItemCommentEntity
tbCfItemComment
)
{
if
(
StringUtils
.
isBlank
(
tbCfItemComment
.
getUserId
())
||
tbCfItemComment
.
getCreateTime
()
==
null
||
tbCfItemComment
.
getCommentType
()
==
null
||
StringUtils
.
isBlank
(
tbCfItemComment
.
getItemId
())
||
StringUtils
.
isBlank
(
tbCfItemComment
.
getAttributs
())
||
StringUtils
.
isBlank
(
tbCfItemComment
.
getItemReview
())
||
tbCfItemComment
.
getItemScore
()
==
null
||
tbCfItemComment
.
getLogisticsScore
()
==
null
||
tbCfItemComment
.
getPriceScore
()
==
null
||
tbCfItemComment
.
getServiceScore
()
==
null
)
{
}
if
(
StringUtils
.
isBlank
(
tbCfItemComment
.
getUserId
()))
{
return
R
.
error
(
"请选择一个用户"
);
}
if
(
tbCfItemComment
.
getCreateTime
()
==
null
)
{
return
R
.
error
(
"创建时间不能为空"
);
}
if
(
tbCfItemComment
.
getType
()
==
null
)
{
return
R
.
error
(
"评论类型不能为空"
);
}
if
(
StringUtils
.
isBlank
(
tbCfItemComment
.
getItemId
()))
{
return
R
.
error
(
"请选择一条商品"
);
}
if
(
StringUtils
.
isBlank
(
tbCfItemComment
.
getAttributs
()))
{
return
R
.
error
(
"请选择商品属性"
);
}
if
(
tbCfItemComment
.
getItemScore
()
==
null
||
!
StringUtils
.
isNumeric
(
tbCfItemComment
.
getItemScore
().
toString
()))
{
return
R
.
error
(
"你输入商品评分有误"
);
}
if
(
tbCfItemComment
.
getServiceScore
()
==
null
||
!
StringUtils
.
isNumeric
(
tbCfItemComment
.
getServiceScore
().
toString
()))
{
return
R
.
error
(
"你输入服务评分有误"
);
}
if
(
tbCfItemComment
.
getLogisticsScore
()
==
null
||
!
StringUtils
.
isNumeric
(
tbCfItemComment
.
getLogisticsScore
().
toString
()))
{
return
R
.
error
(
"你输入物流评分有误"
);
}
if
(
tbCfItemComment
.
getPriceScore
()
==
null
||
!
StringUtils
.
isNumeric
(
tbCfItemComment
.
getPriceScore
().
toString
()))
{
return
R
.
error
(
"你输入价格评分有误"
);
}
if
(
StringUtils
.
isBlank
(
tbCfItemComment
.
getItemReview
()))
{
return
R
.
error
(
"请输入商品评价"
);
}
int
res
=
tbCfItemCommentService
.
save
(
tbCfItemComment
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"评分输入有误,必须是1-5之间的整数"
);
}
return
R
.
error
(
"操作失败"
);
}
...
...
platform-admin/src/main/java/com/platform/service/impl/TbCfItemCommentServiceImpl.java
浏览文件 @
f2205fe5
...
...
@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -65,6 +67,19 @@ public class TbCfItemCommentServiceImpl implements TbCfItemCommentService {
// return 0;
// }
// tbCfItemComment.setUserId(userId);
String
regex
=
"^[1-5]{1}$"
;
Pattern
pattern
=
Pattern
.
compile
(
regex
);
Matcher
matcher1
=
pattern
.
matcher
(
tbCfItemComment
.
getItemScore
().
toString
());
Matcher
matcher2
=
pattern
.
matcher
(
tbCfItemComment
.
getItemScore
().
toString
());
Matcher
matcher3
=
pattern
.
matcher
(
tbCfItemComment
.
getItemScore
().
toString
());
Matcher
matcher4
=
pattern
.
matcher
(
tbCfItemComment
.
getItemScore
().
toString
());
if
(!
matcher1
.
matches
()
||
!
matcher2
.
matches
()
||
!
matcher3
.
matches
()
||
!
matcher4
.
matches
())
{
return
-
1
;
}
tbCfItemComment
.
setId
(
IdUtil
.
createIdbyUUID
());
tbCfItemComment
.
setCommentType
(
0
);
tbCfItemComment
.
setCreateTime
(
new
Date
());
...
...
platform-admin/src/main/resources/com/platform/dao/TbCfItemCommentDao.xml
浏览文件 @
f2205fe5
...
...
@@ -122,7 +122,7 @@
AND c.comment_type=#{real}
</if>
<if
test=
"startTime != null and startTime.trim() != '' and endTime!=null and endTime!=''"
>
AND
c.create_time
between #{startTime} and #{endTime}
AND
DATE_FORMAT( c.create_time, '%Y-%m-%d' )
between #{startTime} and #{endTime}
</if>
<if
test=
"orderNo != null and orderNo.trim() != ''"
>
AND o.order_no =#{orderNo}
...
...
@@ -176,7 +176,7 @@
<if
test=
"orderId != null"
>
`order_id` = #{orderId},
</if>
<if
test=
"itemId != null"
>
`item_id` = #{itemId},
</if>
<if
test=
"type != null"
>
`type` = #{type},
</if>
<if
test=
"urls != null"
>
`urls` = #{urls},
</if>
`urls` = #{urls},
<if
test=
"itemScore != null"
>
`item_score` = #{itemScore},
</if>
<if
test=
"serviceScore != null"
>
`service_score` = #{serviceScore},
</if>
<if
test=
"logisticsScore != null"
>
`logistics_score` = #{logisticsScore},
</if>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论