From 58f5c3402d631a1403750df820f98d38bf3a9410 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 3 Aug 2022 14:19:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/pay/OrderController.java | 57 +++++++++++++++++++ .../com/hai/dao/HighGasOilPriceMapperExt.java | 3 +- .../HighGasDiscountOilPriceServiceImpl.java | 6 +- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 691b6502..86a648c6 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -191,6 +191,21 @@ public class OrderController { } } } + + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + BigDecimal account = new BigDecimal("0"); + // 查询账号余额 + HighMerchantAccount merAccount = merchantAccountService.getStoreAccountDetail(store.getMerchantId()); + if (merAccount != null) { + account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId())); + } + // 客户加油金额 大于 商户账号余额 + if(order.getTotalPrice().compareTo(account) == 1) { + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } } } @@ -531,6 +546,20 @@ public class OrderController { } } } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + BigDecimal account = new BigDecimal("0"); + // 查询账号余额 + HighMerchantAccount merAccount = merchantAccountService.getStoreAccountDetail(store.getMerchantId()); + if (merAccount != null) { + account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId())); + } + // 客户加油金额 大于 商户账号余额 + if(order.getTotalPrice().compareTo(account) == 1) { + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } } } @@ -643,6 +672,20 @@ public class OrderController { } } } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + BigDecimal account = new BigDecimal("0"); + // 查询账号余额 + HighMerchantAccount merAccount = merchantAccountService.getStoreAccountDetail(store.getMerchantId()); + if (merAccount != null) { + account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId())); + } + // 客户加油金额 大于 商户账号余额 + if(order.getTotalPrice().compareTo(account) == 1) { + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } } } @@ -735,6 +778,20 @@ public class OrderController { } } } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + BigDecimal account = new BigDecimal("0"); + // 查询账号余额 + HighMerchantAccount merAccount = merchantAccountService.getStoreAccountDetail(store.getMerchantId()); + if (merAccount != null) { + account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId())); + } + // 客户加油金额 大于 商户账号余额 + if(order.getTotalPrice().compareTo(account) == 1) { + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } } } diff --git a/hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java index 788d11aa..5a2a8059 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java @@ -41,7 +41,8 @@ public interface HighGasOilPriceMapperExt { @Select({" SELECT a.store_key storeKey,ROUND((st_distance_sphere(point(a.longitude, a.latitude) , point(${longitude},${latitude}))/1000),2) as distance" + - " FROM high_merchant_store a,high_gas_oil_price b where a.type = 1 and a.`status` = 1 and a.id = b.merchant_store_id and b.`status` = 1 GROUP BY a.id" + + " FROM high_merchant_store a,high_gas_oil_price b where a.type = 1 and a.`status` = 1 and a.id = b.merchant_store_id and b.`status` = 1 " + + " and a.longitude is not null and a.latitude is not null GROUP BY a.id" + " ORDER BY distance asc LIMIT 1 "}) Map recentGasStation(@Param("longitude") String longitude,@Param("latitude") String latitude); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java index d42f3c5d..0a6a0a9f 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java @@ -156,9 +156,11 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri // 1:平台自建 2:团油 3: 壳牌 if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) - || store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + || store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber()) + || store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber()) + ) { - // 嗨森逛平台价 国标价 * 折扣 + // 嗨森逛平台价 油枪价 * 折扣 BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); // 加油金额