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 cb6485c8..ff42bcfc 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 @@ -21,10 +21,7 @@ import com.hai.config.*; import com.hai.entity.*; import com.hai.enum_type.GoodsType; import com.hai.enum_type.PayType; -import com.hai.model.HighCouponModel; -import com.hai.model.HighUserModel; -import com.hai.model.ResponseData; -import com.hai.model.UserInfoModel; +import com.hai.model.*; import com.hai.service.*; import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier; @@ -87,6 +84,9 @@ public class OrderController { @Resource private HighCouponService highCouponService; + @Resource + private HighMerchantStoreService merchantStoreService; + @Resource private HighQzOrderService highQzOrderService; @@ -159,17 +159,25 @@ public class OrderController { if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); } - // 查询账号余额 - JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); - JSONArray result = accountInfo2JD.getJSONArray("result"); - for (Object accountObject : result) { - JSONObject account = (JSONObject)accountObject; - // 1:汽油:2:柴油;3:天然气 - if (account.getInteger("energyType") == childOrder.getGasOilType()) { - // 支付金额 大于 团油账号余额 - if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + // 查询加油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); + } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询账号余额 + JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); + JSONArray result = accountInfo2JD.getJSONArray("result"); + for (Object accountObject : result) { + JSONObject account = (JSONObject)accountObject; + // 1:汽油:2:柴油;3:天然气 + if (account.getInteger("energyType") == childOrder.getGasOilType()) { + // 支付金额 大于 团油账号余额 + if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ + log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + } } } } @@ -300,17 +308,25 @@ public class OrderController { if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); } - // 查询账号余额 - JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); - JSONArray result = accountInfo2JD.getJSONArray("result"); - for (Object accountObject : result) { - JSONObject account = (JSONObject)accountObject; - // 1:汽油:2:柴油;3:天然气 - if (account.getInteger("energyType") == childOrder.getGasOilType()) { - // 支付金额 大于 团油账号余额 - if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + // 查询加油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); + } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询账号余额 + JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); + JSONArray result = accountInfo2JD.getJSONArray("result"); + for (Object accountObject : result) { + JSONObject account = (JSONObject)accountObject; + // 1:汽油:2:柴油;3:天然气 + if (account.getInteger("energyType") == childOrder.getGasOilType()) { + // 支付金额 大于 团油账号余额 + if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ + log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + } } } } @@ -404,17 +420,26 @@ public class OrderController { if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); } - // 查询账号余额 - JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); - JSONArray result = accountInfo2JD.getJSONArray("result"); - for (Object accountObject : result) { - JSONObject account = (JSONObject)accountObject; - // 1:汽油:2:柴油;3:天然气 - if (account.getInteger("energyType") == childOrder.getGasOilType()) { - // 支付金额 大于 团油账号余额 - if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + + // 查询加油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); + } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询账号余额 + JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); + JSONArray result = accountInfo2JD.getJSONArray("result"); + for (Object accountObject : result) { + JSONObject account = (JSONObject)accountObject; + // 1:汽油:2:柴油;3:天然气 + if (account.getInteger("energyType") == childOrder.getGasOilType()) { + // 支付金额 大于 团油账号余额 + if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ + log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + } } } } @@ -508,17 +533,25 @@ public class OrderController { if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); } - // 查询账号余额 - JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); - JSONArray result = accountInfo2JD.getJSONArray("result"); - for (Object accountObject : result) { - JSONObject account = (JSONObject)accountObject; - // 1:汽油:2:柴油;3:天然气 - if (account.getInteger("energyType") == childOrder.getGasOilType()) { - // 支付金额 大于 团油账号余额 - if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + // 查询加油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); + } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询账号余额 + JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); + JSONArray result = accountInfo2JD.getJSONArray("result"); + for (Object accountObject : result) { + JSONObject account = (JSONObject)accountObject; + // 1:汽油:2:柴油;3:天然气 + if (account.getInteger("energyType") == childOrder.getGasOilType()) { + // 支付金额 大于 团油账号余额 + if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ + log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + } } } } @@ -592,17 +625,25 @@ public class OrderController { if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); } - // 查询账号余额 - JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); - JSONArray result = accountInfo2JD.getJSONArray("result"); - for (Object accountObject : result) { - JSONObject account = (JSONObject)accountObject; - // 1:汽油:2:柴油;3:天然气 - if (account.getInteger("energyType") == childOrder.getGasOilType()) { - // 支付金额 大于 团油账号余额 - if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + // 查询加油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限"); + } + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询账号余额 + JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); + JSONArray result = accountInfo2JD.getJSONArray("result"); + for (Object accountObject : result) { + JSONObject account = (JSONObject)accountObject; + // 1:汽油:2:柴油;3:天然气 + if (account.getInteger("energyType") == childOrder.getGasOilType()) { + // 支付金额 大于 团油账号余额 + if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ + log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + } } } }