Browse Source

fixed 收银挂单相关判断

fushengqian 1 year ago
parent
commit
f39e0a0859

+ 3 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/CartServiceImpl.java

@@ -307,13 +307,15 @@ public class CartServiceImpl extends ServiceImpl<MtCartMapper, MtCart> implement
     @Override
     @OperationServiceLog(description = "执行挂单")
     @Transactional(rollbackFor = Exception.class)
-    public MtCart setHangNo(Integer cartId, String hangNo, String isVisitor) {
+    public MtCart setHangNo(Integer cartId, String hangNo, String isVisitor) throws BusinessCheckException {
         MtCart mtCart = mtCartMapper.selectById(cartId);
         if (mtCart != null) {
             mtCart.setHangNo(hangNo);
             mtCart.setUpdateTime(new Date());
             mtCart.setIsVisitor(isVisitor);
             this.updateById(mtCart);
+        } else {
+            throw new BusinessCheckException("执行挂单失败");
         }
         return mtCart;
     }

+ 4 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCashierController.java

@@ -360,6 +360,10 @@ public class BackendCashierController extends BaseController {
             return getFailureResult(1001, "请先登录");
         }
 
+        if (accountInfo.getMerchantId() == null || accountInfo.getMerchantId() <= 0) {
+            return getFailureResult(201, "平台账号不能执行该操作");
+        }
+
         String isVisitor = YesOrNoEnum.NO.getKey();
         if (StringUtil.isEmpty(userId)) {
             isVisitor = YesOrNoEnum.YES.getKey();

+ 2 - 2
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientCartController.java

@@ -124,9 +124,9 @@ public class ClientCartController extends BaseController {
         }
         if (merchantId <= 0) {
             AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
-            if (accountInfo != null && accountInfo.getMerchantId() != null) {
+            if (accountInfo != null) {
                 merchantId = accountInfo.getMerchantId();
-                if (merchantId <= 0) {
+                if (merchantId == null || merchantId <= 0) {
                     return getFailureResult(201, "平台方账户无操作权限");
                 }
             }