From bd4457f1f359360042d76e94dc52b9cb8b503ec7 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 30 May 2022 13:58:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighOrderController.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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) {