正在显示
100 个修改的文件
包含
769 行增加
和
310 行删除
lh-jar/lh-jar-device-analysis/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + <parent> | ||
| 7 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 8 | + <artifactId>lh-jar</artifactId> | ||
| 9 | + <version>1.0-SNAPSHOT</version> | ||
| 10 | + </parent> | ||
| 11 | + | ||
| 12 | + <artifactId>lh-jar-device-analysis</artifactId> | ||
| 13 | + | ||
| 14 | + <properties> | ||
| 15 | + <maven.compiler.source>8</maven.compiler.source> | ||
| 16 | + <maven.compiler.target>8</maven.compiler.target> | ||
| 17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| 18 | + </properties> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <dependency> | ||
| 22 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 23 | + <artifactId>ruoyi-framework</artifactId> | ||
| 24 | + </dependency> | ||
| 25 | + <dependency> | ||
| 26 | + <groupId>org.aspectj</groupId> | ||
| 27 | + <artifactId>aspectjweaver</artifactId> | ||
| 28 | + </dependency> | ||
| 29 | + <dependency> | ||
| 30 | + <groupId>org.aspectj</groupId> | ||
| 31 | + <artifactId>aspectjrt</artifactId> | ||
| 32 | + </dependency> | ||
| 33 | + | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 36 | + <artifactId>lh-jar-device-service</artifactId> | ||
| 37 | + <scope>compile</scope> | ||
| 38 | + </dependency> | ||
| 39 | + </dependencies> | ||
| 40 | +</project> |
| 1 | -package com.zhonglai.luhui.mqtt.comm.agreement; | 1 | +package com.zhonglai.luhui.device.analysis.comm.agreement; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreementFactory; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 3 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreementFactory; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.agreement; | 1 | +package com.zhonglai.luhui.device.analysis.comm.agreement; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.clien; | 1 | +package com.zhonglai.luhui.device.analysis.comm.clien; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.dto.Message; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * 客户端链接 | 8 | * 客户端链接 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.clien.impl; | 1 | +package com.zhonglai.luhui.device.analysis.comm.clien.impl; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.clien.ClienConnection; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 8 | -import com.zhonglai.luhui.mqtt.dto.MessageCodeType; | 4 | +import com.zhonglai.luhui.device.analysis.comm.clien.ClienConnection; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.MessageCodeType; | ||
| 9 | 9 | ||
| 10 | public class ClienConnectionImpl implements ClienConnection { | 10 | public class ClienConnectionImpl implements ClienConnection { |
| 11 | private Message message = new Message(); | 11 | private Message message = new Message(); |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | ||
| 4 | import lombok.Data; | 3 | import lombok.Data; |
| 5 | 4 | ||
| 6 | @Data | 5 | @Data |
| @@ -23,18 +22,18 @@ public class DeviceInfoDto { | @@ -23,18 +22,18 @@ public class DeviceInfoDto { | ||
| 23 | private String sensorType; //设备配置 | 22 | private String sensorType; //设备配置 |
| 24 | private Boolean isadd; //是否添加 | 23 | private Boolean isadd; //是否添加 |
| 25 | 24 | ||
| 26 | - public static DeviceInfoDto newDefaultDeviceInfoDto(String imei, String sensor_number, String device_model, String device_type) | ||
| 27 | - { | ||
| 28 | - DeviceInfoDto deviceInfoDto = new DeviceInfoDto(); | ||
| 29 | - deviceInfoDto.setId(imei+"_"+sensor_number); | ||
| 30 | - deviceInfoDto.setDeviceId(imei); | ||
| 31 | - deviceInfoDto.setSensorNumber(sensor_number); | ||
| 32 | - deviceInfoDto.setDeviceModel(device_model); | ||
| 33 | - deviceInfoDto.setDeviceType(device_type); | ||
| 34 | - deviceInfoDto.setAlarmCode("00"); | ||
| 35 | - deviceInfoDto.setOnline("01"); | ||
| 36 | - deviceInfoDto.setDeviceServiceIp(SysParameter.service_ip); | ||
| 37 | - deviceInfoDto.setIsadd(true); | ||
| 38 | - return deviceInfoDto; | ||
| 39 | - } | 25 | +// public static DeviceInfoDto newDefaultDeviceInfoDto(String imei, String sensor_number, String device_model, String device_type) |
| 26 | +// { | ||
| 27 | +// DeviceInfoDto deviceInfoDto = new DeviceInfoDto(); | ||
| 28 | +// deviceInfoDto.setId(imei+"_"+sensor_number); | ||
| 29 | +// deviceInfoDto.setDeviceId(imei); | ||
| 30 | +// deviceInfoDto.setSensorNumber(sensor_number); | ||
| 31 | +// deviceInfoDto.setDeviceModel(device_model); | ||
| 32 | +// deviceInfoDto.setDeviceType(device_type); | ||
| 33 | +// deviceInfoDto.setAlarmCode("00"); | ||
| 34 | +// deviceInfoDto.setOnline("01"); | ||
| 35 | +// deviceInfoDto.setDeviceServiceIp(SysParameter.service_ip); | ||
| 36 | +// deviceInfoDto.setIsadd(true); | ||
| 37 | +// return deviceInfoDto; | ||
| 38 | +// } | ||
| 40 | } | 39 | } |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | public class BusinessDtoClassNew { | 3 | public class BusinessDtoClassNew { |
| 4 | public static BusinessDto newBean(String payloadtype,byte[] data ) | 4 | public static BusinessDto newBean(String payloadtype,byte[] data ) |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | import lombok.Data; | 4 | import lombok.Data; |
| 6 | import org.apache.commons.lang3.ArrayUtils; | 5 | import org.apache.commons.lang3.ArrayUtils; |
| 7 | 6 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | import lombok.Data; | 4 | import lombok.Data; |
| 6 | 5 | ||
| 7 | import java.io.UnsupportedEncodingException; | 6 | import java.io.UnsupportedEncodingException; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 物模型数据类型,及对应显示解析方案 | 7 | * 物模型数据类型,及对应显示解析方案 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.alibaba.fastjson.annotation.JSONField; | 4 | import com.alibaba.fastjson.annotation.JSONField; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| 8 | @Data | 8 | @Data |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | @Data | 6 | @Data |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.EnumItemOutput; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.EnumItemOutput; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
| 8 | 8 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 1 | -package com.zhonglai.luhui.mqtt.comm.factory; | 1 | +package com.zhonglai.luhui.device.analysis.comm.factory; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * mqtt业务协议 | 8 | * mqtt业务协议 |
| 1 | +package com.zhonglai.luhui.device.analysis.comm.factory; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.MyException; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | + | ||
| 9 | +import java.lang.reflect.Field; | ||
| 10 | +import java.util.Optional; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +public class Topic { | ||
| 14 | + | ||
| 15 | + private String roleid; | ||
| 16 | + private String username; | ||
| 17 | + private String clientid; | ||
| 18 | + private String topicType; | ||
| 19 | + private String messageid; | ||
| 20 | + private String payloadtype; | ||
| 21 | + | ||
| 22 | + public Topic() { | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public Topic(String roleid, String username, String clientid, String topicType, String payloadtype) { | ||
| 26 | + this.roleid = roleid; | ||
| 27 | + this.username = username; | ||
| 28 | + this.clientid = clientid; | ||
| 29 | + this.topicType = topicType; | ||
| 30 | + this.payloadtype = payloadtype; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public Topic(String roleid, String username, String clientid, String topicType, String messageid, String payloadtype) { | ||
| 34 | + this.roleid = roleid; | ||
| 35 | + this.username = username; | ||
| 36 | + this.clientid = clientid; | ||
| 37 | + this.topicType = topicType; | ||
| 38 | + this.messageid = messageid; | ||
| 39 | + this.payloadtype = payloadtype; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +} |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util; |
| 2 | 2 | ||
| 3 | import org.apache.commons.lang3.time.DateFormatUtils; | 3 | import org.apache.commons.lang3.time.DateFormatUtils; |
| 4 | 4 | ||
| @@ -116,7 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils | @@ -116,7 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils | ||
| 116 | } | 116 | } |
| 117 | try | 117 | try |
| 118 | { | 118 | { |
| 119 | - return parseDate(str.toString(), parsePatterns); | 119 | + return DateUtils.parseDate(str.toString(), parsePatterns); |
| 120 | } | 120 | } |
| 121 | catch (ParseException e) | 121 | catch (ParseException e) |
| 122 | { | 122 | { |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util; |
| 2 | 2 | ||
| 3 | import org.springframework.util.AntPathMatcher; | 3 | import org.springframework.util.AntPathMatcher; |
| 4 | 4 | ||
| @@ -327,13 +327,13 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils | @@ -327,13 +327,13 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils | ||
| 327 | */ | 327 | */ |
| 328 | public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) | 328 | public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) |
| 329 | { | 329 | { |
| 330 | - if (isEmpty(cs) || isEmpty(searchCharSequences)) | 330 | + if (StringUtils.isEmpty(cs) || isEmpty(searchCharSequences)) |
| 331 | { | 331 | { |
| 332 | return false; | 332 | return false; |
| 333 | } | 333 | } |
| 334 | for (CharSequence testStr : searchCharSequences) | 334 | for (CharSequence testStr : searchCharSequences) |
| 335 | { | 335 | { |
| 336 | - if (containsIgnoreCase(cs, testStr)) | 336 | + if (StringUtils.containsIgnoreCase(cs, testStr)) |
| 337 | { | 337 | { |
| 338 | return true; | 338 | return true; |
| 339 | } | 339 | } |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util.http; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util.http; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.util.Constants; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.Constants; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | 7 |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class AddPostDto extends ServerDto { | 6 | public class AddPostDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class AllPostDto extends ServerDto { | 6 | public class AllPostDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class GetDto extends ServerDto { | 6 | public class GetDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | 4 | ||
| 5 | public class GetReqDto extends ServerDto { | 5 | public class GetReqDto extends ServerDto { |
| 6 | } | 6 | } |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | 4 | ||
| 5 | public class OnlineDto extends ServerDto { | 5 | public class OnlineDto extends ServerDto { |
| 6 | private Integer state; | 6 | private Integer state; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 7 | 5 | ||
| 8 | public class PutReqDto extends ServerDto { | 6 | public class PutReqDto extends ServerDto { |
| 9 | private Integer code; | 7 | private Integer code; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 8 | - | ||
| 9 | -import java.util.HashMap; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 10 | 5 | ||
| 11 | public class ReadReqDto extends ServerDto { | 6 | public class ReadReqDto extends ServerDto { |
| 12 | private Integer code; | 7 | private Integer code; |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | <modules> | 13 | <modules> |
| 14 | <module>lh-jar-action</module> | 14 | <module>lh-jar-action</module> |
| 15 | <module>lh-jar-chatgpt</module> | 15 | <module>lh-jar-chatgpt</module> |
| 16 | + <module>lh-jar-device-analysis</module> | ||
| 16 | <module>lh-jar-device-service</module> | 17 | <module>lh-jar-device-service</module> |
| 17 | <module>lh-jar-rocketmq</module> | 18 | <module>lh-jar-rocketmq</module> |
| 18 | <module>lh-jar-sys-service</module> | 19 | <module>lh-jar-sys-service</module> |
| @@ -4,6 +4,7 @@ import java.util.*; | @@ -4,6 +4,7 @@ import java.util.*; | ||
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | ||
| 6 | import com.zhonglai.luhui.action.BaseController; | 6 | import com.zhonglai.luhui.action.BaseController; |
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; | ||
| 7 | import com.zhonglai.luhui.security.utils.SecurityUtils; | 8 | import com.zhonglai.luhui.security.utils.SecurityUtils; |
| 8 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 9 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 9 | import com.alibaba.fastjson.JSON; | 10 | import com.alibaba.fastjson.JSON; |
| @@ -12,8 +13,7 @@ import com.zhonglai.luhui.device.domain.DistributionCurrencyModel; | @@ -12,8 +13,7 @@ import com.zhonglai.luhui.device.domain.DistributionCurrencyModel; | ||
| 12 | import com.zhonglai.luhui.device.domain.IotProduct; | 13 | import com.zhonglai.luhui.device.domain.IotProduct; |
| 13 | import com.zhonglai.luhui.device.service.IIotProductService; | 14 | import com.zhonglai.luhui.device.service.IIotProductService; |
| 14 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | 15 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; |
| 15 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 16 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 16 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 17 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 17 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 18 | import io.swagger.annotations.Api; | 18 | import io.swagger.annotations.Api; |
| 19 | import io.swagger.annotations.ApiOperation; | 19 | import io.swagger.annotations.ApiOperation; |
| @@ -5,14 +5,14 @@ import java.util.List; | @@ -5,14 +5,14 @@ import java.util.List; | ||
| 5 | import javax.servlet.http.HttpServletResponse; | 5 | import javax.servlet.http.HttpServletResponse; |
| 6 | 6 | ||
| 7 | import com.zhonglai.luhui.action.BaseController; | 7 | import com.zhonglai.luhui.action.BaseController; |
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; | ||
| 8 | import com.zhonglai.luhui.device.service.IIotProductService; | 9 | import com.zhonglai.luhui.device.service.IIotProductService; |
| 9 | import com.zhonglai.luhui.security.utils.SecurityUtils; | 10 | import com.zhonglai.luhui.security.utils.SecurityUtils; |
| 10 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 11 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 11 | import com.alibaba.fastjson.JSON; | 12 | import com.alibaba.fastjson.JSON; |
| 12 | import com.alibaba.fastjson.JSONObject; | 13 | import com.alibaba.fastjson.JSONObject; |
| 13 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | 14 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; |
| 14 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 15 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 15 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 16 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 17 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
| 18 | import org.springframework.security.access.prepost.PreAuthorize; | 18 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -6,9 +6,6 @@ import cn.hutool.extra.ssh.ChannelType; | @@ -6,9 +6,6 @@ import cn.hutool.extra.ssh.ChannelType; | ||
| 6 | import cn.hutool.extra.ssh.JschUtil; | 6 | import cn.hutool.extra.ssh.JschUtil; |
| 7 | import com.jcraft.jsch.ChannelExec; | 7 | import com.jcraft.jsch.ChannelExec; |
| 8 | import com.jcraft.jsch.JSchException; | 8 | import com.jcraft.jsch.JSchException; |
| 9 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 10 | -import org.slf4j.Logger; | ||
| 11 | -import org.slf4j.LoggerFactory; | ||
| 12 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
| 13 | 10 | ||
| 14 | import java.io.*; | 11 | import java.io.*; |
lh-modules/lh-http-service/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + <parent> | ||
| 7 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 8 | + <artifactId>lh-modules</artifactId> | ||
| 9 | + <version>1.0-SNAPSHOT</version> | ||
| 10 | + </parent> | ||
| 11 | + | ||
| 12 | + <artifactId>lh-http-service</artifactId> | ||
| 13 | + | ||
| 14 | + <properties> | ||
| 15 | + <maven.compiler.source>8</maven.compiler.source> | ||
| 16 | + <maven.compiler.target>8</maven.compiler.target> | ||
| 17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| 18 | + </properties> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <!-- 核心模块--> | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 24 | + <artifactId>ruoyi-framework</artifactId> | ||
| 25 | + </dependency> | ||
| 26 | + <dependency> | ||
| 27 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 28 | + <artifactId>lh-jar-sys-service</artifactId> | ||
| 29 | + </dependency> | ||
| 30 | + <dependency> | ||
| 31 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 32 | + <artifactId>lh-common-swagger</artifactId> | ||
| 33 | + </dependency> | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 36 | + <artifactId>lh-common-datasource</artifactId> | ||
| 37 | + </dependency> | ||
| 38 | + <dependency> | ||
| 39 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 40 | + <artifactId>lh-public-dao</artifactId> | ||
| 41 | + </dependency> | ||
| 42 | + <dependency> | ||
| 43 | + <groupId>org.aspectj</groupId> | ||
| 44 | + <artifactId>aspectjweaver</artifactId> | ||
| 45 | + </dependency> | ||
| 46 | + <dependency> | ||
| 47 | + <groupId>org.aspectj</groupId> | ||
| 48 | + <artifactId>aspectjrt</artifactId> | ||
| 49 | + </dependency> | ||
| 50 | + <dependency> | ||
| 51 | + <groupId>org.springframework.boot</groupId> | ||
| 52 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 53 | + </dependency> | ||
| 54 | + <dependency> | ||
| 55 | + <groupId>org.yaml</groupId> | ||
| 56 | + <artifactId>snakeyaml</artifactId> | ||
| 57 | + </dependency> | ||
| 58 | + | ||
| 59 | + <!-- <dependency>--> | ||
| 60 | +<!-- <groupId>com.zhonglai.luhui</groupId>--> | ||
| 61 | +<!-- <artifactId>lh-jar-device-analysis</artifactId>--> | ||
| 62 | +<!-- </dependency>--> | ||
| 63 | + </dependencies> | ||
| 64 | + | ||
| 65 | + <build> | ||
| 66 | + <finalName>lh-http-service</finalName> | ||
| 67 | + <plugins> | ||
| 68 | + <plugin> | ||
| 69 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 70 | + <artifactId>maven-jar-plugin</artifactId> | ||
| 71 | + <version>2.4</version> | ||
| 72 | + <configuration> | ||
| 73 | + <archive> | ||
| 74 | + <!-- | ||
| 75 | + 生成的jar中,不要包含pom.xml和pom.properties这两个文件 | ||
| 76 | + --> | ||
| 77 | + <addMavenDescriptor>false</addMavenDescriptor> | ||
| 78 | + <manifest> | ||
| 79 | + <!-- | ||
| 80 | + 是否要把第三方jar放到manifest的classpath中 | ||
| 81 | + --> | ||
| 82 | + <addClasspath>true</addClasspath> | ||
| 83 | + | ||
| 84 | + <!-- | ||
| 85 | + 生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/ | ||
| 86 | + --> | ||
| 87 | + <classpathPrefix>lib/</classpathPrefix> | ||
| 88 | + <mainClass>com.zhonglai.luhui.http.service.Main</mainClass> | ||
| 89 | + </manifest> | ||
| 90 | + </archive> | ||
| 91 | + </configuration> | ||
| 92 | + </plugin> | ||
| 93 | + | ||
| 94 | + <!-- The configuration of maven-assembly-plugin --> | ||
| 95 | + <plugin> | ||
| 96 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 97 | + <artifactId>maven-assembly-plugin</artifactId> | ||
| 98 | + <version>2.4</version> | ||
| 99 | + <configuration> | ||
| 100 | + <descriptors> | ||
| 101 | + <descriptor>src/main/resources/package.xml</descriptor> | ||
| 102 | + </descriptors> | ||
| 103 | + </configuration> | ||
| 104 | + <executions> | ||
| 105 | + <execution> | ||
| 106 | + <id>make-assembly</id> | ||
| 107 | + <phase>package</phase> | ||
| 108 | + <goals> | ||
| 109 | + <goal>single</goal> | ||
| 110 | + </goals> | ||
| 111 | + </execution> | ||
| 112 | + </executions> | ||
| 113 | + </plugin> | ||
| 114 | + </plugins> | ||
| 115 | + </build> | ||
| 116 | +</project> |
| 1 | +package com.zhonglai.luhui.http.service; | ||
| 2 | + | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | +import org.springframework.boot.SpringApplication; | ||
| 6 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 7 | +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 8 | +import org.springframework.context.annotation.ComponentScan; | ||
| 9 | + | ||
| 10 | +@ComponentScan(basePackages = { | ||
| 11 | + "com.ruoyi.common", | ||
| 12 | + "com.ruoyi.framework", | ||
| 13 | + "com.zhonglai.luhui.datasource", | ||
| 14 | + "com.zhonglai.luhui.dao", | ||
| 15 | + "com.zhonglai.luhui.http.service", | ||
| 16 | +} | ||
| 17 | +) | ||
| 18 | +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class}) | ||
| 19 | +public class Main { | ||
| 20 | + private static final Logger logger = LoggerFactory.getLogger(Main.class); | ||
| 21 | + public static void main(String[] args) { | ||
| 22 | + SpringApplication.run(Main.class,args); | ||
| 23 | + logger.info("启动服务"); | ||
| 24 | + } | ||
| 25 | +} |
lh-modules/lh-http-service/src/main/java/com/zhonglai/luhui/http/service/config/SwaggerConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.http.service.config; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.config.RuoYiConfig; | ||
| 4 | +import io.swagger.annotations.ApiOperation; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.context.annotation.Bean; | ||
| 7 | +import org.springframework.context.annotation.Configuration; | ||
| 8 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
| 9 | +import springfox.documentation.builders.PathSelectors; | ||
| 10 | +import springfox.documentation.builders.RequestHandlerSelectors; | ||
| 11 | +import springfox.documentation.service.Contact; | ||
| 12 | +import springfox.documentation.spi.DocumentationType; | ||
| 13 | +import springfox.documentation.spring.web.plugins.Docket; | ||
| 14 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +@Configuration | ||
| 18 | +@EnableSwagger2 | ||
| 19 | +public class SwaggerConfig { | ||
| 20 | + /** 系统基础配置 */ | ||
| 21 | + @Autowired | ||
| 22 | + private RuoYiConfig ruoyiConfig; | ||
| 23 | + @Bean | ||
| 24 | + public Docket createRestApi() { | ||
| 25 | + return new Docket(DocumentationType.SWAGGER_2) | ||
| 26 | + .groupName("设备http服务器") | ||
| 27 | + .apiInfo( | ||
| 28 | + new ApiInfoBuilder().title("标题:设备http服务器") | ||
| 29 | + .description("设备http服务器") | ||
| 30 | + .contact(new Contact(ruoyiConfig.getName(), null, null)) | ||
| 31 | + .version("版本号:" + ruoyiConfig.getVersion()) | ||
| 32 | + .build() | ||
| 33 | + ) | ||
| 34 | + .select() | ||
| 35 | + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | ||
| 36 | + .paths(PathSelectors.any()) | ||
| 37 | + .build(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +} |
| 1 | +package com.zhonglai.luhui.http.service.controller; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | +import com.ruoyi.common.utils.StringUtils; | ||
| 5 | +import io.swagger.annotations.Api; | ||
| 6 | +import io.swagger.annotations.ApiOperation; | ||
| 7 | +import org.springframework.web.bind.annotation.ModelAttribute; | ||
| 8 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import javax.servlet.http.HttpServletRequest; | ||
| 13 | +import javax.servlet.http.HttpServletResponse; | ||
| 14 | + | ||
| 15 | +@Api(tags = "设备操作") | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("/device") | ||
| 18 | +public class DeviceService { | ||
| 19 | + | ||
| 20 | + private static String authKey = "key"; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 添加校验 | ||
| 24 | + * @return | ||
| 25 | + */ | ||
| 26 | + @ModelAttribute | ||
| 27 | + public void preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) | ||
| 28 | + { | ||
| 29 | + String key = request.getParameter(authKey); | ||
| 30 | + if(StringUtils.isNoneEmpty(key)) | ||
| 31 | + { | ||
| 32 | + response.setStatus(403); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @ApiOperation("更新指定设备的全部数据") | ||
| 37 | + @RequestMapping(value = "putAllData/{deviceid}") | ||
| 38 | + public AjaxResult putAllData(@PathVariable String deviceid) | ||
| 39 | + { | ||
| 40 | + return AjaxResult.success(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @ApiOperation("更新指定设备的部分数据") | ||
| 44 | + @RequestMapping(value = "putPartialData/{deviceid}") | ||
| 45 | + public AjaxResult putPartialData(@PathVariable String deviceid) | ||
| 46 | + { | ||
| 47 | + return AjaxResult.success(); | ||
| 48 | + } | ||
| 49 | +} |
| 1 | +restart.include.json=/com.alibaba.fastjson.*.jar |
| 1 | +# 数据源配置 | ||
| 2 | +spring: | ||
| 3 | + datasource: | ||
| 4 | + type: com.alibaba.druid.pool.DruidDataSource | ||
| 5 | + driverClassName: com.mysql.cj.jdbc.Driver | ||
| 6 | + druid: | ||
| 7 | + # 主库数据源 | ||
| 8 | + master: | ||
| 9 | + url: jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/mqtt_broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | ||
| 10 | + username: luhui | ||
| 11 | + password: Luhui586 | ||
| 12 | + # 从库数据源 | ||
| 13 | + slave: | ||
| 14 | + # 从数据源开关/默认关闭 | ||
| 15 | + enabled: false | ||
| 16 | + url: | ||
| 17 | + username: | ||
| 18 | + password: | ||
| 19 | + # 初始连接数 | ||
| 20 | + initialSize: 5 | ||
| 21 | + # 最小连接池数量 | ||
| 22 | + minIdle: 10 | ||
| 23 | + # 最大连接池数量 | ||
| 24 | + maxActive: 20 | ||
| 25 | + # 配置获取连接等待超时的时间 | ||
| 26 | + maxWait: 60000 | ||
| 27 | + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | ||
| 28 | + timeBetweenEvictionRunsMillis: 60000 | ||
| 29 | + # 配置一个连接在池中最小生存的时间,单位是毫秒 | ||
| 30 | + minEvictableIdleTimeMillis: 300000 | ||
| 31 | + # 配置一个连接在池中最大生存的时间,单位是毫秒 | ||
| 32 | + maxEvictableIdleTimeMillis: 900000 | ||
| 33 | + # 配置检测连接是否有效 | ||
| 34 | + validationQuery: SELECT 1 FROM DUAL | ||
| 35 | + testWhileIdle: true | ||
| 36 | + testOnBorrow: false | ||
| 37 | + testOnReturn: false | ||
| 38 | + webStatFilter: | ||
| 39 | + enabled: true | ||
| 40 | + statViewServlet: | ||
| 41 | + enabled: true | ||
| 42 | + # 设置白名单,不填则允许所有访问 | ||
| 43 | + allow: | ||
| 44 | + url-pattern: /druid/* | ||
| 45 | + # 控制台管理用户名和密码 | ||
| 46 | + login-username: ruoyi | ||
| 47 | + login-password: 123456 | ||
| 48 | + filter: | ||
| 49 | + stat: | ||
| 50 | + enabled: true | ||
| 51 | + # 慢SQL记录 | ||
| 52 | + log-slow-sql: true | ||
| 53 | + slow-sql-millis: 1000 | ||
| 54 | + merge-sql: true | ||
| 55 | + wall: | ||
| 56 | + config: | ||
| 57 | + multi-statement-allow: true |
| 1 | +# 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8065 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* |
| 1 | +#错误消息 | ||
| 2 | +not.null=* 必须填写 | ||
| 3 | +user.jcaptcha.error=验证码错误 | ||
| 4 | +user.jcaptcha.expire=验证码已失效 | ||
| 5 | +user.not.exists=用户不存在/密码错误 | ||
| 6 | +user.password.not.match=用户不存在/密码错误 | ||
| 7 | +user.password.retry.limit.count=密码输入错误{0}次 | ||
| 8 | +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 | ||
| 9 | +user.password.delete=对不起,您的账号已被删除 | ||
| 10 | +user.blocked=用户已封禁,请联系管理员 | ||
| 11 | +role.blocked=角色已封禁,请联系管理员 | ||
| 12 | +user.logout.success=退出成功 | ||
| 13 | + | ||
| 14 | +length.not.valid=长度必须在{min}到{max}个字符之间 | ||
| 15 | + | ||
| 16 | +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 | ||
| 17 | +user.password.not.valid=* 5-50个字符 | ||
| 18 | + | ||
| 19 | +user.email.not.valid=邮箱格式错误 | ||
| 20 | +user.mobile.phone.number.not.valid=手机号格式错误 | ||
| 21 | +user.login.success=登录成功 | ||
| 22 | +user.register.success=注册成功 | ||
| 23 | +user.notfound=请重新登录 | ||
| 24 | +user.forcelogout=管理员强制退出,请重新登录 | ||
| 25 | +user.unknown.error=未知错误,请重新登录 | ||
| 26 | + | ||
| 27 | +##文件上传消息 | ||
| 28 | +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | ||
| 29 | +upload.filename.exceed.length=上传的文件名最长{0}个字符 | ||
| 30 | + | ||
| 31 | +##权限 | ||
| 32 | +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] | ||
| 33 | +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] | ||
| 34 | +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] | ||
| 35 | +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] | ||
| 36 | +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] | ||
| 37 | +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE configuration | ||
| 3 | +PUBLIC "-//mybatis.org//DTD Config 3.0//EN" | ||
| 4 | +"http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
| 5 | +<configuration> | ||
| 6 | + <!-- 全局参数 --> | ||
| 7 | + <settings> | ||
| 8 | + <!-- 使全局的映射器启用或禁用缓存 --> | ||
| 9 | + <setting name="cacheEnabled" value="true" /> | ||
| 10 | + <!-- 允许JDBC 支持自动生成主键 --> | ||
| 11 | + <setting name="useGeneratedKeys" value="true" /> | ||
| 12 | + <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> | ||
| 13 | + <setting name="defaultExecutorType" value="SIMPLE" /> | ||
| 14 | + <!-- 指定 MyBatis 所用日志的具体实现 --> | ||
| 15 | + <setting name="logImpl" value="SLF4J" /> | ||
| 16 | + <!-- 使用驼峰命名法转换字段 --> | ||
| 17 | + <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> | ||
| 18 | + </settings> | ||
| 19 | + | ||
| 20 | +</configuration> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<assembly> | ||
| 4 | + <id>bin</id> | ||
| 5 | + <!-- 最终打包成一个用于发布的zip文件 --> | ||
| 6 | + <formats> | ||
| 7 | + <format>zip</format> | ||
| 8 | + </formats> | ||
| 9 | + | ||
| 10 | + <!-- Adds dependencies to zip package under lib directory --> | ||
| 11 | + <dependencySets> | ||
| 12 | + <dependencySet> | ||
| 13 | + <!-- | ||
| 14 | + 不使用项目的artifact,第三方jar不要解压,打包进zip文件的lib目录 | ||
| 15 | + --> | ||
| 16 | + <useProjectArtifact>false</useProjectArtifact> | ||
| 17 | + <outputDirectory>lib</outputDirectory> | ||
| 18 | + <unpack>false</unpack> | ||
| 19 | + </dependencySet> | ||
| 20 | + </dependencySets> | ||
| 21 | + | ||
| 22 | + <fileSets> | ||
| 23 | + <!-- 把项目相关的说明文件,打包进zip文件的根目录 --> | ||
| 24 | + <fileSet> | ||
| 25 | + <directory>${project.basedir}</directory> | ||
| 26 | + <outputDirectory>/</outputDirectory> | ||
| 27 | + <includes> | ||
| 28 | + <include>README*</include> | ||
| 29 | + <include>LICENSE*</include> | ||
| 30 | + <include>NOTICE*</include> | ||
| 31 | + </includes> | ||
| 32 | + </fileSet> | ||
| 33 | + | ||
| 34 | + <!-- 把项目的配置文件,打包进zip文件的config目录 --> | ||
| 35 | + <fileSet> | ||
| 36 | + <directory>${project.basedir}\src\main\resources\configs</directory> | ||
| 37 | + <outputDirectory>../configs</outputDirectory> | ||
| 38 | + <includes> | ||
| 39 | + <include>*.properties</include> | ||
| 40 | + </includes> | ||
| 41 | + </fileSet> | ||
| 42 | + | ||
| 43 | + <!-- 把项目的配置文件,提出来 --> | ||
| 44 | + <fileSet> | ||
| 45 | + <directory>${project.basedir}\src\main\resources</directory> | ||
| 46 | + <outputDirectory>/</outputDirectory> | ||
| 47 | + <includes> | ||
| 48 | + <include>*.properties</include> | ||
| 49 | + <include>*.yml</include> | ||
| 50 | + </includes> | ||
| 51 | + </fileSet> | ||
| 52 | + | ||
| 53 | + <!-- 把项目的脚本文件目录( src/main/scripts )中的启动脚本文件,打包进zip文件的跟目录 --> | ||
| 54 | + <fileSet> | ||
| 55 | + <directory>${project.basedir}\bin</directory> | ||
| 56 | + <outputDirectory></outputDirectory> | ||
| 57 | + <includes> | ||
| 58 | + <include>start.*</include> | ||
| 59 | + <include>stop.*</include> | ||
| 60 | + </includes> | ||
| 61 | + </fileSet> | ||
| 62 | + | ||
| 63 | + <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 --> | ||
| 64 | + <fileSet> | ||
| 65 | + <directory>${project.build.directory}</directory> | ||
| 66 | + <outputDirectory></outputDirectory> | ||
| 67 | + <includes> | ||
| 68 | + <include>*.jar</include> | ||
| 69 | + </includes> | ||
| 70 | + </fileSet> | ||
| 71 | + </fileSets> | ||
| 72 | +</assembly> |
| @@ -174,10 +174,13 @@ | @@ -174,10 +174,13 @@ | ||
| 174 | <dependency> | 174 | <dependency> |
| 175 | <groupId>com.zhonglai.luhui</groupId> | 175 | <groupId>com.zhonglai.luhui</groupId> |
| 176 | <artifactId>lh-jar-device-service</artifactId> | 176 | <artifactId>lh-jar-device-service</artifactId> |
| 177 | - <version>1.0-SNAPSHOT</version> | ||
| 178 | <scope>compile</scope> | 177 | <scope>compile</scope> |
| 179 | </dependency> | 178 | </dependency> |
| 180 | - | 179 | + <dependency> |
| 180 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 181 | + <artifactId>lh-jar-device-analysis</artifactId> | ||
| 182 | + <scope>compile</scope> | ||
| 183 | + </dependency> | ||
| 181 | </dependencies> | 184 | </dependencies> |
| 182 | 185 | ||
| 183 | <build> | 186 | <build> |
| @@ -9,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan; | @@ -9,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan; | ||
| 9 | 9 | ||
| 10 | @ComponentScan(basePackages = { | 10 | @ComponentScan(basePackages = { |
| 11 | "com.zhonglai.luhui.mqtt.comm.config", | 11 | "com.zhonglai.luhui.mqtt.comm.config", |
| 12 | - "com.zhonglai.luhui.mqtt.comm.agreement", | 12 | + "com.zhonglai.luhui.device.analysis", |
| 13 | "com.zhonglai.luhui.mqtt.comm.service", | 13 | "com.zhonglai.luhui.mqtt.comm.service", |
| 14 | "com.zhonglai.luhui.mqtt.comm.rocketMq", | 14 | "com.zhonglai.luhui.mqtt.comm.rocketMq", |
| 15 | "com.zhonglai.luhui.mqtt.config", | 15 | "com.zhonglai.luhui.mqtt.config", |
| @@ -9,18 +9,11 @@ import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator | @@ -9,18 +9,11 @@ import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator | ||
| 9 | import org.springframework.beans.factory.annotation.Value; | 9 | import org.springframework.beans.factory.annotation.Value; |
| 10 | import org.springframework.context.annotation.Bean; | 10 | import org.springframework.context.annotation.Bean; |
| 11 | import org.springframework.context.annotation.Configuration; | 11 | import org.springframework.context.annotation.Configuration; |
| 12 | -import org.springframework.data.redis.connection.RedisConnection; | ||
| 13 | import org.springframework.data.redis.connection.RedisConnectionFactory; | 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 14 | import org.springframework.data.redis.core.RedisTemplate; | 13 | import org.springframework.data.redis.core.RedisTemplate; |
| 15 | -import org.springframework.data.redis.listener.PatternTopic; | ||
| 16 | -import org.springframework.data.redis.listener.RedisMessageListenerContainer; | ||
| 17 | -import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; | ||
| 18 | -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | ||
| 19 | import org.springframework.data.redis.serializer.StringRedisSerializer; | 14 | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| 20 | -import org.springframework.util.StringUtils; | ||
| 21 | 15 | ||
| 22 | import javax.annotation.PostConstruct; | 16 | import javax.annotation.PostConstruct; |
| 23 | -import java.util.Properties; | ||
| 24 | 17 | ||
| 25 | @Configuration | 18 | @Configuration |
| 26 | public class RedisConfig { | 19 | public class RedisConfig { |
| 1 | package com.zhonglai.luhui.mqtt.comm.config; | 1 | package com.zhonglai.luhui.mqtt.comm.config; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.util.http.HttpUtils; | 4 | +import com.zhonglai.luhui.device.analysis.comm.util.http.HttpUtils; |
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Value; | 7 | import org.springframework.beans.factory.annotation.Value; |
| @@ -2,12 +2,12 @@ package com.zhonglai.luhui.mqtt.comm.dao; | @@ -2,12 +2,12 @@ package com.zhonglai.luhui.mqtt.comm.dao; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.ruoyi.common.annotation.PublicSQLConfig; | 4 | import com.ruoyi.common.annotation.PublicSQLConfig; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | import org.apache.commons.dbutils.*; | 6 | import org.apache.commons.dbutils.*; |
| 6 | import org.apache.commons.dbutils.handlers.BeanHandler; | 7 | import org.apache.commons.dbutils.handlers.BeanHandler; |
| 7 | import org.apache.commons.dbutils.handlers.BeanListHandler; | 8 | import org.apache.commons.dbutils.handlers.BeanListHandler; |
| 8 | import org.apache.commons.dbutils.handlers.MapListHandler; | 9 | import org.apache.commons.dbutils.handlers.MapListHandler; |
| 9 | import org.apache.commons.dbutils.handlers.ScalarHandler; | 10 | import org.apache.commons.dbutils.handlers.ScalarHandler; |
| 10 | -import org.apache.commons.lang3.StringUtils; | ||
| 11 | 11 | ||
| 12 | import java.lang.reflect.Field; | 12 | import java.lang.reflect.Field; |
| 13 | import java.lang.reflect.InvocationTargetException; | 13 | import java.lang.reflect.InvocationTargetException; |
| @@ -56,7 +56,7 @@ public class BaseDao { | @@ -56,7 +56,7 @@ public class BaseDao { | ||
| 56 | } | 56 | } |
| 57 | Method method; | 57 | Method method; |
| 58 | try { | 58 | try { |
| 59 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 59 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 60 | 60 | ||
| 61 | Object value = method.invoke(object); | 61 | Object value = method.invoke(object); |
| 62 | if(null != value) | 62 | if(null != value) |
| @@ -66,7 +66,7 @@ public class BaseDao { | @@ -66,7 +66,7 @@ public class BaseDao { | ||
| 66 | sql += ","; | 66 | sql += ","; |
| 67 | values += ","; | 67 | values += ","; |
| 68 | } | 68 | } |
| 69 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 69 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 70 | values += "?"; | 70 | values += "?"; |
| 71 | valueList.add(value); | 71 | valueList.add(value); |
| 72 | } | 72 | } |
| @@ -126,7 +126,7 @@ public class BaseDao { | @@ -126,7 +126,7 @@ public class BaseDao { | ||
| 126 | String sql = "insert into "; | 126 | String sql = "insert into "; |
| 127 | if(StringUtils.isBlank(tableName)) | 127 | if(StringUtils.isBlank(tableName)) |
| 128 | { | 128 | { |
| 129 | - tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(object.getClass().getSimpleName()); | 129 | + tableName = StringUtils.toUnderScoreCase(object.getClass().getSimpleName()); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | List<Object> valueList = new ArrayList<Object>(); | 132 | List<Object> valueList = new ArrayList<Object>(); |
| @@ -155,7 +155,7 @@ public class BaseDao { | @@ -155,7 +155,7 @@ public class BaseDao { | ||
| 155 | { | 155 | { |
| 156 | attributeStr += ","; | 156 | attributeStr += ","; |
| 157 | } | 157 | } |
| 158 | - attributeStr += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 158 | + attributeStr += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 159 | } | 159 | } |
| 160 | attributeStr += ")"; | 160 | attributeStr += ")"; |
| 161 | return attributeStr; | 161 | return attributeStr; |
| @@ -177,7 +177,7 @@ public class BaseDao { | @@ -177,7 +177,7 @@ public class BaseDao { | ||
| 177 | } | 177 | } |
| 178 | Method method; | 178 | Method method; |
| 179 | try { | 179 | try { |
| 180 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 180 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 181 | Object value = method.invoke(object); | 181 | Object value = method.invoke(object); |
| 182 | if(!"(".equals(values) ) | 182 | if(!"(".equals(values) ) |
| 183 | { | 183 | { |
| @@ -253,7 +253,7 @@ public class BaseDao { | @@ -253,7 +253,7 @@ public class BaseDao { | ||
| 253 | } | 253 | } |
| 254 | Method method = null; | 254 | Method method = null; |
| 255 | try { | 255 | try { |
| 256 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 256 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 257 | } catch (NoSuchMethodException e) { | 257 | } catch (NoSuchMethodException e) { |
| 258 | continue; | 258 | continue; |
| 259 | } | 259 | } |
| @@ -264,7 +264,7 @@ public class BaseDao { | @@ -264,7 +264,7 @@ public class BaseDao { | ||
| 264 | { | 264 | { |
| 265 | sql += ","; | 265 | sql += ","; |
| 266 | } | 266 | } |
| 267 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=?"; | 267 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=?"; |
| 268 | j++; | 268 | j++; |
| 269 | valueList.add(value); | 269 | valueList.add(value); |
| 270 | } | 270 | } |
| @@ -293,10 +293,10 @@ public class BaseDao { | @@ -293,10 +293,10 @@ public class BaseDao { | ||
| 293 | for(int i =0;i<wheres.length;i++) | 293 | for(int i =0;i<wheres.length;i++) |
| 294 | { | 294 | { |
| 295 | try { | 295 | try { |
| 296 | - Method method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(wheres[i])); | 296 | + Method method = object.getClass().getMethod("get"+ StringUtils.getName(wheres[i])); |
| 297 | Object value = method.invoke(object); | 297 | Object value = method.invoke(object); |
| 298 | sql += " and "; | 298 | sql += " and "; |
| 299 | - sql += com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(wheres[i]) + "=?"; | 299 | + sql += StringUtils.toUnderScoreCase(wheres[i]) + "=?"; |
| 300 | valueList.add(value); | 300 | valueList.add(value); |
| 301 | } catch (IllegalAccessException e) { | 301 | } catch (IllegalAccessException e) { |
| 302 | // TODO Auto-generated catch block | 302 | // TODO Auto-generated catch block |
| @@ -334,7 +334,7 @@ public class BaseDao { | @@ -334,7 +334,7 @@ public class BaseDao { | ||
| 334 | idName = field.getName(); | 334 | idName = field.getName(); |
| 335 | } | 335 | } |
| 336 | } | 336 | } |
| 337 | - method = object.getClass().getMethod("get"+ com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(idName)); | 337 | + method = object.getClass().getMethod("get"+ StringUtils.getName(idName)); |
| 338 | Object value = method.invoke(object); | 338 | Object value = method.invoke(object); |
| 339 | sql += " and "; | 339 | sql += " and "; |
| 340 | 340 | ||
| @@ -369,7 +369,7 @@ public class BaseDao { | @@ -369,7 +369,7 @@ public class BaseDao { | ||
| 369 | { | 369 | { |
| 370 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 370 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 371 | 371 | ||
| 372 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 372 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 373 | 373 | ||
| 374 | String sql = "select * from "+tableName+" where 1=1 "; | 374 | String sql = "select * from "+tableName+" where 1=1 "; |
| 375 | try { | 375 | try { |
| @@ -415,7 +415,7 @@ public class BaseDao { | @@ -415,7 +415,7 @@ public class BaseDao { | ||
| 415 | { | 415 | { |
| 416 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 416 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 417 | 417 | ||
| 418 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 418 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 419 | 419 | ||
| 420 | String sql = "select * from "+tableName+" where 1=1 "; | 420 | String sql = "select * from "+tableName+" where 1=1 "; |
| 421 | String idName = "id"; | 421 | String idName = "id"; |
| @@ -454,7 +454,7 @@ public class BaseDao { | @@ -454,7 +454,7 @@ public class BaseDao { | ||
| 454 | { | 454 | { |
| 455 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 455 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 456 | 456 | ||
| 457 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 457 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 458 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; | 458 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; |
| 459 | try { | 459 | try { |
| 460 | List<Object> valueList = new ArrayList<Object>(); | 460 | List<Object> valueList = new ArrayList<Object>(); |
| @@ -487,7 +487,7 @@ public class BaseDao { | @@ -487,7 +487,7 @@ public class BaseDao { | ||
| 487 | 487 | ||
| 488 | if(StringUtils.isBlank(tableName)) | 488 | if(StringUtils.isBlank(tableName)) |
| 489 | { | 489 | { |
| 490 | - tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 490 | + tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 491 | } | 491 | } |
| 492 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; | 492 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; |
| 493 | try { | 493 | try { |
| @@ -745,7 +745,7 @@ public class BaseDao { | @@ -745,7 +745,7 @@ public class BaseDao { | ||
| 745 | } | 745 | } |
| 746 | try { | 746 | try { |
| 747 | Method method; | 747 | Method method; |
| 748 | - method = object.getClass().getMethod("get"+ com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 748 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 749 | Object value = method.invoke(object); | 749 | Object value = method.invoke(object); |
| 750 | if(!(null == value)) | 750 | if(!(null == value)) |
| 751 | { | 751 | { |
| @@ -757,17 +757,17 @@ public class BaseDao { | @@ -757,17 +757,17 @@ public class BaseDao { | ||
| 757 | if("like".equals(s)) | 757 | if("like".equals(s)) |
| 758 | { | 758 | { |
| 759 | value = "%"+value+"%"; | 759 | value = "%"+value+"%"; |
| 760 | - like += " or " + "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther ; | 760 | + like += " or " + "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther ; |
| 761 | valueList.add(value); | 761 | valueList.add(value); |
| 762 | continue; | 762 | continue; |
| 763 | } | 763 | } |
| 764 | if("time".equals(s)) | 764 | if("time".equals(s)) |
| 765 | { | 765 | { |
| 766 | s = ">"; | 766 | s = ">"; |
| 767 | - orther = " and `"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`< '"+whereMap.get("end_"+field.getName())+"'"; | 767 | + orther = " and `"+ StringUtils.toUnderScoreCase(field.getName())+"`< '"+whereMap.get("end_"+field.getName())+"'"; |
| 768 | } | 768 | } |
| 769 | } | 769 | } |
| 770 | - where += " and `"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther; | 770 | + where += " and `"+ StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther; |
| 771 | valueList.add(value); | 771 | valueList.add(value); |
| 772 | } | 772 | } |
| 773 | } catch (NoSuchMethodException e) { | 773 | } catch (NoSuchMethodException e) { |
| @@ -819,7 +819,7 @@ public class BaseDao { | @@ -819,7 +819,7 @@ public class BaseDao { | ||
| 819 | { | 819 | { |
| 820 | continue; | 820 | continue; |
| 821 | } | 821 | } |
| 822 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 822 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 823 | Object value = method.invoke(object); | 823 | Object value = method.invoke(object); |
| 824 | if(null != value) | 824 | if(null != value) |
| 825 | { | 825 | { |
| @@ -829,9 +829,9 @@ public class BaseDao { | @@ -829,9 +829,9 @@ public class BaseDao { | ||
| 829 | values += ","; | 829 | values += ","; |
| 830 | update += ","; | 830 | update += ","; |
| 831 | } | 831 | } |
| 832 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 832 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 833 | values += "'"+ value+"'"; | 833 | values += "'"+ value+"'"; |
| 834 | - update += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`)"; | 834 | + update += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+ StringUtils.toUnderScoreCase(field.getName())+"`)"; |
| 835 | } | 835 | } |
| 836 | } catch (NoSuchMethodException e) { | 836 | } catch (NoSuchMethodException e) { |
| 837 | } catch (SecurityException e) { | 837 | } catch (SecurityException e) { |
| @@ -891,8 +891,8 @@ public class BaseDao { | @@ -891,8 +891,8 @@ public class BaseDao { | ||
| 891 | sb.append(","); | 891 | sb.append(","); |
| 892 | update += ","; | 892 | update += ","; |
| 893 | } | 893 | } |
| 894 | - sb.append("`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"); | ||
| 895 | - update += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`)"; | 894 | + sb.append("`"+ StringUtils.toUnderScoreCase(field.getName())+"`"); |
| 895 | + update += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+ StringUtils.toUnderScoreCase(field.getName())+"`)"; | ||
| 896 | } | 896 | } |
| 897 | sb.append(")"); | 897 | sb.append(")"); |
| 898 | sb.append("VALUES "); | 898 | sb.append("VALUES "); |
| @@ -904,7 +904,7 @@ public class BaseDao { | @@ -904,7 +904,7 @@ public class BaseDao { | ||
| 904 | Field field = fields[j]; | 904 | Field field = fields[j]; |
| 905 | Method method; | 905 | Method method; |
| 906 | try { | 906 | try { |
| 907 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 907 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 908 | Object value = method.invoke(object); | 908 | Object value = method.invoke(object); |
| 909 | if(null == value) | 909 | if(null == value) |
| 910 | { | 910 | { |
| @@ -963,7 +963,7 @@ public class BaseDao { | @@ -963,7 +963,7 @@ public class BaseDao { | ||
| 963 | { | 963 | { |
| 964 | Object value = mapwhere.get(key); | 964 | Object value = mapwhere.get(key); |
| 965 | where += " and "; | 965 | where += " and "; |
| 966 | - where += com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(key) + "=?"; | 966 | + where += StringUtils.toUnderScoreCase(key) + "=?"; |
| 967 | valueList.add(value); | 967 | valueList.add(value); |
| 968 | } | 968 | } |
| 969 | return where; | 969 | return where; |
| @@ -1007,6 +1007,6 @@ public class BaseDao { | @@ -1007,6 +1007,6 @@ public class BaseDao { | ||
| 1007 | e.printStackTrace(); | 1007 | e.printStackTrace(); |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | - return com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(tableNmae); | 1010 | + return StringUtils.toUnderScoreCase(tableNmae); |
| 1011 | } | 1011 | } |
| 1012 | } | 1012 | } |
| 1 | -package com.zhonglai.luhui.mqtt.dto; | 1 | +package com.zhonglai.luhui.mqtt.comm.dto; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.zhonglai.luhui.device.analysis.dto.ApiName; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.dto.DeviceCommandApiParameter; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 8 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 9 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 10 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 1 | package com.zhonglai.luhui.mqtt.comm.rocketMq; | 1 | package com.zhonglai.luhui.mqtt.comm.rocketMq; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.service.MqttCallback; | ||
| 5 | -import com.zhonglai.luhui.mqtt.dto.DeviceCommandApi; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 4 | +import com.zhonglai.luhui.mqtt.comm.dto.DeviceCommandApi; |
| 5 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 7 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 9 | import org.apache.rocketmq.common.message.MessageExt; | 8 | import org.apache.rocketmq.common.message.MessageExt; |
| 10 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | 9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.SaveDataDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.topic.AddPostDto; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.topic.AllPostDto; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 9 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 10 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 11 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 6 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 12 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 10 | -import com.zhonglai.luhui.mqtt.dto.SaveDataDto; | ||
| 11 | -import com.zhonglai.luhui.mqtt.dto.topic.AddPostDto; | ||
| 12 | -import com.zhonglai.luhui.mqtt.dto.topic.AllPostDto; | ||
| 13 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; | 13 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; |
| 14 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 14 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 15 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| @@ -55,7 +55,7 @@ public class BusinessDataUpdateService { | @@ -55,7 +55,7 @@ public class BusinessDataUpdateService { | ||
| 55 | * @param type | 55 | * @param type |
| 56 | * @param topic | 56 | * @param topic |
| 57 | */ | 57 | */ |
| 58 | - public void updataDta(Type type, Topic topic, ServerDto serverDto,String operationType,boolean isLog) | 58 | + public void updataDta(Type type, Topic topic, ServerDto serverDto, String operationType, boolean isLog) |
| 59 | { | 59 | { |
| 60 | IotDevice olddevice = cacheService.getIotDevice(topic.getClientid()); | 60 | IotDevice olddevice = cacheService.getIotDevice(topic.getClientid()); |
| 61 | 61 |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 5 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 6 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 缓存业务 | 10 | * 缓存业务 |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.clien.ClienConnection; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.clien.impl.ClienConnectionImpl; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.TerminalClientRePlyDto; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.util.ByteUtil; | ||
| 9 | -import com.zhonglai.luhui.mqtt.dto.Message; | 3 | +import com.zhonglai.luhui.device.analysis.comm.clien.ClienConnection; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.clien.impl.ClienConnectionImpl; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.TerminalClientRePlyDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.util.ByteUtil; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 10 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; | ||
| 10 | import net.jodah.expiringmap.ExpirationListener; | 11 | import net.jodah.expiringmap.ExpirationListener; |
| 11 | import net.jodah.expiringmap.ExpirationPolicy; | 12 | import net.jodah.expiringmap.ExpirationPolicy; |
| 12 | import net.jodah.expiringmap.ExpiringMap; | 13 | import net.jodah.expiringmap.ExpiringMap; |
| @@ -56,10 +57,10 @@ public class ClienNoticeService { | @@ -56,10 +57,10 @@ public class ClienNoticeService { | ||
| 56 | public Message sendMessage(Topic topic, MqttMessage mqttMessage) throws MqttException, InterruptedException { | 57 | public Message sendMessage(Topic topic, MqttMessage mqttMessage) throws MqttException, InterruptedException { |
| 57 | //设置通知渠道 | 58 | //设置通知渠道 |
| 58 | ClienConnection clienConnection = new ClienConnectionImpl(); | 59 | ClienConnection clienConnection = new ClienConnectionImpl(); |
| 59 | - String key = topic.generateClienKey().replace(topic.getTopicType(),top_return_map.get(topic.getTopicType())); | 60 | + String key = TopicUtil.generateClienKey(topic).replace(topic.getTopicType(),top_return_map.get(topic.getTopicType())); |
| 60 | log.info("设置通知渠道 {} {}",key,clienConnection); | 61 | log.info("设置通知渠道 {} {}",key,clienConnection); |
| 61 | clienConnectionMap.put(key,clienConnection); | 62 | clienConnectionMap.put(key,clienConnection); |
| 62 | - sendMessage(topic.generateSendMessageTopic(),mqttMessage); | 63 | + sendMessage(TopicUtil.generateSendMessageTopic(topic),mqttMessage); |
| 63 | synchronized(clienConnection) | 64 | synchronized(clienConnection) |
| 64 | { | 65 | { |
| 65 | log.info("{}等待通知",topic.getClientid()); | 66 | log.info("{}等待通知",topic.getClientid()); |
| @@ -88,7 +89,7 @@ public class ClienNoticeService { | @@ -88,7 +89,7 @@ public class ClienNoticeService { | ||
| 88 | 89 | ||
| 89 | public ClienConnection getClienConnection(Topic topic) | 90 | public ClienConnection getClienConnection(Topic topic) |
| 90 | { | 91 | { |
| 91 | - return clienConnectionMap.get(topic.generateClienKey()); | 92 | + return clienConnectionMap.get(TopicUtil.generateClienKey(topic)); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | /** | 95 | /** |
| @@ -2,16 +2,16 @@ package com.zhonglai.luhui.mqtt.comm.service; | @@ -2,16 +2,16 @@ package com.zhonglai.luhui.mqtt.comm.service; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelBase; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 11 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 12 | +import com.zhonglai.luhui.device.analysis.dto.SaveDataDto; | ||
| 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 13 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 6 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 14 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelBase; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 11 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 12 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 13 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 14 | -import com.zhonglai.luhui.mqtt.dto.SaveDataDto; | ||
| 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 16 | import org.apache.commons.lang3.EnumUtils; | 16 | import org.apache.commons.lang3.EnumUtils; |
| 17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
| @@ -59,7 +59,7 @@ public class DataModeAnalysisService { | @@ -59,7 +59,7 @@ public class DataModeAnalysisService { | ||
| 59 | /** | 59 | /** |
| 60 | * 解析物模型数据 | 60 | * 解析物模型数据 |
| 61 | */ | 61 | */ |
| 62 | - public SaveDataDto analysisThingsModelValue(String id,String userName ,JSONObject jsData, ServerDto serverDto) | 62 | + public SaveDataDto analysisThingsModelValue(String id, String userName , JSONObject jsData, ServerDto serverDto) |
| 63 | { | 63 | { |
| 64 | if(null != jsData && jsData.size() != 0 ) | 64 | if(null != jsData && jsData.size() != 0 ) |
| 65 | { | 65 | { |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceAlarmInfo; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.TableUtil; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 4 | import com.zhonglai.luhui.mqtt.comm.dto.*; | 8 | import com.zhonglai.luhui.mqtt.comm.dto.*; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.TableUtil; | ||
| 8 | -import org.apache.commons.lang3.StringUtils; | 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; |
| 9 | 10 | ||
| 10 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| 11 | import java.util.List; | 12 | import java.util.List; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.LogDeviceOperation; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.TableGenerateSqlEnum; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.LogDeviceOperation; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.TableGenerateSqlEnum; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 8 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
| 9 | 9 | ||
| 10 | import java.util.List; | 10 | import java.util.List; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDtoClassNew; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.ByteUtil; | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 7 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDtoClassNew; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreementFactory; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.util.ByteUtil; | 8 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; |
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreementFactory; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 11 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; | ||
| 11 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 12 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 12 | import lombok.SneakyThrows; | 13 | import lombok.SneakyThrows; |
| 13 | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; | 14 | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; |
| @@ -53,7 +54,7 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -53,7 +54,7 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 53 | 54 | ||
| 54 | @Override | 55 | @Override |
| 55 | public void messageArrived(String s, MqttMessage mqttMessage) { | 56 | public void messageArrived(String s, MqttMessage mqttMessage) { |
| 56 | - Topic desttopic = new Topic(s); | 57 | + Topic desttopic = TopicUtil.initTopic(s); |
| 57 | desttopic.setPayloadtype("POST_REQ"); | 58 | desttopic.setPayloadtype("POST_REQ"); |
| 58 | 59 | ||
| 59 | //接收到消息 | 60 | //接收到消息 |
| @@ -70,12 +71,12 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -70,12 +71,12 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 70 | buffer.append("\r\n"); | 71 | buffer.append("\r\n"); |
| 71 | 72 | ||
| 72 | try { | 73 | try { |
| 73 | - Topic topic = new Topic(s); | 74 | + Topic topic = TopicUtil.initTopic(s); |
| 74 | if(null == topic) | 75 | if(null == topic) |
| 75 | { | 76 | { |
| 76 | log.error("消息{},topic为空,不做解析"); | 77 | log.error("消息{},topic为空,不做解析"); |
| 77 | log.error("消息《"+s+"》解析为空 》》》内容:\r\n"+buffer.toString()); | 78 | log.error("消息《"+s+"》解析为空 》》》内容:\r\n"+buffer.toString()); |
| 78 | - terminalService.publish(desttopic.generateSendMessageTopic(),"0"); | 79 | + terminalService.publish(TopicUtil.generateSendMessageTopic(topic),"0"); |
| 79 | return; | 80 | return; |
| 80 | } | 81 | } |
| 81 | 82 | ||
| @@ -88,7 +89,7 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -88,7 +89,7 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 88 | if(null == iotDevice) | 89 | if(null == iotDevice) |
| 89 | { | 90 | { |
| 90 | log.info("设备{}不存在",topic.getClientid()); | 91 | log.info("设备{}不存在",topic.getClientid()); |
| 91 | - terminalService.publish(desttopic.generateSendMessageTopic(),"1"); | 92 | + terminalService.publish(TopicUtil.generateSendMessageTopic(topic),"1"); |
| 92 | return; | 93 | return; |
| 93 | } | 94 | } |
| 94 | if("ONLINE".equals(topic.getTopicType().toUpperCase())) | 95 | if("ONLINE".equals(topic.getTopicType().toUpperCase())) |
| @@ -113,12 +114,12 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -113,12 +114,12 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 113 | //数据持久化 | 114 | //数据持久化 |
| 114 | dataPersistenceService.persistence(topic,dto); | 115 | dataPersistenceService.persistence(topic,dto); |
| 115 | 116 | ||
| 116 | - terminalService.publish(desttopic.generateSendMessageTopic(),"2"); | 117 | + terminalService.publish(TopicUtil.generateSendMessageTopic(desttopic),"2"); |
| 117 | log.info("{}payload解析完成",s); | 118 | log.info("{}payload解析完成",s); |
| 118 | } catch (Exception e) { | 119 | } catch (Exception e) { |
| 119 | log.error(s+"消息解析异常",e); | 120 | log.error(s+"消息解析异常",e); |
| 120 | try { | 121 | try { |
| 121 | - terminalService.publish(desttopic.generateSendMessageTopic(),"3"); | 122 | + terminalService.publish(TopicUtil.generateSendMessageTopic(desttopic),"3"); |
| 122 | } catch (MqttException ex) { | 123 | } catch (MqttException ex) { |
| 123 | log.error(s+"消息解析异常时返回的执行结果消息异常",ex); | 124 | log.error(s+"消息解析异常时返回的执行结果消息异常",ex); |
| 124 | } | 125 | } |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 4 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 5 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; |
| 5 | import org.apache.commons.lang3.StringUtils; | 6 | import org.apache.commons.lang3.StringUtils; |
| 6 | import org.eclipse.paho.client.mqttv3.MqttClient; | 7 | import org.eclipse.paho.client.mqttv3.MqttClient; |
| 7 | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; | 8 | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; |
| @@ -139,7 +140,7 @@ public class TerminalService { | @@ -139,7 +140,7 @@ public class TerminalService { | ||
| 139 | List<String> ts = getCompletionTopics(); | 140 | List<String> ts = getCompletionTopics(); |
| 140 | for(String topicstr:ts) | 141 | for(String topicstr:ts) |
| 141 | { | 142 | { |
| 142 | - Topic topic = new Topic(topicstr); | 143 | + Topic topic = TopicUtil.initTopic(topicstr); |
| 143 | if(null != topic) | 144 | if(null != topic) |
| 144 | { | 145 | { |
| 145 | String rild = topic.getRoleid(); | 146 | String rild = topic.getRoleid(); |
| @@ -3,7 +3,6 @@ package com.zhonglai.luhui.mqtt.comm.service.redis; | @@ -3,7 +3,6 @@ package com.zhonglai.luhui.mqtt.comm.service.redis; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 6 | -import org.springframework.beans.factory.annotation.Value; | ||
| 7 | import org.springframework.data.redis.core.RedisTemplate; | 6 | import org.springframework.data.redis.core.RedisTemplate; |
| 8 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 9 | import org.springframework.util.CollectionUtils; | 8 | import org.springframework.util.CollectionUtils; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.factory; | 1 | +package com.zhonglai.luhui.mqtt.comm.util; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.MyException; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 4 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 6 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.MyException; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.service.MqttCallback; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 8 | -import lombok.Data; | ||
| 9 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 11 | 9 | ||
| 12 | import java.lang.reflect.Field; | 10 | import java.lang.reflect.Field; |
| 13 | import java.util.Optional; | 11 | import java.util.Optional; |
| 14 | 12 | ||
| 15 | -@Data | ||
| 16 | -public class Topic { | ||
| 17 | - private static final Logger log = LoggerFactory.getLogger(Topic.class); | 13 | +public class TopicUtil { |
| 14 | + private static final Logger log = LoggerFactory.getLogger(TopicUtil.class); | ||
| 18 | 15 | ||
| 19 | - private String roleid; | ||
| 20 | - private String username; | ||
| 21 | - private String clientid; | ||
| 22 | - private String topicType; | ||
| 23 | - private String messageid; | ||
| 24 | - private String payloadtype; | ||
| 25 | - | ||
| 26 | - public Topic() { | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - public Topic(String roleid, String username, String clientid, String topicType, String payloadtype) { | ||
| 30 | - this.roleid = roleid; | ||
| 31 | - this.username = username; | ||
| 32 | - this.clientid = clientid; | ||
| 33 | - this.topicType = topicType; | ||
| 34 | - this.payloadtype = payloadtype; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - public Topic(String roleid, String username, String clientid, String topicType, String messageid, String payloadtype) { | ||
| 38 | - this.roleid = roleid; | ||
| 39 | - this.username = username; | ||
| 40 | - this.clientid = clientid; | ||
| 41 | - this.topicType = topicType; | ||
| 42 | - this.messageid = messageid; | ||
| 43 | - this.payloadtype = payloadtype; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - public Topic(String topic) | 16 | + public static Topic initTopic(String topic) |
| 47 | { | 17 | { |
| 48 | topic = Optional.ofNullable(topic).orElseThrow(()->new MyException("topic为空")); | 18 | topic = Optional.ofNullable(topic).orElseThrow(()->new MyException("topic为空")); |
| 49 | String[] sts = topic.split("/"); | 19 | String[] sts = topic.split("/"); |
| @@ -53,83 +23,85 @@ public class Topic { | @@ -53,83 +23,85 @@ public class Topic { | ||
| 53 | { | 23 | { |
| 54 | number = config.length; | 24 | number = config.length; |
| 55 | } | 25 | } |
| 26 | + Topic topicObject = new Topic(); | ||
| 56 | for(int i=1;i<number;i++) | 27 | for(int i=1;i<number;i++) |
| 57 | { | 28 | { |
| 58 | String cf = config[i].replace("{{","").replace("}}",""); | 29 | String cf = config[i].replace("{{","").replace("}}",""); |
| 59 | try { | 30 | try { |
| 60 | - Field field = this.getClass().getDeclaredField(cf); | ||
| 61 | - field.set(this,sts[i]); | 31 | + Field field = topicObject.getClass().getDeclaredField(cf); |
| 32 | + field.set(topicObject,sts[i]); | ||
| 62 | } catch (NoSuchFieldException e) { | 33 | } catch (NoSuchFieldException e) { |
| 63 | log.info("{}生成topic时没有属性{}",topic,cf); | 34 | log.info("{}生成topic时没有属性{}",topic,cf); |
| 64 | } catch (IllegalAccessException e) { | 35 | } catch (IllegalAccessException e) { |
| 65 | log.info("{}生成topic时无法给{}赋值{}",topic,cf,sts[i]); | 36 | log.info("{}生成topic时无法给{}赋值{}",topic,cf,sts[i]); |
| 66 | } | 37 | } |
| 67 | } | 38 | } |
| 39 | + return topicObject; | ||
| 68 | } | 40 | } |
| 69 | 41 | ||
| 70 | /** | 42 | /** |
| 71 | * 生成缓存关键字 | 43 | * 生成缓存关键字 |
| 72 | * @return | 44 | * @return |
| 73 | */ | 45 | */ |
| 74 | - public String generateRedicKey() | 46 | + public static String generateRedicKey(Topic topic) |
| 75 | { | 47 | { |
| 76 | - return generate(":"); | 48 | + return generate(topic,":"); |
| 77 | } | 49 | } |
| 78 | 50 | ||
| 79 | /** | 51 | /** |
| 80 | * 生成发送消息的topic | 52 | * 生成发送消息的topic |
| 81 | * @return | 53 | * @return |
| 82 | */ | 54 | */ |
| 83 | - public String generateSendMessageTopic() | 55 | + public static String generateSendMessageTopic(Topic topic) |
| 84 | { | 56 | { |
| 85 | - return "/"+generate("/"); | 57 | + return "/"+generate(topic,"/"); |
| 86 | } | 58 | } |
| 87 | 59 | ||
| 88 | /** | 60 | /** |
| 89 | * 生成客户端关键字 | 61 | * 生成客户端关键字 |
| 90 | * @return | 62 | * @return |
| 91 | */ | 63 | */ |
| 92 | - public String generateClienKey() | 64 | + public static String generateClienKey(Topic topic) |
| 93 | { | 65 | { |
| 94 | - return "/"+generate("/"); | 66 | + return "/"+generate(topic,"/"); |
| 95 | } | 67 | } |
| 96 | 68 | ||
| 97 | - private String generate(String division) | 69 | + private static String generate(Topic topic,String division) |
| 98 | { | 70 | { |
| 99 | String str = SysParameter.topicconfig; | 71 | String str = SysParameter.topicconfig; |
| 100 | - if(StringUtils.isEmpty(roleid)) | 72 | + if(StringUtils.isEmpty(topic.getRoleid())) |
| 101 | { | 73 | { |
| 102 | - roleid = "2"; | 74 | + topic.setRoleid("2"); |
| 103 | } | 75 | } |
| 104 | - str = str.replace("/{{roleid}}",roleid+division); | 76 | + str = str.replace("/{{roleid}}",topic.getRoleid()+division); |
| 105 | 77 | ||
| 106 | - if(StringUtils.isEmpty(username)) | 78 | + if(StringUtils.isEmpty(topic.getUsername())) |
| 107 | { | 79 | { |
| 108 | - username = "+"; | 80 | + topic.setUsername("+"); |
| 109 | } | 81 | } |
| 110 | - str = str.replace("/{{username}}",username+division); | 82 | + str = str.replace("/{{username}}",topic.getUsername()+division); |
| 111 | 83 | ||
| 112 | - if(StringUtils.isEmpty(clientid)) | 84 | + if(StringUtils.isEmpty(topic.getClientid())) |
| 113 | { | 85 | { |
| 114 | - clientid = "+"; | 86 | + topic.setClientid( "+"); |
| 115 | } | 87 | } |
| 116 | - str = str.replace("/{{clientid}}",clientid+division); | 88 | + str = str.replace("/{{clientid}}",topic.getClientid()+division); |
| 117 | 89 | ||
| 118 | - if(StringUtils.isEmpty(payloadtype)) | 90 | + if(StringUtils.isEmpty(topic.getPayloadtype())) |
| 119 | { | 91 | { |
| 120 | - payloadtype = "String"; | 92 | + topic.setPayloadtype( "String"); |
| 121 | } | 93 | } |
| 122 | - str = str.replace("/{{payloadtype}}",payloadtype+division); | 94 | + str = str.replace("/{{payloadtype}}",topic.getPayloadtype()+division); |
| 123 | 95 | ||
| 124 | - if(StringUtils.isEmpty(topicType)) | 96 | + if(StringUtils.isEmpty(topic.getTopicType())) |
| 125 | { | 97 | { |
| 126 | - topicType = "PUT"; | 98 | + topic.setTopicType("PUT"); |
| 127 | } | 99 | } |
| 128 | - str = str.replace("/{{topicType}}",topicType+division); | 100 | + str = str.replace("/{{topicType}}",topic.getTopicType()+division); |
| 129 | 101 | ||
| 130 | - if(StringUtils.isNotEmpty(messageid)) | 102 | + if(StringUtils.isNotEmpty(topic.getMessageid())) |
| 131 | { | 103 | { |
| 132 | - str = str.replace("/{{messageid}}",messageid); | 104 | + str = str.replace("/{{messageid}}",topic.getMessageid()); |
| 133 | } | 105 | } |
| 134 | 106 | ||
| 135 | return str; | 107 | return str; |
| @@ -3,8 +3,8 @@ package com.zhonglai.luhui.mqtt.controller; | @@ -3,8 +3,8 @@ package com.zhonglai.luhui.mqtt.controller; | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 3 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | import com.zhonglai.luhui.device.domain.IotTerminal; | 4 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; |
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 9 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 9 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 10 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
| @@ -2,20 +2,18 @@ package com.zhonglai.luhui.mqtt.controller; | @@ -2,20 +2,18 @@ package com.zhonglai.luhui.mqtt.controller; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.util.IOUtils; | 4 | import com.alibaba.fastjson.util.IOUtils; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 9 | import io.swagger.annotations.ApiImplicitParam; | 9 | import io.swagger.annotations.ApiImplicitParam; |
| 10 | import io.swagger.annotations.ApiImplicitParams; | 10 | import io.swagger.annotations.ApiImplicitParams; |
| 11 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
| 12 | -import org.springframework.http.MediaType; | ||
| 13 | import org.springframework.stereotype.Controller; | 12 | import org.springframework.stereotype.Controller; |
| 14 | import org.springframework.web.bind.annotation.PathVariable; | 13 | import org.springframework.web.bind.annotation.PathVariable; |
| 15 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 16 | import org.springframework.web.bind.annotation.RequestMethod; | 15 | import org.springframework.web.bind.annotation.RequestMethod; |
| 17 | 16 | ||
| 18 | -import javax.servlet.ServletOutputStream; | ||
| 19 | import javax.servlet.http.HttpServletResponse; | 17 | import javax.servlet.http.HttpServletResponse; |
| 20 | import java.io.*; | 18 | import java.io.*; |
| 21 | import java.util.Date; | 19 | import java.util.Date; |
| @@ -5,11 +5,11 @@ import com.zhonglai.luhui.device.domain.IotDevice; | @@ -5,11 +5,11 @@ import com.zhonglai.luhui.device.domain.IotDevice; | ||
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 5 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; | 6 | import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; |
| 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 10 | import com.zhonglai.luhui.mqtt.comm.service.CacheService; | 10 | import com.zhonglai.luhui.mqtt.comm.service.CacheService; |
| 11 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; | 11 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; |
| 12 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 12 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 13 | import com.zhonglai.luhui.mqtt.service.redis.RedisDeleteListener; | 13 | import com.zhonglai.luhui.mqtt.service.redis.RedisDeleteListener; |
| 14 | import com.zhonglai.luhui.mqtt.service.redis.RedisExpiredListener; | 14 | import com.zhonglai.luhui.mqtt.service.redis.RedisExpiredListener; |
| 15 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| @@ -2,10 +2,10 @@ package com.zhonglai.luhui.mqtt.service; | @@ -2,10 +2,10 @@ package com.zhonglai.luhui.mqtt.service; | ||
| 2 | 2 | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 3 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | import com.zhonglai.luhui.device.domain.IotTerminal; | 4 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.LogDeviceOperation; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; |
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.LogDeviceOperation; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 9 | import com.zhonglai.luhui.mqtt.comm.service.DataPersistenceService; | 9 | import com.zhonglai.luhui.mqtt.comm.service.DataPersistenceService; |
| 10 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; | 10 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; |
| 11 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 1 | package com.zhonglai.luhui.mqtt.service; | 1 | package com.zhonglai.luhui.mqtt.service; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 4 | import org.springframework.context.annotation.Configuration; | 4 | import org.springframework.context.annotation.Configuration; |
| 5 | import org.springframework.scheduling.annotation.EnableScheduling; | 5 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 6 | import org.springframework.scheduling.annotation.Scheduled; | 6 | import org.springframework.scheduling.annotation.Scheduled; |
-
请 注册 或 登录 后发表评论