diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java index e8ec6556..8d2e9e53 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java @@ -239,4 +239,6 @@ public class SmUser extends BaseEntity @JsonView(JsonViewProfile.AppMch.class) private BigDecimal agentDeviceService; + @ApiModelProperty("代理商是否允许商户开关设备") + private Boolean agentAllowMchSwitch; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java index cd2767fd..54089203 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java @@ -97,6 +97,13 @@ public class DeviceVO extends Device implements IotDevice { @ApiModelProperty("正在使用中的订单数量") private Integer usingBillCount; + @ApiModelProperty("代理商是否允许商户开关设备") + private Boolean agentAllowMchSwitch; + + @ApiModelProperty("是否允许当前用户开关设备") + @JsonView(JsonViewProfile.App.class) + private Boolean allowSwitch; + @Override public String iotMac1() { return getMac(); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml index d80b9af0..1fd046ef 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml @@ -77,7 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.show_bill_mobile as mch_show_bill_mobile, if(sua.is_real, sua.real_name, sua.user_name) as agent_name, sua.phonenumber as agent_mobile, - sua.agent_service_rate as agent_user_service_rate + sua.agent_service_rate as agent_user_service_rate, + sua.agent_allow_mch_switch as agent_allow_mch_switch diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceAssembler.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceAssembler.java index 13738a14..ae4d4cc7 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceAssembler.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceAssembler.java @@ -3,6 +3,7 @@ package com.ruoyi.ss.device.service; import com.ruoyi.ss.device.domain.vo.DeviceVO; +import java.util.Collections; import java.util.List; /** @@ -41,4 +42,13 @@ public interface DeviceAssembler { * 拼接正在使用中的订单数量 */ void assembleUsingBillCount(List list); + + /** + * 拼接是否允许切换开关设备 + */ + void assembleAllowSwitch(List list, Long userId); + + default void assembleAllowSwitch(DeviceVO device, Long userId) { + assembleAllowSwitch(Collections.singletonList(device), userId); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java index 3703918e..e2c9d0d4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java @@ -98,10 +98,11 @@ public interface DeviceService /** * 切换设备通电状态(通/断电) - * @param deviceId 设备id + * + * @param device 设备id * @param status 通电状态 */ - boolean changePowerStatus(Long deviceId, DevicePowerStatus status); + boolean changePowerStatus(DeviceVO device, DevicePowerStatus status); /** * 拉取设备信息,并保存到数据库 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java index 5ae7c198..47827f6f 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java @@ -23,9 +23,14 @@ public interface DeviceValidator { * @param deviceId 设备id * @param userId 用户id */ - boolean isBelong(Long deviceId, Long userId); + boolean isMch(Long deviceId, Long userId); - boolean isBelong(Collection deviceIds, Long userId); + boolean isMch(Collection deviceIds, Long userId); + + /** + * 判断是否设备的商户 + */ + boolean isMch(DeviceVO device, Long userId); /** * 创建前校验 @@ -88,4 +93,9 @@ public interface DeviceValidator { * @param deviceNo */ void checkSn(Long deviceId, String deviceNo); + + /** + * 判断代理商是否允许商户开关 + */ + boolean isAgentAllowMchSwitch(DeviceVO device); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java index d0d2e4f3..83671cf8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.ss.device.service.impl; import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.common.domain.vo.CommonCountVO; import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.dashboard.domain.vo.BillCountVo; +import com.ruoyi.ss.device.domain.enums.DeviceServiceMode; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceAssembler; +import com.ruoyi.ss.device.service.DeviceValidator; import com.ruoyi.ss.deviceSuit.domain.DeviceSuitQuery; import com.ruoyi.ss.deviceSuit.domain.DeviceSuitVO; import com.ruoyi.ss.deviceSuit.service.DeviceSuitService; @@ -46,6 +47,9 @@ public class DeviceAssemblerImpl implements DeviceAssembler { @Autowired private ISysConfigService sysConfigService; + @Autowired + private DeviceValidator deviceValidator; + /** * 拼接套餐列表 * @@ -183,4 +187,35 @@ public class DeviceAssemblerImpl implements DeviceAssembler { } } + @Override + public void assembleAllowSwitch(List list, Long userId) { + if (CollectionUtils.isEmptyElement(list)) { + return; + } + + for (DeviceVO device : list) { + // 直营模式 + if (DeviceServiceMode.DIRECT.getMode().equals(device.getServiceMode())) { + // 是商户 + if (deviceValidator.isMch(device, userId)) { + device.setAllowSwitch(true); + continue; + } + } + // 代理模式 + else if (DeviceServiceMode.AGENT.getMode().equals(device.getServiceMode())) { + // 是代理 + if (deviceValidator.isAgent(device, userId)) { + device.setAllowSwitch(true); + continue; + } + // 是商户,并且代理允许 + if (deviceValidator.isMch(device, userId) && device.getAgentAllowMchSwitch()) { + device.setAllowSwitch(true); + continue; + } + } + device.setAllowSwitch(false); + } + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index 1d3fb9ea..2b2c5dc5 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -978,15 +978,13 @@ public class DeviceServiceImpl implements DeviceService /** * 切换设备通电状态(通/断电) - * @param deviceId 设备id + * + * @param device 设备id * @param status 通电状态 */ @Override - public boolean changePowerStatus(Long deviceId, DevicePowerStatus status) { - DeviceVO device = deviceMapper.selectSmDeviceByDeviceId(deviceId); + public boolean changePowerStatus(DeviceVO device, DevicePowerStatus status) { ServiceUtil.assertion(device == null || device.getDeleted(), "设备不存在"); - ServiceUtil.assertion(!StringUtils.hasText(device.getMac()), "设备Mac号为空"); - ServiceUtil.assertion(!UserUtil.hasFrontUser(device.getUserId()), "该设备不是您的,无法进行该操作" ); if (DevicePowerStatus.ON.equals(status)) { iotService.open(device); @@ -998,7 +996,7 @@ public class DeviceServiceImpl implements DeviceService // 修改数据库通断电状态 Device changePowerForm = new Device(); - changePowerForm.setDeviceId(deviceId); + changePowerForm.setDeviceId(device.getDeviceId()); changePowerForm.setPowerStatus(status.getStatus()); deviceMapper.updateSmDevice(changePowerForm); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java index d19465a9..fed961b9 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java @@ -13,13 +13,14 @@ import com.ruoyi.ss.device.domain.enums.DeviceServiceMode; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.device.service.DeviceValidator; -import com.ruoyi.ss.model.domain.enums.ModelTag; import com.ruoyi.ss.store.service.StoreValidator; import com.ruoyi.ss.suit.service.SuitValidator; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType; import com.ruoyi.ss.transactionBill.service.TransactionBillService; -import org.eclipse.jetty.util.StringUtil; +import com.ruoyi.ss.user.domain.SmUserVO; +import com.ruoyi.ss.user.service.ISmUserService; +import com.ruoyi.ss.user.service.impl.SmUserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,6 +45,9 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato @Autowired private TransactionBillService transactionBillService; + @Autowired + private ISmUserService userService; + /** * 设备编号是否存在 * @@ -66,16 +70,16 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato * @param userId 用户id */ @Override - public boolean isBelong(Long deviceId, Long userId) { + public boolean isMch(Long deviceId, Long userId) { if (deviceId == null || userId == null) { return false; } DeviceVO device = deviceService.selectById(deviceId); - return device != null && Objects.equals(device.getUserId(), userId); + return this.isMch(device, userId); } @Override - public boolean isBelong(Collection deviceIds, Long userId) { + public boolean isMch(Collection deviceIds, Long userId) { if (CollectionUtils.isEmptyElement(deviceIds) || userId == null) { return false; } @@ -83,7 +87,17 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato query.setDeviceIds(new ArrayList<>(deviceIds)); query.setUserId(userId); List deviceList = deviceService.selectSmDeviceList(query); - return deviceList.size() == deviceIds.size(); + for (DeviceVO device : deviceList) { + if (!isMch(device, userId)) { + return false; + } + } + return true; + } + + @Override + public boolean isMch(DeviceVO device, Long userId) { + return device != null && userId != null && Objects.equals(device.getUserId(), userId); } /** @@ -131,7 +145,7 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato Long userId = SecurityUtils.getUserId(); // 判断是否有权限更改 - if (!isBelong(data.getDeviceId(), userId)) { + if (!isMch(data.getDeviceId(), userId)) { return error("这不是您的设备,您无权更改"); } // 判断套餐 @@ -233,4 +247,13 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato public void checkSn(Long deviceId, String deviceNo) { ServiceUtil.assertion(isRepeatSn(deviceId, deviceNo), "SN重复", ServiceCode.DEVICE_SN_REPEAT.getCode()); } + + @Override + public boolean isAgentAllowMchSwitch(DeviceVO device) { + if (device != null && DeviceServiceMode.AGENT.getMode().equals(device.getServiceMode()) && device.getAgentId() != null) { + SmUserVO agent = userService.selectSimpleById(device.getAgentId()); + return agent == null || agent.getAgentAllowMchSwitch(); + } + return true; + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/service/impl/SuitValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/service/impl/SuitValidatorImpl.java index d14f0b9f..f0ce84fd 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/service/impl/SuitValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/service/impl/SuitValidatorImpl.java @@ -92,7 +92,7 @@ public class SuitValidatorImpl extends BaseValidator implements SuitValidator { } // 设备校验 - if (CollectionUtils.isNotEmptyElement(suit.getDeviceIds()) && !deviceValidator.isBelong(suit.getDeviceIds(), SecurityUtils.getUserId())) { + if (CollectionUtils.isNotEmptyElement(suit.getDeviceIds()) && !deviceValidator.isMch(suit.getDeviceIds(), SecurityUtils.getUserId())) { return error("有设备不属于该用户"); } @@ -121,7 +121,7 @@ public class SuitValidatorImpl extends BaseValidator implements SuitValidator { } // 设备校验 - if (CollectionUtils.isNotEmptyElement(suit.getDeviceIds()) && !deviceValidator.isBelong(suit.getDeviceIds(), SecurityUtils.getUserId())) { + if (CollectionUtils.isNotEmptyElement(suit.getDeviceIds()) && !deviceValidator.isMch(suit.getDeviceIds(), SecurityUtils.getUserId())) { return error("有设备不属于该用户"); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml index ecaf4bca..07c07313 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml @@ -59,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.show_bill_mobile, su.show_bill_mobile_price, su.agent_device_service, + su.agent_allow_mch_switch, if(su.is_real, su.real_name, su.user_name) as real_or_user_name, (select sum(stb.money) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '1' and stb.status = '2') as recharge_amount, (select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '2' and stb.status = '14') as with_drawl_amount, @@ -89,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and read_mch_licence = #{readMchLicence} and show_bill_mobile = #{showBillMobile} and su.user_id != #{excludeUserId} + and su.agent_allow_mch_switch != #{agentAllowMchSwitch} and if(su.is_real, su.real_name, su.user_name) like concat('%', #{realOrUserName}, '%') and su.user_id in ( @@ -197,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" show_bill_mobile, show_bill_mobile_price, agent_device_service, + agent_allow_mch_switch, #{userName}, @@ -244,6 +247,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{showBillMobile}, #{showBillMobilePrice}, #{agentDeviceService}, + #{agentAllowMchSwitch}, @@ -307,6 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" show_bill_mobile = #{showBillMobile}, show_bill_mobile_price = #{showBillMobilePrice}, agent_device_service = #{agentDeviceService}, + agent_allow_mch_switch = #{agentAllowMchSwitch}, where user_id = #{userId} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java index 1fe0de8d..886d73ab 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java @@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.ValidGroup; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.OperatorType; -import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.iot.service.IotService; @@ -40,7 +39,6 @@ import java.math.BigDecimal; import java.util.Collections; import java.util.List; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; /** * 设备Controller @@ -114,6 +112,7 @@ public class AppDeviceController extends BaseController { DeviceVO device = smDeviceService.selectById(deviceId); List list = Collections.singletonList(device); deviceAssembler.assembleOrderCountInfo(list); // 订单统计信息 + deviceAssembler.assembleAllowSwitch(list, getUserId()); return success(device); } @@ -121,8 +120,13 @@ public class AppDeviceController extends BaseController { @ApiOperation("设备通断电") @PutMapping("/{deviceId}/changePower") public AjaxResult close(@PathVariable @ApiParam("设备id") Long deviceId, String status) { + DeviceVO device = smDeviceService.selectById(deviceId); + ServiceUtil.assertion(device == null, "设备不存在"); + deviceAssembler.assembleAllowSwitch(device, getUserId()); + ServiceUtil.assertion(!device.getAllowSwitch(), "您无权操作此设备"); + DevicePowerStatus powerStatus = DevicePowerStatus.parse(status); - return success(smDeviceService.changePowerStatus(deviceId, powerStatus )); + return success(smDeviceService.changePowerStatus(device, powerStatus )); } @Log(title = "绑定设备", businessType = BusinessType.OTHER, operatorType = OperatorType.MOBILE) @@ -143,7 +147,7 @@ public class AppDeviceController extends BaseController { @ApiOperation("解除设备绑定") @DeleteMapping("/mch/unbind/{deviceId}") public AjaxResult mchUnbind(@PathVariable @ApiParam("设备id") Long deviceId) { - ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备"); + ServiceUtil.assertion(!deviceValidator.isMch(deviceId, getUserId()), "这不是您的设备"); return toAjax(smDeviceService.unbind(deviceId)); } @@ -169,9 +173,10 @@ public class AppDeviceController extends BaseController { @ApiParam("单位") @RequestParam(required = false, defaultValue = "3") String timeUnit, @ApiParam("是否操作物联网设备") @RequestParam(required = false, defaultValue = "true") Boolean withIot ) { - ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备"); DeviceVO device = smDeviceService.selectById(deviceId); - ServiceUtil.assertion(device == null || !getUserId().equals(device.getUserId()), "设备不存在或您无权充值"); + ServiceUtil.assertion(device == null, "设备不存在"); + deviceAssembler.assembleAllowSwitch(device, getUserId()); + ServiceUtil.assertion(!device.getAllowSwitch(), "您无权操作此设备"); // 电量 if ( "0".equals(timeUnit)) { diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppSuitController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppSuitController.java index 31c5323b..2ecabd2d 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppSuitController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppSuitController.java @@ -14,7 +14,6 @@ import com.ruoyi.ss.suit.domain.Suit; import com.ruoyi.ss.suit.domain.SuitBO; import com.ruoyi.ss.suit.domain.SuitQuery; import com.ruoyi.ss.suit.domain.SuitVO; -import com.ruoyi.ss.suit.domain.dto.SuitCopyDTO; import com.ruoyi.ss.suit.service.SuitAssembler; import com.ruoyi.ss.suit.service.SuitService; import com.ruoyi.ss.suit.service.SuitValidator; @@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -55,7 +53,7 @@ public class AppSuitController extends BaseController { @JsonView(JsonViewProfile.AppMch.class) @GetMapping("/listByDeviceId/{deviceId}") public AjaxResult list(@PathVariable Long deviceId) { - ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备,无法查看"); + ServiceUtil.assertion(!deviceValidator.isMch(deviceId, getUserId()), "这不是您的设备,无法查看"); List list = suitService.selectByDeviceId(deviceId); suitAssembler.assembleDeviceList(list); return success(list); @@ -109,7 +107,7 @@ public class AppSuitController extends BaseController { @ApiOperation("将指定设备的套餐清空") @DeleteMapping("/delByDevice/{deviceId}") public AjaxResult delByDevice(@PathVariable Long deviceId) { - if (!deviceValidator.isBelong(deviceId, getUserId())) { + if (!deviceValidator.isMch(deviceId, getUserId())) { return error("这不是您的设备,无法清空套餐"); } return toAjax(deviceSuitService.deleteByDeviceId(deviceId)); 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 19f171f5..f0647214 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 @@ -222,7 +222,7 @@ public class AppTransactionBillController extends BaseController @GetMapping("/rechargeListByDevice") @JsonView(JsonViewProfile.AppMch.class) public TableDataInfo getDeviceRechargeList(@RequestParam @ApiParam("设备id") Long deviceId) { - ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备,无法查询"); + ServiceUtil.assertion(!deviceValidator.isMch(deviceId, getUserId()), "这不是您的设备,无法查询"); TransactionBillQuery query = new TransactionBillQuery(); query.setDeviceId(deviceId); query.setMchId(getUserId());