设备激活二维码生成逻辑修改,设备上报基本信息新增接口添加设备编码查重逻辑。

This commit is contained in:
mi9688
2024-12-13 17:55:51 +08:00
parent a96497c954
commit ffbb8bcfe4
7 changed files with 101 additions and 19 deletions

View File

@ -1,5 +1,6 @@
package com.fastbee.iot.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -18,6 +19,7 @@ import com.fastbee.common.core.domain.BaseEntity;
@ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("iot_device_report_info")
public class DeviceReportInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -93,7 +95,7 @@ public class DeviceReportInfo extends BaseEntity
/** 批号 */
@Excel(name = "批号")
@ApiModelProperty("批号")
private Long batchNumber;
private String batchNumber;
/** 设备编号 */
@Excel(name = "设备编号")
@ -125,4 +127,9 @@ public class DeviceReportInfo extends BaseEntity
@ApiModelProperty("代工厂家名称")
private String replaceManufacturerName;
/** 对应设备id */
@Excel(name = "对应设备id")
@ApiModelProperty("对应设备id")
private Long deviceId;
}

View File

@ -1,6 +1,8 @@
package com.fastbee.iot.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.iot.domain.DeviceReportInfo;
import org.apache.ibatis.annotations.Mapper;
@ -12,7 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
* @date 2024-12-05
*/
@Mapper
public interface DeviceReportInfoMapper
public interface DeviceReportInfoMapper extends BaseMapper<DeviceReportInfo>
{
/**
* 查询设备上电审核前上报的基础信息

View File

@ -1,6 +1,9 @@
package com.fastbee.iot.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.iot.mapper.DeviceReportInfoMapper;
@ -56,6 +59,15 @@ public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
@Override
public int insertDeviceReportInfo(DeviceReportInfo deviceReportInfo)
{
//查重
List<DeviceReportInfo> list = new LambdaQueryChainWrapper<>(deviceReportInfoMapper)
.select(DeviceReportInfo::getSerialNumber)
.eq(DeviceReportInfo::getSerialNumber, deviceReportInfo.getSerialNumber())
.list();
System.err.println("查重:"+list);
if (!list.isEmpty()) {
throw new ServiceException("设备编号重复!");
}
return deviceReportInfoMapper.insertDeviceReportInfo(deviceReportInfo);
}