Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
ffd83cc7
提交
ffd83cc7
authored
6月 15, 2019
作者:
wangtongzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
订单评论超时自动评论
上级
e7c94648
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
238 行增加
和
15 行删除
+238
-15
OrderCommentService.java
...n/java/cn/iocoder/mall/order/api/OrderCommentService.java
+15
-7
OrderCommentTimeOutBO.java
...a/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java
+19
-0
OrderCommentStatusEnum.java
...coder/mall/order/api/constant/OrderCommentStatusEnum.java
+34
-0
OrderCommentTimeOutPageDTO.java
...ocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java
+36
-0
OrderCommentConvert.java
...n/iocoder/mall/order/biz/convert/OrderCommentConvert.java
+7
-0
OrderCommentMapper.java
...ava/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java
+19
-0
AutomaticCommentJob.java
...va/cn/iocoder/mall/order/biz/job/AutomaticCommentJob.java
+68
-0
OrderCommentReplyServiceImpl.java
.../mall/order/biz/service/OrderCommentReplyServiceImpl.java
+0
-1
OrderCommentServiceImpl.java
...coder/mall/order/biz/service/OrderCommentServiceImpl.java
+13
-7
OrderCommentMapper.xml
...ice-impl/src/main/resources/mapper/OrderCommentMapper.xml
+27
-0
没有找到文件。
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
api
;
import
cn.iocoder.mall.order.api.bo.OrderCommentCreateBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentInfoBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentPageBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentStateInfoPageBO
;
import
cn.iocoder.mall.order.api.bo.*
;
import
cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentStateInfoPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 订单评论模块
...
...
@@ -49,11 +50,18 @@ public interface OrderCommentService {
OrderCommentStateInfoPageBO
getOrderCommentStateInfoPage
(
OrderCommentStateInfoPageDTO
orderCommentStateInfoPageDTO
);
/**
*
订单评价超时自动好评
*
采用任务的形式执行
*
获取订单评论超时分页
*
@param orderCommentTimeOutPageDTO
* @return
*/
Boolean
OrderCommentTimeOutProductCommentTask
();
List
<
OrderCommentTimeOutBO
>
getOrderCommentTimeOutPage
(
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
/**
* 批量更新订单评论状态
* @param orderCommentTimeOutBOList
*/
void
updateBatchOrderCommentState
(
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
);
...
...
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java
0 → 100644
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
api
.
bo
;
import
java.io.Serializable
;
/**
* 订单评论超时
*
* @author wtz
* @time 2019-06-15 13:52
*/
public
class
OrderCommentTimeOutBO
implements
Serializable
{
/**
* 评论 id
*/
private
Integer
id
;
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java
0 → 100644
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
api
.
constant
;
/**
* 订单评论状态
*
* @author wtz
* @time 2019-06-15 14:26
*/
public
enum
OrderCommentStatusEnum
{
WAIT_COMMENT
(
0
,
"待评论"
),
SUCCESS_COMMENT
(
1
,
"评论成功"
);
/**
* 状态值
*/
private
Integer
value
;
/**
* 状态名
*/
private
String
name
;
OrderCommentStatusEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java
0 → 100644
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
api
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* 订单评论超时
*
* @author wtz
* @time 2019-06-15 10:59
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentTimeOutPageDTO
implements
Serializable
{
/**
* 超过的天数
*/
private
Integer
overDay
;
/**
* 评论的状态
*/
private
Integer
commentState
;
/**
* 页码
*/
private
Integer
pageNo
;
/**
* 每页条数
*/
private
Integer
pageSize
;
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java
浏览文件 @
ffd83cc7
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.mall.order.biz.convert;
import
cn.iocoder.mall.order.api.bo.OrderCommentCreateBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentInfoBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentStateInfoPageBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentTimeOutBO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderCommentDO
;
import
org.mapstruct.Mapper
;
...
...
@@ -38,6 +39,12 @@ public interface OrderCommentConvert {
@Mappings
({})
OrderCommentInfoBO
convertOrderCommentInfoBO
(
OrderCommentDO
orderCommentDO
);
@Mappings
({})
OrderCommentTimeOutBO
convertOrderCommentTimeOutBO
(
OrderCommentTimeOutBO
orderCommentTimeOutBO
);
@Mappings
({})
List
<
OrderCommentTimeOutBO
>
convertOrderCommentTimeOutBOList
(
List
<
OrderCommentDO
>
orderCommentDOList
);
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
biz
.
dao
;
import
cn.iocoder.mall.order.api.bo.OrderCommentTimeOutBO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentStateInfoPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderCommentDO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderItemDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -68,5 +71,21 @@ public interface OrderCommentMapper{
@Param
(
"commentState"
)
Integer
commentState
);
/**
* 订单评论超时分页
* @param orderCommentTimeOutPageDTO
* @return
*/
List
<
OrderCommentDO
>
selectOrderCommentTimeOutPage
(
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
);
/**
* 批量更新订单评论状态
* @param orderCommentTimeOutBOList
* @param commentState
*/
void
updateBatchOrderCommentState
(
@Param
(
"list"
)
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
,
@Param
(
"commentState"
)
Integer
commentState
);
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/job/AutomaticCommentJob.java
0 → 100644
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
biz
.
job
;
import
cn.iocoder.mall.order.api.OrderCommentService
;
import
cn.iocoder.mall.order.api.bo.OrderCommentTimeOutBO
;
import
cn.iocoder.mall.order.api.constant.OrderCommentStatusEnum
;
import
cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO
;
import
cn.iocoder.mall.order.biz.dao.OrderCommentMapper
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.handler.IJobHandler
;
import
com.xxl.job.core.handler.annotation.JobHandler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 超时以后自动生成评论
*
* @author wtz
* @time 2019-06-15 10:26
*/
@Component
@JobHandler
(
"automaticCommentJob"
)
public
class
AutomaticCommentJob
extends
IJobHandler
{
/**
* 默认生成订单7天以后的自动生成订单评论
*/
private
static
final
Integer
OVERDAYCOUNT
=
7
;
private
static
final
Integer
PAGESIZE
=
1000
;
@Autowired
private
OrderCommentService
orderCommentService
;
@Override
public
ReturnT
<
String
>
execute
(
String
param
)
throws
Exception
{
Integer
overDayCount
=
OVERDAYCOUNT
;
if
(
param
.
isEmpty
()){
overDayCount
=
Integer
.
parseInt
(
param
);
}
for
(
int
i
=
0
;;
i
++){
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
=
new
OrderCommentTimeOutPageDTO
();
orderCommentTimeOutPageDTO
.
setOverDay
(
overDayCount
);
orderCommentTimeOutPageDTO
.
setCommentState
(
OrderCommentStatusEnum
.
WAIT_COMMENT
.
getValue
());
orderCommentTimeOutPageDTO
.
setPageNo
(
i
);
orderCommentTimeOutPageDTO
.
setPageSize
(
PAGESIZE
);
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
=
orderCommentService
.
getOrderCommentTimeOutPage
(
orderCommentTimeOutPageDTO
);
//为空时候跳出循环
if
(
orderCommentTimeOutBOList
.
isEmpty
()){
break
;
}
//批量更新
orderCommentService
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
);
}
return
null
;
}
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyServiceImpl.java
浏览文件 @
ffd83cc7
...
...
@@ -60,7 +60,6 @@ public class OrderCommentReplyServiceImpl implements OrderCommentReplyService {
public
OrderCommentReplyCreateBO
createOrderCommentReply
(
OrderCommentReplyCreateDTO
orderCommentReplyCreateDTO
)
{
OrderCommentReplyDO
orderCommentReplyDO
=
OrderCommentReplyConvert
.
INSTANCE
.
convert
(
orderCommentReplyCreateDTO
);
orderCommentReplyDO
.
setCreateTime
(
new
Date
());
orderCommentReplyDO
.
setUpdateTime
(
new
Date
());
Integer
replyType
=
orderCommentReplyCreateDTO
.
getCommentId
()==
orderCommentReplyCreateDTO
.
getParentId
()?
OrderCommentRelpyTypeEnum
.
COMMENT_REPLY
.
getValue
():
OrderCommentRelpyTypeEnum
.
REPLY_REPLY
.
getValue
();
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java
浏览文件 @
ffd83cc7
package
cn
.
iocoder
.
mall
.
order
.
biz
.
service
;
import
cn.iocoder.mall.order.api.OrderCommentService
;
import
cn.iocoder.mall.order.api.bo.OrderCommentCreateBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentInfoBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentPageBO
;
import
cn.iocoder.mall.order.api.bo.OrderCommentStateInfoPageBO
;
import
cn.iocoder.mall.order.api.bo.*
;
import
cn.iocoder.mall.order.api.constant.OrderCommentStatusEnum
;
import
cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum
;
import
cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentStateInfoPageDTO
;
import
cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO
;
import
cn.iocoder.mall.order.biz.convert.OrderCommentConvert
;
import
cn.iocoder.mall.order.biz.dao.OrderCommentMapper
;
import
cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper
;
...
...
@@ -16,6 +15,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO;
import
cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -43,7 +43,6 @@ public class OrderCommentServiceImpl implements OrderCommentService {
public
OrderCommentCreateBO
createOrderComment
(
OrderCommentCreateDTO
orderCommentCreateDTO
)
{
OrderCommentDO
orderCommentDO
=
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentDO
(
orderCommentCreateDTO
);
orderCommentDO
.
setCreateTime
(
new
Date
());
orderCommentDO
.
setUpdateTime
(
new
Date
());
orderCommentMapper
.
insert
(
orderCommentDO
);
return
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentCreateBO
(
orderCommentDO
);
}
...
...
@@ -97,7 +96,14 @@ public class OrderCommentServiceImpl implements OrderCommentService {
}
@Override
public
Boolean
OrderCommentTimeOutProductCommentTask
()
{
return
null
;
public
List
<
OrderCommentTimeOutBO
>
getOrderCommentTimeOutPage
(
OrderCommentTimeOutPageDTO
orderCommentTimeOutPageDTO
)
{
List
<
OrderCommentDO
>
orderCommentDOList
=
orderCommentMapper
.
selectOrderCommentTimeOutPage
(
orderCommentTimeOutPageDTO
);
return
OrderCommentConvert
.
INSTANCE
.
convertOrderCommentTimeOutBOList
(
orderCommentDOList
);
}
@Transactional
@Override
public
void
updateBatchOrderCommentState
(
List
<
OrderCommentTimeOutBO
>
orderCommentTimeOutBOList
)
{
orderCommentMapper
.
updateBatchOrderCommentState
(
orderCommentTimeOutBOList
,
OrderCommentStatusEnum
.
SUCCESS_COMMENT
.
getValue
());
}
}
order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml
浏览文件 @
ffd83cc7
...
...
@@ -72,4 +72,30 @@
comment_state = #{commentState}
</select>
<!--订单评论超时分页-->
<select
id=
"selectOrderCommentTimeOutPage"
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()) > #{orverDay}
LIMIT ${pageNo*pageSize},${pageSize}
</select>
<!--批量更新订单评论-->
<update
id=
"updateBatchOrderCommentState"
parameterType=
"java.util.List"
>
UPDATE order_comment
SET
comment_state = #{commentState}
WHERE
id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
""
close=
""
separator=
";"
>
#{item.id}
</foreach>
</update>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论