| 
					
				 | 
			
			
				@@ -503,272 +503,272 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 计算消费生成积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void calculateIntegralAndPushIntegral(CalculateIntegral calculateIntegral, CustomerManage customerManage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int integral =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //获取该油站的优惠方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String discountPlanType = stationService.getStationDiscountWay(calculateIntegral.getStationId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        IntegralRule integralRule = new IntegralRule(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        integralRule.setStationId(calculateIntegral.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        integralRule.setEmptyDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        integralRule.setOilName(calculateIntegral.getOilName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        integralRule.setOilType(calculateIntegral.getOilType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //获取该油站的积分规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<IntegralRule> integralRuleList = integralRuleService.getIntegralRule(integralRule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(integralRuleList !=null && integralRuleList.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<IntegralRuleDetail> integralRuleDetailList = integralRuleList.get(0).getIntegralRuleDetailList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String currentTime = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String datePickerTime=null;         //活动时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String[] datePickerTimeArray ={}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String integralActivity = integralRuleList.get(0).getIntegralActivity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String integralProportion =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(integralActivity.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                datePickerTime = integralRuleList.get(0).getDatePickerTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                integralProportion = integralRuleList.get(0).getIntegralProportion(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(datePickerTime.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    datePickerTimeArray = datePickerTime.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    datePickerTimeArray= new String[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    datePickerTimeArray[0] = datePickerTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(integralRuleDetailList !=null && integralRuleDetailList.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Calendar calendar = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                calendar.setTime(new Date());   //获取当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (IntegralRuleDetail integralRuleDetail : integralRuleDetailList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(integralRuleDetail.getOilType().equals("1")){    //油品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (integralRuleDetail.getRuleType().equals("1")){  //按照实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 1 || calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                integral =multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        }else if (integralRuleDetail.getRuleType().equals("2")){    //按应收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                integral = multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        }else if (integralRuleDetail.getRuleType().equals("3")){    //按照加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                integral =multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }else if (integralRuleDetail.getOilType().equals("2")){     //非油品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            integral = multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            calculateIntegral.setIntegral(integral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.pushIntegral(calculateIntegral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 公众号推送积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param stationId 油站ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param integral  本次所得积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param openId    小程序用户openID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void pushIntegral(CalculateIntegral calculateIntegral){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Integer stationId = calculateIntegral.getStationId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int integral = calculateIntegral.getIntegral(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String openId = calculateIntegral.getOpenId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String unionId = calculateIntegral.getUnionId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String gzhAppId =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String gzhAppSecret =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String stationName = "";        //油站名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BigDecimal surplusIntegral=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String customerName =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(StringUtils.isNotBlank(openId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, String> m = stationService.getStationAppIdAndAppSecret(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                stationName = m.get("stationName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                gzhAppId = m.get("gzhAppId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                gzhAppSecret = m.get("gzhAppSecret"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CustomerPoints customerPoints = new CustomerPoints(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerPoints.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerPoints.setMinaOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerPoints.setUnionId(unionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByUnionId(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(customerPointsInfo !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerName =customerPointsInfo.getCustomerName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                surplusIntegral =new BigDecimal(customerPointsInfo.getPoints()).add(new BigDecimal(integral)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                CustomerPointsRecord customerPointsRecord = new CustomerPointsRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setCustomerName(customerName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setStationName(stationName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setRecordType("+"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setUnionId(customerPointsInfo.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecord.setIntegral(integral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsRecordService.insertCustomerPointsRecordInfo(customerPointsRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPoints.setUnionId(customerPointsInfo.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPoints.setPoints(surplusIntegral.intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //更新客户积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                customerPointsService.updateCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String blogOpenId = customerPointsInfo.getBlogOpenId();     //公众号openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(blogOpenId !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //推送模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<WxMpTemplateData> wxMpTemplate = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+customerName+",您好:\n" + "您在"+stationName+"的积分最新交易信息如下")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("time", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("type", "增加")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("Point", String.valueOf(integral))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("From", stationName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    wxMpTemplate.add(new WxMpTemplateData("remark", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            "截止至" + new SimpleDateFormat(" yyyy年MM月dd日HH时mm分").format(new Date())+",您在"+stationName+"的可用积分为 "+surplusIntegral.toString()+" 分")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    gzhNewsTemplate.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    gzhNewsTemplate.setTemplateType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    GzhNewsTemplate gzhNewsTemplateInfo = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(gzhNewsTemplateInfo !=null && gzhNewsTemplateInfo.getTemplateId() !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        wxPushUtil.push(gzhAppId, gzhAppSecret, gzhNewsTemplateInfo.getTemplateId(), blogOpenId, wxMpTemplate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    public void calculateIntegralAndPushIntegral(CalculateIntegral calculateIntegral, CustomerManage customerManage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        int integral =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        //获取该油站的优惠方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String discountPlanType = stationService.getStationDiscountWay(calculateIntegral.getStationId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        IntegralRule integralRule = new IntegralRule(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        integralRule.setStationId(calculateIntegral.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        integralRule.setEmptyDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        integralRule.setOilName(calculateIntegral.getOilName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        integralRule.setOilType(calculateIntegral.getOilType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        //获取该油站的积分规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        List<IntegralRule> integralRuleList = integralRuleService.getIntegralRule(integralRule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        if(integralRuleList !=null && integralRuleList.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            List<IntegralRuleDetail> integralRuleDetailList = integralRuleList.get(0).getIntegralRuleDetailList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            String currentTime = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            String datePickerTime=null;         //活动时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            String[] datePickerTimeArray ={}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            String integralActivity = integralRuleList.get(0).getIntegralActivity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            String integralProportion =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            if(integralActivity.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                datePickerTime = integralRuleList.get(0).getDatePickerTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                integralProportion = integralRuleList.get(0).getIntegralProportion(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                if(datePickerTime.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    datePickerTimeArray = datePickerTime.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    datePickerTimeArray= new String[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    datePickerTimeArray[0] = datePickerTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            if(integralRuleDetailList !=null && integralRuleDetailList.size() >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                Calendar calendar = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                calendar.setTime(new Date());   //获取当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                for (IntegralRuleDetail integralRuleDetail : integralRuleDetailList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if(integralRuleDetail.getOilType().equals("1")){    //油品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        if (integralRuleDetail.getRuleType().equals("1")){  //按照实收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if(calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 1 || calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                integral =multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        }else if (integralRuleDetail.getRuleType().equals("2")){    //按应收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if(calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                integral = multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        }else if (integralRuleDetail.getRuleType().equals("3")){    //按照加油升数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if(calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                integral =multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    }else if (integralRuleDetail.getOilType().equals("2")){     //非油品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        if (calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            BigDecimal divide = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            BigDecimal multiply = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            //判断油站配置的优惠类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                multiply = divide.multiply(integralRuleDetail.getIntegral()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if(integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                String datePicker = integralRuleList.get(0).getDatePicker(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                switch (datePicker){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    case "1":   //  1.按周来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        int day_Week = calendar.get(Calendar.DAY_OF_WEEK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        currentTime = String.valueOf(day_Week); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    case "2":   //  2.每月的多少号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        int day_month = calendar.get(Calendar.DAY_OF_MONTH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        day_month = day_month-1;        //减一原因:数据库存的下标从零开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        currentTime = String.valueOf(day_month); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    case "3":   //  3.固定日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                for (String s : datePickerTimeArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    if(s.equals(currentTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        multiply = multiply.multiply(new BigDecimal(integralProportion)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            integral = multiply.intValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            calculateIntegral.setIntegral(integral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            this.pushIntegral(calculateIntegral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     * 公众号推送积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     * @param stationId 油站ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     * @param integral  本次所得积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     * @param openId    小程序用户openID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    public void pushIntegral(CalculateIntegral calculateIntegral){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        Integer stationId = calculateIntegral.getStationId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        int integral = calculateIntegral.getIntegral(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String openId = calculateIntegral.getOpenId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String unionId = calculateIntegral.getUnionId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String gzhAppId =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String gzhAppSecret =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String stationName = "";        //油站名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        BigDecimal surplusIntegral=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String customerName =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        if(StringUtils.isNotBlank(openId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            Map<String, String> m = stationService.getStationAppIdAndAppSecret(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                stationName = m.get("stationName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                gzhAppId = m.get("gzhAppId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                gzhAppSecret = m.get("gzhAppSecret"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            CustomerPoints customerPoints = new CustomerPoints(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            customerPoints.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            customerPoints.setMinaOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            customerPoints.setUnionId(unionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByUnionId(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            if(customerPointsInfo !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerName =customerPointsInfo.getCustomerName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                surplusIntegral =new BigDecimal(customerPointsInfo.getPoints()).add(new BigDecimal(integral)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                CustomerPointsRecord customerPointsRecord = new CustomerPointsRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setCustomerName(customerName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setStationName(stationName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setRecordType("+"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setUnionId(customerPointsInfo.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecord.setIntegral(integral); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsRecordService.insertCustomerPointsRecordInfo(customerPointsRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPoints.setUnionId(customerPointsInfo.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPoints.setPoints(surplusIntegral.intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                //更新客户积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                customerPointsService.updateCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                String blogOpenId = customerPointsInfo.getBlogOpenId();     //公众号openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                if(blogOpenId !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    //推送模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    List<WxMpTemplateData> wxMpTemplate = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+customerName+",您好:\n" + "您在"+stationName+"的积分最新交易信息如下")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("time", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("type", "增加")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("Point", String.valueOf(integral))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("From", stationName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    wxMpTemplate.add(new WxMpTemplateData("remark", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            "截止至" + new SimpleDateFormat(" yyyy年MM月dd日HH时mm分").format(new Date())+",您在"+stationName+"的可用积分为 "+surplusIntegral.toString()+" 分")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    gzhNewsTemplate.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    gzhNewsTemplate.setTemplateType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    GzhNewsTemplate gzhNewsTemplateInfo = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if(gzhNewsTemplateInfo !=null && gzhNewsTemplateInfo.getTemplateId() !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        wxPushUtil.push(gzhAppId, gzhAppSecret, gzhNewsTemplateInfo.getTemplateId(), blogOpenId, wxMpTemplate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 根据订单号获取订单信息 
			 |