|
@@ -23,6 +23,7 @@ import shop.alien.entity.store.vo.LifeUserOrderVo;
|
|
|
import shop.alien.entity.store.vo.StoreInfoVo;
|
|
import shop.alien.entity.store.vo.StoreInfoVo;
|
|
|
import shop.alien.mapper.*;
|
|
import shop.alien.mapper.*;
|
|
|
import shop.alien.store.config.GaoDeMapUtil;
|
|
import shop.alien.store.config.GaoDeMapUtil;
|
|
|
|
|
+import shop.alien.store.util.ali.AliApi;
|
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
|
import shop.alien.util.common.AlipayTradeRefund;
|
|
import shop.alien.util.common.AlipayTradeRefund;
|
|
|
import shop.alien.util.common.UniqueRandomNumGenerator;
|
|
import shop.alien.util.common.UniqueRandomNumGenerator;
|
|
@@ -80,6 +81,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
private final AliOSSUtil aliOSSUtil;
|
|
private final AliOSSUtil aliOSSUtil;
|
|
|
private final OrderCouponMiddleMapper orderCouponMiddleMapper;
|
|
private final OrderCouponMiddleMapper orderCouponMiddleMapper;
|
|
|
private final LifeGroupBuyMainMapper lifeGroupBuyMainMapper;
|
|
private final LifeGroupBuyMainMapper lifeGroupBuyMainMapper;
|
|
|
|
|
+ private final AliApi aliApi;
|
|
|
|
|
|
|
|
@Value("${spring.web.resources.excel-path}")
|
|
@Value("${spring.web.resources.excel-path}")
|
|
|
private String excelPath;
|
|
private String excelPath;
|
|
@@ -428,9 +430,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
}
|
|
}
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
LifeUserOrder order = lifeUserOrderMapper.selectById(refundOrder.getOrderId());
|
|
LifeUserOrder order = lifeUserOrderMapper.selectById(refundOrder.getOrderId());
|
|
|
- // TODO 退款
|
|
|
|
|
-// String result = alipayTradeRefund.processRefund(order.getOrderNo(), refundOrder.getRefundMoney(), refundOrder.getDescription());
|
|
|
|
|
- String result = refundOrder.getDescription();
|
|
|
|
|
|
|
+ String result = aliApi.processRefund(order.getOrderNo(), refundOrder.getRefundMoney(), refundOrder.getDescription());
|
|
|
String refundMessage = "";
|
|
String refundMessage = "";
|
|
|
|
|
|
|
|
// 更新的中间表id
|
|
// 更新的中间表id
|
|
@@ -633,7 +633,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
* 创建用户订单
|
|
* 创建用户订单
|
|
|
* @param lifeUserOrderDto 构造数据用
|
|
* @param lifeUserOrderDto 构造数据用
|
|
|
*/
|
|
*/
|
|
|
- @Transactional
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, Object> createUserOrder(LifeUserOrderDto lifeUserOrderDto) {
|
|
public Map<String, Object> createUserOrder(LifeUserOrderDto lifeUserOrderDto) {
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
//1.创建订单
|
|
//1.创建订单
|
|
@@ -660,7 +660,10 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
//2.判断是否使用优惠券
|
|
//2.判断是否使用优惠券
|
|
|
//查询优惠券信息
|
|
//查询优惠券信息
|
|
|
if (StringUtils.isNotEmpty(lifeUserOrderDto.getYhquanId())) {
|
|
if (StringUtils.isNotEmpty(lifeUserOrderDto.getYhquanId())) {
|
|
|
- LifeDiscountCouponUser lifeDiscountCouponUser = lifeDiscountCouponUserMapper.selectById(lifeUserOrderDto.getYhquanId());
|
|
|
|
|
|
|
+ LifeDiscountCouponUser lifeDiscountCouponUser = lifeDiscountCouponUserMapper.selectOne(new QueryWrapper<LifeDiscountCouponUser>()
|
|
|
|
|
+ .eq("coupon_id", lifeUserOrderDto.getYhquanId())
|
|
|
|
|
+ .eq("user_id", lifeUserOrderDto.getUserId())
|
|
|
|
|
+ .eq("delete_flag", 0));
|
|
|
//将优惠券状态变更为已使用
|
|
//将优惠券状态变更为已使用
|
|
|
lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.HAVE_BEEN_USED.getValue()));
|
|
lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.HAVE_BEEN_USED.getValue()));
|
|
|
//将优惠券使用时间存入
|
|
//将优惠券使用时间存入
|
|
@@ -736,6 +739,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
lifeUserOrder.setPayTime(date);
|
|
lifeUserOrder.setPayTime(date);
|
|
|
lifeUserOrder.setPayMethod(lifeUserOrderDto.getPayMethod());
|
|
lifeUserOrder.setPayMethod(lifeUserOrderDto.getPayMethod());
|
|
|
lifeUserOrder.setStatus(lifeUserOrderDto.getStatus());
|
|
lifeUserOrder.setStatus(lifeUserOrderDto.getStatus());
|
|
|
|
|
+ lifeUserOrder.setOrderNo(lifeUserOrderDto.getOrderNo());
|
|
|
orderCouponMiddleUpdateWrapper.set("status",lifeUserOrderDto.getStatus());
|
|
orderCouponMiddleUpdateWrapper.set("status",lifeUserOrderDto.getStatus());
|
|
|
break;
|
|
break;
|
|
|
case 3:
|
|
case 3:
|
|
@@ -762,7 +766,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
}
|
|
}
|
|
|
// 判断订单状态
|
|
// 判断订单状态
|
|
|
// 已核销才可以删除和已退款可以核销
|
|
// 已核销才可以删除和已退款可以核销
|
|
|
- if (lifeUserOrder.getStatus() == OrderStatusEnum.WAIT_USE.getStatus() || lifeUserOrder.getStatus() == OrderStatusEnum.WAIT_PAY.getStatus()) {
|
|
|
|
|
|
|
+ if (lifeUserOrder.getStatus() == OrderStatusEnum.WAIT_USE.getStatus()) {
|
|
|
log.error("deleteUserOrder订单状态错误,订单完成才可以删除");
|
|
log.error("deleteUserOrder订单状态错误,订单完成才可以删除");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|