yujian
2019-02-28 92169dede637c907561cb27ae2a9973f1553715f
券消息添加
2个文件已修改
48 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/UserCouponController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserCouponController.java
@@ -474,10 +474,11 @@
                            couponId = systemCouponId;
                        }
                        if (countPrize == 1) {
                            SystemCoupon coupon = systemCouponService.selectByPrimaryKey(systemCouponId);
                            hasPrize = coupon.getType().name();
                        }
                    }
                    if (countPrize == 1 && couponId != null) {
                        SystemCoupon coupon = systemCouponService.selectByPrimaryKey(couponId);
                        hasPrize = coupon.getType().name();
                    }
                    count = MAX_COUNT - 1 - list.size();
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -619,9 +619,9 @@
        // 消息推送
        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) {
@@ -1082,7 +1082,7 @@
        userSystemCouponRecordService.updateByPrimaryKeySelective(record);
        
        // 券退回
        sendBackCoupon(record.getUserSystemCoupon());
        sendBackCoupon(record.getUserSystemCoupon(), record);
    }
    
    @Transactional
@@ -1102,6 +1102,13 @@
        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
@@ -1238,7 +1245,7 @@
                userSystemCouponRecordService.updateByPrimaryKeySelective(record);
                
                // 退回券
                sendBackCoupon(userSystemCoupon);
                sendBackCoupon(userSystemCoupon, record);
                
            } else {
                // 免单匹配成功
@@ -1253,16 +1260,15 @@
                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);
                } 
            }
        }
@@ -1274,7 +1280,7 @@
     * 退回券 初始数据
     * @param userSystemCoupon
     */
    public void sendBackCoupon(UserSystemCoupon userSystemCoupon) throws Exception{
    public void sendBackCoupon(UserSystemCoupon userSystemCoupon, UserSystemCouponRecord record) throws Exception{
        int expiryDay = 15;
@@ -1303,6 +1309,13 @@
        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());
        }
    }