diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index e80f130c..2210cdb1 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -55,6 +55,9 @@ public class HighOrderController { @Autowired private UserCenter userCenter; + @Resource + private CommonService commonService; + @Resource private HighOrderService highOrderService; @@ -220,8 +223,18 @@ public class HighOrderController { log.error("HighOrderController --> addOrder() error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - if (childOrder.getGoodsPrice().compareTo(new BigDecimal("800")) == 1){ - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油金额不能超过800元"); + + // 加油限制 + if (childOrder.getGasOilType().equals(1)) { + SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "汽油"); + if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "汽油加油金额不能超过" + refuelLimit.getCodeValue()+"元"); + } + } else if (childOrder.getGasOilType().equals(2)){ + SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "柴油"); + if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "柴油加油金额不能超过" + refuelLimit.getCodeValue()+"元"); + } } if (highOrderService.getGasTheDayOrderNum(userInfoModel.getHighUser().getId()) >= 1) {