Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
b9047e49
提交
b9047e49
authored
6月 22, 2019
作者:
zhenxianyimeng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of gitee.com:zhijiantianya/onemall
上级
68458fbf
38955444
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
129 行增加
和
19 行删除
+129
-19
mall_order.sql
docs/sql/mall_order.sql
+59
-0
OrderCommentMapper.java
...ava/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java
+4
-3
AutomaticCommentJob.java
...va/cn/iocoder/mall/order/biz/job/AutomaticCommentJob.java
+3
-4
OrderCommentServiceImpl.java
...coder/mall/order/biz/service/OrderCommentServiceImpl.java
+3
-2
OrderCommentMapper.xml
...ice-impl/src/main/resources/mapper/OrderCommentMapper.xml
+13
-10
OrderCommentReplayMapper.xml
...pl/src/main/resources/mapper/OrderCommentReplayMapper.xml
+2
-0
OrderCommentJobTest.java
...n/iocoder/mall/order/biz/service/OrderCommentJobTest.java
+45
-0
没有找到文件。
docs/sql/mall_order.sql
浏览文件 @
b9047e49
...
...
@@ -159,6 +159,65 @@ CREATE TABLE `order_recipient` (
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
186
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Table structure for order_comment
-- ----------------------------
DROP
TABLE
IF
EXISTS
`order_comment`
;
CREATE
TABLE
`order_comment`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`order_id`
int
(
11
)
NOT
NULL
COMMENT
'订单id'
,
`order_no`
varchar
(
50
)
NOT
NULL
COMMENT
'订单编号'
,
`product_spu_id`
int
(
11
)
NOT
NULL
COMMENT
'商品SPU'
,
`product_spu_name`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'商品SPU名称 SPU这两个字段待考量是否加入'
,
`product_sku_id`
int
(
11
)
NOT
NULL
COMMENT
'商品的sku'
,
`product_sku_attrs`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'商品规格属性'
,
`product_sku_price`
int
(
11
)
NOT
NULL
COMMENT
'商品价格,单位:分'
,
`product_sku_pic_url`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'商品的图片地址'
,
`user_id`
int
(
11
)
NOT
NULL
COMMENT
'用户id'
,
`user_avatar`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'用户头像'
,
`user_nick_name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'用户昵称'
,
`star`
int
(
3
)
DEFAULT
'5'
COMMENT
'评价星数:0->5'
,
`product_description_star`
int
(
3
)
DEFAULT
'5'
COMMENT
'商品描述:0->5'
,
`logistics_star`
int
(
3
)
DEFAULT
'5'
COMMENT
'物流星数:0->5'
,
`merchant_star`
int
(
3
)
DEFAULT
'5'
COMMENT
'商家星数:0->5'
,
`replay_count`
int
(
11
)
DEFAULT
'0'
COMMENT
'回复的条数'
,
`like_count`
int
(
11
)
DEFAULT
'0'
COMMENT
'点赞的个数'
,
`comment_content`
varchar
(
1000
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'评论的内容'
,
`comment_pics`
varchar
(
1000
)
DEFAULT
NULL
COMMENT
'评论的图片地址 按照,分割'
,
`comment_state`
int
(
3
)
DEFAULT
'0'
COMMENT
'评论的状态 0待评论 1已评论'
,
`create_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
5
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Table structure for order_comment_replay
-- ----------------------------
DROP
TABLE
IF
EXISTS
`order_comment_replay`
;
CREATE
TABLE
`order_comment_replay`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'id自增'
,
`comment_id`
int
(
11
)
NOT
NULL
COMMENT
'评论id'
,
`reply_type`
int
(
1
)
NOT
NULL
COMMENT
'回复的类型:0基于评论的回复1基于回复的回复'
,
`parent_id`
int
(
11
)
NOT
NULL
COMMENT
'父id: parent_id=comment_id 基于评论的回复,否则基于回复的回复'
,
`parent_user_id`
varchar
(
11
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'回复目标用户id'
,
`parent_user_nick_name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'回复目标用户的真实姓名'
,
`parent_user_avatar`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'回复目标的头像'
,
`reply_content`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'回复的内容'
,
`reply_user_id`
int
(
11
)
NOT
NULL
COMMENT
'回复用户id'
,
`reply_user_nick_name`
varchar
(
255
)
NOT
NULL
COMMENT
'回复用户昵称'
,
`reply_user_avatar`
varchar
(
255
)
NOT
NULL
COMMENT
'回复用户头像'
,
`user_type`
int
(
3
)
DEFAULT
'0'
COMMENT
'回复用户的身份:0普通用户,1商家'
,
`reply_like_count`
int
(
11
)
NOT
NULL
DEFAULT
'0'
COMMENT
'回复的点赞数量'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'回复创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'回复更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Table structure for order_return
-- ----------------------------
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java
浏览文件 @
b9047e49
...
...
@@ -9,6 +9,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
/**
...
...
@@ -76,15 +77,15 @@ public interface OrderCommentMapper{
* @param orderCommentTimeOutPageDTO
* @return
*/
List
<
OrderCommentDO
>
selectOrderCommentTimeOutPage
(
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
List
<
OrderCommentDO
>
selectOrderCommentTimeOutPage
(
@Param
(
"commentTimeOut"
)
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
/**
* 批量更新订单评论状态
* @param orderCommentTimeOutBOList
* @param commentState
*/
void
updateBatchOrderCommentState
(
@Param
(
"
list"
)
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
,
@Param
(
"commentState"
)
Integer
commentState
);
void
updateBatchOrderCommentState
(
@Param
(
"
commentState"
)
Integer
commentState
,
@Param
(
"list"
)
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
);
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/job/AutomaticCommentJob.java
浏览文件 @
b9047e49
...
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 超时以后自动生成评论
...
...
@@ -59,10 +60,8 @@ public class AutomaticCommentJob extends IJobHandler {
orderCommentService
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
);
}
return
null
;
}
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java
浏览文件 @
b9047e49
...
...
@@ -18,7 +18,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -101,9 +103,8 @@ public class OrderCommentServiceImpl implements OrderCommentService {
return
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentTimeOutBOList
(
orderCommentDOList
);
}
@Transactional
@Override
public
void
updateBatchOrderCommentState
(
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
)
{
orderCommentMapper
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
,
OrderCommentStatusEnum
.
SUCCESS_COMMENT
.
getValue
()
);
orderCommentMapper
.
updateBatchOrderCommentState
(
OrderCommentStatusEnum
.
SUCCESS_COMMENT
.
getValue
(),
orderCommentTimeOutBOList
);
}
}
order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml
浏览文件 @
b9047e49
...
...
@@ -73,27 +73,30 @@
</select>
<!--订单评论超时分页-->
<select
id=
"selectOrderCommentTimeOutPage"
resultType=
"cn.iocoder.mall.order.biz.dataobject.OrderCommentDO"
>
<select
id=
"selectOrderCommentTimeOutPage"
parameterType=
"cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO"
resultType=
"cn.iocoder.mall.order.biz.dataobject.OrderCommentDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM order_comment
WHERE
comment_state = #{commentState}
having
TIMESTAMPDIFF(DAY,create_time,NOW()) > #{
or
verDay}
LIMIT ${
pageNo*pageSize},${
pageSize}
comment_state = #{comment
TimeOut.comment
State}
HAVING
TIMESTAMPDIFF(DAY,create_time,NOW()) > #{
commentTimeOut.o
verDay}
LIMIT ${
commentTimeOut.pageNo*commentTimeOut.pageSize},${commentTimeOut.
pageSize}
</select>
<!--批量更新订单评论-->
<update
id=
"updateBatchOrderCommentState"
parameterType=
"java.util.List"
>
<update
id=
"updateBatchOrderCommentState"
>
UPDATE order_comment
SET
comment_state = #{commentState}
WHERE
id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
""
close=
""
separator=
";"
>
#{item.id}
</foreach>
id
IN
<if
test=
"list !=null"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.id}
</foreach>
</if>
</update>
...
...
order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml
浏览文件 @
b9047e49
...
...
@@ -74,6 +74,8 @@
<foreach
collection=
"commentIds"
item=
"commentId"
separator=
","
open=
"("
close=
")"
>
#{commentId}
</foreach>
AND
user_type = #{userType}
</select>
</mapper>
order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java
0 → 100644
浏览文件 @
b9047e49
package
cn
.
iocoder
.
mall
.
order
.
biz
.
service
;
import
cn.iocoder.mall.order.api.OrderCommentService
;
import
cn.iocoder.mall.order.api.bo.OrderCommentTimeOutBO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO
;
import
cn.iocoder.mall.order.biz.OrderApplicationTest
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 订单评论自动好评任务测试
*
* @author wtz
* @time 2019-06-17 19:09
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
OrderApplicationTest
.
class
)
@ActiveProfiles
(
"dev"
)
public
class
OrderCommentJobTest
{
@Autowired
private
OrderCommentService
orderCommentService
;
@Test
public
void
createOrderCommentJob
(){
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
=
new
OrderCommentTimeOutPageDTO
();
orderCommentTimeOutPageDTO
.
setCommentState
(
0
);
orderCommentTimeOutPageDTO
.
setPageNo
(
0
);
orderCommentTimeOutPageDTO
.
setPageSize
(
10
);
orderCommentTimeOutPageDTO
.
setOverDay
(
7
);
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
=
orderCommentService
.
getOrderCommentTimeOutPage
(
orderCommentTimeOutPageDTO
);
orderCommentService
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论