提交代码

dev-discount
胡锐 2 years ago
parent 27d55c471e
commit 58f5c3402d
  1. 57
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  2. 3
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java
  3. 6
      hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.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, "暂时无法进行支付,请联系平台客服");
}
}
} }
} }

@ -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" + @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 "}) " ORDER BY distance asc LIMIT 1 "})
Map<String,Object> recentGasStation(@Param("longitude") String longitude,@Param("latitude") String latitude); Map<String,Object> recentGasStation(@Param("longitude") String longitude,@Param("latitude") String latitude);

@ -156,9 +156,11 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
// 1:平台自建 2:团油 3: 壳牌 // 1:平台自建 2:团油 3: 壳牌
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) 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); BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
// 加油金额 // 加油金额

Loading…
Cancel
Save