Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
498f7ed5
提交
498f7ed5
authored
6月 18, 2019
作者:
wangtongzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
订单超时自动好评Job测试
上级
b3322bf2
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
68 行增加
和
17 行删除
+68
-17
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
+11
-8
OrderCommentReplayMapper.xml
...pl/src/main/resources/mapper/OrderCommentReplayMapper.xml
+2
-0
OrderCommentJobTest.java
...n/iocoder/mall/order/biz/service/OrderCommentJobTest.java
+45
-0
没有找到文件。
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java
浏览文件 @
498f7ed5
...
@@ -9,6 +9,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
...
@@ -9,6 +9,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -76,15 +77,15 @@ public interface OrderCommentMapper{
...
@@ -76,15 +77,15 @@ public interface OrderCommentMapper{
* @param orderCommentTimeOutPageDTO
* @param orderCommentTimeOutPageDTO
* @return
* @return
*/
*/
List
<
OrderCommentDO
>
selectOrderCommentTimeOutPage
(
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
List
<
OrderCommentDO
>
selectOrderCommentTimeOutPage
(
@Param
(
"commentTimeOut"
)
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
/**
/**
* 批量更新订单评论状态
* 批量更新订单评论状态
* @param orderCommentTimeOutBOList
* @param orderCommentTimeOutBOList
* @param commentState
* @param commentState
*/
*/
void
updateBatchOrderCommentState
(
@Param
(
"
list"
)
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
,
void
updateBatchOrderCommentState
(
@Param
(
"
commentState"
)
Integer
commentState
,
@Param
(
"commentState"
)
Integer
commentState
);
@Param
(
"list"
)
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
);
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/job/AutomaticCommentJob.java
浏览文件 @
498f7ed5
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 超时以后自动生成评论
* 超时以后自动生成评论
...
@@ -59,10 +60,8 @@ public class AutomaticCommentJob extends IJobHandler {
...
@@ -59,10 +60,8 @@ public class AutomaticCommentJob extends IJobHandler {
orderCommentService
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
);
orderCommentService
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
);
}
}
return
null
;
return
null
;
}
}
}
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java
浏览文件 @
498f7ed5
...
@@ -18,7 +18,9 @@ import org.springframework.stereotype.Service;
...
@@ -18,7 +18,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -101,9 +103,8 @@ public class OrderCommentServiceImpl implements OrderCommentService {
...
@@ -101,9 +103,8 @@ public class OrderCommentServiceImpl implements OrderCommentService {
return
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentTimeOutBOList
(
orderCommentDOList
);
return
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentTimeOutBOList
(
orderCommentDOList
);
}
}
@Transactional
@Override
@Override
public
void
updateBatchOrderCommentState
(
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
)
{
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
浏览文件 @
498f7ed5
...
@@ -73,27 +73,30 @@
...
@@ -73,27 +73,30 @@
</select>
</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
SELECT
<include
refid=
"FIELDS"
/>
<include
refid=
"FIELDS"
/>
FROM order_comment
FROM order_comment
WHERE
WHERE
comment_state = #{commentState}
comment_state = #{comment
TimeOut.comment
State}
having
HAVING
TIMESTAMPDIFF(DAY,create_time,NOW()) > #{
or
verDay}
TIMESTAMPDIFF(DAY,create_time,NOW()) > #{
commentTimeOut.o
verDay}
LIMIT ${
pageNo*pageSize},${
pageSize}
LIMIT ${
commentTimeOut.pageNo*commentTimeOut.pageSize},${commentTimeOut.
pageSize}
</select>
</select>
<!--批量更新订单评论-->
<!--批量更新订单评论-->
<update
id=
"updateBatchOrderCommentState"
parameterType=
"java.util.List"
>
<update
id=
"updateBatchOrderCommentState"
>
UPDATE order_comment
UPDATE order_comment
SET
SET
comment_state = #{commentState}
comment_state = #{commentState}
WHERE
WHERE
id IN
id
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
""
close=
""
separator=
";"
>
IN
<if
test=
"list !=null"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.id}
#{item.id}
</foreach>
</foreach>
</if>
</update>
</update>
...
...
order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml
浏览文件 @
498f7ed5
...
@@ -74,6 +74,8 @@
...
@@ -74,6 +74,8 @@
<foreach
collection=
"commentIds"
item=
"commentId"
separator=
","
open=
"("
close=
")"
>
<foreach
collection=
"commentIds"
item=
"commentId"
separator=
","
open=
"("
close=
")"
>
#{commentId}
#{commentId}
</foreach>
</foreach>
AND
user_type = #{userType}
</select>
</select>
</mapper>
</mapper>
order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java
0 → 100644
浏览文件 @
498f7ed5
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论