|
@@ -2202,385 +2202,386 @@ public class PayOrderController {
|
|
|
StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
|
|
|
Map<String ,Object> resultMap = new HashMap<>(); //返回结果集
|
|
|
if(stationInfos !=null) {
|
|
|
- payOrder.setStationName(stationInfos.getStationName());
|
|
|
- //获取油站图片和名称
|
|
|
- resultMap.put("stationPic", stationInfos.getStationPic());
|
|
|
- resultMap.put("stationName", stationInfos.getStationName());
|
|
|
- payOrder.setConsumer(payOrderRequest.getCustomerName()); //昵称
|
|
|
- payOrder.setConsumerId(1); //用户id
|
|
|
- Random random = new Random();
|
|
|
- String result = "";
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- result += random.nextInt(10);
|
|
|
- }
|
|
|
- String ordNo = System.nanoTime() + result;
|
|
|
- payOrder.setOrderNo(ordNo); //订单号
|
|
|
- logger.info("生成的订单号:" + ordNo);
|
|
|
-
|
|
|
- payOrder.setDiscountCouponAmt(payOrderRequest.getDiscountCouponAmt()); //优惠劵金额
|
|
|
- payOrder.setDiscountCoupon(payOrderRequest.getDiscountCoupon()); //优惠券
|
|
|
- payOrder.setCarNo(payOrderRequest.getCarNo()); //车牌号、
|
|
|
- payOrder.setCustomerGrade(payOrderRequest.getCustomerGrade()); //客户电话
|
|
|
- payOrder.setMemberNo(payOrderRequest.getMemberNo()); //会员卡号
|
|
|
- payOrder.setMemberAmt(payOrderRequest.getMemberAmt()); //会员支付金额
|
|
|
- payOrder.setScore(payOrderRequest.getScore()); //积分
|
|
|
- payOrder.setStationId(payOrderRequest.getStationId()); //油站id
|
|
|
- payOrder.setStatus("0"); //创建订单 未支付状态 0
|
|
|
- payOrder.setCreatedDate(new Timestamp(new Date().getTime())); //创建时间
|
|
|
- payOrder.setOrderType(payOrderRequest.getOrderType()); //订单类型
|
|
|
- payOrder.setOilGun(payOrderRequest.getOilGun()); //油枪号
|
|
|
- payOrder.setReceivableAmt(Double.valueOf(payOrderRequest.getReceivableAmt())); //订单应收金额
|
|
|
- String oilName = payOrderRequest.getOilName();
|
|
|
- //获取该油品所属哪一类
|
|
|
- Oil oil = new Oil();
|
|
|
- oil.setOilName(oilName);
|
|
|
- oil.setDictType("oil_name");
|
|
|
- Oil oilInfo = sysDictDataService.selectOilType(oil);
|
|
|
- payOrder.setOilType(oilInfo.getOilsType()); //油品类型
|
|
|
- resultMap.put("cardOilsType", oilInfo.getOilsType());
|
|
|
- String oilsType = oilInfo.getOilsType(); //获取订单类型
|
|
|
- logger.info("订单油品类型:" + oilsType);
|
|
|
- if(oilsType.equals("3")) { //订单类型是油品时计算
|
|
|
- payOrder.setOrderType("2");
|
|
|
- }else {
|
|
|
- payOrder.setOrderType("1");
|
|
|
- }
|
|
|
- payOrder.setOilName(oilName); //油品名称
|
|
|
- payOrder.setAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));
|
|
|
- payOrder.setDiscountAmt(Double.valueOf("0.00"));
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("oilName", oilName);
|
|
|
- map.put("stationId", payOrderRequest.getStationId());
|
|
|
- //获取油站油品价格 优惠方案 是否开启电子卡
|
|
|
- Map<String, Object> resultOilPrice = stationService.selectStationOilPriceAndDiscountSetting(map);
|
|
|
- BigDecimal oilPrice = new BigDecimal(resultOilPrice.get("oilPrice").toString()); //油站油品价格
|
|
|
- payOrder.setOilPirce(resultOilPrice.get("oilPrice").toString());
|
|
|
- BigDecimal orderLiters = new BigDecimal(payOrderRequest.getReceivableAmt()).divide(oilPrice, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
- payOrder.setOrderLiters(orderLiters.toString());
|
|
|
- if(stationInfos.getIsLngFlagGroup() !=null && stationInfos.getIsLngFlagGroup().equals("1")){
|
|
|
- //如果是加气站
|
|
|
- payOrder.setSellAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));
|
|
|
- payOrder.setSellDiscountAmt(Double.valueOf("0.00"));
|
|
|
- payOrder.setSellOilPrice(Double.valueOf(resultOilPrice.get("oilPrice").toString()));
|
|
|
- payOrder.setDriverDiscountAmt(Double.valueOf("0.00"));
|
|
|
- payOrder.setDriverOilPrice(Double.valueOf(resultOilPrice.get("oilPrice").toString()));
|
|
|
- resultMap.put("driverDiscountAmt", "0.00");
|
|
|
- resultMap.put("sellDiscountAmt", "0.00");
|
|
|
- }
|
|
|
- resultMap.put("discountAmt", "0.00"); //优惠价格
|
|
|
- resultMap.put("amt", payOrderRequest.getReceivableAmt()); //实收价格
|
|
|
- resultMap.put("receivableAmt", payOrderRequest.getReceivableAmt()); //应收价格
|
|
|
- resultMap.put("oilLiters", orderLiters.toString());
|
|
|
- resultMap.put("discountPrice", oilPrice);
|
|
|
-
|
|
|
- BigDecimal discountPrice = oilPrice;
|
|
|
- BigDecimal amt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
- BigDecimal discountAmt = new BigDecimal("0.00");
|
|
|
- BigDecimal receivableAmt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
-
|
|
|
- //表示支付宝支付只走满减
|
|
|
- if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("1")){
|
|
|
- Map<String ,Object> params = new HashMap<>();
|
|
|
- params.put("discountPlanType", "1");
|
|
|
- params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
- params.put("oilName", oilName);
|
|
|
- List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
- if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0) {
|
|
|
- BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString()); //条件金额
|
|
|
- BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString()); //享受的优惠
|
|
|
- if (receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0) {
|
|
|
- discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b); //优惠金额
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- //会员活动是否开启:1是;0否'
|
|
|
- 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);
|
|
|
+ if(stationInfos.getIsAliPayFlag() !=null && stationInfos.getIsAliPayFlag().equals("1")){
|
|
|
+ payOrder.setStationName(stationInfos.getStationName());
|
|
|
+ //获取油站图片和名称
|
|
|
+ resultMap.put("stationPic", stationInfos.getStationPic());
|
|
|
+ resultMap.put("stationName", stationInfos.getStationName());
|
|
|
+ payOrder.setConsumer(payOrderRequest.getCustomerName()); //昵称
|
|
|
+ payOrder.setConsumerId(1); //用户id
|
|
|
+ Random random = new Random();
|
|
|
+ String result = "";
|
|
|
+ for (int i = 0; i < 6; i++) {
|
|
|
+ result += random.nextInt(10);
|
|
|
+ }
|
|
|
+ String ordNo = System.nanoTime() + result;
|
|
|
+ payOrder.setOrderNo(ordNo); //订单号
|
|
|
+ logger.info("生成的订单号:" + ordNo);
|
|
|
+
|
|
|
+ payOrder.setDiscountCouponAmt(payOrderRequest.getDiscountCouponAmt()); //优惠劵金额
|
|
|
+ payOrder.setDiscountCoupon(payOrderRequest.getDiscountCoupon()); //优惠券
|
|
|
+ payOrder.setCarNo(payOrderRequest.getCarNo()); //车牌号、
|
|
|
+ payOrder.setCustomerGrade(payOrderRequest.getCustomerGrade()); //客户电话
|
|
|
+ payOrder.setMemberNo(payOrderRequest.getMemberNo()); //会员卡号
|
|
|
+ payOrder.setMemberAmt(payOrderRequest.getMemberAmt()); //会员支付金额
|
|
|
+ payOrder.setScore(payOrderRequest.getScore()); //积分
|
|
|
+ payOrder.setStationId(payOrderRequest.getStationId()); //油站id
|
|
|
+ payOrder.setStatus("0"); //创建订单 未支付状态 0
|
|
|
+ payOrder.setCreatedDate(new Timestamp(new Date().getTime())); //创建时间
|
|
|
+ payOrder.setOrderType(payOrderRequest.getOrderType()); //订单类型
|
|
|
+ payOrder.setOilGun(payOrderRequest.getOilGun()); //油枪号
|
|
|
+ payOrder.setReceivableAmt(Double.valueOf(payOrderRequest.getReceivableAmt())); //订单应收金额
|
|
|
+ String oilName = payOrderRequest.getOilName();
|
|
|
+ //获取该油品所属哪一类
|
|
|
+ Oil oil = new Oil();
|
|
|
+ oil.setOilName(oilName);
|
|
|
+ oil.setDictType("oil_name");
|
|
|
+ Oil oilInfo = sysDictDataService.selectOilType(oil);
|
|
|
+ payOrder.setOilType(oilInfo.getOilsType()); //油品类型
|
|
|
+ resultMap.put("cardOilsType", oilInfo.getOilsType());
|
|
|
+ String oilsType = oilInfo.getOilsType(); //获取订单类型
|
|
|
+ logger.info("订单油品类型:" + oilsType);
|
|
|
+ if(oilsType.equals("3")) { //订单类型是油品时计算
|
|
|
+ payOrder.setOrderType("2");
|
|
|
+ }else {
|
|
|
+ payOrder.setOrderType("1");
|
|
|
+ }
|
|
|
+ payOrder.setOilName(oilName); //油品名称
|
|
|
+ payOrder.setAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf("0.00"));
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("oilName", oilName);
|
|
|
+ map.put("stationId", payOrderRequest.getStationId());
|
|
|
+ //获取油站油品价格 优惠方案 是否开启电子卡
|
|
|
+ Map<String, Object> resultOilPrice = stationService.selectStationOilPriceAndDiscountSetting(map);
|
|
|
+ BigDecimal oilPrice = new BigDecimal(resultOilPrice.get("oilPrice").toString()); //油站油品价格
|
|
|
+ payOrder.setOilPirce(resultOilPrice.get("oilPrice").toString());
|
|
|
+ BigDecimal orderLiters = new BigDecimal(payOrderRequest.getReceivableAmt()).divide(oilPrice, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ payOrder.setOrderLiters(orderLiters.toString());
|
|
|
+ if(stationInfos.getIsLngFlagGroup() !=null && stationInfos.getIsLngFlagGroup().equals("1")){
|
|
|
+ //如果是加气站
|
|
|
+ payOrder.setSellAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));
|
|
|
+ payOrder.setSellDiscountAmt(Double.valueOf("0.00"));
|
|
|
+ payOrder.setSellOilPrice(Double.valueOf(resultOilPrice.get("oilPrice").toString()));
|
|
|
+ payOrder.setDriverDiscountAmt(Double.valueOf("0.00"));
|
|
|
+ payOrder.setDriverOilPrice(Double.valueOf(resultOilPrice.get("oilPrice").toString()));
|
|
|
+ resultMap.put("driverDiscountAmt", "0.00");
|
|
|
+ resultMap.put("sellDiscountAmt", "0.00");
|
|
|
+ }
|
|
|
+ resultMap.put("discountAmt", "0.00"); //优惠价格
|
|
|
+ resultMap.put("amt", payOrderRequest.getReceivableAmt()); //实收价格
|
|
|
+ resultMap.put("receivableAmt", payOrderRequest.getReceivableAmt()); //应收价格
|
|
|
+ resultMap.put("oilLiters", orderLiters.toString());
|
|
|
+ resultMap.put("discountPrice", oilPrice);
|
|
|
+
|
|
|
+ BigDecimal discountPrice = oilPrice;
|
|
|
+ BigDecimal amt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
+ BigDecimal discountAmt = new BigDecimal("0.00");
|
|
|
+ BigDecimal receivableAmt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
+
|
|
|
+ //表示支付宝支付只走满减
|
|
|
+ if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("1")){
|
|
|
+ Map<String ,Object> params = new HashMap<>();
|
|
|
+ params.put("discountPlanType", "1");
|
|
|
+ params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
+ params.put("oilName", oilName);
|
|
|
+ List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
+ if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0) {
|
|
|
+ BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString()); //条件金额
|
|
|
+ BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString()); //享受的优惠
|
|
|
+ if (receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0) {
|
|
|
+ discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b); //优惠金额
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ //会员活动是否开启:1是;0否'
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+ amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
+ amt = amt.toString().equals("0.00") ? new BigDecimal("0.01") : amt;
|
|
|
+ amt = amt.signum() == -1 ? new BigDecimal("0.01") : amt;
|
|
|
+ discountPrice = orderLiters.equals(new BigDecimal("0.0000")) ? discountPrice : amt.divide(orderLiters, 2, BigDecimal.ROUND_HALF_UP); //优惠价格
|
|
|
+ discountPrice = discountPrice.compareTo(oilPrice) == 1 ? oilPrice : discountPrice;
|
|
|
}
|
|
|
- amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
- amt = amt.toString().equals("0.00") ? new BigDecimal("0.01") : amt;
|
|
|
- amt = amt.signum() == -1 ? new BigDecimal("0.01") : amt;
|
|
|
- discountPrice = orderLiters.equals(new BigDecimal("0.0000")) ? discountPrice : amt.divide(orderLiters, 2, BigDecimal.ROUND_HALF_UP); //优惠价格
|
|
|
- discountPrice = discountPrice.compareTo(oilPrice) == 1 ? oilPrice : discountPrice;
|
|
|
}
|
|
|
+ payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
+ resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
+ resultMap.put("amt", amt.toString()); //实收价格
|
|
|
+ resultMap.put("discountPrice", discountPrice.toString());
|
|
|
}
|
|
|
- payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
- payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
- resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
- resultMap.put("amt", amt.toString()); //实收价格
|
|
|
- resultMap.put("discountPrice", discountPrice.toString());
|
|
|
- }
|
|
|
|
|
|
- //表示支付宝支付只走立减
|
|
|
- if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("2")){
|
|
|
- Map<String ,Object> params = new HashMap<>();
|
|
|
- params.put("discountPlanType", "2");
|
|
|
- params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
- params.put("oilName", oilName);
|
|
|
- List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
- if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
- BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString()); //条件金额
|
|
|
- BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString()); //享受的优惠
|
|
|
- if(receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0){
|
|
|
- discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b); //优惠金额
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- //会员活动是否开启:1是;0否'
|
|
|
- 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);
|
|
|
+ //表示支付宝支付只走立减
|
|
|
+ if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("2")){
|
|
|
+ Map<String ,Object> params = new HashMap<>();
|
|
|
+ params.put("discountPlanType", "2");
|
|
|
+ params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
+ params.put("oilName", oilName);
|
|
|
+ List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
+ if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
+ BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString()); //条件金额
|
|
|
+ BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString()); //享受的优惠
|
|
|
+ if(receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0){
|
|
|
+ discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b); //优惠金额
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ //会员活动是否开启:1是;0否'
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+ amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
+ amt = amt.toString().equals("0.00") ? new BigDecimal("0.01") : amt;
|
|
|
+ amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
+ discountPrice = orderLiters.equals(new BigDecimal("0.0000")) ? discountPrice : amt.divide(orderLiters, 2, BigDecimal.ROUND_HALF_UP); //优惠价格
|
|
|
+ discountPrice =discountPrice.compareTo(oilPrice) == 1 ? oilPrice : discountPrice;
|
|
|
}
|
|
|
- amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
- amt = amt.toString().equals("0.00") ? new BigDecimal("0.01") : amt;
|
|
|
- amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
- discountPrice = orderLiters.equals(new BigDecimal("0.0000")) ? discountPrice : amt.divide(orderLiters, 2, BigDecimal.ROUND_HALF_UP); //优惠价格
|
|
|
- discountPrice =discountPrice.compareTo(oilPrice) == 1 ? oilPrice : discountPrice;
|
|
|
}
|
|
|
- }
|
|
|
- payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
- payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
- resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
- resultMap.put("amt", amt.toString()); //实收价格
|
|
|
- resultMap.put("discountPrice", discountPrice.toString());
|
|
|
+ payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
+ resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
+ resultMap.put("amt", amt.toString()); //实收价格
|
|
|
+ resultMap.put("discountPrice", discountPrice.toString());
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- //表示支付宝支付只走直降
|
|
|
- if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("3")){
|
|
|
- //只有直降
|
|
|
- Map<String ,Object> params = new HashMap<>();
|
|
|
- params.put("discountPlanType", "3");
|
|
|
- params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
- params.put("oilName", oilName);
|
|
|
- List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
- if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
- 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;
|
|
|
- switch (discountTerm){
|
|
|
- case "1": //按照加油升数
|
|
|
- if(orderLiters.compareTo(discountAmt_b) == 1 || orderLiters.compareTo(discountAmt_b) ==0){
|
|
|
- discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
- if(discountPrice.compareTo(oilPrice) ==0){
|
|
|
- amt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
- discountAmt = new BigDecimal("0.00");
|
|
|
- }else {
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }
|
|
|
- //会员活动是否开启:1是;0否'
|
|
|
- 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) {
|
|
|
- discountPrice = oilPrice.subtract(new BigDecimal(discountActivityAmt));
|
|
|
- if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
- amt = amt;
|
|
|
- discountAmt = discountAmt;
|
|
|
- }else {
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- //discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ //表示支付宝支付只走直降
|
|
|
+ if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("3")){
|
|
|
+ //只有直降
|
|
|
+ Map<String ,Object> params = new HashMap<>();
|
|
|
+ params.put("discountPlanType", "3");
|
|
|
+ params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
+ params.put("oilName", oilName);
|
|
|
+ List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
+ if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
+ 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;
|
|
|
+ switch (discountTerm){
|
|
|
+ case "1": //按照加油升数
|
|
|
+ if(orderLiters.compareTo(discountAmt_b) == 1 || orderLiters.compareTo(discountAmt_b) ==0){
|
|
|
+ discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
+ if(discountPrice.compareTo(oilPrice) ==0){
|
|
|
+ amt = new BigDecimal(payOrderRequest.getReceivableAmt());
|
|
|
+ discountAmt = new BigDecimal("0.00");
|
|
|
+ }else {
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ //会员活动是否开启:1是;0否'
|
|
|
+ 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) {
|
|
|
+ discountPrice = oilPrice.subtract(new BigDecimal(discountActivityAmt));
|
|
|
+ if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
+ amt = amt;
|
|
|
+ discountAmt = discountAmt;
|
|
|
+ }else {
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ //discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- break;
|
|
|
- case "2": //按照加油金额
|
|
|
- if(receivableAmt.compareTo(discountAmt_b) ==1 || receivableAmt.compareTo(discountAmt_b) ==0){
|
|
|
- discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
- if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
- //
|
|
|
- amt = receivableAmt;
|
|
|
- discountAmt = new BigDecimal("0.00");
|
|
|
- }else {
|
|
|
- //
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }
|
|
|
+ break;
|
|
|
+ case "2": //按照加油金额
|
|
|
+ if(receivableAmt.compareTo(discountAmt_b) ==1 || receivableAmt.compareTo(discountAmt_b) ==0){
|
|
|
+ discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
+ if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
+ //
|
|
|
+ amt = receivableAmt;
|
|
|
+ discountAmt = new BigDecimal("0.00");
|
|
|
+ }else {
|
|
|
+ //
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
|
|
|
- //会员活动是否开启:1是;0否'
|
|
|
- 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) {
|
|
|
- discountPrice = oilPrice.subtract(new BigDecimal(discountActivityAmt));
|
|
|
- if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
- amt = amt;
|
|
|
- discountAmt = discountAmt;
|
|
|
- }else {
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- //discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ //会员活动是否开启:1是;0否'
|
|
|
+ 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) {
|
|
|
+ discountPrice = oilPrice.subtract(new BigDecimal(discountActivityAmt));
|
|
|
+ if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
+ amt = amt;
|
|
|
+ discountAmt = discountAmt;
|
|
|
+ }else {
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ //discountAmt = oilLiters.multiply(new BigDecimal(discountActivityAmt));
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- break;
|
|
|
}
|
|
|
|
|
|
+ amt = amt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if(amt.toString().equals("0.00")){
|
|
|
+ amt = new BigDecimal("0.01");
|
|
|
+ }
|
|
|
+ amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
+ payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
+ resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
+ resultMap.put("amt", amt.toString()); //实收价格
|
|
|
+ resultMap.put("discountPrice", discountPrice.toString());
|
|
|
}
|
|
|
|
|
|
- amt = amt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- if(amt.toString().equals("0.00")){
|
|
|
- amt = new BigDecimal("0.01");
|
|
|
- }
|
|
|
- amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
- payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
- payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
- resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
- resultMap.put("amt", amt.toString()); //实收价格
|
|
|
- resultMap.put("discountPrice", discountPrice.toString());
|
|
|
- }
|
|
|
-
|
|
|
- //表示支付宝支付只走阶梯
|
|
|
- if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("4")){
|
|
|
- Map<String ,Object> params = new HashMap<>();
|
|
|
- params.put("discountPlanType", "4");
|
|
|
- params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
- params.put("oilName", oilName);
|
|
|
- List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
- if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
- for(Map m : customerMarkertPlanList){
|
|
|
- BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString()); //条件金额
|
|
|
- BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());
|
|
|
- String discountTerm = m.get("discountTerm").toString();
|
|
|
- if(discountTerm.equals("1")){
|
|
|
- if(orderLiters.compareTo(discountAmt_b) ==1 || orderLiters.compareTo(discountAmt_b) ==0){
|
|
|
- discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
- if(discountPrice.compareTo(oilPrice) ==0){
|
|
|
- amt = receivableAmt;
|
|
|
- discountAmt = new BigDecimal("0.00");
|
|
|
- }else {
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- //discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ //表示支付宝支付只走阶梯
|
|
|
+ if(stationInfos.getDiscountSetting() !=null && stationInfos.getDiscountSetting().equals("4")){
|
|
|
+ Map<String ,Object> params = new HashMap<>();
|
|
|
+ params.put("discountPlanType", "4");
|
|
|
+ params.put("stationId", payOrderRequest.getStationId().toString());
|
|
|
+ params.put("oilName", oilName);
|
|
|
+ List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
|
|
|
+ if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
|
|
|
+ for(Map m : customerMarkertPlanList){
|
|
|
+ BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString()); //条件金额
|
|
|
+ BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());
|
|
|
+ String discountTerm = m.get("discountTerm").toString();
|
|
|
+ if(discountTerm.equals("1")){
|
|
|
+ if(orderLiters.compareTo(discountAmt_b) ==1 || orderLiters.compareTo(discountAmt_b) ==0){
|
|
|
+ discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
+ if(discountPrice.compareTo(oilPrice) ==0){
|
|
|
+ amt = receivableAmt;
|
|
|
+ discountAmt = new BigDecimal("0.00");
|
|
|
+ }else {
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ //discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
- }
|
|
|
- }else if(discountTerm.equals("2")){
|
|
|
- if(receivableAmt.compareTo(discountAmt_b) ==1 || receivableAmt.compareTo(discountAmt_b) ==0){
|
|
|
- discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
- if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
- amt = receivableAmt;
|
|
|
- discountAmt = new BigDecimal("0.00");
|
|
|
- }else {
|
|
|
- amt = discountPrice.multiply(orderLiters);
|
|
|
- discountAmt = receivableAmt.subtract(amt);
|
|
|
- //discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
- discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }else if(discountTerm.equals("2")){
|
|
|
+ if(receivableAmt.compareTo(discountAmt_b) ==1 || receivableAmt.compareTo(discountAmt_b) ==0){
|
|
|
+ discountPrice = oilPrice.subtract(gasoilDiscountAmt_b);
|
|
|
+ if(discountPrice.compareTo(oilPrice) == 0){
|
|
|
+ amt = receivableAmt;
|
|
|
+ discountAmt = new BigDecimal("0.00");
|
|
|
+ }else {
|
|
|
+ amt = discountPrice.multiply(orderLiters);
|
|
|
+ discountAmt = receivableAmt.subtract(amt);
|
|
|
+ //discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
|
|
|
+ discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
+ amt = amt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if(amt.toString().equals("0.00")){
|
|
|
+ amt = new BigDecimal("0.01");
|
|
|
+ }
|
|
|
+ amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
+ payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
+ resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
+ resultMap.put("amt", amt.toString()); //实收价格
|
|
|
+ resultMap.put("discountPrice", discountPrice.toString());
|
|
|
}
|
|
|
- //amt = receivableAmt.subtract(discountAmt); //应收金额
|
|
|
- amt = amt.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- if(amt.toString().equals("0.00")){
|
|
|
- amt = new BigDecimal("0.01");
|
|
|
- }
|
|
|
- amt =amt.signum() == -1 ? new BigDecimal("0.01"): amt;
|
|
|
- payOrder.setAmt(Double.valueOf(amt.toString()));
|
|
|
- payOrder.setDiscountAmt(Double.valueOf(discountAmt.toString()));
|
|
|
- resultMap.put("discountAmt", discountAmt.toString()); //优惠价格
|
|
|
- resultMap.put("amt", amt.toString()); //实收价格
|
|
|
- resultMap.put("discountPrice", discountPrice.toString());
|
|
|
- }
|
|
|
|
|
|
- //返回订单号
|
|
|
- resultMap.put("ordNo", ordNo);
|
|
|
-
|
|
|
- //表示为一人一码:一个加油员一个码
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("personnelId", payOrderRequest.getPersonnelId());
|
|
|
- params.put("stationId", payOrderRequest.getStationId());
|
|
|
- List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params);
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- if (list.get(0).containsKey("personnelName") && list.get(0).get("personnelName") != null && list.get(0).get("personnelName").toString() != "") {
|
|
|
- payOrder.setOilPersonnel(list.get(0).get("personnelName").toString());
|
|
|
- payOrder.setOilPersonnelId(list.get(0).get("personnelId").toString());
|
|
|
- }
|
|
|
- payOrderMapper.insertSelective(payOrder);
|
|
|
- logger.info("返回前端的结果:" +resultMap.toString());
|
|
|
- resultData = ResultData.success(resultMap);
|
|
|
- }else {
|
|
|
- //根据油站和油枪获取加油员
|
|
|
- HashMap<String, Object> params_1 = new HashMap<>();
|
|
|
- params_1.put("oliGunNo", payOrderRequest.getOilGun());
|
|
|
- params_1.put("stationId", payOrderRequest.getStationId());
|
|
|
- List<Map> mapResultList = payOrderMapper.selectPersonelName(params_1); //使用list原因:一个枪号对应多个加油员场景
|
|
|
- logger.info("加油员信息:"+ mapResultList.toString());
|
|
|
- if(mapResultList != null && mapResultList.size() == 1){
|
|
|
- String oilPersonnel = "";
|
|
|
- String oilPersonnelId ="";
|
|
|
- for (Map per : mapResultList){
|
|
|
- if(per.containsKey("personnelName") && per.get("personnelName").toString() !=null && per.get("personnelName").toString() !=""){
|
|
|
- oilPersonnel += per.get("personnelName").toString() +",";
|
|
|
- oilPersonnelId += per.get("personnelId").toString() +",";
|
|
|
- }
|
|
|
- }
|
|
|
- if(oilPersonnel !=""){
|
|
|
- payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1)); //加油员
|
|
|
- payOrder.setOilPersonnelId(oilPersonnelId.substring(0, oilPersonnelId.length()-1));
|
|
|
+ //返回订单号
|
|
|
+ resultMap.put("ordNo", ordNo);
|
|
|
+
|
|
|
+ //表示为一人一码:一个加油员一个码
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("personnelId", payOrderRequest.getPersonnelId());
|
|
|
+ params.put("stationId", payOrderRequest.getStationId());
|
|
|
+ List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ if (list.get(0).containsKey("personnelName") && list.get(0).get("personnelName") != null && list.get(0).get("personnelName").toString() != "") {
|
|
|
+ payOrder.setOilPersonnel(list.get(0).get("personnelName").toString());
|
|
|
+ payOrder.setOilPersonnelId(list.get(0).get("personnelId").toString());
|
|
|
}
|
|
|
payOrderMapper.insertSelective(payOrder);
|
|
|
logger.info("返回前端的结果:" +resultMap.toString());
|
|
|
resultData = ResultData.success(resultMap);
|
|
|
}else {
|
|
|
- resultData = ResultData.error(CodeMsg.MORE_PERSONNAL);
|
|
|
+ //根据油站和油枪获取加油员
|
|
|
+ HashMap<String, Object> params_1 = new HashMap<>();
|
|
|
+ params_1.put("oliGunNo", payOrderRequest.getOilGun());
|
|
|
+ params_1.put("stationId", payOrderRequest.getStationId());
|
|
|
+ List<Map> mapResultList = payOrderMapper.selectPersonelName(params_1); //使用list原因:一个枪号对应多个加油员场景
|
|
|
+ logger.info("加油员信息:"+ mapResultList.toString());
|
|
|
+ if(mapResultList != null && mapResultList.size() == 1){
|
|
|
+ String oilPersonnel = "";
|
|
|
+ String oilPersonnelId ="";
|
|
|
+ for (Map per : mapResultList){
|
|
|
+ if(per.containsKey("personnelName") && per.get("personnelName").toString() !=null && per.get("personnelName").toString() !=""){
|
|
|
+ oilPersonnel += per.get("personnelName").toString() +",";
|
|
|
+ oilPersonnelId += per.get("personnelId").toString() +",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(oilPersonnel !=""){
|
|
|
+ payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1)); //加油员
|
|
|
+ payOrder.setOilPersonnelId(oilPersonnelId.substring(0, oilPersonnelId.length()-1));
|
|
|
+ }
|
|
|
+ payOrderMapper.insertSelective(payOrder);
|
|
|
+ logger.info("返回前端的结果:" +resultMap.toString());
|
|
|
+ resultData = ResultData.success(resultMap);
|
|
|
+ }else {
|
|
|
+ resultData = ResultData.error(CodeMsg.MORE_PERSONNAL);
|
|
|
+ }
|
|
|
}
|
|
|
+ }else {
|
|
|
+ resultData = ResultData.error(CodeMsg.NOT_ALIPAY);
|
|
|
}
|
|
|
-// payOrderMapper.insertSelective(payOrder);
|
|
|
-// logger.info("返回前端的结果:" +resultMap.toString());
|
|
|
-// resultData = ResultData.success(resultMap);
|
|
|
}else {
|
|
|
resultData = ResultData.error(CodeMsg.STATION_NULL_INFO);
|
|
|
}
|