Merge remote-tracking branch 'origin/master'

dev
夜笙歌 1 year ago
commit f50f0ef9e1

@ -24,7 +24,10 @@ public class TdEngineConstants {
public static final String PAYLOAD_DEVICE_CODE = "uid";//协议上传设备编号的key
public static final String PAYLOAD_DEVICE_DATA_TYPE_IMAGE = "image";//协议上传图片类型的key
public static final String PAYLOAD_DEVICE_DATA_TYPE_IMAGE = "image";//协议上传图片的key
public static final String PAYLOAD_DEVICE_DATA_TYPE_TYPE = "type";//协议上传图片类型的key
public static final String PAYLOAD_DEVICE_DATA_TYPE_TYPE_FIRSET_UPPER = "Type";//协议上传图片类型的key
// public static final String DEFAULT_DB_NAME_PREFIX = "db_scene_";//数据库名称前缀
@ -71,7 +74,7 @@ public class TdEngineConstants {
/**
*
*/
public static final List<String> ABNDON_FUNCTION_IDENTIFIERS = Arrays.asList("ts","value1");
public static final List<String> ABNDON_FUNCTION_IDENTIFIERS = Arrays.asList("ts","value1","type");
public static final Map<String, String> DEVICE_DATA_COLUMN_MAP = new HashMap<String, String>();

@ -106,7 +106,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
String keyLatitude = keyLatitudeR.getData();
hwDeviceModeFunctionList.forEach(d -> {
if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(d.getFunctionIdentifier())) {
if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(d.getFunctionIdentifier().toLowerCase())) {
throw new ServiceException("标识符不能等于:" + d.getFunctionIdentifier());
}
if (StringUtils.isEmpty(d.getCoordinate()) &&
@ -391,7 +391,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
*/
private void checkDuplicateIdentifiers(HwDeviceModeFunction hwDeviceModeFunction) {
String functionIdentifier = hwDeviceModeFunction.getFunctionIdentifier();
if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(functionIdentifier)) {
if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(functionIdentifier.toLowerCase())) {
throw new ServiceException("标识符不能等于:" + functionIdentifier);
}

@ -135,6 +135,10 @@ public class DataProcessServiceImpl implements IDataProcessService {
key = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key) == null ? key
: TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key);
if (key.equalsIgnoreCase(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_TYPE)) {
continue;
}
if (value instanceof String) {
String valueStr = (String) value;
if (StringUtils.isNotBlank(valueStr)) {
@ -143,13 +147,23 @@ public class DataProcessServiceImpl implements IDataProcessService {
*/
String[] imagePatternArr = imagePatterns.split(",");
String extension = ImageUtils.getImageType(valueStr, imagePatternArr);
if (StringUtils.isNotBlank(extension)) {
if (StringUtils.isNotBlank(extension) && valueStr.length() > 300) {
//保存图片,并返回图片详细地址进行赋值保存
value = getImageFileName(imagePath, imageDomain, imagePrefix, valueStr, deviceId, extension);
if (value == null) continue;
} else if (dataType.equalsIgnoreCase(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_IMAGE)) {
if (ImageUtils.checkIsBase64(valueStr)) {//判断没有加前缀的情况
value = getImageFileName(imagePath, imageDomain, imagePrefix, valueStr, deviceId, "jpg");
if (ImageUtils.checkIsBase64(valueStr) && valueStr.length() > 300) {//判断没有加前缀的情况
String type = dataValueJson.getString(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_TYPE);
if (type == null) {
type = dataValueJson.getString(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_TYPE_FIRSET_UPPER);
}
extension = "jpg";
if (type != null) {
extension = StringUtils.isNotBlank(ImageUtils.getImageType(type, imagePatternArr))
? ImageUtils.getImageType(type, imagePatternArr) : extension;
System.out.println("extension: " + extension);
}
value = getImageFileName(imagePath, imageDomain, imagePrefix, valueStr, deviceId, extension);
if (value == null) continue;
}
}

@ -14,7 +14,11 @@ mqtt:
qos : 1 # qos服务质量等级0最多交付一次1至少交付一次2只交付一次
dataTopicFilter: /v1/# # 订阅的处理设备上报数据的topic
deviceStatusTopic: /device/status/v1 # 订阅的处理设备状态的topic
imagePath: images # base64图片转换保存的路径
#domain: http://127.0.0.1:9665 # 文件服务地址
#path: D:/ruoyi/uploadPath # base64图片转换保存的路径
domain: http://175.27.215.92:9665 # 文件服务地址
path: /home/ruoyi/uploadPath # base64图片转换保存的路径
prefix: /statics
imagePatterns: jpg,jpeg,png #支持的图片格式
# Spring
@ -24,7 +28,7 @@ spring:
name: hw-data-process
profiles:
# 环境配置
active: dev
active: prod
cloud:
nacos:
discovery:

@ -1,6 +1,7 @@
package com.ruoyi.job.task;
import com.ruoyi.business.api.RemoteBusinessService;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.utils.StringUtils;
import org.springframework.stereotype.Component;
@ -30,6 +31,6 @@ public class RyTask {
public void computeOnlineDevicesCount(Integer days) {
this.remoteBusinessService.computeOnlineDevicecCount(days);
this.remoteBusinessService.computeOnlineDevicecCount(days, SecurityConstants.INNER);
}
}

Loading…
Cancel
Save