diff --git a/fastbee-admin/src/main/resources/application-dev.yml b/fastbee-admin/src/main/resources/application-dev.yml index df8b3b2..e8a17df 100644 --- a/fastbee-admin/src/main/resources/application-dev.yml +++ b/fastbee-admin/src/main/resources/application-dev.yml @@ -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 # 保持连接 diff --git a/fastbee-common/src/main/java/com/fastbee/common/enums/TopicType.java b/fastbee-common/src/main/java/com/fastbee/common/enums/TopicType.java index 4d8f766..1e844f7 100644 --- a/fastbee-common/src/main/java/com/fastbee/common/enums/TopicType.java +++ b/fastbee-common/src/main/java/com/fastbee/common/enums/TopicType.java @@ -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", "发布功能"), diff --git a/fastbee-common/src/main/java/com/fastbee/common/utils/gateway/mq/TopicsUtils.java b/fastbee-common/src/main/java/com/fastbee/common/utils/gateway/mq/TopicsUtils.java index 014fe27..2b93fd2 100644 --- a/fastbee-common/src/main/java/com/fastbee/common/utils/gateway/mq/TopicsUtils.java +++ b/fastbee-common/src/main/java/com/fastbee/common/utils/gateway/mq/TopicsUtils.java @@ -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; } diff --git a/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/redischannel/consumer/DeviceOtherMsgConsumer.java b/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/redischannel/consumer/DeviceOtherMsgConsumer.java index be32c0a..dfba6ec 100644 --- a/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/redischannel/consumer/DeviceOtherMsgConsumer.java +++ b/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/redischannel/consumer/DeviceOtherMsgConsumer.java @@ -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); } diff --git a/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/service/impl/DeviceOtherMsgHandler.java b/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/service/impl/DeviceOtherMsgHandler.java index 86405d6..83f1d74 100644 --- a/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/service/impl/DeviceOtherMsgHandler.java +++ b/fastbee-gateway/fastbee-mq/src/main/java/com/fastbee/mq/service/impl/DeviceOtherMsgHandler.java @@ -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; } + } /** diff --git a/fastbee-open-api/pom.xml b/fastbee-open-api/pom.xml index 520a788..ec488e8 100644 --- a/fastbee-open-api/pom.xml +++ b/fastbee-open-api/pom.xml @@ -61,7 +61,8 @@ compile - + + diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/controller/DeviceReportInfoController.java b/fastbee-open-api/src/main/java/com/fastbee/data/controller/DeviceReportInfoController.java new file mode 100644 index 0000000..567b89f --- /dev/null +++ b/fastbee-open-api/src/main/java/com/fastbee/data/controller/DeviceReportInfoController.java @@ -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 list = deviceReportInfoService.selectDeviceReportInfoList(deviceReportInfo); + return getDataTable(list); + } + + /** + * 导出设备上电审核前上报的基础信息列表 + */ + @ApiOperation("导出设备上电审核前上报的基础信息列表") + @PreAuthorize("@ss.hasPermi('iot:info:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, DeviceReportInfo deviceReportInfo) + { + List list = deviceReportInfoService.selectDeviceReportInfoList(deviceReportInfo); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/controller/aaScreenAgricultural/DeviceInfoController.java b/fastbee-open-api/src/main/java/com/fastbee/data/controller/aaScreenAgricultural/DeviceInfoController.java index 970a293..bca6812 100644 --- a/fastbee-open-api/src/main/java/com/fastbee/data/controller/aaScreenAgricultural/DeviceInfoController.java +++ b/fastbee-open-api/src/main/java/com/fastbee/data/controller/aaScreenAgricultural/DeviceInfoController.java @@ -115,9 +115,9 @@ public class DeviceInfoController extends BaseController { } /** - * 查询虫情设备列表 + * 查询气象设备列表 */ - @GetMapping("/wormList") + @GetMapping("/weatherList") public AjaxResult getDeviceList() { LambdaQueryWrapper 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 queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.select(DeviceInformationWorms::getId,DeviceInformationWorms::getName, diff --git a/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttCallBack.java b/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttCallBack.java index 0d9146b..0ca85e2 100644 --- a/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttCallBack.java +++ b/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttCallBack.java @@ -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) { diff --git a/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttClient.java b/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttClient.java index 54b9981..d49dd15 100644 --- a/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttClient.java +++ b/fastbee-plugs/fastbee-mqtt-client/src/main/java/com/fastbee/mqttclient/PubMqttClient.java @@ -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); diff --git a/fastbee-server/mqtt-broker/src/main/java/com/fastbee/mqtt/auth/AuthService.java b/fastbee-server/mqtt-broker/src/main/java/com/fastbee/mqtt/auth/AuthService.java index 3cf5c32..5f97f68 100644 --- a/fastbee-server/mqtt-broker/src/main/java/com/fastbee/mqtt/auth/AuthService.java +++ b/fastbee-server/mqtt-broker/src/main/java/com/fastbee/mqtt/auth/AuthService.java @@ -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)) { diff --git a/fastbee-service/fastbee-device-service/src/main/java/com/fastbee/crop/service/impl/AgricultureCropYieldServiceImpl.java b/fastbee-service/fastbee-device-service/src/main/java/com/fastbee/crop/service/impl/AgricultureCropYieldServiceImpl.java index 7c84e87..65b3226 100644 --- a/fastbee-service/fastbee-device-service/src/main/java/com/fastbee/crop/service/impl/AgricultureCropYieldServiceImpl.java +++ b/fastbee-service/fastbee-device-service/src/main/java/com/fastbee/crop/service/impl/AgricultureCropYieldServiceImpl.java @@ -108,7 +108,6 @@ public class AgricultureCropYieldServiceImpl implements IAgricultureCropYieldSer Map> collect = list.stream().collect(Collectors.groupingBy(AgricultureCropYield::getHarvestMonth)); List> result = new ArrayList<>(); collect.forEach((month, cropYieldList) -> { - System.out.println("月份: " + month); HashMap props = new HashMap<>(); props.put("name", month+"月"); props.put("value",cropYieldList.get(0).getYieldValue()); diff --git a/fastbee-service/fastbee-ggroup-service/src/main/java/com/fastbee/ggroup/service/impl/GSiteDeviceServiceImpl.java b/fastbee-service/fastbee-ggroup-service/src/main/java/com/fastbee/ggroup/service/impl/GSiteDeviceServiceImpl.java index c3068a8..33856c2 100644 --- a/fastbee-service/fastbee-ggroup-service/src/main/java/com/fastbee/ggroup/service/impl/GSiteDeviceServiceImpl.java +++ b/fastbee-service/fastbee-ggroup-service/src/main/java/com/fastbee/ggroup/service/impl/GSiteDeviceServiceImpl.java @@ -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; diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/DeviceReportInfo.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/DeviceReportInfo.java new file mode 100644 index 0000000..4d065a6 --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/DeviceReportInfo.java @@ -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; + + /** 显示屏厂家,上报1,2,3等类似的数值,通过后台进行录入数值和显示屏厂家对应关系例:1对应GT2116 */ + @Excel(name = "显示屏厂家,上报1,2,3等类似的数值,通过后台进行录入数值和显示屏厂家对应关系例:1对应GT2116") + @ApiModelProperty("显示屏厂家,上报1,2,3等类似的数值,通过后台进行录入数值和显示屏厂家对应关系例:1对应GT2116") + private Long lcdManufacturer; + + /** 语音厂家,上报1,2,3等类似的数值,通过后台进行录入数值和语音厂家对应关系例:1对应 */ + @Excel(name = "语音厂家,上报1,2,3等类似的数值,通过后台进行录入数值和语音厂家对应关系例:1对应") + @ApiModelProperty("语音厂家,上报1,2,3等类似的数值,通过后台进行录入数值和语音厂家对应关系例:1对应") + private Long voiceManufacturer; + + /** FRAM型号 */ + @Excel(name = "FRAM型号") + @ApiModelProperty("FRAM型号") + private String framModel; + + /** 代工厂家,上报1,2,3等类似的数值,通过后台进行录入数值和代工厂家对应关系例:1对应 */ + @Excel(name = "代工厂家,上报1,2,3等类似的数值,通过后台进行录入数值和代工厂家对应关系例:1对应") + @ApiModelProperty("代工厂家,上报1,2,3等类似的数值,通过后台进行录入数值和代工厂家对应关系例:1对应") + private Long replaceManufacturer; + + /** 记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息 */ + @Excel(name = "记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息") + @ApiModelProperty("记录测试的过程,包括了测试脉冲次数、第一次上电时间等待补充信息") + private String testRecord; + +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/DeviceReportInfoMapper.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/DeviceReportInfoMapper.java new file mode 100644 index 0000000..07b607b --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/DeviceReportInfoMapper.java @@ -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 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); +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/model/ProductAuthenticateModel.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/model/ProductAuthenticateModel.java index 3615b47..7f95556 100644 --- a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/model/ProductAuthenticateModel.java +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/model/ProductAuthenticateModel.java @@ -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; } diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/ruleEngine/MqttClientFactory.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/ruleEngine/MqttClientFactory.java index 0ad6eb2..a5749db 100644 --- a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/ruleEngine/MqttClientFactory.java +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/ruleEngine/MqttClientFactory.java @@ -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); diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceReportInfoService.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceReportInfoService.java new file mode 100644 index 0000000..1ed3dae --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceReportInfoService.java @@ -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 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); +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceReportInfoServiceImpl.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceReportInfoServiceImpl.java new file mode 100644 index 0000000..f7c3a60 --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceReportInfoServiceImpl.java @@ -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 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); + } +} diff --git a/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/DeviceReportInfoMapper.xml b/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/DeviceReportInfoMapper.xml new file mode 100644 index 0000000..1e54ee5 --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/DeviceReportInfoMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into iot_device_report_info + + imei, + iccid, + mcu_id, + bsp_type, + lte_type, + mcu_type, + mcuFw, + lteFw, + lcd_manufacturer, + voice_manufacturer, + fram_model, + replace_manufacturer, + test_record, + + + #{imei}, + #{iccid}, + #{mcuId}, + #{bspType}, + #{lteType}, + #{mcuType}, + #{mcufw}, + #{ltefw}, + #{lcdManufacturer}, + #{voiceManufacturer}, + #{framModel}, + #{replaceManufacturer}, + #{testRecord}, + + + + + update iot_device_report_info + + imei = #{imei}, + iccid = #{iccid}, + mcu_id = #{mcuId}, + bsp_type = #{bspType}, + lte_type = #{lteType}, + mcu_type = #{mcuType}, + mcuFw = #{mcufw}, + lteFw = #{ltefw}, + lcd_manufacturer = #{lcdManufacturer}, + voice_manufacturer = #{voiceManufacturer}, + fram_model = #{framModel}, + replace_manufacturer = #{replaceManufacturer}, + test_record = #{testRecord}, + + where id = #{id} + + + + delete from iot_device_report_info where id = #{id} + + + + delete from iot_device_report_info where id in + + #{id} + + + \ No newline at end of file diff --git a/logs/record.log.2024-11-11.0.gz b/logs/record.log.2024-11-11.0.gz new file mode 100644 index 0000000..f40bdf6 Binary files /dev/null and b/logs/record.log.2024-11-11.0.gz differ