Browse Source

fixed 收银挂单问题修复

fushengqian 1 year ago
parent
commit
47f6e83d12

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

@@ -147,7 +147,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo != null) {
             // 输入了会员ID就用会员的账号下单,否则用员工账号下单
-            if (userId > 0) {
+            if (userId != null && userId > 0) {
                 mtUser = queryMemberById(userId);
             } else {
                 Integer accountId = accountInfo.getId();

+ 6 - 10
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCashierController.java

@@ -349,7 +349,7 @@ public class BackendCashierController extends BaseController {
     @RequestMapping(value = "/doHangUp", method = RequestMethod.POST)
     @CrossOrigin
     @PreAuthorize("@pms.hasPermission('cashier:index')")
-    public ResponseObject doHangUp(HttpServletRequest request, @RequestBody Map<String, Object> param) {
+    public ResponseObject doHangUp(HttpServletRequest request, @RequestBody Map<String, Object> param) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
         String cartIds = param.get("cartIds") == null ? "" : param.get("cartIds").toString();
         String hangNo = param.get("hangNo") == null ? "" : param.get("hangNo").toString();
@@ -365,17 +365,13 @@ public class BackendCashierController extends BaseController {
             isVisitor = YesOrNoEnum.YES.getKey();
         }
 
-        try {
-            if (StringUtil.isNotEmpty(cartIds)) {
-                String[] ids = cartIds.split(",");
-                if (ids.length > 0) {
-                    for (int i = 0; i < ids.length; i++) {
-                         cartService.setHangNo(Integer.parseInt(ids[i]), hangNo, isVisitor);
-                    }
+        if (StringUtil.isNotEmpty(cartIds)) {
+            String[] ids = cartIds.split(",");
+            if (ids.length > 0) {
+                for (int i = 0; i < ids.length; i++) {
+                     cartService.setHangNo(Integer.parseInt(ids[i]), hangNo, isVisitor);
                 }
             }
-        } catch (BusinessCheckException e) {
-            return getFailureResult(201, "挂单失败");
         }
 
         return getSuccessResult(true);

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

@@ -122,6 +122,12 @@ public class ClientCartController extends BaseController {
         if (merchantId <= 0) {
             merchantId = mtUser.getMerchantId();
         }
+        if (merchantId <= 0) {
+            AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
+            if (accountInfo != null && accountInfo.getMerchantId() != null) {
+                merchantId = accountInfo.getMerchantId();
+            }
+        }
 
         MtCart mtCart = new MtCart();
         mtCart.setGoodsId(goodsId);