jk-GitHub-coder пре 3 година
родитељ
комит
a825f403c0

+ 82 - 79
YijiaRestful/src/main/java/com/platform/yijia/controller/CouponController.java

@@ -221,51 +221,60 @@ public class CouponController {
                 couponVerificationUser.setUnionId(unionId);
                 CouponVerificationUser cu = couponService.selectCouponVerificationUserInfo(couponVerificationUser);
                 if(cu !=null && cu.getStationId() !=null){
-                    Integer stationId = cu.getStationId();
+                    Integer staIdCvu = cu.getStationId();       //核销人员所在站点
                     UserCoupon ucoupon = new UserCoupon();
                     ucoupon.setCouponNo(couponNo);
                     //获取该已核销优惠券的信息
                     UserCoupon couponInfo = couponService.selectUserCouponInfo(ucoupon);
                     if(couponInfo !=null){
-                        String verification = couponInfo.getVerification();
-                        StationInfo stationInfo = new StationInfo();
-                        stationInfo.setStationId(cu.getStationId());
-                        //核销人员所在的站点信息
-                        StationInfo sta_cu = stationService.selectStationInfo(stationInfo);
-                        //核销人员所在站点级别
-                        String jiBie_cu = sta_cu.getJiBie();
-                        Integer stationId_coupon = couponInfo.getStationId();
-                        stationInfo.setStationId(stationId_coupon);
-                        //当前优惠券所在的站点信息
-                        StationInfo sta_coupon = stationService.selectStationInfo(stationInfo);
-                        //核销券所在站点级别
-                        String jiBie_coupon = sta_coupon.getJiBie();
-                        if("1".equals(jiBie_coupon)){
-                            //表示为集团共享的优惠券
-                            if(jiBie_cu.equals("1")){
-
-                            }
-
-
+                        String verificationIds = couponInfo.getVerification();  //优惠券的核销站点
+                        Integer staIdCoupon = couponInfo.getStationId();          //优惠券创建点
+
+                        StationInfo staParam = new StationInfo();
+                        staParam.setStationId(staIdCvu);
+                        //核销人员所在站点信息
+                        StationInfo staCvuInfo = stationService.selectStationInfo(staParam);
+                        String staCvuInfo_jiBie = staCvuInfo.getJiBie();    //核销人员所在站点级别
+                        //兑换券创建站点所在信息
+                        staParam.setStationId(staIdCoupon);
+                        StationInfo staCouponInfo = stationService.selectStationInfo(staParam);
+                        String staCouponInfo_jiBie = staCouponInfo.getJiBie();  //优惠券所在站点级别
+                        Boolean boo = false;
+                        //根据核销人员的级别去做业务逻辑处理
+                        switch (staCvuInfo_jiBie){
+                            case "1":   //集团级别核销人员
+                                if("1".equals(staCouponInfo_jiBie)){        //此张兑换券的核销点为:优惠券本身创建站点 + 优惠券核销点
+                                    if(staIdCoupon.toString().equals(staIdCvu.toString())){
+                                        boo =  verificationIds.contains(staIdCvu.toString());
+                                    }
+                                   //verificationIds = StringUtils.isNotBlank(verificationIds)? verificationIds +","+ staIdCoupon.toString() : staIdCoupon.toString();
+                                }else if("2".equals(staCouponInfo_jiBie)){
+                                    boo =false;     //兑换券创建为站点级别,则说明是不共享;则集团人员不能核销
+                                }
+                                break;
+                            case "2":    //站点级别核销人员
+                                if("1".equals(staCouponInfo_jiBie)){        //如果该兑换券为集团级别创建 这说明该张兑换券集团下站点可以核销
+                                    if(staCvuInfo.getGroupId().toString().equals(staIdCoupon)){
+                                        boo = true;
+                                    }else {
+                                        verificationIds = StringUtils.isNotBlank(verificationIds)? verificationIds +","+ staIdCoupon.toString() : staIdCoupon.toString();
+                                        if(verificationIds.contains(staCvuInfo.getGroupId().toString())){
+                                            boo = true;
+                                        }
+                                    }
+                                }else if("2".equals(staCouponInfo_jiBie)){
+                                    verificationIds =StringUtils.isNotBlank(verificationIds)? verificationIds + "," + staIdCoupon.toString() : staIdCoupon.toString();
+                                    if(verificationIds.contains(staIdCvu.toString())){
+                                        boo = true;
+                                    }
+                                }
+                                break;
                         }
-
-
-
-
-
-
-                        boolean contains = verification.contains(stationId.toString());
-                        if(contains){
+                        if(boo){
                             //如果当前登录用户是异业端核销人员非加油站异业券核销
                             resultData = ResultData.success(couponInfo);
                         }else {
-                            Integer stationIdCoupon = couponInfo.getStationId();
-                            Integer stationIdVer = cu.getStationId();
-                            if(stationIdVer.toString().equals(stationIdCoupon.toString())){
-                                resultData = ResultData.success(couponInfo);
-                            }else {
-                                resultData = ResultData.error(CodeMsg.ERROR_VERIFICATION);
-                            }
+                            resultData = ResultData.error(CodeMsg.ERROR_VERIFICATION);
                         }
                     }else {
                         resultData = ResultData.error(CodeMsg.NO_COUPON);
@@ -606,51 +615,47 @@ public class CouponController {
                                     StationInfo stationInfo = new StationInfo();
                                     stationInfo.setStationId(cu.getStationId());
                                     StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
+
                                     //当前异业券的核销站点
                                     String verification = userCouponInfo.getVerification();
                                     userCoupon.setVerificationTime(new Date());                     //核销时间
                                     Integer stationIdCoupon = userCouponInfo.getStationId();        //当前优惠券所在发放站点
-                                    //如果当前异业券有核销站点
-                                    if(StringUtils.isNotBlank(verification)){
-                                        //当前优惠券是否共享
-                                        if(cu.getJiBie()!=null){
-                                            String jiBie = cu.getJiBie();
-                                            //核销人员所在站点的级别
-                                            switch (jiBie){
-                                                case "1":
-                                                    if(StringUtils.isNotBlank(stationInfos.getCouponFlag()) && stationInfos.getCouponFlag().equals("1")){
-                                                        verificationId = stationInfos.getGroupId().toString();
-                                                    }
-                                                    break;
-                                                case "2":
-                                                    if(StringUtils.isNotBlank(stationInfos.getCouponFlag()) && stationInfos.getCouponFlag().equals("1")){
-                                                        //表示为集团下优惠券共享
-                                                        verificationId = stationInfos.getStationId().toString();
+                                    stationInfo.setStationId(stationIdCoupon);
+                                    StationInfo stationInfoUCoupon = stationService.selectStationInfo(stationInfo);
+
+                                    Boolean booResult  = false;
+                                    //当前优惠券是否共享
+                                    String jiBie = cu.getJiBie();
+                                    //核销人员所在站点的级别
+                                    switch (jiBie){
+                                        case "1":
+                                            if("1".equals(stationInfoUCoupon.getJiBie())){
+                                                if(verificationId.equals(stationIdCoupon.toString())){
+                                                    booResult = true;
+                                                }
+                                            }else if("2".equals(stationInfoUCoupon.getJiBie())){
+                                                booResult = false;
+                                            }
+                                            break;
+                                        case "2":
+                                            if("1".equals(stationInfoUCoupon.getJiBie())){
+                                                if(stationInfos.getGroupId().equals(stationIdCoupon.toString())){
+                                                    booResult = true;
+                                                }else {
+                                                    verification = StringUtils.isNotBlank(verification)? verification + "," + stationIdCoupon.toString() : stationIdCoupon.toString();
+                                                    if(verification.contains(verificationId)){
+                                                        booResult = true;
                                                     }
-                                                    break;
+                                                }
+                                            }else if("2".equals(stationInfoUCoupon.getJiBie())){
+                                                verification = StringUtils.isNotBlank(verification)? verification + "," + stationIdCoupon.toString() : stationIdCoupon.toString();
+                                                if(verification.contains(verificationId)){
+                                                    booResult = true;
+                                                }
                                             }
-                                        }
-                                        //是否能在该核销点核销
-                                        Integer stationIdVerification = cu.getStationId();              //核销人员所在核销点
-                                        if(verification.contains(verificationId) || stationIdVerification.toString().equals(stationIdCoupon.toString())){
-                                            userCoupon.setCouponIsUsed("1");
-                                            couponService.updateCouponUserInfo(userCoupon);
-                                            resultData = ResultData.success("核销成功!");
-
-                                            UserCoupon u = new UserCoupon();
-                                            u.setId(userCouponInfo.getId());
-                                            UserCoupon ucResult = couponService.selectUserCouponInfo(u);
-                                            Coupon coupon_up = new Coupon();
-                                            coupon_up.setCouponId(userCouponInfo.getCouponId());
-                                            Integer couponUseNum = ucResult.getCouponUseNum();
-                                            couponUseNum = couponUseNum + 1;
-                                            coupon_up.setCouponNum(couponUseNum);
-                                            couponService.updateCouponInfo(coupon_up);
-                                        }else {
-                                            resultData = ResultData.error(CodeMsg.ERROR_VERIFICATION);
-                                        }
-                                    }else if(verificationId.equals(stationIdCoupon.toString())){
-                                        //如果当前异业券没有核销站点,则为油站设置自己兑换券
+                                            break;
+                                    }
+                                    if(booResult){
                                         userCoupon.setCouponIsUsed("1");
                                         couponService.updateCouponUserInfo(userCoupon);
                                         resultData = ResultData.success("核销成功!");
@@ -659,16 +664,14 @@ public class CouponController {
                                         u.setId(userCouponInfo.getId());
                                         UserCoupon ucResult = couponService.selectUserCouponInfo(u);
                                         Coupon coupon_up = new Coupon();
-                                        coupon_up.setCouponId(ucResult.getCouponId());
+                                        coupon_up.setCouponId(userCouponInfo.getCouponId());
                                         Integer couponUseNum = ucResult.getCouponUseNum();
                                         logger.info("当前优惠券模板已使用次数:"+ couponUseNum.toString());
                                         couponUseNum = couponUseNum + 1;
                                         logger.info("当前优惠券模板本次使用后次数:"+ couponUseNum.toString());
-                                        coupon_up.setCouponUseNum(couponUseNum);
+                                        coupon_up.setCouponNum(couponUseNum);
                                         couponService.updateCouponInfo(coupon_up);
-
                                     }else {
-                                        //当前异业券不能在此异业端核销
                                         resultData = ResultData.error(CodeMsg.ERROR_VERIFICATION);
                                     }
                                 }else {

+ 72 - 71
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -425,82 +425,83 @@ public class ElectronicMembershipCardController {
 
                     BigDecimal amtNew = new BigDecimal(dzkAmt);
                     BigDecimal discountAmtNew = new BigDecimal(discountAmt);
-                    //获取该优惠券
-                    if(StringUtils.isNotBlank(id) && !id.equals("undefined")){
-                        UserCoupon userCoupon = new UserCoupon();
-                        userCoupon.setId(Integer.valueOf(id));
-                        UserCoupon ucResult = couponService.selectUserCouponInfo(userCoupon);
-                        if(ucResult !=null){
-                            payOrder.setDiscountCoupon(ucResult.getId().toString());
-                            BigDecimal couponAmt = ucResult.getCouponAmt();
-                            String couponType = ucResult.getCouponType();
-                            if(ucResult.getIsCardFlag() !=null && ucResult.getIsCardFlag().equals("1")){
-                                switch (couponType){
-                                    case "1":
-                                        amtNew = new BigDecimal(dzkAmt).subtract(couponAmt);
-                                        payOrder.setAmt(Double.valueOf(amtNew.toString()));
-                                        payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
-                                        discountAmtNew = discountAmtNew.add(couponAmt);
-                                        payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
-                                        break;
-                                    case "2":
-                                        BigDecimal divide = new BigDecimal(dzkAmt).multiply(couponAmt).divide(new BigDecimal("100"));
-                                        amtNew = new BigDecimal(dzkAmt).subtract(divide);
-                                        discountAmtNew =discountAmtNew.add(divide);
-                                        amtNew = amtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                                        payOrder.setAmt(Double.valueOf(amtNew.toString()));
-                                        payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
-                                        discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                                        payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
-                                        break;
-                                }
-                            }else {
-                                //表示不共享
-                                switch (couponType){
-                                    case "1":
-                                        amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
-                                        payOrder.setAmt(Double.valueOf(amtNew.toString()));
-                                        payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
-                                        payOrder.setDiscountAmt(Double.valueOf(couponAmt.toString()));
-                                        break;
-                                    case "2":
-                                        amtNew = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
-                                        discountAmtNew = new BigDecimal(receivableAmt).subtract(amtNew);
-                                        amtNew = amtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                                        payOrder.setAmt(Double.valueOf(amtNew.toString()));
-                                        payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
-                                        discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                                        payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
-                                        break;
+                    if(StringUtils.isNotBlank(stationInfos.getCouponEnabledFlag()) && "1".equals(stationInfos.getCouponEnabledFlag())){
+                        //获取该优惠券
+                        if(StringUtils.isNotBlank(id) && !id.equals("undefined")){
+                            UserCoupon userCoupon = new UserCoupon();
+                            userCoupon.setId(Integer.valueOf(id));
+                            UserCoupon ucResult = couponService.selectUserCouponInfo(userCoupon);
+                            if(ucResult !=null){
+                                payOrder.setDiscountCoupon(ucResult.getId().toString());
+                                BigDecimal couponAmt = ucResult.getCouponAmt();
+                                String couponType = ucResult.getCouponType();
+                                if(ucResult.getIsCardFlag() !=null && ucResult.getIsCardFlag().equals("1")){
+                                    switch (couponType){
+                                        case "1":
+                                            amtNew = new BigDecimal(dzkAmt).subtract(couponAmt);
+                                            payOrder.setAmt(Double.valueOf(amtNew.toString()));
+                                            payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
+                                            discountAmtNew = discountAmtNew.add(couponAmt);
+                                            payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
+                                            break;
+                                        case "2":
+                                            BigDecimal divide = new BigDecimal(dzkAmt).multiply(couponAmt).divide(new BigDecimal("100"));
+                                            amtNew = new BigDecimal(dzkAmt).subtract(divide);
+                                            discountAmtNew =discountAmtNew.add(divide);
+                                            amtNew = amtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                                            payOrder.setAmt(Double.valueOf(amtNew.toString()));
+                                            payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
+                                            discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                                            payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
+                                            break;
+                                    }
+                                }else {
+                                    //表示不共享
+                                    switch (couponType){
+                                        case "1":
+                                            amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
+                                            payOrder.setAmt(Double.valueOf(amtNew.toString()));
+                                            payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
+                                            payOrder.setDiscountAmt(Double.valueOf(couponAmt.toString()));
+                                            break;
+                                        case "2":
+                                            amtNew = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
+                                            discountAmtNew = new BigDecimal(receivableAmt).subtract(amtNew);
+                                            amtNew = amtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                                            payOrder.setAmt(Double.valueOf(amtNew.toString()));
+                                            payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
+                                            discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                                            payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
+                                            break;
+                                    }
                                 }
                             }
-                        }
 
-                        UserCoupon userCoupon_p = new UserCoupon();
-                        userCoupon_p.setCouponIsUsed("1");
-                        //String discountCoupon = infoMap.get("discountCoupon").toString();
-                        userCoupon_p.setId(Integer.valueOf(id));
-                        userCoupon_p.setCreateTime(new Date());
-                        userCoupon_p.setVerificationTime(new Date());
-                        userCoupon_p.setMobilePhone(personnelPhone);
-                        couponService.updateCouponUserInfo(userCoupon_p);
-
-
-                        //更新该优惠券的使用数量
-                        UserCoupon u = new UserCoupon();
-                        u.setId(Integer.valueOf(id));
-                        UserCoupon userCouponInfo = couponService.selectUserCouponInfo(u);
-                        Coupon coupon_up = new Coupon();
-                        coupon_up.setCouponId(userCouponInfo.getCouponId());
-                        Integer couponUseNum = userCouponInfo.getCouponUseNum();
-                        logger.info("当前优惠券模板已使用次数:"+ couponUseNum.toString());
-                        couponUseNum = couponUseNum + 1;
-                        logger.info("当前优惠券模板本次使用后次数:"+ couponUseNum.toString());
-                        coupon_up.setCouponUseNum(couponUseNum);
-                        couponService.updateCouponInfo(coupon_up);
+                            UserCoupon userCoupon_p = new UserCoupon();
+                            userCoupon_p.setCouponIsUsed("1");
+                            //String discountCoupon = infoMap.get("discountCoupon").toString();
+                            userCoupon_p.setId(Integer.valueOf(id));
+                            userCoupon_p.setCreateTime(new Date());
+                            userCoupon_p.setVerificationTime(new Date());
+                            userCoupon_p.setMobilePhone(personnelPhone);
+                            couponService.updateCouponUserInfo(userCoupon_p);
+
+
+                            //更新该优惠券的使用数量
+                            UserCoupon u = new UserCoupon();
+                            u.setId(Integer.valueOf(id));
+                            UserCoupon userCouponInfo = couponService.selectUserCouponInfo(u);
+                            Coupon coupon_up = new Coupon();
+                            coupon_up.setCouponId(userCouponInfo.getCouponId());
+                            Integer couponUseNum = userCouponInfo.getCouponUseNum();
+                            logger.info("当前优惠券模板已使用次数:"+ couponUseNum.toString());
+                            couponUseNum = couponUseNum + 1;
+                            logger.info("当前优惠券模板本次使用后次数:"+ couponUseNum.toString());
+                            coupon_up.setCouponUseNum(couponUseNum);
+                            couponService.updateCouponInfo(coupon_up);
 
+                        }
                     }
-
                     //payOrder.setTransactionId(ordNo);
                     //BigDecimal discountAmt = new BigDecimal(receivableAmt).subtract(new BigDecimal(dzkAmt));
                     //payOrder.setDiscountAmt(Double.valueOf(discountAmt));

+ 184 - 365
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -359,27 +359,34 @@ public class PayOrderController {
                     CustomerLabel customerLabel_info = labelService.getCustomerLabel(customerLabel);
                     if(customerLabel_info !=null){
                         customerLabel.setUpdateTime(new Date());
-//                        customerLabel.setCreateBy(payOrderResultInfo.getLabelCreateBy());
-//                        if(payOrderResultInfo.getLabelUpdateBy() !=null){
-//                            customerLabel.setUpdateBy(payOrderResultInfo.getLabelUpdateBy());
-//                        }
                         customerLabel.setLabelId(payOrderRequest.getLabelId());
                         labelService.updateCustomerLabel(customerLabel);
                     }else {
                         customerLabel.setCreateTime(new Date());
                         customerLabel.setDelFlag("0");
-                        //customerLabel.setCreateBy(payOrderResultInfo.getLabelCreateBy());
                         customerLabel.setLabelId(payOrderRequest.getLabelId());
                         labelService.insertCustomerLabel(customerLabel);
                     }
                 }
             }else {
+
+                /*
+                 * ***********************************************************************************************************************
+                 * 说明: payOrderResultInfo.setAllDiscountType (计算优惠券时所自定义的参数区别优惠方案): 1、表示等级优惠;2、表示营销优惠;3、标签优惠;
+                 * ***********************************************************************************************************************
+                 */
+
                 //按照正常优惠计算
                 CustomerLabel customerLabelInfo = labelService.getCustomerLabel(customerLabel); //获取该用户是否在标签组内
                 if(payOrderRequest.getLabelFlag() !=null && payOrderRequest.getLabelFlag().equals("1") && customerLabelInfo !=null){
                     //表示此用户为标签用户,计算标签用户优惠
                     params.put("labelId", customerLabelInfo.getLabelId());
                     payOrderResultInfo = this.calculateLabelDiscount(params);
+                    payOrderResultInfo.setOilName(params.get("oilName").toString());
+                    payOrderResultInfo.setUnionId(params.get("unionId").toString());
+                    payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
+                    payOrderResultInfo.setAllDiscountType("3");
+                    payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
                 }else {
                     //不为标签用户时
                     switch (discountSetting){
@@ -387,47 +394,40 @@ public class PayOrderController {
                             payOrderResultInfo = this.calculateGradeDiscount(params);
                             payOrderResultInfo.setOilName(params.get("oilName").toString());
                             payOrderResultInfo.setUnionId(params.get("unionId").toString());
-                            payOrderResultInfo.setAllDiscountType("1");
                             payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
-                            payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
+                            payOrderResultInfo.setAllDiscountType("1");
                             break;
                         case "1":    //满减方案
                             payOrderResultInfo = this.calculateManJianDiscount(params);
-
                             payOrderResultInfo.setOilName(params.get("oilName").toString());
                             payOrderResultInfo.setUnionId(params.get("unionId").toString());
-                            payOrderResultInfo.setAllDiscountType("2");
                             payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
-                            payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
+                            payOrderResultInfo.setAllDiscountType("2");
                             break;
                         case "2":    //立减方案
                             payOrderResultInfo = this.calculateLiJianDiscount(params);
-
                             payOrderResultInfo.setOilName(params.get("oilName").toString());
                             payOrderResultInfo.setUnionId(params.get("unionId").toString());
-                            payOrderResultInfo.setAllDiscountType("2");
                             payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
-                            payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
+                            payOrderResultInfo.setAllDiscountType("2");
                             break;
                         case "3":    //独立直降
                             payOrderResultInfo = this.calculateZhiJiangDiscount(params);
-
                             payOrderResultInfo.setOilName(params.get("oilName").toString());
                             payOrderResultInfo.setUnionId(params.get("unionId").toString());
-                            payOrderResultInfo.setAllDiscountType("2");
                             payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
-                            payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
+                            payOrderResultInfo.setAllDiscountType("2");
                             break;
                         case "4":    //计算阶梯直降
                             payOrderResultInfo = this.calculateJieTiZhiJiangDiscount(params);
-
                             payOrderResultInfo.setOilName(params.get("oilName").toString());
                             payOrderResultInfo.setUnionId(params.get("unionId").toString());
-                            payOrderResultInfo.setAllDiscountType("2");
                             payOrderResultInfo.setStationId(Integer.valueOf(params.get("stationId").toString()));
-                            payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
+                            payOrderResultInfo.setAllDiscountType("2");
                             break;
                     }
+                    //优惠券计算
+                    payOrderResultInfo.setUserCouponsList(this.getUserCouponAscList(payOrderResultInfo));
                 }
             }
         }
@@ -1542,7 +1542,7 @@ public class PayOrderController {
                                 }
                             }
                         }
-                        uc.setCouponNo("");
+                        uc.setCouponNo("");         //隐藏优惠券核销码
                         uc.setCouponReckonAmt(couponReckonAmt);
                     }
                 }
@@ -1554,7 +1554,7 @@ public class PayOrderController {
         return userCouponsList;
     }
 
-    /***
+    /*
      * //计算使用优惠券后金额
      * @param c         //返回前端使用优惠券后的计算
      * @param uc        //用户所持有该张优惠券的信息
@@ -1579,12 +1579,12 @@ public class PayOrderController {
         BigDecimal dzkDiscountAmtNew = new BigDecimal(dzkDiscountAmt);
         BigDecimal dzkDiscountPriceNew = new BigDecimal(dzkDiscountPrice);
 
-        //根据优惠券类型计算金额
-        switch (uc.getCouponType()){
-            case "1":       //现金券
-                if(p.getAllDiscountType().equals("1")){
-                    //表示等级
-                    if(uc.getIsGradeFlag().equals("1")){
+
+        //表示等级叠加
+        if("1".equals(p.getAllDiscountType())){
+            if("1".equals(uc.getIsGradeFlag())){
+                switch (uc.getCouponType()){
+                    case "1":
                         amtNew = new BigDecimal(amt).subtract(couponAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         if(!oilLiters.equals("0.00")){
@@ -1594,7 +1594,25 @@ public class PayOrderController {
                         discountAmtNew = discountAmtNew.add(couponAmt);
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }else {
+                        break;
+                    case "2":
+                        BigDecimal zheKouAmt = new BigDecimal(amt).multiply(couponAmt).divide(new BigDecimal("100"));
+                        discountAmtNew = discountAmtNew.add(zheKouAmt);
+                        amtNew = amtNew.subtract(zheKouAmt);
+                        amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
+                        if(!oilLiters.equals("0.00")){
+                            discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
+                        }
+                        discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
+                        couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
+                        couponReckonAmt.setAmt(amtNew.toString());
+                        break;
+                }
+            }else {
+                //表示不叠加 则只使用优惠券
+                switch (uc.getCouponType()){
+                    case "1":
                         amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         if(!oilLiters.equals("0.00")){
@@ -1605,23 +1623,59 @@ public class PayOrderController {
                         discountAmtNew = discountAmtNew.add(couponAmt);
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }
+                        break;
+                    case "2":
+                        //优惠券折扣金额
+                        BigDecimal zheKouAmt = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
+                        discountAmtNew = new BigDecimal("0.00");
+                        discountAmtNew = discountAmtNew.add(zheKouAmt);
+                        amtNew = amtNew.subtract(discountAmtNew);
+                        amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
+                        if(!oilLiters.equals("0.00")){
+                            discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
+                        }
+                        discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
+                        couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
+                        couponReckonAmt.setAmt(amtNew.toString());
+                        break;
                 }
-                if(p.getAllDiscountType().equals("2")){
-                    //表示营销
-                    if(uc.getIsMarketFlag().equals("1")){
-                        //优惠券后的优惠金额
+            }
+        }
+
+        //表示营销叠加
+        if("2".equals(p.getAllDiscountType())){
+            if("1".equals(uc.getIsMarketFlag())){
+                switch (uc.getCouponType()){
+                    case "1":
                         amtNew = new BigDecimal(amt).subtract(couponAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
-                        //优惠券后的优惠价格
                         if(!oilLiters.equals("0.00")){
                             discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
                         }
+                        couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         discountAmtNew = discountAmtNew.add(couponAmt);
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
+                        couponReckonAmt.setAmt(amtNew.toString());
+                        break;
+                    case "2":
+                        BigDecimal zheKouAmt = new BigDecimal(amt).multiply(couponAmt).divide(new BigDecimal("100"));
+                        discountAmtNew = discountAmtNew.add(zheKouAmt);
+                        amtNew = amtNew.subtract(zheKouAmt);
+                        amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
+                        if(!oilLiters.equals("0.00")){
+                            discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
+                        }
+                        discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }else {
+                        break;
+                }
+            }else {
+                //不叠加营销
+                switch (uc.getCouponType()){
+                    case "1":
                         //优惠券后的优惠金额
                         amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
@@ -1634,45 +1688,15 @@ public class PayOrderController {
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }
-                }
-                if(p.getCardEnabledFlag().equals("1")){
-                    if(uc.getIsCardFlag().equals("1")){
-                        //与电子卡共享
-                        dzkAmtNew = new BigDecimal(dzkAmt).subtract(couponAmt);
-                        dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                        dzkDiscountAmtNew = dzkDiscountAmtNew.add(couponAmt);
-                        couponReckonAmt.setDzkDiscountAmt(dzkDiscountAmtNew.toString());
-                        couponReckonAmt.setDzkAmt(dzkAmtNew.toString());
-                        if(!oilLiters.equals("0.00")){
-                            dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
-                        }
-                        couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
-                    }else {
-                        //与电子卡共享
-                        dzkAmtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
-                        dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
-                        dzkDiscountAmtNew = new BigDecimal("0.00");
-                        dzkDiscountAmtNew = dzkDiscountAmtNew.add(couponAmt);
-                        couponReckonAmt.setDzkDiscountAmt(dzkDiscountAmtNew.toString());
-                        couponReckonAmt.setDzkAmt(dzkAmtNew.toString());
-                        if(!oilLiters.equals("0.00")){
-                            dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
-                        }
-                        couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
-                    }
-                }
-                break;
-            case "2":       //折扣券
-                if(p.getAllDiscountType().equals("1")){
-                    //表示等级
-                    if(uc.getIsGradeFlag().equals("1")){
-                        //表示与等级共享
-                        //优惠券折扣金额
-                        BigDecimal zheKouAmt = new BigDecimal(amt).multiply(couponAmt).divide(new BigDecimal("100"));
+                        break;
+                    case "2":
+                        //优惠券后的优惠金额
+                        BigDecimal zheKouAmt = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
+                        discountAmtNew = new BigDecimal("0.00");
                         discountAmtNew = discountAmtNew.add(zheKouAmt);
-                        amtNew = amtNew.subtract(zheKouAmt);
+                        amtNew = amtNew.subtract(discountAmtNew);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
+                        //优惠券后的优惠价格
                         if(!oilLiters.equals("0.00")){
                             discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
                         }
@@ -1680,12 +1704,30 @@ public class PayOrderController {
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }else {
-                        //优惠券折扣金额
-                        BigDecimal zheKouAmt = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
-                        discountAmtNew = new BigDecimal("0.00");
+                        break;
+                }
+            }
+        }
+
+        //表示标签叠加
+        if("3".equals(p.getAllDiscountType())){
+            if("1".equals(uc.getIsLabelFlag())){
+                switch (uc.getCouponType()){
+                    case "1":
+                        amtNew = new BigDecimal(amt).subtract(couponAmt);
+                        amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
+                        if(!oilLiters.equals("0.00")){
+                            discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
+                        }
+                        couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
+                        discountAmtNew = discountAmtNew.add(couponAmt);
+                        couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
+                        couponReckonAmt.setAmt(amtNew.toString());
+                        break;
+                    case "2":
+                        BigDecimal zheKouAmt = new BigDecimal(amt).multiply(couponAmt).divide(new BigDecimal("100"));
                         discountAmtNew = discountAmtNew.add(zheKouAmt);
-                        amtNew = amtNew.subtract(discountAmtNew);
+                        amtNew = amtNew.subtract(zheKouAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         if(!oilLiters.equals("0.00")){
                             discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
@@ -1694,25 +1736,25 @@ public class PayOrderController {
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }
+                        break;
                 }
-                if(p.getAllDiscountType().equals("2")){
-                    //表示营销
-                    if(uc.getIsMarketFlag().equals("1")){
+            }else {
+                switch (uc.getCouponType()){
+                    case "1":
                         //优惠券后的优惠金额
-                        BigDecimal zheKouAmt = new BigDecimal(amt).multiply(couponAmt).divide(new BigDecimal("100"));
-                        discountAmtNew = discountAmtNew.add(zheKouAmt);
-                        amtNew = amtNew.subtract(zheKouAmt);
+                        amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
                         amtNew = amtNew.signum() == -1 ? new BigDecimal("0.01") : amtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         //优惠券后的优惠价格
                         if(!oilLiters.equals("0.00")){
                             discountPriceNew = amtNew.divide(new BigDecimal(oilLiters), 2, BigDecimal.ROUND_HALF_UP);
                         }
-                        discountAmtNew = discountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        discountAmtNew = new BigDecimal("0.00");
+                        discountAmtNew = discountAmtNew.add(couponAmt);
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }else {
+                        break;
+                    case "2":
                         //优惠券后的优惠金额
                         BigDecimal zheKouAmt = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
                         discountAmtNew = new BigDecimal("0.00");
@@ -1727,14 +1769,31 @@ public class PayOrderController {
                         couponReckonAmt.setDiscountAmt(discountAmtNew.toString());
                         couponReckonAmt.setDiscountPrice(discountPriceNew.toString());
                         couponReckonAmt.setAmt(amtNew.toString());
-                    }
+                        break;
                 }
-                if(p.getCardEnabledFlag().equals("1")){
-                    if(uc.getIsCardFlag().equals("1")){
+            }
+        }
+
+        //表示电子卡
+        if("1".equals(p.getCardEnabledFlag())) {
+            if ("1".equals(uc.getIsCardFlag())) {
+                switch (uc.getCouponType()){
+                    case "1":
+                        //与电子卡共享
+                        dzkAmtNew = new BigDecimal(dzkAmt).subtract(couponAmt);
+                        dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        dzkDiscountAmtNew = dzkDiscountAmtNew.add(couponAmt);
+                        couponReckonAmt.setDzkDiscountAmt(dzkDiscountAmtNew.toString());
+                        couponReckonAmt.setDzkAmt(dzkAmtNew.toString());
+                        if(!oilLiters.equals("0.00")){
+                            dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
+                        }
+                        couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
+                        break;
+                    case "2":
                         //与电子卡共享
                         BigDecimal zheKouDzkAmt = new BigDecimal(dzkAmt).multiply(couponAmt).divide(new BigDecimal("100"));
                         dzkDiscountAmtNew = dzkDiscountAmtNew.add(zheKouDzkAmt);
-                        //System.out.println("电子卡优惠金额:"+dzkDiscountAmtNew.toString());
                         dzkAmtNew = dzkAmtNew.subtract(zheKouDzkAmt);
                         dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         dzkDiscountAmtNew = dzkDiscountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
@@ -1744,11 +1803,27 @@ public class PayOrderController {
                             dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
                         }
                         couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
-                    }else {
+                        break;
+                }
+            }else {
+                switch (uc.getCouponType()){
+                    case "1":
+                        //与电子卡共享
+                        dzkAmtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
+                        dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        dzkDiscountAmtNew = new BigDecimal("0.00");
+                        dzkDiscountAmtNew = dzkDiscountAmtNew.add(couponAmt);
+                        couponReckonAmt.setDzkDiscountAmt(dzkDiscountAmtNew.toString());
+                        couponReckonAmt.setDzkAmt(dzkAmtNew.toString());
+                        if(!oilLiters.equals("0.00")){
+                            dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
+                        }
+                        couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
+                        break;
+                    case "2":
                         BigDecimal zheKouDzkAmt = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
                         dzkDiscountAmtNew = new BigDecimal("0.00");
                         dzkDiscountAmtNew = dzkDiscountAmtNew.add(zheKouDzkAmt);
-                        //System.out.println("电子卡优惠金额:"+dzkDiscountAmtNew.toString());
                         dzkAmtNew = dzkAmtNew.subtract(dzkDiscountAmtNew);
                         dzkAmtNew = dzkAmtNew.signum() == -1 ? new BigDecimal("0.01") : dzkAmtNew.setScale(2,BigDecimal.ROUND_HALF_UP);
                         dzkDiscountAmtNew = dzkDiscountAmtNew.setScale(2, BigDecimal.ROUND_HALF_UP);
@@ -1758,39 +1833,19 @@ public class PayOrderController {
                             dzkDiscountPriceNew = dzkAmtNew.divide(new BigDecimal(oilLiters), 2 ,BigDecimal.ROUND_HALF_UP);
                         }
                         couponReckonAmt.setDzkDiscountPrice(dzkDiscountPriceNew.toString());
-                    }
+                        break;
                 }
-                break;
+            }
         }
+
         return couponReckonAmt;
     }
 
-
-
-    //获取客户所拥有的优惠券
-//    public List<UserCoupon> getUserCoupon(String unionId, Integer stationId){
-//        List<UserCoupon> userCouponsList = new ArrayList<>();
-//        StationInfo stationInfo = new StationInfo();
-//        stationInfo.setStationId(stationId);
-//        StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
-//        if(stationInfos !=null && stationInfos.getCouponEnabledFlag() !=null && stationInfos.getCouponEnabledFlag().equals("1")){
-//            UserCoupon userCoupon = new UserCoupon();
-//            userCoupon.setStationId(stationId);
-//            if(stationInfos.getCouponFlag() !=null && stationInfos.getCouponFlag().equals("1")){
-//                userCoupon.setStationId(stationInfos.getGroupId());
-//            }
-//            userCoupon.setUnionId(unionId);
-//            userCoupon.setCouponIsUsed("0");
-//            userCoupon.setExpireFlag("0");                  // SQL 条件判断 过期标志: 1 代表使用的优惠券已过期查询参数; 0 代表未过期有效的优惠券
-//            userCoupon.setNoVerificationVerFlag("0");       //SQL 条件判断 查询没有异业券的参数标识: 0代表只有加油券 1代表只有异业券
-//            userCoupon.setCurrentTime(new Date());
-//            userCouponsList = couponService.selectUserCoupons(userCoupon);
-//        }
-//        return userCouponsList;
-//    }
-
-
-    //获取支付后
+    /*
+     * 获取领取方式
+     * @param stationId
+     * @return
+     */
     public List<CouponIssue> getCouponIssue(Integer stationId){
         CouponIssue c = new CouponIssue();
         c.setStationId(stationId);
@@ -1800,7 +1855,12 @@ public class PayOrderController {
         return couponIssuesList;
     }
 
-    //查询用户电子会员卡余额
+    /*
+     * 查询用户电子会员卡余额
+     * @param card
+     * @param params
+     * @return
+     */
     public Map<String, String>  selectCardBalance(CustomerElectronicCard card, Map params) {
         CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
         customerElectronicCard.setCardOilsType(card.getCardOilsType());
@@ -1855,8 +1915,8 @@ public class PayOrderController {
     }
 
 
-    /***
-     * //营销方案活动日优惠
+    /*
+     * 营销方案活动日优惠
      * @param discountType              活动日时间类型
      * @param discountDate              活动日时间字符串,格式:1,2,3,4,5
      * @return
@@ -1894,249 +1954,8 @@ public class PayOrderController {
         return boo;
     }
 
-//    /***
-//     * 计算使用优惠券金额
-//     * @param ordNo
-//     * @param id
-//     * @return
-//     */
-//    @RequestMapping(value = "/calculateCouponDiscount", method = RequestMethod.GET)
-//    @ResponseBody
-//    public String calculateCouponDiscount(@RequestParam String ordNo, @RequestParam Integer id){
-//        Gson gson =new Gson();
-//        ResultData resultData =null;
-//        PayOrder payOrder = new PayOrder();
-//        payOrder.setOrderNo(ordNo);
-//        Map<String, Object> infoMap = payOrderService.getOrderInfoAndUserInfoByOrderNo(payOrder);
-//        StationInfo stationInfo = new StationInfo();
-//        stationInfo.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
-//        StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
-//        if(stationInfos !=null && stationInfos.getCouponEnabledFlag().equals("1")){
-//            Map<String ,Object> resultMap = new HashMap<>();                //返回结果集
-//            if(infoMap !=null){
-//                UserCoupon u = new UserCoupon();
-//                if(id !=null){
-//                    u.setId(id);
-//                    UserCoupon couponInfo = couponService.selectUserCouponInfo(u);
-//                    if(couponInfo !=null){
-//                        String oilName = infoMap.get("oilName").toString();
-//                        String oilNames = couponInfo.getOilName();
-//                        //判断该油品是否能用该张张优惠券
-//                        boolean contains = oilNames.contains(oilName);
-//                        if(contains){
-//                            String status = couponInfo.getStatus();
-//                            //该优惠券是否有效
-//                            if(status !=null && status.equals("1")) {
-//                                PayOrderResultInfo p = new PayOrderResultInfo();
-//                                BigDecimal receivableAmt = new BigDecimal(infoMap.get("receivableAmt").toString());  //应收金额
-//                                BigDecimal couponThresholdAmt = couponInfo.getCouponThresholdAmt();                  //门槛金额
-//                                p.setReceivableAmt(receivableAmt.toString());
-//                                //判断该订单是否满足该优惠券门槛金额要求
-//                                if(!(receivableAmt.compareTo(couponThresholdAmt) == -1)){
-//                                    String isMarketFlag = couponInfo.getIsMarketFlag();
-//                                    String isCardFlag = couponInfo.getIsCardFlag();
-//                                    String isGradeFlag = couponInfo.getIsGradeFlag();
-//                                    BigDecimal amt = new BigDecimal(infoMap.get("amt").toString());                      //实收金额
-//                                    p.setAmt(amt.toString());
-//                                    BigDecimal dzkAmt = new BigDecimal(infoMap.get("dzkAmt").toString());                //电子卡金额
-//                                    p.setDzkAmt(dzkAmt.toString());
-//                                    BigDecimal oilPrice = new BigDecimal(infoMap.get("oilPirce").toString());            //油品价格
-//                                    BigDecimal orderLiters = new BigDecimal(infoMap.get("orderLiters").toString());      //电子卡金额
-//                                    p.setOilLiters(orderLiters.toString());
-//                                    BigDecimal couponAmt = couponInfo.getCouponAmt();                                       //优惠券金额:金额 比例值
-//                                    String couponType = couponInfo.getCouponType();                                         //优惠劵类型 1现金劵,2折扣券,3兑换券
-//                                    String cardEnabledFlag = stationInfos.getCardEnabledFlag();                             //是否开启电子卡
-//                                    //计算优惠券优惠后金额
-//                                    CalCouponAmtInfo cal = new CalCouponAmtInfo();
-//                                    cal.setReceivableAmt(receivableAmt);
-//                                    cal.setAmt(amt);
-//                                    cal.setCardEnabledFlag(cardEnabledFlag);
-//                                    cal.setCouponAmt(couponAmt);
-//                                    cal.setCouponType(couponType);
-//                                    cal.setDzkAmt(dzkAmt);
-//                                    cal.setIsCardFlag(isCardFlag);
-//                                    cal.setIsGradeFlag(isGradeFlag);
-//                                    cal.setIsMarketFlag(isMarketFlag);
-//                                    //使用优惠券时返回结果
-//                                    PayOrderResultInfo resultCalCoupon = calCouponAmt(cal);
-//                                    //查询优惠券使用时间
-//                                    String availableControl = couponInfo.getAvailableControl();         //时间类型选择
-//                                    switch (availableControl){
-//                                        case "0":
-//                                            p.setAmt(resultCalCoupon.getAmt());
-//                                            p.setDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getAmt())).toString());
-//                                            p.setDzkAmt(resultCalCoupon.getDzkAmt());
-//                                            p.setDzkDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getDzkAmt())).toString());
-//                                            break;
-//                                        case "1":
-//                                            boolean activityDay = this.isActivityDay("1", couponInfo.getCycleDays());
-//                                            if(activityDay){
-//                                                p.setDzkAmt(resultCalCoupon.getDzkAmt());
-//                                                p.setDzkDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getDzkAmt())).toString());
-//                                                p.setAmt(resultCalCoupon.getAmt());
-//                                                p.setDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getAmt())).toString());
-//                                            }
-//                                            break;
-//                                        case "2":
-//                                            boolean activityDay2 = this.isActivityDay("2", couponInfo.getCycleDays());
-//                                            if(activityDay2){
-//                                                p.setDzkAmt(resultCalCoupon.getDzkAmt());
-//                                                p.setDzkDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getDzkAmt())).toString());
-//                                                p.setAmt(resultCalCoupon.getAmt());
-//                                                p.setDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getAmt())).toString());
-//                                            }
-//                                            break;
-//                                        case "3":
-//                                            boolean activityDay3 = this.isActivityDay("3", couponInfo.getCycleDays());
-//                                            if(activityDay3){
-//                                                p.setDzkAmt(resultCalCoupon.getDzkAmt());
-//                                                p.setDzkDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getDzkAmt())).toString());
-//                                                p.setAmt(resultCalCoupon.getAmt());
-//                                                p.setDiscountAmt(receivableAmt.subtract(new BigDecimal(resultCalCoupon.getAmt())).toString());
-//                                            }
-//                                    }
-//                                    BigDecimal discountPrice = oilPrice;
-//                                    if(!orderLiters.toString().equals("0.00")){
-//                                        //.setScale(2, BigDecimal.ROUND_HALF_UP)
-//                                        discountPrice = (new BigDecimal(p.getAmt()).divide(orderLiters, 2, BigDecimal.ROUND_HALF_UP));
-//                                    }
-//                                    resultMap.put("discountPrice", discountPrice.toString());
-//                                    resultMap.put("discountAmt", p.getDiscountAmt());               //优惠金额
-//                                    resultMap.put("amt", p.getAmt());                               //实收价格
-//                                    resultMap.put("receivableAmt", p.getReceivableAmt());           //应收价格
-//                                    resultMap.put("oilLiters", p.getOilLiters());
-//                                    resultMap.put("amt_dzk", p.getDzkAmt());
-//                                    resultMap.put("discountAmt_dzk", p.getDzkDiscountAmt());          //电子卡优惠金额
-//                                    resultMap.put("ordNo", ordNo);
-//                                    resultData = ResultData.success(resultMap);
-//                                }else{
-//                                    resultData = ResultData.error(CodeMsg.COUPON_NOT_COUPONTHRESHOLDAMT);
-//                                }
-//                            }else {
-//                                resultData = ResultData.error(CodeMsg.COUPON_LOSE_EFFECTIVE);
-//                            }
-//                        }else {
-//                            resultData = ResultData.error(CodeMsg.COUPON_NOT_CONTATINS_OILNAME);
-//                        }
-//                    }else {
-//                        resultData = ResultData.error(CodeMsg.NO_COUPON);
-//                    }
-//                }
-//            }else {
-//                resultData = ResultData.error(CodeMsg.NO_ORDER);
-//            }
-//        }else {
-//            resultData = ResultData.error(CodeMsg.NO_ENABLE_COUPON);
-//        }
-//        return gson.toJson(resultData);
-//    }
-
-
-
-    //计算优惠券金额
-    public PayOrderResultInfo calCouponAmt(CalCouponAmtInfo calCouponAmtInfo){
-        PayOrderResultInfo p = new PayOrderResultInfo();
-        BigDecimal receivableAmt = calCouponAmtInfo.getReceivableAmt();         //
-        BigDecimal amt = calCouponAmtInfo.getAmt();
-        BigDecimal couponAmt = calCouponAmtInfo.getCouponAmt();                 //优惠券优惠值
-        BigDecimal dzkAmt = calCouponAmtInfo.getDzkAmt();                       //优惠券电子卡金额
-        String cardEnabledFlag = calCouponAmtInfo.getCardEnabledFlag();         //是否开启电子卡
-        switch (calCouponAmtInfo.getCouponType()) {
-            case "1":
-                //现金券
-                //与营销方案,电子卡互斥
-                BigDecimal subtract = receivableAmt.subtract(couponAmt);
-                subtract = subtract.signum() == -1 ? new BigDecimal("0.01") : subtract;
-                p.setAmt(subtract.toString());
-                //是否开启电子卡
-                if(cardEnabledFlag.equals("1")){
-                    p.setDzkAmt(subtract.toString());
-                    //是否与电子卡叠加
-                    if (calCouponAmtInfo.getIsCardFlag().equals("1")) {
-                        BigDecimal dzkAmtSub = dzkAmt.subtract(couponAmt);
-                        dzkAmtSub = dzkAmtSub.signum() == -1 ? new BigDecimal("0.01") : dzkAmtSub;
-                        p.setDzkAmt(dzkAmtSub.toString());
-                    }
-                }
-                //是否与营销方案叠加
-                if (calCouponAmtInfo.getIsMarketFlag().equals("1")) {
-                    BigDecimal marketSub = amt.subtract(calCouponAmtInfo.getCouponAmt());
-                    marketSub = marketSub.signum() == -1 ? new BigDecimal("0.01") : marketSub;
-                    p.setAmt(marketSub.toString());
-                }
-
-                //是否与等级叠加
-                if(calCouponAmtInfo.getIsGradeFlag().equals("1")){
-                    //
-                }
-
-                break;
-            case "2":
-                //折扣券
-                BigDecimal multiply = calCouponAmtInfo.getReceivableAmt().multiply(calCouponAmtInfo.getCouponAmt()).divide(new BigDecimal("100"));
-                multiply = receivableAmt.subtract(multiply).setScale(2, BigDecimal.ROUND_HALF_UP);
-                p.setAmt(multiply.toString());
-                if(cardEnabledFlag.equals("1")){
-                    p.setDzkAmt(multiply.toString());
-                    //是否与电子卡叠加
-                    if (calCouponAmtInfo.getIsCardFlag().equals("1")) {
-                        BigDecimal multiplyCard = dzkAmt.multiply(couponAmt).divide(new BigDecimal("100"));
-                        multiplyCard = dzkAmt.subtract(multiplyCard).setScale(2, BigDecimal.ROUND_HALF_UP);
-                        p.setDzkAmt(multiplyCard.toString());
-                    }
-                }
 
-                //是否与营销方案叠加
-                if (calCouponAmtInfo.getIsMarketFlag().equals("1")) {
-                    BigDecimal multiplyMarket = amt.multiply(couponAmt).divide(new BigDecimal("100"));
-                    multiplyMarket = amt.subtract(multiplyMarket).setScale(2, BigDecimal.ROUND_HALF_UP);
-                    p.setAmt(multiplyMarket.toString());
-                }
-                break;
-        }
-        return p;
-    }
-
-
-//    /***
-//     * 计算使用优惠券金额
-//     * @param ordNo
-//     * @param id
-//     * @return
-//     */
-//    @RequestMapping(value = "/updateOrderCoupon", method = RequestMethod.GET)
-//    @ResponseBody
-//    public String updateOrderCoupon(@RequestParam String ordNo, @RequestParam Integer id){
-//        Gson gson =new Gson();
-//        ResultData resultData =null;
-//
-//        PayOrder payOrder = payOrderService.selectOrderInfoByOrdNo(ordNo);
-//        UserCoupon userCoupon = new UserCoupon();
-//        userCoupon.setCouponId(id);
-//        UserCoupon ucr = couponService.selectUserCouponInfo(userCoupon);
-//        PayOrder p = new PayOrder();
-//        p.setDiscountCoupon(id.toString());
-//        p.setDiscountCouponAmt(Double.valueOf(ucr.getCouponAmt().toString()));
-//        Double amt = payOrder.getAmt();
-//        String couponType = ucr.getCouponType();
-//        BigDecimal couponAmt = ucr.getCouponAmt();
-//
-//        CalCouponAmtInfo calCouponAmtInfo = new CalCouponAmtInfo();
-////        calCouponAmtInfo.setReceivableAmt(payOrder.getReceivableAmt());
-////        calCouponAmtInfo.setIsMarketFlag(userCoupon.getIsMarketFlag());
-////        calCouponAmtInfo.setIsGradeFlag(ucr.get);
-//        this.calCouponAmt(calCouponAmtInfo);
-//
-//
-// //       p.setAmt();
-//        p.setOrderNo(ordNo);
-//        payOrderService.getUpdatePayOrder(p);
-//        resultData = ResultData.success("");
-//        return  gson.toJson(resultData);
-//    }
-
-
-    /**
+    /*
      * 根据订单号获取订单信息
      * produces="application/json;charset=UTF-8",consumes = "application/json",
      * @RequestBody String orderno

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/Coupon.java

@@ -50,6 +50,7 @@ public class Coupon {
     private String isCardFlag;              //是否电子卡
     private String isGradeFlag;             //是否等级
     private String isMarketFlag;            //是否叠加营销方案;
+    private String isLabelFlag;             //是否叠加标签优惠
 
     //领取方式属性
     private Integer showId;                     //展示位

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/UserCoupon.java

@@ -66,6 +66,7 @@ public class UserCoupon {
     private String isCardFlag;              //是否电子卡
     private String isGradeFlag;             //是否等级
     private String isMarketFlag;            //是否叠加营销方案;
+    private String isLabelFlag;             //是否叠加标签优惠
 
     //领取方式属性
     private Integer showId;                     //展示位

+ 4 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/StationService.java

@@ -42,10 +42,13 @@ public interface StationService {
 
     //查询油站列表
     List<StationInfo> getStationList(StationInfo stationInfo);
+
     //添加油站信息
     void AddStationInfo(StationInfo stationInfo);
+
     //修改油站信息
     void updateStationInfo(StationInfo stationInfo);
+
     //删除油站信息
     void deleteStationInfo(StationInfo stationInfo);
 
@@ -63,4 +66,5 @@ public interface StationService {
 
     //查询油站配置信息
     StationPayManage selectStationPayManage(StationPayManage stationPayManage);
+
 }

+ 7 - 2
YijiaRestful/src/main/resources/mapper/CouponMapper.xml

@@ -39,6 +39,7 @@
       <result column="is_card_flag"           jdbcType="VARCHAR"   property="isCardFlag" />
       <result column="is_grade_flag"          jdbcType="VARCHAR"   property="isGradeFlag" />
       <result column="is_market_flag"         jdbcType="VARCHAR"   property="isMarketFlag" />
+      <result column="is_label_flag"          jdbcType="VARCHAR"    property="isLabelFlag" />
 
       <result column="available_control"         jdbcType="VARCHAR"   property="availableControl" />
       <result column="appointed_days"            jdbcType="VARCHAR"   property="appointedDays" />
@@ -121,6 +122,7 @@
       <result column="is_card_flag"           jdbcType="VARCHAR"   property="isCardFlag" />
       <result column="is_grade_flag"          jdbcType="VARCHAR"   property="isGradeFlag" />
       <result column="is_market_flag"         jdbcType="VARCHAR"   property="isMarketFlag" />
+      <result column="is_label_flag"          jdbcType="VARCHAR"   property="isLabelFlag" />
 
       <result column="available_control"       jdbcType="VARCHAR"   property="availableControl" />
       <result column="appointed_days"          jdbcType="VARCHAR"   property="appointedDays" />
@@ -156,14 +158,14 @@
     T1.id, T1.coupon_is_used, T1.coupon_no, T1.coupon_effective_time, T1.get_coupon_time, T1.coupon_is_used, T2.id AS coupon_id, T2.station_id, T2.coupon_name, T2.coupon_remark, T2.coupon_type, T2.coupon_threshold_amt, T2.oil_name, T2.oil_type, T2.coupon_amt, T2.effective_time_type,
     T2.effective_time_start, T2.effective_time_end, T2.effective_day_num, T2.coupon_cumulative_num, T2.coupon_use_num,
     T2.open_platform, T2.status, T2.create_by, T2.create_time, T2.update_by, T2.update_time, T2.del_flag, T2.coupon_details, T2.verification,
-    T2.is_card_flag, T2.is_grade_flag, T2.is_market_flag, T2.edit_flag, T2.available_control, T2.appointed_days, T2.cycle_days
+    T2.is_card_flag, T2.is_grade_flag, T2.is_market_flag, T2.is_label_flag, T2.edit_flag, T2.available_control, T2.appointed_days, T2.cycle_days
   </sql>
 
     <sql id="Coupon_Base_Column_List">
         T2.id, T2.station_id, T2.coupon_name, T2.coupon_type, T2.coupon_remark, T2.coupon_threshold_amt, T2.oil_name, T2.oil_type, T2.coupon_amt, T2.coupon_num, T2.effective_time_type,
         T2.effective_time_start, T2.effective_time_end, T2.effective_day_num, T2.coupon_receive_num, T2.coupon_hold_num, T2.coupon_cumulative_num, T2.coupon_use_num,
         T2.open_platform, T2.status, T2.create_by, T2.create_time, T2.update_by, T2.update_time, T2.del_flag, T2.coupon_details, T2.verification,
-        T2.is_card_flag, T2.is_grade_flag, T2.is_market_flag, T2.edit_flag, T2.available_control, T2.appointed_days, T2.cycle_days
+        T2.is_card_flag, T2.is_grade_flag, T2.is_market_flag, T2.edit_flag, T2.is_label_flag, T2.available_control, T2.appointed_days, T2.cycle_days
       </sql>
 
     <!--查询优惠券模板信息-->
@@ -271,6 +273,7 @@
             T3.is_card_flag,
             T3.is_grade_flag,
             T3.is_market_flag,
+            T3.is_label_flag,
             T3.available_control,
             T3.appointed_days,
             T3.edit_flag,
@@ -611,6 +614,7 @@
         T2.is_card_flag,
         T2.is_grade_flag,
         T2.is_market_flag,
+        T2.is_label_flag,
         T2.available_control,
         CASE
              WHEN  T2.available_control ='0'   THEN  CASE WHEN ( NOW() - T1.coupon_effective_time &lt;= 0) 				     THEN  'true' ELSE 'false'   END
@@ -694,6 +698,7 @@
             T2.is_card_flag,
             T2.is_grade_flag,
             T2.is_market_flag,
+            T2.is_label_flag,
             T2.available_control,
             CASE
                 WHEN  T2.available_control ='0'   THEN  CASE WHEN ( NOW() - T1.coupon_effective_time &lt;= 0) 				         THEN  'true' ELSE 'false'   END

+ 1 - 1
YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml

@@ -167,7 +167,7 @@
         T2.card_rule_flag       AS card_rule_flag_group,
         T2.integral_flag        AS integral_flag_group,
         T2.integral_rule_flag   AS integral_rule_flag_group,
-        T2.is_lng_flag          AS is_lng_flag_group
+        T2.is_lng_flag          AS is_lng_flag_group,
         T2.coupon_flag          AS coupon_flag_group,
         T2.coupon_enabled_flag  AS coupon_enabled_flag_group
     FROM          sys_dept      AS T1