超时订单关闭逻辑修改
This commit is contained in:
parent
da4647aceb
commit
63f4f05089
|
@ -47,4 +47,11 @@ public class OrderQuery extends OrderVO {
|
|||
@ApiModelProperty("支付渠道ID")
|
||||
private Long payChannelId;
|
||||
|
||||
@ApiModelProperty("支付超时时间(结束)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime payExpireTimeEnd;
|
||||
|
||||
@ApiModelProperty("支付超时时间(开始)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime payExpireTimeStart;
|
||||
}
|
||||
|
|
|
@ -125,6 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.cancelRemark != null and query.cancelRemark != ''"> and bo.cancel_remark like concat('%', #{query.cancelRemark}, '%')</if>
|
||||
<if test="query.payDate != null "> and date(bp.pay_time) = #{query.payDate}</if>
|
||||
<if test="query.payChannelId != null "> and bp.channel_id = #{query.payChannelId}</if>
|
||||
<if test="query.payExpireTimeEnd != null "> and bp.pay_expire_time <= #{query.payExpireTimeEnd}</if>
|
||||
<if test="query.payExpireTimeStart != null "> and bp.pay_expire_time >= #{query.payExpireTimeStart}</if>
|
||||
<if test="query.bonusUserId != null ">
|
||||
and bo.id in (
|
||||
select distinct bb.bst_id from bst_bonus bb
|
||||
|
|
|
@ -285,9 +285,6 @@ public class OrderServiceImpl implements OrderService
|
|||
ServiceUtil.assertion(doPayVO == null, "支付失败");
|
||||
bo.setDoPayVO(doPayVO);
|
||||
|
||||
// 加入延时队列,超时取消
|
||||
this.cancelWhenExpired(order);
|
||||
|
||||
return doPayVO;
|
||||
});
|
||||
} finally {
|
||||
|
|
|
@ -43,6 +43,10 @@ public class OrderDeviceVO extends OrderDevice{
|
|||
@ApiModelProperty("设备商户名称")
|
||||
private String deviceMchName;
|
||||
|
||||
// 车型
|
||||
@ApiModelProperty("车型")
|
||||
private String deviceModelName;
|
||||
|
||||
// 设备剩余续航(公里)
|
||||
public BigDecimal getDeviceRemainEndurance() {
|
||||
BigDecimal remainEndurance = MathUtils.mulDecimal(getDeviceRemainingPower(), getDeviceModelFullEndurance());
|
||||
|
|
|
@ -43,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bd.longitude as device_longitude,
|
||||
bd.latitude as device_latitude,
|
||||
su.nick_name as order_user_name,
|
||||
mch.nick_name as device_mch_name
|
||||
mch.nick_name as device_mch_name,
|
||||
bm.name as device_model_name
|
||||
from bst_order_device bod
|
||||
left join bst_order bo on bo.id = bod.order_id
|
||||
left join bst_device bd on bd.id = bod.device_id
|
||||
|
@ -73,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.startAreaSubName != null and query.startAreaSubName != ''"> and bod.start_area_sub_name like concat('%', #{query.startAreaSubName}, '%')</if>
|
||||
<if test="query.endAreaSubName != null and query.endAreaSubName != ''"> and bod.end_area_sub_name like concat('%', #{query.endAreaSubName}, '%')</if>
|
||||
<if test="query.returnMode != null and query.returnMode != ''"> and bod.return_mode = #{query.returnMode}</if>
|
||||
<if test="query.deviceModelName != null and query.deviceModelName != ''"> and bm.name like concat('%', #{query.deviceModelName}, '%')</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and bod.status in
|
||||
<foreach item="item" collection="query.statusList" separator="," open="(" close=")">
|
||||
|
|
|
@ -114,4 +114,28 @@ public class OrderTask implements ApplicationRunner {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 取消超时未支付的订单
|
||||
*/
|
||||
public void cancelExpireUnPayOrder() {
|
||||
// 查询超时未支付的订单
|
||||
OrderQuery query = new OrderQuery();
|
||||
query.setStatusList(OrderStatus.unPayList());
|
||||
query.setPayExpireTimeEnd(LocalDateTime.now());
|
||||
List<Long> orderIds = orderService.selectIdList(query);
|
||||
|
||||
if (CollectionUtils.isEmptyElement(orderIds)) {
|
||||
log.info("没有超时未支付的订单");
|
||||
return;
|
||||
}
|
||||
|
||||
for (Long id : orderIds) {
|
||||
try {
|
||||
orderService.cancelOrder(id, "订单超时取消");
|
||||
} catch (Exception e) {
|
||||
log.error("取消订单失败,订单ID:{}", id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user