提交代码

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

Loading…
Cancel
Save