| 
					
				 | 
			
			
				@@ -114,7 +114,8 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String orderType = payOrderRequest.getOrderType();                          //获取订单类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             logger.info("订单类型:" + orderType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(orderType.equals("1")){                                                  //订单类型是油品时计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                resultMap = this.calculateAmt(payOrderRequest);                         //计算油价 加油升数 优惠金额 实收金额 优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //resultMap = this.calculateAmt(payOrderRequest);                         //计算油价 加油升数 优惠金额 实收金额 优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                resultMap = this.calculateAmtNew(payOrderRequest);                         //计算油价 加油升数 优惠金额 实收金额 优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 payOrder.setOilPirce(resultMap.get("oilPrice").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 payOrder.setOrderLiters(resultMap.get("oilLiters").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 payOrder.setDiscountAmt(Double.valueOf(resultMap.get("discountAmt").toString())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -451,8 +452,14 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 修订优惠计算: 2021年4月20日15:31:30 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 修订内容 : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     *    修改为目前只有三种优惠:等级优惠根据立减 满减 独立直降 是否启用 等级直降来确定是否使用等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     *    优惠为 1 是:表示不走优惠,没有优惠只走等级直降的优惠 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *    修改为目前只有三种优惠:根据立减、满减、独立直降; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *    注释:优惠为 1 是:表示不走满减、立减、独立直降优惠,只走等级直降的优惠; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *    条件规则: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *      一,优先满减(只有一档,不存在多档!)、立减(只有一档,不存在多档!)、独立直降(只有一档) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *      二,若用户消费门槛 >= 优惠门槛,且启用优惠叠加时,则计算优惠规则和等级优惠规则; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *         若用户消费门槛 >= 优惠门槛,且不启用优惠叠加时,则只计算优惠规则; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *         若用户消费门槛 <  优惠门槛,且启用优惠叠加时,则只计算等级规则; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *         若用户消费门槛 <  优惠门槛,且不启用优惠叠加时,则只计算等级规则; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Map<String ,Object> calculateAmtNew(PayOrderRequest payOrderRequest){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -536,44 +543,57 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     List<Map> customerMarkertPlanList_1 = customerGradeServices.getCustomerMarkertPlanList(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //有优惠规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(customerMarkertPlanList_1 !=null && customerMarkertPlanList_1.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        boolean flag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String isAddDiscount="0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (Map m : customerMarkertPlanList_1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //如果当前应收金额大于条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());   //每满多少优惠多少的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                discountAmt = receivableAmt_b.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b);  //优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                amt = receivableAmt_b.subtract(discountAmt);   //实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice),2, BigDecimal.ROUND_HALF_UP);   //加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                discountPrice = amt.divide(oilLiters,2,BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //是否共享会员优惠叠加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                String vipDiscountyPlus = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(vipDiscountyPlus.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    isAddDiscount ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //是否共享会员优惠叠加: 1 代表是; 2 代表否; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String vipDiscountyPlus = customerMarkertPlanList_1.get(0).get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //如果当前应收金额大于条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList_1.get(0).get("discountAmt").toString());   //条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList_1.get(0).get("gasoilDiscountAmt").toString());   //每满多少优惠多少的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountAmt = receivableAmt_b.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b);  //优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            amt = receivableAmt_b.subtract(discountAmt);   //实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice),2, BigDecimal.ROUND_HALF_UP);   //加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountPrice = amt.divide(oilLiters,2,BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            switch (vipDiscountyPlus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     amt = amt.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            switch (vipDiscountyPlus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    amt = amt.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(flag && isAddDiscount.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("oilLiters", map.get("oilLiters").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("discountPrice", map.get("discountPrice").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //没有优惠规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //用户没有设置优惠规则时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -585,44 +605,58 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     params.put("discountPlanType", "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //营销方案 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     List<Map> customerMarkertPlanList_2 = customerGradeServices.getCustomerMarkertPlanList(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //是否共享会员优惠叠加: 1 代表是; 2 代表否; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String vipDiscountyPlus = customerMarkertPlanList_2.get(0).get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(customerMarkertPlanList_2 !=null && customerMarkertPlanList_2.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        boolean flag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String isAddDiscount="0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (Map m : customerMarkertPlanList_2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //如果当前应收金额大于条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());   //满多少优惠多少的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                discountAmt = gasoilDiscountAmt_b;  //优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                amt = receivableAmt_b.subtract(gasoilDiscountAmt_b);   //实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_HALF_UP);   //加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //是否共享会员优惠叠加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                String vipDiscountyPlus = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(vipDiscountyPlus.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    isAddDiscount ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //如果当前应收金额大于条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList_2.get(0).get("discountAmt").toString());   //条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList_2.get(0).get("gasoilDiscountAmt").toString());   //满多少优惠多少的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountAmt = gasoilDiscountAmt_b;  //优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            amt = receivableAmt_b.subtract(gasoilDiscountAmt_b);   //实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_HALF_UP);   //加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            switch (vipDiscountyPlus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     amt = amt.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //不满足优惠条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            switch (vipDiscountyPlus) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    amt = amt.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountAmt", discountAmt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("amt", amt.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("oilLiters", oilLiters.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    resultMap.put("discountPrice", discountPrice.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(flag && isAddDiscount.equals("1")){   //用户加油金额不符合优惠条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("oilLiters", map.get("oilLiters").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            resultMap.put("discountPrice", map.get("discountPrice").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //没有优惠规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //用户没有设置优惠规则时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -636,7 +670,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     List<Map> customerMarkertPlanList_3 = customerGradeServices.getCustomerMarkertPlanList(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(customerMarkertPlanList_3 !=null && customerMarkertPlanList_3.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         boolean flag= true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String isAddDiscount="0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //独立直降时会存在多条 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         for(Map m : customerMarkertPlanList_3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -649,9 +683,8 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     amt = receivableAmt_b.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     //是否共享会员优惠叠加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    String vipDiscountyPlus = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    if(vipDiscountyPlus.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        isAddDiscount ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    String vipDiscountyPlus_3 = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if(vipDiscountyPlus_3.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         amt = amt.subtract(discountAmt); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -671,9 +704,8 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     amt = receivableAmt_b.subtract(discountAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);        //优惠价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     //是否共享会员优惠叠加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    String vipDiscountyPlus = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    if(vipDiscountyPlus.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        isAddDiscount ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    String vipDiscountyPlus_3 = m.get("vipDiscountyPlus").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if(vipDiscountyPlus_3.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         discountAmt = discountAmt.add(new BigDecimal(map.get("discountAmt").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         amt = amt.subtract(discountAmt); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -688,7 +720,8 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(flag && isAddDiscount.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //如果用户加油金额都不符合优惠门槛则计算等级的优惠 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -696,7 +729,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             resultMap.put("discountPrice", map.get("discountPrice").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //没有优惠规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //用户没有设置优惠规则时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Map<String, Object> map = this.calcuteDengJiZhiJiang(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("discountAmt", map.get("discountAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         resultMap.put("amt", map.get("amt").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -710,7 +743,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //计算等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Map<String, Object> calcuteDengJiZhiJiang(Map params){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public  Map<String, Object> calcuteDengJiZhiJiang(Map params){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Double receivableAmt = Double.valueOf(params.get("receivableAmt").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> resultMap = new HashMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal oilLiters = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -818,3 +851,4 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return gson.toJson(resultData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 |