设备上电审核前上报的基础信息表管理接口

This commit is contained in:
mi9688 2024-12-05 15:53:52 +08:00
parent 79cdd499f7
commit 6aaed01915
21 changed files with 627 additions and 61 deletions

View File

@ -75,6 +75,7 @@ spring:
password: fastbee # 密码
host-url: tcp://localhost:1883 # mqtt连接tcp地址
client-id: ${random.int} # 客户端Id不能相同采用随机数 ${random.value}
# client-id: mqttx_22ee8d0f # 客户端Id不能相同采用随机数 ${random.value}
default-topic: test # 默认主题
timeout: 30 # 超时时间
keepalive: 30 # 保持连接

View File

@ -27,6 +27,8 @@ public enum TopicType {
SERVICE_INVOKE_REPLY(0,8,"/service/reply", "订阅功能调用返回结果"),
FIRMWARE_UPGRADE_REPLY(0,9,"/upgrade/reply", "订阅设备OTA升级结果"),
MESSAGE_POST(0,26,"/message/post","订阅设备上报消息"),
//测试主题
TEST_TOPIC(0,27,"/topic/test","测试主题"),
/*** 通用设备订阅主题(平台下发)***/
FUNCTION_GET(1,17,"/function/get", "发布功能"),

View File

@ -157,7 +157,7 @@ public class TopicsUtils {
public String parseTopicName(String topic) {
String[] values = topic.split("/");
if (values.length >2){
return "/"+ values[3] + "/" + values[4];
return "/"+ values[2] + "/" + values[3];
}else {
return null;
}

View File

@ -1,5 +1,7 @@
package com.fastbee.mq.redischannel.consumer;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.fastbee.common.constant.FastBeeConstant;
import com.fastbee.common.core.mq.DeviceReportBo;
import com.fastbee.mq.service.impl.DeviceOtherMsgHandler;
@ -9,6 +11,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
/**
* @author gsb
@ -25,7 +28,53 @@ public class DeviceOtherMsgConsumer {
public void consume(DeviceReportBo bo){
try {
//处理emq订阅的非 property/post 属性上报的消息 因为其他消息量小放在一起处理
otherMsgHandler.messageHandler(bo);
String serialNumber;//设备序列号
Long packetId;//包号
byte[] data = bo.getData();//数据
String topic;//主题
System.err.println("接收到数据:"+ new String(data));
//解析
String jsonString = "{\"type\": \"waterEleData\", \"pakSn\": 123, \"data\": {\"workState\": 1, \"action\": \"startPump\", \"mcuSn\": \"MCU123456\", \"sumEle\": 5000, \"sumFlow\": 3000, \"insFlow\": 2.5, \"userSumFlow\": 1500, \"areaCode\": \"010\", \"cardId\": \"CARD12345678\", \"userBalance\": 100.0, \"userSumEle\": 3000, \"curEle\": 50, \"curFlow\": 200, \"insPower\": 2300}}";
JSONObject entries = JSONUtil.parseObj(jsonString);
System.err.println("解析后:"+entries);
//获取帧标识
String type = entries.getStr("type");
//获取帧号
Long pakSn = entries.getLong("pakSn");
//获取数据
JSONObject dataObj = entries.getJSONObject("data");
//获取水泵状态0=关泵,1=开泵
Integer workState = dataObj.getInt("workState");
//获取动作
String action = dataObj.getStr("action");
//获取单片机编码
String mcuSn = dataObj.getStr("mcuSn");
//获取累计用电量
Integer sumEle = dataObj.getInt("sumEle");
//获取累计用水量
Integer sumFlow = dataObj.getInt("sumFlow");
//获取瞬时流量
Double insFlow = dataObj.getDouble("insFlow");
//当前用户累计用水量
Integer userSumFlow = dataObj.getInt("userSumFlow");
//获取区域号
String areaCode = dataObj.getStr("areaCode");
//获取卡号
String cardId = dataObj.getStr("cardId");
//获取用户余额
Double userBalance = dataObj.getDouble("userBalance");
//获取用户累计用电量
Integer userSumEle = dataObj.getInt("userSumEle");
//获取本次用电量
Integer curEle = dataObj.getInt("curEle");
//获取本次用水量
Integer curFlow = dataObj.getInt("curFlow");
//获取瞬时功率
Integer insPower = dataObj.getInt("insPower");
// otherMsgHandler.messageHandler(bo);
}catch (Exception e){
log.error("=>设备其他消息处理出错",e);
}

View File

@ -4,6 +4,7 @@ import com.fastbee.common.core.mq.DeviceReportBo;
import com.fastbee.common.enums.TopicType;
import com.fastbee.common.utils.StringUtils;
import com.fastbee.common.utils.gateway.mq.TopicsUtils;
import com.fastbee.jsonchenyi.JsonChenYiProtocolService;
import com.fastbee.mq.model.ReportDataBo;
import com.fastbee.mq.service.IDataHandler;
import com.fastbee.mq.service.IMqttMessagePublish;
@ -41,6 +42,7 @@ public class DeviceOtherMsgHandler {
* @param bo
*/
public void messageHandler(DeviceReportBo bo) {
System.err.println("进入消息处理入口:"+bo);
String type = "";
String name = topicsUtils.parseTopicName(bo.getTopicName());
if (StringUtils.isEmpty(name) || name.endsWith(TopicType.FUNCTION_GET.getTopicSuffix())) return;
@ -65,6 +67,7 @@ public class DeviceOtherMsgHandler {
dataHandler.reportEvent(data);
break;
}
}
/**

View File

@ -61,7 +61,8 @@
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.fastbee</groupId>-->
<!-- <artifactId>fastbee-project-service</artifactId>-->
<!-- </dependency>-->

View File

@ -0,0 +1,110 @@
package com.fastbee.data.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.iot.domain.DeviceReportInfo;
import com.fastbee.iot.service.IDeviceReportInfoService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;
/**
* 设备上电审核前上报的基础信息Controller
*
* @author kerwincui
* @date 2024-12-05
*/
@RestController
@RequestMapping("/iot/info")
@Api(tags = "设备上电审核前上报的基础信息")
public class DeviceReportInfoController extends BaseController
{
@Autowired
private IDeviceReportInfoService deviceReportInfoService;
/**
* 查询设备上电审核前上报的基础信息列表
*/
@PreAuthorize("@ss.hasPermi('iot:info:list')")
@GetMapping("/list")
@ApiOperation("查询设备上电审核前上报的基础信息列表")
public TableDataInfo list(DeviceReportInfo deviceReportInfo)
{
startPage();
List<DeviceReportInfo> list = deviceReportInfoService.selectDeviceReportInfoList(deviceReportInfo);
return getDataTable(list);
}
/**
* 导出设备上电审核前上报的基础信息列表
*/
@ApiOperation("导出设备上电审核前上报的基础信息列表")
@PreAuthorize("@ss.hasPermi('iot:info:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, DeviceReportInfo deviceReportInfo)
{
List<DeviceReportInfo> list = deviceReportInfoService.selectDeviceReportInfoList(deviceReportInfo);
ExcelUtil<DeviceReportInfo> util = new ExcelUtil<DeviceReportInfo>(DeviceReportInfo.class);
util.exportExcel(response, list, "设备上电审核前上报的基础信息数据");
}
/**
* 获取设备上电审核前上报的基础信息详细信息
*/
@PreAuthorize("@ss.hasPermi('iot:info:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取设备上电审核前上报的基础信息详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(deviceReportInfoService.selectDeviceReportInfoById(id));
}
/**
* 新增设备上电审核前上报的基础信息
*/
@PreAuthorize("@ss.hasPermi('iot:info:add')")
@PostMapping
@ApiOperation("新增设备上电审核前上报的基础信息")
public AjaxResult add(@RequestBody DeviceReportInfo deviceReportInfo)
{
return toAjax(deviceReportInfoService.insertDeviceReportInfo(deviceReportInfo));
}
/**
* 修改设备上电审核前上报的基础信息
*/
@PreAuthorize("@ss.hasPermi('iot:info:edit')")
@PutMapping
@ApiOperation("修改设备上电审核前上报的基础信息")
public AjaxResult edit(@RequestBody DeviceReportInfo deviceReportInfo)
{
return toAjax(deviceReportInfoService.updateDeviceReportInfo(deviceReportInfo));
}
/**
* 删除设备上电审核前上报的基础信息
*/
@PreAuthorize("@ss.hasPermi('iot:info:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除设备上电审核前上报的基础信息")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceReportInfoService.deleteDeviceReportInfoByIds(ids));
}
}

View File

@ -115,9 +115,9 @@ public class DeviceInfoController extends BaseController {
}
/**
* 查询虫情设备列表
* 查询气象设备列表
*/
@GetMapping("/wormList")
@GetMapping("/weatherList")
public AjaxResult getDeviceList() {
LambdaQueryWrapper<DeviceInformationMeteorology> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(DeviceInformationMeteorology::getId,DeviceInformationMeteorology::getName,
@ -125,10 +125,11 @@ public class DeviceInfoController extends BaseController {
return success(deviceInformationMeteorologyMapper.selectList(queryWrapper));
}
/**
* 查询气象设备列表
* 查询虫情设备列表
*/
@GetMapping("/weatherList")
@GetMapping("/wormList")
public AjaxResult getWeatherList() {
LambdaQueryWrapper<DeviceInformationWorms> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(DeviceInformationWorms::getId,DeviceInformationWorms::getName,

View File

@ -18,6 +18,7 @@ import java.util.Arrays;
@Data
@NoArgsConstructor
public class PubMqttCallBack implements MqttCallbackExtended {
/**
* mqtt客户端
*/
@ -76,6 +77,7 @@ public class PubMqttCallBack implements MqttCallbackExtended {
@Override
public void messageArrived(String topic, MqttMessage message) throws Exception {
// subscribe后得到的消息会执行到这里面
System.err.println("接收消息主题:" + topic + " 消息内容:" + new String(message.getPayload()));
try {
listener.messageArrived(topic, message);
} catch (Exception e) {

View File

@ -58,6 +58,7 @@ public class PubMqttClient {
}
log.debug("=>内部mqtt客户端连接中...");
Thread.sleep(20000);
// publish(1,true,"/topic/test","mqtt测试主题发布消息");
}
} catch (MqttException ex) {
log.error("=>MQTT客户端初始化异常", ex);

View File

@ -52,6 +52,7 @@ public class AuthService {
* @return 结果
*/
public boolean auth(String clientId, String username, String password,String serialNumber) {
/*认证次数*/
redisCache.incr2(FastBeeConstant.REDIS.MESSAGE_AUTH_TOTAL, -1L);
if (StringUtils.isEmpty(clientId) || StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {

View File

@ -108,7 +108,6 @@ public class AgricultureCropYieldServiceImpl implements IAgricultureCropYieldSer
Map<String, List<AgricultureCropYield>> collect = list.stream().collect(Collectors.groupingBy(AgricultureCropYield::getHarvestMonth));
List<HashMap<String, Object>> result = new ArrayList<>();
collect.forEach((month, cropYieldList) -> {
System.out.println("月份: " + month);
HashMap<String, Object> props = new HashMap<>();
props.put("name", month+"");
props.put("value",cropYieldList.get(0).getYieldValue());

View File

@ -1,18 +1,15 @@
package com.fastbee.ggroup.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.domain.dto.GSiteDeviceDto;
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
import com.fastbee.ggroup.mapper.GSitesMapper;
import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.Group;
import com.fastbee.iot.mapper.DeviceMapper;
import com.fastbee.iot.mapper.GroupMapper;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -0,0 +1,93 @@
package com.fastbee.iot.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 设备上电审核前上报的基础信息对象 iot_device_report_info
*
* @author kerwincui
* @date 2024-12-05
*/
@ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info")
@Data
@EqualsAndHashCode(callSuper = true)
public class DeviceReportInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 模组IMEI号 */
@Excel(name = "模组IMEI号")
@ApiModelProperty("模组IMEI号")
private String imei;
/** 流量卡iccid */
@Excel(name = "流量卡iccid")
@ApiModelProperty("流量卡iccid")
private String iccid;
/** MCU唯一id */
@Excel(name = "MCU唯一id")
@ApiModelProperty("MCU唯一id")
private String mcuId;
/** 硬件板型 */
@Excel(name = "硬件板型")
@ApiModelProperty("硬件板型")
private String bspType;
/** 模组型号 */
@Excel(name = "模组型号")
@ApiModelProperty("模组型号")
private String lteType;
/** MCU型号 */
@Excel(name = "MCU型号")
@ApiModelProperty("MCU型号")
private String mcuType;
/** MCU固件包含了固件的名称和版本 */
@Excel(name = "MCU固件包含了固件的名称和版本")
@ApiModelProperty("MCU固件包含了固件的名称和版本")
private String mcufw;
/** 模组固件,包含了固件的名称和版本 */
@Excel(name = "模组固件,包含了固件的名称和版本")
@ApiModelProperty("模组固件,包含了固件的名称和版本")
private String ltefw;
/** 显示屏厂家上报123等类似的数值通过后台进行录入数值和显示屏厂家对应关系例1对应GT2116 */
@Excel(name = "显示屏厂家上报123等类似的数值通过后台进行录入数值和显示屏厂家对应关系例1对应GT2116")
@ApiModelProperty("显示屏厂家上报123等类似的数值通过后台进行录入数值和显示屏厂家对应关系例1对应GT2116")
private Long lcdManufacturer;
/** 语音厂家上报123等类似的数值通过后台进行录入数值和语音厂家对应关系例1对应 */
@Excel(name = "语音厂家上报123等类似的数值通过后台进行录入数值和语音厂家对应关系例1对应")
@ApiModelProperty("语音厂家上报123等类似的数值通过后台进行录入数值和语音厂家对应关系例1对应")
private Long voiceManufacturer;
/** FRAM型号 */
@Excel(name = "FRAM型号")
@ApiModelProperty("FRAM型号")
private String framModel;
/** 代工厂家上报123等类似的数值通过后台进行录入数值和代工厂家对应关系例1对应 */
@Excel(name = "代工厂家上报123等类似的数值通过后台进行录入数值和代工厂家对应关系例1对应")
@ApiModelProperty("代工厂家上报123等类似的数值通过后台进行录入数值和代工厂家对应关系例1对应")
private Long replaceManufacturer;
/** 记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息 */
@Excel(name = "记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息")
@ApiModelProperty("记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息")
private String testRecord;
}

View File

@ -0,0 +1,64 @@
package com.fastbee.iot.mapper;
import java.util.List;
import com.fastbee.iot.domain.DeviceReportInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* 设备上电审核前上报的基础信息Mapper接口
*
* @author kerwincui
* @date 2024-12-05
*/
@Mapper
public interface DeviceReportInfoMapper
{
/**
* 查询设备上电审核前上报的基础信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 设备上电审核前上报的基础信息
*/
public DeviceReportInfo selectDeviceReportInfoById(Long id);
/**
* 查询设备上电审核前上报的基础信息列表
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 设备上电审核前上报的基础信息集合
*/
public List<DeviceReportInfo> selectDeviceReportInfoList(DeviceReportInfo deviceReportInfo);
/**
* 新增设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
public int insertDeviceReportInfo(DeviceReportInfo deviceReportInfo);
/**
* 修改设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
public int updateDeviceReportInfo(DeviceReportInfo deviceReportInfo);
/**
* 删除设备上电审核前上报的基础信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 结果
*/
public int deleteDeviceReportInfoById(Long id);
/**
* 批量删除设备上电审核前上报的基础信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeviceReportInfoByIds(Long[] ids);
}

View File

@ -2,8 +2,12 @@ package com.fastbee.iot.model;
import com.fastbee.common.annotation.Excel;
import lombok.Getter;
public class ProductAuthenticateModel {
import java.io.Serializable;
@Getter
public class ProductAuthenticateModel implements Serializable {
/** 产品分类ID */
private Long deviceId;
@ -39,98 +43,50 @@ public class ProductAuthenticateModel {
private int vertificateMethod;
public int getVertificateMethod() {
return vertificateMethod;
}
public void setVertificateMethod(int vertificateMethod) {
this.vertificateMethod = vertificateMethod;
}
public Integer getIsAuthorize() {
return isAuthorize;
}
public void setIsAuthorize(Integer isAuthorize) {
this.isAuthorize = isAuthorize;
}
public int getProductStatus() {
return productStatus;
}
public void setProductStatus(int productStatus) {
this.productStatus = productStatus;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getMqttAccount() {
return mqttAccount;
}
public void setMqttAccount(String mqttAccount) {
this.mqttAccount = mqttAccount;
}
public String getMqttPassword() {
return mqttPassword;
}
public void setMqttPassword(String mqttPassword) {
this.mqttPassword = mqttPassword;
}
public String getMqttSecret() {
return mqttSecret;
}
public void setMqttSecret(String mqttSecret) {
this.mqttSecret = mqttSecret;
}

View File

@ -29,6 +29,11 @@ public class MqttClientFactory {
return client;
}
/**
* 创建mqtt实例
* @param config
* @return
*/
public static MqttAsyncClient instanceNew(MqttClientConfig config) {
MqttAsyncClient client = null;
try {
@ -40,12 +45,18 @@ public class MqttClientFactory {
options.setAutomaticReconnect(true);
IMqttToken token = client.connect(options);
token.waitForCompletion();
log.info("=>mqtt客户端创建成功!!!!!key{}host{}", config.getKey(), config.getHostUrl());
} catch (MqttException e) {
log.error("=>mqtt客户端创建错误原因" + e.getMessage());
}
return client;
}
/**
* 添加订阅
* @param key key
* @param topic 主题
*/
public static void addSubscribe(String key, String topic) {
try {
MqttAsyncClient client = CLIENT_CACHE.get(key);
@ -66,6 +77,11 @@ public class MqttClientFactory {
}
}
/**
* 取消订阅
* @param key key
* @param topic 主题
*/
public static void delSubscribe(String key, String topic) {
try {
MqttAsyncClient client = CLIENT_CACHE.get(key);

View File

@ -0,0 +1,61 @@
package com.fastbee.iot.service;
import java.util.List;
import com.fastbee.iot.domain.DeviceReportInfo;
/**
* 设备上电审核前上报的基础信息Service接口
*
* @author kerwincui
* @date 2024-12-05
*/
public interface IDeviceReportInfoService
{
/**
* 查询设备上电审核前上报的基础信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 设备上电审核前上报的基础信息
*/
public DeviceReportInfo selectDeviceReportInfoById(Long id);
/**
* 查询设备上电审核前上报的基础信息列表
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 设备上电审核前上报的基础信息集合
*/
public List<DeviceReportInfo> selectDeviceReportInfoList(DeviceReportInfo deviceReportInfo);
/**
* 新增设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
public int insertDeviceReportInfo(DeviceReportInfo deviceReportInfo);
/**
* 修改设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
public int updateDeviceReportInfo(DeviceReportInfo deviceReportInfo);
/**
* 批量删除设备上电审核前上报的基础信息
*
* @param ids 需要删除的设备上电审核前上报的基础信息主键集合
* @return 结果
*/
public int deleteDeviceReportInfoByIds(Long[] ids);
/**
* 删除设备上电审核前上报的基础信息信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 结果
*/
public int deleteDeviceReportInfoById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.fastbee.iot.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.iot.mapper.DeviceReportInfoMapper;
import com.fastbee.iot.domain.DeviceReportInfo;
import com.fastbee.iot.service.IDeviceReportInfoService;
/**
* 设备上电审核前上报的基础信息Service业务层处理
*
* @author kerwincui
* @date 2024-12-05
*/
@Service
public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
{
@Autowired
private DeviceReportInfoMapper deviceReportInfoMapper;
/**
* 查询设备上电审核前上报的基础信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 设备上电审核前上报的基础信息
*/
@Override
public DeviceReportInfo selectDeviceReportInfoById(Long id)
{
return deviceReportInfoMapper.selectDeviceReportInfoById(id);
}
/**
* 查询设备上电审核前上报的基础信息列表
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 设备上电审核前上报的基础信息
*/
@Override
public List<DeviceReportInfo> selectDeviceReportInfoList(DeviceReportInfo deviceReportInfo)
{
return deviceReportInfoMapper.selectDeviceReportInfoList(deviceReportInfo);
}
/**
* 新增设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
@Override
public int insertDeviceReportInfo(DeviceReportInfo deviceReportInfo)
{
return deviceReportInfoMapper.insertDeviceReportInfo(deviceReportInfo);
}
/**
* 修改设备上电审核前上报的基础信息
*
* @param deviceReportInfo 设备上电审核前上报的基础信息
* @return 结果
*/
@Override
public int updateDeviceReportInfo(DeviceReportInfo deviceReportInfo)
{
return deviceReportInfoMapper.updateDeviceReportInfo(deviceReportInfo);
}
/**
* 批量删除设备上电审核前上报的基础信息
*
* @param ids 需要删除的设备上电审核前上报的基础信息主键
* @return 结果
*/
@Override
public int deleteDeviceReportInfoByIds(Long[] ids)
{
return deviceReportInfoMapper.deleteDeviceReportInfoByIds(ids);
}
/**
* 删除设备上电审核前上报的基础信息信息
*
* @param id 设备上电审核前上报的基础信息主键
* @return 结果
*/
@Override
public int deleteDeviceReportInfoById(Long id)
{
return deviceReportInfoMapper.deleteDeviceReportInfoById(id);
}
}

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.iot.mapper.DeviceReportInfoMapper">
<resultMap type="DeviceReportInfo" id="DeviceReportInfoResult">
<result property="id" column="id" />
<result property="imei" column="imei" />
<result property="iccid" column="iccid" />
<result property="mcuId" column="mcu_id" />
<result property="bspType" column="bsp_type" />
<result property="lteType" column="lte_type" />
<result property="mcuType" column="mcu_type" />
<result property="mcufw" column="mcuFw" />
<result property="ltefw" column="lteFw" />
<result property="lcdManufacturer" column="lcd_manufacturer" />
<result property="voiceManufacturer" column="voice_manufacturer" />
<result property="framModel" column="fram_model" />
<result property="replaceManufacturer" column="replace_manufacturer" />
<result property="testRecord" column="test_record" />
</resultMap>
<sql id="selectDeviceReportInfoVo">
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcuFw, lteFw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record from iot_device_report_info
</sql>
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
<include refid="selectDeviceReportInfoVo"/>
<where>
<if test="imei != null and imei != ''"> and imei = #{imei}</if>
<if test="iccid != null and iccid != ''"> and iccid = #{iccid}</if>
<if test="mcuId != null and mcuId != ''"> and mcu_id = #{mcuId}</if>
<if test="bspType != null and bspType != ''"> and bsp_type = #{bspType}</if>
<if test="lteType != null and lteType != ''"> and lte_type = #{lteType}</if>
<if test="mcuType != null and mcuType != ''"> and mcu_type = #{mcuType}</if>
<if test="mcufw != null and mcufw != ''"> and mcuFw = #{mcufw}</if>
<if test="ltefw != null and ltefw != ''"> and lteFw = #{ltefw}</if>
<if test="lcdManufacturer != null "> and lcd_manufacturer = #{lcdManufacturer}</if>
<if test="voiceManufacturer != null "> and voice_manufacturer = #{voiceManufacturer}</if>
<if test="framModel != null and framModel != ''"> and fram_model = #{framModel}</if>
<if test="replaceManufacturer != null "> and replace_manufacturer = #{replaceManufacturer}</if>
<if test="testRecord != null and testRecord != ''"> and test_record = #{testRecord}</if>
</where>
</select>
<select id="selectDeviceReportInfoById" parameterType="Long" resultMap="DeviceReportInfoResult">
<include refid="selectDeviceReportInfoVo"/>
where id = #{id}
</select>
<insert id="insertDeviceReportInfo" parameterType="DeviceReportInfo" useGeneratedKeys="true" keyProperty="id">
insert into iot_device_report_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="imei != null and imei != ''">imei,</if>
<if test="iccid != null and iccid != ''">iccid,</if>
<if test="mcuId != null and mcuId != ''">mcu_id,</if>
<if test="bspType != null and bspType != ''">bsp_type,</if>
<if test="lteType != null and lteType != ''">lte_type,</if>
<if test="mcuType != null and mcuType != ''">mcu_type,</if>
<if test="mcufw != null and mcufw != ''">mcuFw,</if>
<if test="ltefw != null and ltefw != ''">lteFw,</if>
<if test="lcdManufacturer != null">lcd_manufacturer,</if>
<if test="voiceManufacturer != null">voice_manufacturer,</if>
<if test="framModel != null and framModel != ''">fram_model,</if>
<if test="replaceManufacturer != null">replace_manufacturer,</if>
<if test="testRecord != null">test_record,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="imei != null and imei != ''">#{imei},</if>
<if test="iccid != null and iccid != ''">#{iccid},</if>
<if test="mcuId != null and mcuId != ''">#{mcuId},</if>
<if test="bspType != null and bspType != ''">#{bspType},</if>
<if test="lteType != null and lteType != ''">#{lteType},</if>
<if test="mcuType != null and mcuType != ''">#{mcuType},</if>
<if test="mcufw != null and mcufw != ''">#{mcufw},</if>
<if test="ltefw != null and ltefw != ''">#{ltefw},</if>
<if test="lcdManufacturer != null">#{lcdManufacturer},</if>
<if test="voiceManufacturer != null">#{voiceManufacturer},</if>
<if test="framModel != null and framModel != ''">#{framModel},</if>
<if test="replaceManufacturer != null">#{replaceManufacturer},</if>
<if test="testRecord != null">#{testRecord},</if>
</trim>
</insert>
<update id="updateDeviceReportInfo" parameterType="DeviceReportInfo">
update iot_device_report_info
<trim prefix="SET" suffixOverrides=",">
<if test="imei != null and imei != ''">imei = #{imei},</if>
<if test="iccid != null and iccid != ''">iccid = #{iccid},</if>
<if test="mcuId != null and mcuId != ''">mcu_id = #{mcuId},</if>
<if test="bspType != null and bspType != ''">bsp_type = #{bspType},</if>
<if test="lteType != null and lteType != ''">lte_type = #{lteType},</if>
<if test="mcuType != null and mcuType != ''">mcu_type = #{mcuType},</if>
<if test="mcufw != null and mcufw != ''">mcuFw = #{mcufw},</if>
<if test="ltefw != null and ltefw != ''">lteFw = #{ltefw},</if>
<if test="lcdManufacturer != null">lcd_manufacturer = #{lcdManufacturer},</if>
<if test="voiceManufacturer != null">voice_manufacturer = #{voiceManufacturer},</if>
<if test="framModel != null and framModel != ''">fram_model = #{framModel},</if>
<if test="replaceManufacturer != null">replace_manufacturer = #{replaceManufacturer},</if>
<if test="testRecord != null">test_record = #{testRecord},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeviceReportInfoById" parameterType="Long">
delete from iot_device_report_info where id = #{id}
</delete>
<delete id="deleteDeviceReportInfoByIds" parameterType="String">
delete from iot_device_report_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

Binary file not shown.