|
@@ -239,6 +239,7 @@ public class PayOrderController {
|
|
|
CustomerLabel customerLabelInfo = labelService.getCustomerLabel(customerLabel);
|
|
|
if(payOrderRequest.getLabelFlag() !=null && payOrderRequest.getLabelFlag().equals("1") && customerLabelInfo !=null){
|
|
|
//表示此用户为标签用户,计算标签用户优惠
|
|
|
+ params.put("labelId", customerLabelInfo.getLabelId());
|
|
|
payOrderResultInfo = this.calculateLabelDiscount(params);
|
|
|
}else {
|
|
|
//不为标签用户时
|
|
@@ -280,23 +281,24 @@ public class PayOrderController {
|
|
|
LabelRule labelRule = new LabelRule();
|
|
|
labelRule.setStationId(Integer.valueOf(params.get("stationId").toString())); //油站ID
|
|
|
labelRule.setOilName(params.get("oilName").toString()); //oilName
|
|
|
+ labelRule.setLabelId(Integer.valueOf(params.get("labelId").toString()));//
|
|
|
List<LabelRule> labelRuleList = labelService.getLabelRuleList(labelRule);
|
|
|
if(labelRuleList !=null && labelRuleList.size()> 0){
|
|
|
//获取该油品的优惠明细
|
|
|
List<LabelRuleDetail> labelRuleDetailList = labelRuleList.get(0).getLabelRuleDetailList();
|
|
|
if(labelRuleDetailList !=null && labelRuleDetailList.size() ==1){
|
|
|
- BigDecimal discountLitersAmt = new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt());
|
|
|
+ BigDecimal discountAmt_B = new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()); //满足享受优惠条件(满多少升、满多少元)
|
|
|
String discountTerm = labelRuleDetailList.get(0).getDiscountTerm();
|
|
|
switch (discountTerm){
|
|
|
case "1": //按加油升数
|
|
|
- if(oilLiters.compareTo(discountLitersAmt) ==1 || oilLiters.compareTo(discountLitersAmt) ==0 ){
|
|
|
- discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()));
|
|
|
+ if(oilLiters.compareTo(discountAmt_B) ==1 || oilLiters.compareTo(discountAmt_B) ==0 ){
|
|
|
+ discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
|
|
|
discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
break;
|
|
|
case "2": //按加油金额
|
|
|
- if(receivableAmt.compareTo(discountLitersAmt) ==1 || receivableAmt.compareTo(discountLitersAmt) ==0 ){
|
|
|
- discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()));
|
|
|
+ if(receivableAmt.compareTo(discountAmt_B) ==1 || receivableAmt.compareTo(discountAmt_B) ==0 ){
|
|
|
+ discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
|
|
|
discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
break;
|