若依微服务1.5.7

1、dataprocess:图片处理兼容
2、job:innerauth
dev 1.5.7
xins 1 year ago
parent fc7dca2601
commit 196dc1a999

@ -24,7 +24,10 @@ public class TdEngineConstants {
public static final String PAYLOAD_DEVICE_CODE = "uid";//协议上传设备编号的key 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_";//数据库名称前缀 // 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>(); 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(); String keyLatitude = keyLatitudeR.getData();
hwDeviceModeFunctionList.forEach(d -> { 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()); throw new ServiceException("标识符不能等于:" + d.getFunctionIdentifier());
} }
if (StringUtils.isEmpty(d.getCoordinate()) && if (StringUtils.isEmpty(d.getCoordinate()) &&
@ -391,7 +391,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
*/ */
private void checkDuplicateIdentifiers(HwDeviceModeFunction hwDeviceModeFunction) { private void checkDuplicateIdentifiers(HwDeviceModeFunction hwDeviceModeFunction) {
String functionIdentifier = hwDeviceModeFunction.getFunctionIdentifier(); String functionIdentifier = hwDeviceModeFunction.getFunctionIdentifier();
if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(functionIdentifier)) { if (TdEngineConstants.ABNDON_FUNCTION_IDENTIFIERS.contains(functionIdentifier.toLowerCase())) {
throw new ServiceException("标识符不能等于:" + functionIdentifier); throw new ServiceException("标识符不能等于:" + functionIdentifier);
} }

@ -135,6 +135,10 @@ public class DataProcessServiceImpl implements IDataProcessService {
key = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key) == null ? key key = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key) == null ? key
: TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key); : TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key);
if (key.equalsIgnoreCase(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_TYPE)) {
continue;
}
if (value instanceof String) { if (value instanceof String) {
String valueStr = (String) value; String valueStr = (String) value;
if (StringUtils.isNotBlank(valueStr)) { if (StringUtils.isNotBlank(valueStr)) {
@ -143,13 +147,23 @@ public class DataProcessServiceImpl implements IDataProcessService {
*/ */
String[] imagePatternArr = imagePatterns.split(","); String[] imagePatternArr = imagePatterns.split(",");
String extension = ImageUtils.getImageType(valueStr, imagePatternArr); 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); value = getImageFileName(imagePath, imageDomain, imagePrefix, valueStr, deviceId, extension);
if (value == null) continue; if (value == null) continue;
} else if (dataType.equalsIgnoreCase(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_IMAGE)) { } else if (dataType.equalsIgnoreCase(TdEngineConstants.PAYLOAD_DEVICE_DATA_TYPE_IMAGE)) {
if (ImageUtils.checkIsBase64(valueStr)) {//判断没有加前缀的情况 if (ImageUtils.checkIsBase64(valueStr) && valueStr.length() > 300) {//判断没有加前缀的情况
value = getImageFileName(imagePath, imageDomain, imagePrefix, valueStr, deviceId, "jpg"); 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; if (value == null) continue;
} }
} }

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

Loading…
Cancel
Save