|
|
|
@@ -8,6 +8,7 @@ import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxOrder; |
|
|
|
import com.iformall.domain.po.WxOrderPress; |
|
|
|
import com.iformall.enums.EnumOrderPressType; |
|
|
|
import com.iformall.enums.EnumOrderStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxOrderMapper; |
|
|
|
@@ -70,6 +71,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { |
|
|
|
orderPressQ.setUserId(user.getId()); |
|
|
|
int count = wxOrderPressMapper.selectCount(orderPressQ); |
|
|
|
if(count > 1) { |
|
|
|
logger.error("用户已参与砍价: " + user.getId()); |
|
|
|
throw new MallinkException(ErrorCode.COUPON_PRESS_IS_EXIST); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -82,13 +84,14 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { |
|
|
|
orderPress.setOrderId(order.getId()); |
|
|
|
orderPress.setUserId(user.getId()); |
|
|
|
orderPress.setCreateDate(curDate); |
|
|
|
orderPress.setFirst(EnumOrderPressType.NORMAL.getCode()); |
|
|
|
orderPress.setPressValue(PressUtils.stateLessPressValue(total, left_total, coupon.getPressLimitNum(), order.getPressCurrentNum())); |
|
|
|
|
|
|
|
try { |
|
|
|
// 保存订单 |
|
|
|
wxOrderPressMapper.insertSelective(orderPress); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
logger.error("保存砍价记录Err:" + e.getMessage()); |
|
|
|
logger.error("保存砍价记录Error:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -109,7 +112,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { |
|
|
|
// 保存订单 |
|
|
|
wxOrderMapper.updateByPrimaryKeySelective(orderUpdatePress); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
logger.error("更新订单Err:" + e.getMessage()); |
|
|
|
logger.error("更新订单Error:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL); |
|
|
|
} |
|
|
|
} |
|
|
|
|