| | |
| | | // 消息推送
|
| | | try {
|
| | | if (baseCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
|
| | | // userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon,order);
|
| | | //userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon,order.get);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | // userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon);
|
| | | //userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon);
|
| | | }
|
| | |
|
| | | } catch(Exception e) {
|
| | |
| | | userSystemCouponRecordService.updateByPrimaryKeySelective(record);
|
| | |
|
| | | // 券退回
|
| | | sendBackCoupon(record.getUserSystemCoupon());
|
| | | sendBackCoupon(record.getUserSystemCoupon(), record);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | record.setUpdateTime(new Date());
|
| | | record.setState(UserSystemCouponRecord.STATE_SUCCESS);
|
| | | userSystemCouponRecordService.updateByPrimaryKeySelective(record);
|
| | | |
| | | // 消息推送
|
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.welfareCouponUsed(record.getUserSystemCoupon(), orderNo);
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(record.getUserSystemCoupon(), orderNo);
|
| | | } |
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | userSystemCouponRecordService.updateByPrimaryKeySelective(record);
|
| | |
|
| | | // 退回券
|
| | | sendBackCoupon(userSystemCoupon);
|
| | | sendBackCoupon(userSystemCoupon, record);
|
| | |
|
| | | } else {
|
| | | // 免单匹配成功
|
| | |
| | | userSystemCoupon.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
|
| | |
|
| | | SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
|
| | | String couponType = record.getCouponType();
|
| | | if (couponType == null || couponType.trim().length() == 0) {
|
| | | throw new Exception("券类型未被记录");
|
| | | }
|
| | |
|
| | | SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (baseCoupon == null) {
|
| | | // 券已使用
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(userSystemCoupon, orderNo);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
|
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(couponType)) {
|
| | | userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon,orderNo,payment);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(userSystemCoupon,orderNo);
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(couponType)) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon, orderNo, payment);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * 退回券 初始数据
|
| | | * @param userSystemCoupon
|
| | | */
|
| | | public void sendBackCoupon(UserSystemCoupon userSystemCoupon) throws Exception{
|
| | | public void sendBackCoupon(UserSystemCoupon userSystemCoupon, UserSystemCouponRecord record) throws Exception{
|
| | |
|
| | | int expiryDay = 15;
|
| | |
|
| | |
| | | userSystemCoupon.setUpdateTime(new Date());
|
| | |
|
| | | userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
|
| | | |
| | | |
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.welfareCouponDrawBack(userSystemCoupon, record.getOrderNo());
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.freeSheetCouponDrawBack(userSystemCoupon, record.getOrderNo());
|
| | | } |
| | | }
|
| | |
|
| | |
|