|
@@ -65,7 +65,7 @@ public class SysCouponCodeServiceImpl extends BaseServiceImpl<Long, SysCouponCod
|
|
* @param couponId: 优惠券编号
|
|
* @param couponId: 优惠券编号
|
|
* @param paymentOrderId: 订单编号
|
|
* @param paymentOrderId: 订单编号
|
|
* @param exchangeNum: 兑换数量
|
|
* @param exchangeNum: 兑换数量
|
|
- * @param type: 2有paymentOrderId属于订单送券,交易获取,0手动领取 1手动发放
|
|
|
|
|
|
+ * @param type: 2有paymentOrderId属于订单送券,交易获取,0手动领取 1手动发放
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
@@ -84,17 +84,26 @@ public class SysCouponCodeServiceImpl extends BaseServiceImpl<Long, SysCouponCod
|
|
}
|
|
}
|
|
|
|
|
|
private SysCouponCode checkParam(Integer userId, Integer couponId, Long paymentOrderId, Integer exchangeNum, int type, Integer issueId) {
|
|
private SysCouponCode checkParam(Integer userId, Integer couponId, Long paymentOrderId, Integer exchangeNum, int type, Integer issueId) {
|
|
|
|
+ if (type > 2 || type < 0) {
|
|
|
|
+ throw new BizException("优惠券获取途径的参数错误!");
|
|
|
|
+ }
|
|
SysCouponCode sysCouponCode = new SysCouponCode();
|
|
SysCouponCode sysCouponCode = new SysCouponCode();
|
|
- if (type == 2 && WrapperUtil.checkObj(userId, couponId, paymentOrderId, exchangeNum)) {
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(paymentOrderId);
|
|
|
|
- if (Objects.isNull(studentPaymentOrder)) {
|
|
|
|
- throw new BizException("无效订单");
|
|
|
|
|
|
+ //校验参数
|
|
|
|
+ if (WrapperUtil.checkObj(userId, couponId, exchangeNum)) {
|
|
|
|
+ //2 订单满减
|
|
|
|
+ if (type == 2 && Objects.nonNull(paymentOrderId)) {
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(paymentOrderId);
|
|
|
|
+ if (Objects.isNull(studentPaymentOrder)) {
|
|
|
|
+ throw new BizException("无效订单");
|
|
|
|
+ }
|
|
|
|
+ sysCouponCode.setPaymentOrderId(paymentOrderId);
|
|
|
|
+ } else if (type == 1 && Objects.nonNull(issueId)) {
|
|
|
|
+ //1 手动发券
|
|
|
|
+ sysCouponCode.setIssueId(issueId);
|
|
}
|
|
}
|
|
- sysCouponCode.setPaymentOrderId(paymentOrderId);
|
|
|
|
- } else if ((type == 0 || type == 1) && WrapperUtil.checkObj(userId, couponId, issueId, exchangeNum)) {
|
|
|
|
- sysCouponCode.setIssueId(issueId);
|
|
|
|
|
|
+ //0 手动领券
|
|
} else {
|
|
} else {
|
|
- throw new BizException("领取失败");
|
|
|
|
|
|
+ throw new BizException("领取失败,参数错误!");
|
|
}
|
|
}
|
|
sysCouponCode.setType(type);
|
|
sysCouponCode.setType(type);
|
|
return sysCouponCode;
|
|
return sysCouponCode;
|