提交代码

dev-discount
胡锐 3 years ago
parent 0459a6920f
commit 37fc74869d
  1. 9
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 54
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  4. 4
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  5. 7
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  6. 5
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -206,9 +206,14 @@ public class HighOrderController {
log.error("HighOrderController --> addOrder() error!", "参数错误"); log.error("HighOrderController --> addOrder() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
if (childOrder.getGoodsPrice().compareTo(new BigDecimal("500")) == 1){ if (childOrder.getGoodsPrice().compareTo(new BigDecimal("800")) == 1){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油金额不能超过500元"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油金额不能超过800元");
} }
if (highOrderService.getGasTheDayOrderNum(userInfoModel.getHighUser().getId()) >= 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// 查询门店 // 查询门店
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId());
if (store == null) { if (store == null) {

@ -156,6 +156,9 @@ public class OrderController {
} }
if (childOrder.getGoodsType() == 3) { if (childOrder.getGoodsType() == 3) {
if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// 查询账号余额 // 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD.getJSONArray("result"); JSONArray result = accountInfo2JD.getJSONArray("result");
@ -286,6 +289,27 @@ public class OrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持积分支付"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持积分支付");
} }
} }
if (childOrder.getGoodsType() == 3) {
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, "无法进行支付,请联系平台客服");
}
}
}
}
} }
highOrderService.goldPayOrder(order.getMemId(), order.getId()); highOrderService.goldPayOrder(order.getMemId(), order.getId());
@ -369,17 +393,28 @@ public class OrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
} }
/* // 商品类型 1:卡卷 2:金币充值 // 商品类型 1:卡卷 2:金币充值
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGoodsType() == 2) { if (childOrder.getGoodsType() == 3) {
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId()); if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) {
// 支付类型:1.微信支付 2.金币支付 throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
if (coupon.getPayType() != 2) { }
log.error("OrderController --> orderToPay() ERROR", "只支持积分支付"); // 查询账号余额
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持积分支付"); 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, "无法进行支付,请联系平台客服");
}
}
} }
} }
}*/ }
highOrderService.hltUnionCardPay(userCard.getId(), order.getId()); highOrderService.hltUnionCardPay(userCard.getId(), order.getId());
@ -445,6 +480,9 @@ public class OrderController {
} }
if (childOrder.getGoodsType() == 3) { if (childOrder.getGoodsType() == 3) {
if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// 查询账号余额 // 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD(); JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD.getJSONArray("result"); JSONArray result = accountInfo2JD.getJSONArray("result");

@ -148,7 +148,7 @@ public class UnionPayController {
order.setPayRealPrice(order.getPayPrice()); // 实付金额 order.setPayRealPrice(order.getPayPrice()); // 实付金额
order.setPayTime(new Date()); // 支付时间 order.setPayTime(new Date()); // 支付时间
order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合 order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
order.setPayType(6); // 支付方式: 1:支付宝 2:微信 3:金币 4:工会卡 5:银联 6:银联分期 order.setPayType(5); // 支付方式: 1:支付宝 2:微信 3:金币 4:工会卡 5:银联 6:银联分期
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {

@ -945,4 +945,8 @@ public interface HighOrderMapperExt {
}) })
List<DateCountModel> getDateCountByUser(); List<DateCountModel> getDateCountByUser();
@Select({"select count(1) from high_order " +
"where id in (select b.order_id from high_child_order b where goods_type = 3 and mem_id = #{userId} and child_orde_status in (2,3)) " +
"and year(pay_time)=year(now()) and month(pay_time) = month(now()) and day(pay_time) = day(now())"})
int selectGasTheDayOrderNum(@Param("userId") Long userId);
} }

@ -372,4 +372,11 @@ public interface HighOrderService {
*/ */
List<DateCountModel> getDateCountByRecharge(); List<DateCountModel> getDateCountByRecharge();
/**
* 查询用户当天加油订单数据量
* @param userId
* @return
*/
int getGasTheDayOrderNum(Long userId);
} }

@ -1238,4 +1238,9 @@ public class HighOrderServiceImpl implements HighOrderService {
public List<DateCountModel> getDateCountByRecharge() { public List<DateCountModel> getDateCountByRecharge() {
return highOrderMapper.getDateCountByRecharge(); return highOrderMapper.getDateCountByRecharge();
} }
@Override
public int getGasTheDayOrderNum(Long userId) {
return highOrderMapper.selectGasTheDayOrderNum(userId);
}
} }

Loading…
Cancel
Save