|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|