|
@@ -12,7 +12,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import shop.alien.entity.store.*;
|
|
import shop.alien.entity.store.*;
|
|
|
import shop.alien.entity.store.vo.LifeUserOrderVo;
|
|
import shop.alien.entity.store.vo.LifeUserOrderVo;
|
|
|
-import shop.alien.job.feign.AliFeign;
|
|
|
|
|
import shop.alien.job.feign.AlienStoreFeign;
|
|
import shop.alien.job.feign.AlienStoreFeign;
|
|
|
import shop.alien.mapper.*;
|
|
import shop.alien.mapper.*;
|
|
|
import shop.alien.util.common.UniqueRandomNumGenerator;
|
|
import shop.alien.util.common.UniqueRandomNumGenerator;
|
|
@@ -51,8 +50,6 @@ public class LifeUserOrderJob {
|
|
|
private final LifeUserMapper lifeUserMapper;
|
|
private final LifeUserMapper lifeUserMapper;
|
|
|
private final LifeNoticeMapper lifeNoticeMapper;
|
|
private final LifeNoticeMapper lifeNoticeMapper;
|
|
|
|
|
|
|
|
- private final AliFeign aliFeign;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 待支付订单超时处理
|
|
* 待支付订单超时处理
|
|
|
*/
|
|
*/
|
|
@@ -168,7 +165,7 @@ public class LifeUserOrderJob {
|
|
|
// 查询状态为待使用的
|
|
// 查询状态为待使用的
|
|
|
List<Integer> status = new ArrayList<>();
|
|
List<Integer> status = new ArrayList<>();
|
|
|
status.add(OrderStatusEnum.WAIT_USE.getStatus());
|
|
status.add(OrderStatusEnum.WAIT_USE.getStatus());
|
|
|
- selectWrapper.inSql("luo.id", "SELECT distinct order_id FROM order_coupon_middle WHERE status in ( " + String.join(",", status.stream().map(String::valueOf).collect(Collectors.toList())) + ")");
|
|
|
|
|
|
|
+ selectWrapper.inSql("luo.id", "SELECT distinct order_id FROM order_coupon_middle WHERE status in ( "+String.join(",", status.stream().map(String::valueOf).collect(Collectors.toList()))+")");
|
|
|
// 查询待使用的订单
|
|
// 查询待使用的订单
|
|
|
List<LifeUserOrderVo> orderList = lifeUserOrderMapper.selectRefundList(selectWrapper);
|
|
List<LifeUserOrderVo> orderList = lifeUserOrderMapper.selectRefundList(selectWrapper);
|
|
|
|
|
|
|
@@ -186,14 +183,14 @@ public class LifeUserOrderJob {
|
|
|
} else {
|
|
} else {
|
|
|
// 指定时间段
|
|
// 指定时间段
|
|
|
String goqiDate = null;
|
|
String goqiDate = null;
|
|
|
- if (order.getCouponType() == CouponTypeEnum.COUPON.getCode()) {
|
|
|
|
|
|
|
+ if(order.getCouponType() == CouponTypeEnum.COUPON.getCode()){
|
|
|
// 1. 将字符串转换为 long 类型
|
|
// 1. 将字符串转换为 long 类型
|
|
|
long timestamp = Long.parseLong(effectiveDateValue.split(",")[1]);
|
|
long timestamp = Long.parseLong(effectiveDateValue.split(",")[1]);
|
|
|
// 2. 使用 timestamp 构建 Date 对象
|
|
// 2. 使用 timestamp 构建 Date 对象
|
|
|
Date date = new Date(timestamp);
|
|
Date date = new Date(timestamp);
|
|
|
// 如果你需要特定格式的字符串,可以再进行格式化
|
|
// 如果你需要特定格式的字符串,可以再进行格式化
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- goqiDate = sdf.format(date);
|
|
|
|
|
|
|
+ goqiDate =sdf.format(date);
|
|
|
} else {
|
|
} else {
|
|
|
goqiDate = effectiveDateValue.split(",")[1];
|
|
goqiDate = effectiveDateValue.split(",")[1];
|
|
|
}
|
|
}
|
|
@@ -218,11 +215,11 @@ public class LifeUserOrderJob {
|
|
|
String refundResult = null;
|
|
String refundResult = null;
|
|
|
if (refundList.size() == orderCouponMiddleList.size()) {
|
|
if (refundList.size() == orderCouponMiddleList.size()) {
|
|
|
// 全退
|
|
// 全退
|
|
|
- refundResult = aliFeign.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "过期自动退", "");
|
|
|
|
|
|
|
+ refundResult = alienStoreFeign.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "过期自动退","");
|
|
|
} else {
|
|
} else {
|
|
|
// TODO 本次部分退款
|
|
// TODO 本次部分退款
|
|
|
String partialRefundCode = UniqueRandomNumGenerator.generateUniqueCode(12);
|
|
String partialRefundCode = UniqueRandomNumGenerator.generateUniqueCode(12);
|
|
|
- refundResult = aliFeign.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "过期自动退", partialRefundCode);
|
|
|
|
|
|
|
+ refundResult = alienStoreFeign.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "过期自动退",partialRefundCode);
|
|
|
}
|
|
}
|
|
|
if ("调用成功".equals(refundResult)) {
|
|
if ("调用成功".equals(refundResult)) {
|
|
|
// 1.更新中间表状态
|
|
// 1.更新中间表状态
|
|
@@ -257,11 +254,11 @@ public class LifeUserOrderJob {
|
|
|
.set(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue())
|
|
.set(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue())
|
|
|
.eq(LifeDiscountCouponUser::getId, order.getQuanId()));
|
|
.eq(LifeDiscountCouponUser::getId, order.getQuanId()));
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
|
|
+ }else {
|
|
|
// 累计退券个数+当前退券个数!=总个数 且 当前退券数量 = 可退券数
|
|
// 累计退券个数+当前退券个数!=总个数 且 当前退券数量 = 可退券数
|
|
|
- lifeUserOrderMapper.update(null, new UpdateWrapper<LifeUserOrder>().eq("id", order.getId())
|
|
|
|
|
- .set("status", OrderStatusEnum.COMPLETE.getStatus())
|
|
|
|
|
- .set("finish_time", now));
|
|
|
|
|
|
|
+ lifeUserOrderMapper.update(null,new UpdateWrapper<LifeUserOrder>().eq("id",order.getId())
|
|
|
|
|
+ .set("status",OrderStatusEnum.COMPLETE.getStatus())
|
|
|
|
|
+ .set("finish_time",now));
|
|
|
}
|
|
}
|
|
|
// 4.添加退款记录
|
|
// 4.添加退款记录
|
|
|
LifeRefundOrder refundOrder = new LifeRefundOrder()
|
|
LifeRefundOrder refundOrder = new LifeRefundOrder()
|