|
@@ -169,12 +169,10 @@ public class PayOrderController {
|
|
|
}
|
|
|
resultMap.put("cardEnabledFlag", payOrderResultInfo.getCardEnabledFlag());
|
|
|
resultMap.put("oilsCardFlag", payOrderResultInfo.getOilsCardFlag());
|
|
|
- resultMap.put("discountAmt", payOrderResultInfo.getDiscountAmt()); //优惠价格
|
|
|
+ resultMap.put("discountAmt", payOrderResultInfo.getDiscountAmt()); //优惠金额
|
|
|
resultMap.put("amt", payOrderResultInfo.getAmt()); //实收价格
|
|
|
if(payOrderRequest.getIsLngFlagGroup() !=null && payOrderRequest.getIsLngFlagGroup().equals("1")){
|
|
|
- payOrder.setDriverAmt(Double.valueOf(payOrderResultInfo.getDriverAmt()));
|
|
|
- //此处amt赋值司机价支付金额原因:前端使用amt作为实际支付金额,返给前端司机价实收金额
|
|
|
- resultMap.put("amt", payOrderResultInfo.getDriverAmt());
|
|
|
+ payOrder.setSellAmt(Double.valueOf(payOrderResultInfo.getSellAmt()));
|
|
|
}
|
|
|
resultMap.put("receivableAmt", payOrderResultInfo.getReceivableAmt()); //应收价格
|
|
|
resultMap.put("oilLiters", payOrderResultInfo.getOilLiters());
|
|
@@ -296,12 +294,12 @@ public class PayOrderController {
|
|
|
BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString()); //应收金额
|
|
|
BigDecimal oilLiters = new BigDecimal("0.00"); //加油升数
|
|
|
BigDecimal discountAmt = new BigDecimal(0); //油站销售价后优惠金额
|
|
|
- BigDecimal driverDiscountAmt = new BigDecimal(0); //油站司机价后优惠金额
|
|
|
+ BigDecimal sellDiscountAmt = new BigDecimal(0); //油站销售价后优惠金额
|
|
|
BigDecimal dzkDiscountAmt = new BigDecimal(0); //电子卡优惠金额
|
|
|
- BigDecimal amt = new BigDecimal(0); //油站结算价支付金额
|
|
|
- BigDecimal driverAmt = new BigDecimal(0); //司机价后支付金额
|
|
|
- BigDecimal discountPrice = oilPrice; //油站销售价
|
|
|
- BigDecimal driverPrice = discountPrice; //司机销售价
|
|
|
+ BigDecimal amt = new BigDecimal(0); //司机价后支付金额
|
|
|
+ BigDecimal sellAmt = new BigDecimal(0); //油站结算价支付金额
|
|
|
+ BigDecimal discountPrice = oilPrice; //司机销售价
|
|
|
+ BigDecimal sellPrice = discountPrice; //油站销售价
|
|
|
//加油升数
|
|
|
oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
|
|
|
if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
|
|
@@ -311,18 +309,20 @@ public class PayOrderController {
|
|
|
String settlementType = params.get("settlementType").toString();
|
|
|
if(params.containsKey("settlementType") && params.get("settlementType") !=null && params.get("settlementType").toString() !=""){
|
|
|
switch (settlementType){
|
|
|
- case "1":
|
|
|
+ case "1": //直降
|
|
|
//优惠价(销售价)
|
|
|
if(params.containsKey("settlementPrice") && params.get("settlementPrice").toString() !=null && params.get("settlementPrice").toString() !=""){
|
|
|
discountPrice = oilPrice.subtract(new BigDecimal(params.get("settlementPrice").toString()));
|
|
|
discountAmt = discountPrice.multiply(oilLiters);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
break;
|
|
|
- case "2":
|
|
|
+ case "2": //折扣
|
|
|
//优惠价(销售价)
|
|
|
if(params.containsKey("settlementPrice") && params.get("settlementPrice").toString() !=null && params.get("settlementPrice").toString() !=""){
|
|
|
discountPrice = oilPrice.multiply(new BigDecimal(params.get("settlementPrice").toString()));
|
|
|
discountAmt = discountPrice.multiply(oilLiters);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -330,31 +330,35 @@ public class PayOrderController {
|
|
|
|
|
|
if(params.containsKey("driverPrice") && params.get("driverPrice").toString() !=null && params.get("driverPrice").toString() !=""){
|
|
|
//司机价
|
|
|
- driverPrice = discountPrice.multiply(new BigDecimal(params.get("driverPrice").toString()));
|
|
|
- driverDiscountAmt = driverPrice.multiply(oilLiters);
|
|
|
+ sellPrice = discountPrice.multiply(new BigDecimal(params.get("driverPrice").toString()));
|
|
|
+ sellDiscountAmt = sellPrice.multiply(oilLiters);
|
|
|
+ sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
- driverAmt = receivableAmt.subtract(driverDiscountAmt); //司机价实收金额
|
|
|
- driverAmt =driverAmt.signum() == -1 ? new BigDecimal("0.01"): driverAmt;
|
|
|
+ sellAmt = receivableAmt.subtract(sellDiscountAmt); //司机价实收金额
|
|
|
+ sellAmt =sellAmt.signum() == -1 ? new BigDecimal("0.01"): sellAmt;
|
|
|
amt = receivableAmt.subtract(discountAmt); //销售价实收金额
|
|
|
amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
//销售价
|
|
|
discountPrice = oilLiters.equals(new BigDecimal("0.00")) ? discountPrice : amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
//司机价
|
|
|
- driverPrice = oilLiters.equals(new BigDecimal("0.00")) ? driverPrice : driverAmt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sellPrice = oilLiters.equals(new BigDecimal("0.00")) ? sellPrice : sellAmt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
payOrderResultInfo.setReceivableAmt(receivableAmt.toString()); //应收金额
|
|
|
payOrderResultInfo.setOilPrice(oilPrice.toString()); //油机价
|
|
|
payOrderResultInfo.setAmt(amt.toString()); //销售价后时候金额
|
|
|
payOrderResultInfo.setDiscountPrice(discountPrice.toString()); //销售价
|
|
|
payOrderResultInfo.setDiscountAmt(discountAmt.toString()); //销售价后优惠金额
|
|
|
|
|
|
- payOrderResultInfo.setDriverAmt(driverAmt.toString()); //司机价后支付金额
|
|
|
- payOrderResultInfo.setDriverPrice(driverPrice.toString()); //司机价
|
|
|
- payOrderResultInfo.setDriverDiscountAmt(driverDiscountAmt.toString()); //司机价后优惠金额
|
|
|
+ payOrderResultInfo.setSellAmt(sellAmt.toString()); //司机价后支付金额
|
|
|
+ payOrderResultInfo.setSellPrice(sellPrice.toString()); //司机价
|
|
|
+ payOrderResultInfo.setSellDiscountAmt(sellDiscountAmt.toString()); //司机价后优惠金额
|
|
|
|
|
|
payOrderResultInfo.setOilLiters(oilLiters.toString()); //加油升数
|
|
|
|
|
|
+ //LNG加气平台没有电子卡功能:此下参数无用用作填充参数值 0:代表否;4:代表LNG油品
|
|
|
payOrderResultInfo.setDzkAmt(amt.toString()); //电子卡支付金额
|
|
|
payOrderResultInfo.setDzkDiscountAmt(dzkDiscountAmt.toString()); //电子卡优惠金额
|
|
|
+ payOrderResultInfo.setBalance("0");
|
|
|
+ payOrderResultInfo.setCardOilsType("4");
|
|
|
|
|
|
payOrderResultInfo.setOilsCardFlag("0");
|
|
|
payOrderResultInfo.setCardEnabledFlag("0");
|
|
@@ -640,23 +644,26 @@ public class PayOrderController {
|
|
|
BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString()); //条件金额
|
|
|
BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString());
|
|
|
String discountTerm = customerMarkertPlanList.get(0).get("discountTerm").toString();
|
|
|
- String discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
+ String discountSettingFlag;
|
|
|
switch (discountTerm){
|
|
|
case "1": //按加油升数
|
|
|
if(oilLiters.compareTo(discountAmt_b) ==1 || oilLiters.compareTo(discountAmt_b) ==0){
|
|
|
discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
//会员活动是否开启:1是;0否'
|
|
|
- if(discountSettingFlag !=null && discountSettingFlag.equals("1")){
|
|
|
- String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
- String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
- String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
- if(StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)){
|
|
|
- //当前时间是否是活动会员日
|
|
|
- boolean b = isActivityDay(discountType, discountDate);
|
|
|
- if(b){
|
|
|
- discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if(customerMarkertPlanList.get(0).containsKey("discountSettingFlag") && customerMarkertPlanList.get(0).get("discountSettingFlag").toString() !="") {
|
|
|
+ discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
+ if (discountSettingFlag != null && discountSettingFlag.equals("1")) {
|
|
|
+ String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
+ String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
+ String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
+ if (StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)) {
|
|
|
+ //当前时间是否是活动会员日
|
|
|
+ boolean b = isActivityDay(discountType, discountDate);
|
|
|
+ if (b) {
|
|
|
+ discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -667,18 +674,21 @@ public class PayOrderController {
|
|
|
discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
//会员活动是否开启:1是;0否'
|
|
|
- if(discountSettingFlag !=null && discountSettingFlag.equals("1")){
|
|
|
- String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
- String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
- String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
- if(StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)){
|
|
|
- //当前时间是否是活动会员日
|
|
|
- boolean b = isActivityDay(discountType, discountDate);
|
|
|
- if(b){
|
|
|
- discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }
|
|
|
+ if(customerMarkertPlanList.get(0).containsKey("discountSettingFlag") && customerMarkertPlanList.get(0).get("discountSettingFlag").toString() !="") {
|
|
|
+ discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
+ if (discountSettingFlag != null && discountSettingFlag.equals("1")) {
|
|
|
+ String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
+ String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
+ String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
+ if (StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)) {
|
|
|
+ //当前时间是否是活动会员日
|
|
|
+ boolean b = isActivityDay(discountType, discountDate);
|
|
|
+ if (b) {
|
|
|
+ discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -805,16 +815,18 @@ public class PayOrderController {
|
|
|
if(receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0){
|
|
|
discountAmt = gasoilDiscountAmt_b;
|
|
|
//会员活动是否开启:1是;0否'
|
|
|
- String discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
- if(discountSettingFlag !=null && discountSettingFlag.equals("1")){
|
|
|
- String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
- String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
- String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
- if(StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)){
|
|
|
- //当前时间是否是会员日
|
|
|
- boolean b = isActivityDay(discountType, discountDate);
|
|
|
- if(b){
|
|
|
- discountAmt = new BigDecimal(discountActivityAmt);
|
|
|
+ if(customerMarkertPlanList.get(0).containsKey("discountSettingFlag") && customerMarkertPlanList.get(0).get("discountSettingFlag").toString() !="") {
|
|
|
+ String discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
+ if (discountSettingFlag != null && discountSettingFlag.equals("1")) {
|
|
|
+ String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
+ String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
+ String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
+ if (StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)) {
|
|
|
+ //当前时间是否是会员日
|
|
|
+ boolean b = isActivityDay(discountType, discountDate);
|
|
|
+ if (b) {
|
|
|
+ discountAmt = new BigDecimal(discountActivityAmt);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -937,20 +949,22 @@ public class PayOrderController {
|
|
|
discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b); //优惠金额
|
|
|
discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
//会员活动是否开启:1是;0否'
|
|
|
- String discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
- if(discountSettingFlag !=null && discountSettingFlag.equals("1")){
|
|
|
- String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
- String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
- String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
- //当前时间是否是会员日
|
|
|
- if(StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)){
|
|
|
- boolean b = isActivityDay(discountType, discountDate);
|
|
|
- if(b){
|
|
|
- discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(discountActivityAmt)); //优惠金额
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if(customerMarkertPlanList.get(0).containsKey("discountSettingFlag") && customerMarkertPlanList.get(0).get("discountSettingFlag").toString() !=""){
|
|
|
+ String discountSettingFlag = customerMarkertPlanList.get(0).get("discountSettingFlag").toString();
|
|
|
+ if(discountSettingFlag !=null && discountSettingFlag.equals("1")){
|
|
|
+ String discountType = customerMarkertPlanList.get(0).get("discountType").toString(); //会员日周期类型设置
|
|
|
+ String discountDate = customerMarkertPlanList.get(0).get("discountDate").toString(); //按固定日期
|
|
|
+ String discountActivityAmt = customerMarkertPlanList.get(0).get("discountActivityAmt").toString(); //会员日优惠金额
|
|
|
+ //当前时间是否是会员日
|
|
|
+ if(StringUtils.isNotBlank(discountType) && StringUtils.isNotBlank(discountDate) && StringUtils.isNotBlank(discountActivityAmt)){
|
|
|
+ boolean b = isActivityDay(discountType, discountDate);
|
|
|
+ if(b){
|
|
|
+ discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(discountActivityAmt)); //优惠金额
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
dzkDiscountAmt = discountAmt;
|