|
|
|
@@ -369,7 +369,6 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
bodyStr = /*wxMerchant.getName() + */ "-" + EnumCouponType.getEnum(coupon.getType()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxOrder record = new WxOrder(); |
|
|
|
record.setId(orderNumber); |
|
|
|
record.setTenantId(user.getTenantId()); |
|
|
|
@@ -384,9 +383,23 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
record.setCreateDate(curr); |
|
|
|
record.setUpdateDate(curr); |
|
|
|
if(isPress) { |
|
|
|
record.setPressCurrentNum(1); |
|
|
|
// 初始砍价信息 |
|
|
|
record.setPressCurrentNum(0); |
|
|
|
record.setPressEndDate(DateUtils.getHourTimeAfter(coupon.getPressLimitHours(), curr)); |
|
|
|
record.setPressCurrentValue(coupon.getPrice() - coupon.getSalePrice()); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 保存订单 |
|
|
|
wxOrderMapper.insertSelective(record); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
// 库存恢复 |
|
|
|
stockBack(record); |
|
|
|
logger.error("保存订单:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); |
|
|
|
} |
|
|
|
|
|
|
|
if(isPress) { |
|
|
|
// 添加 wx_order_press |
|
|
|
int total = coupon.getPrice() - coupon.getSalePrice(); |
|
|
|
int left_total = total; |
|
|
|
@@ -406,16 +419,22 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
logger.error("保存砍价记录Err:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 保存订单 |
|
|
|
wxOrderMapper.insertSelective(record); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
// 库存恢复 |
|
|
|
stockBack(record); |
|
|
|
logger.error("保存订单:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); |
|
|
|
// 更新砍价信息 |
|
|
|
WxOrder orderUpdatePress = new WxOrder(); |
|
|
|
orderUpdatePress.setId(record.getId()); |
|
|
|
orderUpdatePress.setPressCurrentNum(1); |
|
|
|
orderUpdatePress.setPressCurrentValue(left_total - orderPress.getPressValue()); |
|
|
|
orderUpdatePress.setUpdateDate(new Date()); |
|
|
|
try { |
|
|
|
// 保存订单 |
|
|
|
wxOrderMapper.updateByPrimaryKeySelective(orderUpdatePress); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
// 库存恢复 |
|
|
|
stockBack(record); |
|
|
|
logger.error("保存砍价记录Err:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// couponActionLog |
|
|
|
|