From 8070a2a7e6d57977e71572ef3e624386334af726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?= <14103883+leaf-phos@user.noreply.gitee.com> Date: Mon, 9 Dec 2024 08:45:21 +0800 Subject: [PATCH] =?UTF-8?q?debug=EF=BC=9A=E8=AE=A2=E5=8D=95=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TransactionBillValidator.java | 5 +++++ .../service/impl/TransactionBillServiceImpl.java | 2 +- .../service/impl/TransactionBillValidatorImpl.java | 12 +++++++++--- .../controller/app/AppTransactionBillController.java | 7 +++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java index 7aee0d57..e5f5da7d 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java @@ -71,4 +71,9 @@ public interface TransactionBillValidator { * 是否允许操作订单 */ boolean canOperaOrder(TransactionBillVO bill, Long userId); + + /** + * 是否允许查看订单 + */ + boolean canViewOrder(TransactionBillVO bill, Long userId); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 81c1df50..f46255e6 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -2027,7 +2027,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After if (open) { if (SuitFeeType.timingList().contains(bill.getSuitFeeType())) { - return iotService.open(device.getMac(), device.getModelProductId()) ? 1 : 0; + return iotService.open(device) ? 1 : 0; } else { // 计算设备剩余时长 LocalDateTime expireTime = device.getExpireTime(); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java index 9b429610..4299d58a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java @@ -246,9 +246,6 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans return error("参数错误:billId与userId不允许为空"); } - if (!this.allowGet(billId, userId)) { - return error("您不允许访问该订单"); - } return success(); } @@ -379,6 +376,15 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans return false; } return this.isMch(bill, userId) + || this.isAgent(bill, userId) + || storeStaffValidator.hasStorePermission(bill.getStoreId(), userId, StoreStaffPermissions.ORDER_OPERA); + } + + @Override + public boolean canViewOrder(TransactionBillVO bill, Long userId) { + return this.isMch(bill, userId) + || this.isUser(bill, userId) + || this.isAgent(bill, userId) || storeStaffValidator.hasStorePermission(bill.getStoreId(), userId, StoreStaffPermissions.ORDER_OPERA); } } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index fe91250c..26f9dbc5 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -143,6 +143,9 @@ public class AppTransactionBillController extends BaseController public AjaxResult detail(@PathVariable Long billId) { ServiceUtil.assertion(transactionBillValidator.preGetDetailByApp(billId, getUserId())); TransactionBillVO bill = transactionBillService.selectSmTransactionBillByBillId(billId); + if (!transactionBillValidator.canViewOrder(bill, getUserId())) { + return error("您不允许查看该订单"); + } List list = Collections.singletonList(bill); transactionAssembler.assembleChannelName(Collections.singletonList(bill)); transactionAssembler.handleMchUserMobile(list); @@ -155,8 +158,8 @@ public class AppTransactionBillController extends BaseController @JsonView(JsonViewProfile.AppUser.class) public AjaxResult detail(@PathVariable String billNo) { TransactionBillVO bill = transactionBillService.selectSmTransactionBillByBillNo(billNo); - if (!transactionBillValidator.isUser(bill, getUserId()) && !transactionBillValidator.isMch(bill, getUserId())) { - return success(); + if (!transactionBillValidator.canViewOrder(bill, getUserId())) { + return error("您不允许查看该订单"); } transactionAssembler.assembleChannelName(Collections.singletonList(bill)); return success(bill);