mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-13 07:45:41 +08:00
refactor(device): 云音响设备台账域从 iot 重命名为 device
This commit is contained in:
@@ -157,7 +157,7 @@ CREATE INDEX IF NOT EXISTS idx_mch_store_info_mch_no ON mch_store_info (mch_no,
|
||||
-- ===================================
|
||||
-- 云音响设备(商米云音响, 设备台账与商户/门店绑定关系)
|
||||
-- ===================================
|
||||
CREATE TABLE IF NOT EXISTS iot_speaker_device (
|
||||
CREATE TABLE IF NOT EXISTS device_speaker (
|
||||
id bigint NOT NULL,
|
||||
mch_no varchar(32) NOT NULL,
|
||||
device_sn varchar(64) NOT NULL,
|
||||
@@ -174,28 +174,28 @@ CREATE TABLE IF NOT EXISTS iot_speaker_device (
|
||||
last_modified_time timestamptz(6),
|
||||
version int NOT NULL DEFAULT 0,
|
||||
deleted boolean NOT NULL DEFAULT false,
|
||||
CONSTRAINT iot_speaker_device_pkey PRIMARY KEY (id)
|
||||
CONSTRAINT device_speaker_pkey PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE iot_speaker_device IS '云音响设备(商米云音响, 设备台账与商户/门店绑定关系)';
|
||||
COMMENT ON COLUMN iot_speaker_device.id IS '主键';
|
||||
COMMENT ON COLUMN iot_speaker_device.mch_no IS '所属商户号';
|
||||
COMMENT ON COLUMN iot_speaker_device.device_sn IS '商米设备序列号(SN)';
|
||||
COMMENT ON COLUMN iot_speaker_device.imei IS '设备IMEI';
|
||||
COMMENT ON COLUMN iot_speaker_device.shop_id IS '商米门店ID';
|
||||
COMMENT ON COLUMN iot_speaker_device.device_name IS '设备名称';
|
||||
COMMENT ON COLUMN iot_speaker_device.status IS '设备状态(unbound未绑定/online在线/offline离线/fault故障)';
|
||||
COMMENT ON COLUMN iot_speaker_device.bind_time IS '绑定时间';
|
||||
COMMENT ON COLUMN iot_speaker_device.last_online_time IS '最后在线时间';
|
||||
COMMENT ON COLUMN iot_speaker_device.remark IS '备注';
|
||||
COMMENT ON COLUMN iot_speaker_device.creator IS '创建人ID';
|
||||
COMMENT ON COLUMN iot_speaker_device.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN iot_speaker_device.last_modifier IS '最后修改人ID';
|
||||
COMMENT ON COLUMN iot_speaker_device.last_modified_time IS '最后修改时间';
|
||||
COMMENT ON COLUMN iot_speaker_device.version IS '版本号(乐观锁)';
|
||||
COMMENT ON COLUMN iot_speaker_device.deleted IS '逻辑删除标志';
|
||||
COMMENT ON TABLE device_speaker IS '云音响设备(商米云音响, 设备台账与商户/门店绑定关系)';
|
||||
COMMENT ON COLUMN device_speaker.id IS '主键';
|
||||
COMMENT ON COLUMN device_speaker.mch_no IS '所属商户号';
|
||||
COMMENT ON COLUMN device_speaker.device_sn IS '商米设备序列号(SN)';
|
||||
COMMENT ON COLUMN device_speaker.imei IS '设备IMEI';
|
||||
COMMENT ON COLUMN device_speaker.shop_id IS '商米门店ID';
|
||||
COMMENT ON COLUMN device_speaker.device_name IS '设备名称';
|
||||
COMMENT ON COLUMN device_speaker.status IS '设备状态(unbound未绑定/online在线/offline离线/fault故障)';
|
||||
COMMENT ON COLUMN device_speaker.bind_time IS '绑定时间';
|
||||
COMMENT ON COLUMN device_speaker.last_online_time IS '最后在线时间';
|
||||
COMMENT ON COLUMN device_speaker.remark IS '备注';
|
||||
COMMENT ON COLUMN device_speaker.creator IS '创建人ID';
|
||||
COMMENT ON COLUMN device_speaker.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN device_speaker.last_modifier IS '最后修改人ID';
|
||||
COMMENT ON COLUMN device_speaker.last_modified_time IS '最后修改时间';
|
||||
COMMENT ON COLUMN device_speaker.version IS '版本号(乐观锁)';
|
||||
COMMENT ON COLUMN device_speaker.deleted IS '逻辑删除标志';
|
||||
|
||||
-- 设备序列号唯一索引(未删除范围内)
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uk_iot_speaker_device_sn ON iot_speaker_device (device_sn) WHERE deleted = false;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uk_device_speaker_sn ON device_speaker (device_sn) WHERE deleted = false;
|
||||
-- 商户号查询索引
|
||||
CREATE INDEX IF NOT EXISTS idx_iot_speaker_device_mch_no ON iot_speaker_device (mch_no, deleted);
|
||||
CREATE INDEX IF NOT EXISTS idx_device_speaker_mch_no ON device_speaker (mch_no, deleted);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package cn.daxpay.open.payment.admin.iot.speaker.controller;
|
||||
package cn.daxpay.open.payment.admin.device.speaker.controller;
|
||||
|
||||
import cn.daxpay.open.payment.admin.iot.speaker.service.IotSpeakerDeviceAdminService;
|
||||
import cn.daxpay.open.payment.iot.speaker.param.IotSpeakerDeviceParam;
|
||||
import cn.daxpay.open.payment.iot.speaker.param.IotSpeakerDeviceQuery;
|
||||
import cn.daxpay.open.payment.iot.speaker.result.IotSpeakerDeviceResult;
|
||||
import cn.daxpay.open.payment.admin.device.speaker.service.SpeakerDeviceAdminService;
|
||||
import cn.daxpay.open.payment.device.speaker.param.SpeakerDeviceParam;
|
||||
import cn.daxpay.open.payment.device.speaker.param.SpeakerDeviceQuery;
|
||||
import cn.daxpay.open.payment.device.speaker.result.SpeakerDeviceResult;
|
||||
import cn.daxpay.open.platform.core.annotation.PermCode;
|
||||
import cn.daxpay.open.platform.core.rest.Res;
|
||||
import cn.daxpay.open.platform.core.rest.param.PageParam;
|
||||
@@ -23,51 +23,51 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/// # 云音响设备管理(运营端)
|
||||
///
|
||||
@PermCode(menuCode = "payment:iot:speaker")
|
||||
@PermCode(menuCode = "payment:device:speaker")
|
||||
@Validated
|
||||
@Tag(name = "云音响设备管理")
|
||||
@RestController
|
||||
@RequestMapping("/admin/iot/speaker-device")
|
||||
@RequestMapping("/admin/device/speaker")
|
||||
@RequiredArgsConstructor
|
||||
public class IotSpeakerDeviceAdminController {
|
||||
public class SpeakerDeviceAdminController {
|
||||
|
||||
private final IotSpeakerDeviceAdminService iotSpeakerDeviceAdminService;
|
||||
private final SpeakerDeviceAdminService speakerDeviceAdminService;
|
||||
|
||||
@PermCode(code = "add", nameCn = "云音响新增", nameEn = "Speaker Add")
|
||||
@Operation(summary = "新增云音响设备")
|
||||
@PostMapping("/add")
|
||||
public Result<Void> add(@RequestBody @Validated(ValidationGroup.add.class) IotSpeakerDeviceParam param) {
|
||||
iotSpeakerDeviceAdminService.add(param);
|
||||
public Result<Void> add(@RequestBody @Validated(ValidationGroup.add.class) SpeakerDeviceParam param) {
|
||||
speakerDeviceAdminService.add(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@PermCode(code = "edit", nameCn = "云音响编辑", nameEn = "Speaker Edit")
|
||||
@Operation(summary = "修改云音响设备")
|
||||
@PostMapping("/update")
|
||||
public Result<Void> update(@RequestBody @Validated(ValidationGroup.edit.class) IotSpeakerDeviceParam param) {
|
||||
iotSpeakerDeviceAdminService.update(param);
|
||||
public Result<Void> update(@RequestBody @Validated(ValidationGroup.edit.class) SpeakerDeviceParam param) {
|
||||
speakerDeviceAdminService.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@PermCode(code = "view", nameCn = "云音响查看", nameEn = "Speaker View")
|
||||
@Operation(summary = "云音响设备分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<IotSpeakerDeviceResult>> page(PageParam pageParam, IotSpeakerDeviceQuery query) {
|
||||
return Res.ok(iotSpeakerDeviceAdminService.page(pageParam, query));
|
||||
public Result<PageResult<SpeakerDeviceResult>> page(PageParam pageParam, SpeakerDeviceQuery query) {
|
||||
return Res.ok(speakerDeviceAdminService.page(pageParam, query));
|
||||
}
|
||||
|
||||
@PermCode(code = "view", nameCn = "云音响查看", nameEn = "Speaker View")
|
||||
@Operation(summary = "根据id查询云音响设备")
|
||||
@GetMapping("/get")
|
||||
public Result<IotSpeakerDeviceResult> findById(@NotNull(message = "{validation.field.id.notNull}") Long id) {
|
||||
return Res.ok(iotSpeakerDeviceAdminService.findById(id));
|
||||
public Result<SpeakerDeviceResult> findById(@NotNull(message = "{validation.field.id.notNull}") Long id) {
|
||||
return Res.ok(speakerDeviceAdminService.findById(id));
|
||||
}
|
||||
|
||||
@PermCode(code = "delete", nameCn = "云音响删除", nameEn = "Speaker Delete")
|
||||
@Operation(summary = "删除云音响设备")
|
||||
@PostMapping("/delete")
|
||||
public Result<Void> delete(@NotNull(message = "{validation.field.id.notNull}") Long id) {
|
||||
iotSpeakerDeviceAdminService.delete(id);
|
||||
speakerDeviceAdminService.delete(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class IotSpeakerDeviceAdminController {
|
||||
@Operation(summary = "绑定云音响设备")
|
||||
@PostMapping("/bind")
|
||||
public Result<Void> bind(@NotNull(message = "{validation.field.id.notNull}") Long id) {
|
||||
iotSpeakerDeviceAdminService.bind(id);
|
||||
speakerDeviceAdminService.bind(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class IotSpeakerDeviceAdminController {
|
||||
@Operation(summary = "解绑云音响设备")
|
||||
@PostMapping("/unbind")
|
||||
public Result<Void> unbind(@NotNull(message = "{validation.field.id.notNull}") Long id) {
|
||||
iotSpeakerDeviceAdminService.unbind(id);
|
||||
speakerDeviceAdminService.unbind(id);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package cn.daxpay.open.payment.admin.iot.speaker.service;
|
||||
package cn.daxpay.open.payment.admin.device.speaker.service;
|
||||
|
||||
import cn.daxpay.open.payment.iot.speaker.dao.IotSpeakerDeviceManager;
|
||||
import cn.daxpay.open.payment.iot.speaker.entity.IotSpeakerDevice;
|
||||
import cn.daxpay.open.payment.iot.speaker.enums.IotDeviceStatusEnum;
|
||||
import cn.daxpay.open.payment.iot.speaker.param.IotSpeakerDeviceParam;
|
||||
import cn.daxpay.open.payment.iot.speaker.param.IotSpeakerDeviceQuery;
|
||||
import cn.daxpay.open.payment.iot.speaker.result.IotSpeakerDeviceResult;
|
||||
import cn.daxpay.open.payment.device.enums.DeviceStatusEnum;
|
||||
import cn.daxpay.open.payment.device.speaker.dao.SpeakerDeviceManager;
|
||||
import cn.daxpay.open.payment.device.speaker.entity.SpeakerDevice;
|
||||
import cn.daxpay.open.payment.device.speaker.param.SpeakerDeviceParam;
|
||||
import cn.daxpay.open.payment.device.speaker.param.SpeakerDeviceQuery;
|
||||
import cn.daxpay.open.payment.device.speaker.result.SpeakerDeviceResult;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.daxpay.open.platform.core.code.CommonCode;
|
||||
import cn.daxpay.open.platform.core.exception.DataNotExistException;
|
||||
@@ -25,19 +25,19 @@ import java.time.OffsetDateTime;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class IotSpeakerDeviceAdminService {
|
||||
public class SpeakerDeviceAdminService {
|
||||
|
||||
private final IotSpeakerDeviceManager iotSpeakerDeviceManager;
|
||||
private final SpeakerDeviceManager speakerDeviceManager;
|
||||
|
||||
/// 新增设备(默认未绑定状态)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(IotSpeakerDeviceParam param) {
|
||||
public void add(SpeakerDeviceParam param) {
|
||||
// 校验设备SN唯一
|
||||
if (iotSpeakerDeviceManager.existsByDeviceSn(param.getDeviceSn(), null)) {
|
||||
if (speakerDeviceManager.existsByDeviceSn(param.getDeviceSn(), null)) {
|
||||
// 云音响: 设备序列号已存在
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.iot.speaker.deviceSnExists");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.device.speaker.deviceSnExists");
|
||||
}
|
||||
IotSpeakerDevice entity = new IotSpeakerDevice()
|
||||
SpeakerDevice entity = new SpeakerDevice()
|
||||
.setMchNo(param.getMchNo())
|
||||
.setDeviceSn(param.getDeviceSn())
|
||||
.setImei(param.getImei())
|
||||
@@ -45,20 +45,20 @@ public class IotSpeakerDeviceAdminService {
|
||||
.setDeviceName(param.getDeviceName())
|
||||
.setRemark(param.getRemark())
|
||||
// 新增默认未绑定
|
||||
.setStatus(IotDeviceStatusEnum.UNBOUND.getCode());
|
||||
iotSpeakerDeviceManager.save(entity);
|
||||
.setStatus(DeviceStatusEnum.UNBOUND.getCode());
|
||||
speakerDeviceManager.save(entity);
|
||||
}
|
||||
|
||||
/// 修改设备
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(IotSpeakerDeviceParam param) {
|
||||
IotSpeakerDevice entity = iotSpeakerDeviceManager.findById(param.getId())
|
||||
public void update(SpeakerDeviceParam param) {
|
||||
SpeakerDevice entity = speakerDeviceManager.findById(param.getId())
|
||||
// 云音响: 设备不存在
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceNotFound"));
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceNotFound"));
|
||||
// SN 变更时校验唯一
|
||||
if (!entity.getDeviceSn().equals(param.getDeviceSn())
|
||||
&& iotSpeakerDeviceManager.existsByDeviceSn(param.getDeviceSn(), param.getId())) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.iot.speaker.deviceSnExists");
|
||||
&& speakerDeviceManager.existsByDeviceSn(param.getDeviceSn(), param.getId())) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.device.speaker.deviceSnExists");
|
||||
}
|
||||
entity.setMchNo(param.getMchNo())
|
||||
.setDeviceSn(param.getDeviceSn())
|
||||
@@ -66,45 +66,45 @@ public class IotSpeakerDeviceAdminService {
|
||||
.setShopId(param.getShopId())
|
||||
.setDeviceName(param.getDeviceName())
|
||||
.setRemark(param.getRemark());
|
||||
iotSpeakerDeviceManager.updateById(entity);
|
||||
speakerDeviceManager.updateById(entity);
|
||||
}
|
||||
|
||||
/// 分页
|
||||
public PageResult<IotSpeakerDeviceResult> page(PageParam pageParam, IotSpeakerDeviceQuery query) {
|
||||
return MpUtil.toPageResult(iotSpeakerDeviceManager.page(pageParam, query));
|
||||
public PageResult<SpeakerDeviceResult> page(PageParam pageParam, SpeakerDeviceQuery query) {
|
||||
return MpUtil.toPageResult(speakerDeviceManager.page(pageParam, query));
|
||||
}
|
||||
|
||||
/// 根据id查询
|
||||
public IotSpeakerDeviceResult findById(Long id) {
|
||||
return iotSpeakerDeviceManager.findById(id)
|
||||
public SpeakerDeviceResult findById(Long id) {
|
||||
return speakerDeviceManager.findById(id)
|
||||
// 云音响: 设备不存在
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceNotFound"))
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceNotFound"))
|
||||
.toResult();
|
||||
}
|
||||
|
||||
/// 删除
|
||||
public void delete(Long id) {
|
||||
iotSpeakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceNotFound"));
|
||||
iotSpeakerDeviceManager.deleteById(id);
|
||||
speakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceNotFound"));
|
||||
speakerDeviceManager.deleteById(id);
|
||||
}
|
||||
|
||||
/// 绑定设备(首期仅更新本地状态为在线, 真实商米对接由独立服务完成)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bind(Long id) {
|
||||
IotSpeakerDevice entity = iotSpeakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceNotFound"));
|
||||
entity.setStatus(IotDeviceStatusEnum.ONLINE.getCode())
|
||||
SpeakerDevice entity = speakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceNotFound"));
|
||||
entity.setStatus(DeviceStatusEnum.ONLINE.getCode())
|
||||
.setBindTime(OffsetDateTime.now());
|
||||
iotSpeakerDeviceManager.updateById(entity);
|
||||
speakerDeviceManager.updateById(entity);
|
||||
}
|
||||
|
||||
/// 解绑设备(首期仅更新本地状态为未绑定)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unbind(Long id) {
|
||||
IotSpeakerDevice entity = iotSpeakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceNotFound"));
|
||||
entity.setStatus(IotDeviceStatusEnum.UNBOUND.getCode());
|
||||
iotSpeakerDeviceManager.updateById(entity);
|
||||
SpeakerDevice entity = speakerDeviceManager.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceNotFound"));
|
||||
entity.setStatus(DeviceStatusEnum.UNBOUND.getCode());
|
||||
speakerDeviceManager.updateById(entity);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.enums;
|
||||
package cn.daxpay.open.payment.device.enums;
|
||||
|
||||
import cn.daxpay.open.platform.core.exception.DataNotExistException;
|
||||
import cn.daxpay.open.platform.core.i18n.I18nSupport;
|
||||
@@ -7,12 +7,13 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/// # 云音响设备状态
|
||||
/// # 设备状态
|
||||
///
|
||||
/// 字典: iot_speaker_device_status
|
||||
/// 通用设备状态字典, 适用于云音响/云打印等各类设备。
|
||||
/// 字典: device_status
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum IotDeviceStatusEnum implements I18nSupport {
|
||||
public enum DeviceStatusEnum implements I18nSupport {
|
||||
|
||||
/// 未绑定
|
||||
UNBOUND("unbound"),
|
||||
@@ -29,15 +30,15 @@ public enum IotDeviceStatusEnum implements I18nSupport {
|
||||
/// 翻译 key 前缀
|
||||
@Override
|
||||
public String getI18nPrefix() {
|
||||
return "enum.iot_speaker_device_status";
|
||||
return "enum.device_status";
|
||||
}
|
||||
|
||||
/// 根据编码查找
|
||||
public static IotDeviceStatusEnum findByCode(String code) {
|
||||
public static DeviceStatusEnum findByCode(String code) {
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getCode().equals(code))
|
||||
.findFirst()
|
||||
// 通用: 未找到对应的云音响设备状态: {0}
|
||||
.orElseThrow(() -> new DataNotExistException("error.iot.speaker.deviceStatusNotFound", code));
|
||||
// 通用: 未找到对应的设备状态: {0}
|
||||
.orElseThrow(() -> new DataNotExistException("error.device.speaker.deviceStatusNotFound", code));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.dao;
|
||||
package cn.daxpay.open.payment.device.speaker.dao;
|
||||
|
||||
import cn.daxpay.open.payment.iot.speaker.entity.IotSpeakerDevice;
|
||||
import cn.daxpay.open.payment.iot.speaker.param.IotSpeakerDeviceQuery;
|
||||
import cn.daxpay.open.payment.device.speaker.entity.SpeakerDevice;
|
||||
import cn.daxpay.open.payment.device.speaker.param.SpeakerDeviceQuery;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.util.MpUtil;
|
||||
@@ -19,25 +19,25 @@ import java.util.Optional;
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class IotSpeakerDeviceManager extends BaseManager<IotSpeakerDeviceMapper, IotSpeakerDevice> {
|
||||
public class SpeakerDeviceManager extends BaseManager<SpeakerDeviceMapper, SpeakerDevice> {
|
||||
|
||||
/// 根据设备SN查询
|
||||
public Optional<IotSpeakerDevice> findByDeviceSn(String deviceSn) {
|
||||
return findByField(IotSpeakerDevice::getDeviceSn, deviceSn);
|
||||
public Optional<SpeakerDevice> findByDeviceSn(String deviceSn) {
|
||||
return findByField(SpeakerDevice::getDeviceSn, deviceSn);
|
||||
}
|
||||
|
||||
/// 判断设备SN是否存在(排除指定id, excludeId 为 null 时不排除)
|
||||
public boolean existsByDeviceSn(String deviceSn, Long excludeId) {
|
||||
if (excludeId == null) {
|
||||
return existedByField(IotSpeakerDevice::getDeviceSn, deviceSn);
|
||||
return existedByField(SpeakerDevice::getDeviceSn, deviceSn);
|
||||
}
|
||||
return existedByField(IotSpeakerDevice::getDeviceSn, deviceSn, excludeId);
|
||||
return existedByField(SpeakerDevice::getDeviceSn, deviceSn, excludeId);
|
||||
}
|
||||
|
||||
/// 分页
|
||||
public Page<IotSpeakerDevice> page(PageParam pageParam, IotSpeakerDeviceQuery query) {
|
||||
Page<IotSpeakerDevice> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<IotSpeakerDevice> wrapper = QueryGenerator.generator(query);
|
||||
public Page<SpeakerDevice> page(PageParam pageParam, SpeakerDeviceQuery query) {
|
||||
Page<SpeakerDevice> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<SpeakerDevice> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.daxpay.open.payment.device.speaker.dao;
|
||||
|
||||
import cn.daxpay.open.payment.device.speaker.entity.SpeakerDevice;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/// # 云音响设备
|
||||
@Mapper
|
||||
public interface SpeakerDeviceMapper extends MPJBaseMapper<SpeakerDevice> {
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.entity;
|
||||
package cn.daxpay.open.payment.device.speaker.entity;
|
||||
|
||||
import cn.daxpay.open.payment.iot.speaker.enums.IotDeviceStatusEnum;
|
||||
import cn.daxpay.open.payment.iot.speaker.result.IotSpeakerDeviceResult;
|
||||
import cn.daxpay.open.payment.device.enums.DeviceStatusEnum;
|
||||
import cn.daxpay.open.payment.device.speaker.result.SpeakerDeviceResult;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.function.ToResult;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -17,8 +17,8 @@ import java.time.OffsetDateTime;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("iot_speaker_device")
|
||||
public class IotSpeakerDevice extends MpBaseEntity implements ToResult<IotSpeakerDeviceResult> {
|
||||
@TableName("device_speaker")
|
||||
public class SpeakerDevice extends MpBaseEntity implements ToResult<SpeakerDeviceResult> {
|
||||
|
||||
/// 商户号
|
||||
private String mchNo;
|
||||
@@ -36,7 +36,7 @@ public class IotSpeakerDevice extends MpBaseEntity implements ToResult<IotSpeake
|
||||
private String deviceName;
|
||||
|
||||
/// 设备状态
|
||||
/// @see IotDeviceStatusEnum
|
||||
/// @see DeviceStatusEnum
|
||||
private String status;
|
||||
|
||||
/// 绑定时间
|
||||
@@ -50,8 +50,8 @@ public class IotSpeakerDevice extends MpBaseEntity implements ToResult<IotSpeake
|
||||
|
||||
/// 转换为返回对象
|
||||
@Override
|
||||
public IotSpeakerDeviceResult toResult() {
|
||||
IotSpeakerDeviceResult result = new IotSpeakerDeviceResult()
|
||||
public SpeakerDeviceResult toResult() {
|
||||
SpeakerDeviceResult result = new SpeakerDeviceResult()
|
||||
.setMchNo(mchNo)
|
||||
.setDeviceSn(deviceSn)
|
||||
.setImei(imei)
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.param;
|
||||
package cn.daxpay.open.payment.device.speaker.param;
|
||||
|
||||
import cn.daxpay.open.platform.core.validation.ValidationGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -11,7 +11,7 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "云音响设备")
|
||||
public class IotSpeakerDeviceParam {
|
||||
public class SpeakerDeviceParam {
|
||||
|
||||
/// 主键
|
||||
@Schema(description = "主键")
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.param;
|
||||
package cn.daxpay.open.payment.device.speaker.param;
|
||||
|
||||
import cn.daxpay.open.platform.core.annotation.QueryParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -10,7 +10,7 @@ import lombok.experimental.Accessors;
|
||||
@QueryParam(type = QueryParam.CompareTypeEnum.LIKE)
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "云音响设备查询参数")
|
||||
public class IotSpeakerDeviceQuery {
|
||||
public class SpeakerDeviceQuery {
|
||||
|
||||
/// 商户号
|
||||
@Schema(description = "商户号")
|
||||
@@ -31,7 +31,7 @@ public class IotSpeakerDeviceQuery {
|
||||
private String shopId;
|
||||
|
||||
/// 设备状态
|
||||
/// @see cn.daxpay.open.payment.iot.speaker.enums.IotDeviceStatusEnum
|
||||
/// @see cn.daxpay.open.payment.device.enums.DeviceStatusEnum
|
||||
@Schema(description = "设备状态")
|
||||
@QueryParam(type = QueryParam.CompareTypeEnum.EQ)
|
||||
private String status;
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.result;
|
||||
package cn.daxpay.open.payment.device.speaker.result;
|
||||
|
||||
import cn.daxpay.open.payment.iot.speaker.enums.IotDeviceStatusEnum;
|
||||
import cn.daxpay.open.payment.device.enums.DeviceStatusEnum;
|
||||
import cn.daxpay.open.platform.core.result.BaseResult;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -14,7 +14,7 @@ import java.time.OffsetDateTime;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "云音响设备")
|
||||
public class IotSpeakerDeviceResult extends BaseResult {
|
||||
public class SpeakerDeviceResult extends BaseResult {
|
||||
|
||||
@Schema(description = "商户号")
|
||||
private String mchNo;
|
||||
@@ -32,7 +32,7 @@ public class IotSpeakerDeviceResult extends BaseResult {
|
||||
private String deviceName;
|
||||
|
||||
/// 设备状态
|
||||
/// @see IotDeviceStatusEnum
|
||||
/// @see DeviceStatusEnum
|
||||
@Schema(description = "设备状态(unbound未绑定/online在线/offline离线/fault故障)")
|
||||
private String status;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package cn.daxpay.open.payment.iot.speaker.dao;
|
||||
|
||||
import cn.daxpay.open.payment.iot.speaker.entity.IotSpeakerDevice;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/// # 云音响设备
|
||||
@Mapper
|
||||
public interface IotSpeakerDeviceMapper extends MPJBaseMapper<IotSpeakerDevice> {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"deviceNotFound": "Cloud speaker device not found",
|
||||
"deviceSnExists": "Device serial number already exists",
|
||||
"deviceStatusNotFound": "Cloud speaker device status not found: {0}"
|
||||
"deviceStatusNotFound": "Device status not found: {0}"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"deviceNotFound": "云音响设备不存在",
|
||||
"deviceSnExists": "设备序列号已存在",
|
||||
"deviceStatusNotFound": "未找到对应的云音响设备状态: {0}"
|
||||
"deviceStatusNotFound": "未找到对应的设备状态: {0}"
|
||||
}
|
||||
Reference in New Issue
Block a user