Commit 95295847 authored by 麻笑宇's avatar 麻笑宇

中屏-设备总览-设备详情-详细信息,涉及到日期字段,时间格式调整为年-月-日,去掉时分秒显示

parent eb2022ea
......@@ -33,6 +33,8 @@ import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.net.URI;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
......@@ -632,6 +634,17 @@ public class DPSubServiceImpl {
jsonObject.put("value", (!ValidationUtil.isEmpty(lnglatSelect.getString("latitude")) && !ValidationUtil.isEmpty(lnglatSelect.getString("longitude")))
? String.format("[%s,%s]", lnglatSelect.getString("latitude"), lnglatSelect.getString("longitude")) : lnglatSelect.getString("address"));
}
} else if ("dateTime".equals(xObj.getString("componentKey"))) {
if (!ValidationUtil.isEmpty(value)) {
SimpleDateFormat sdf = new SimpleDateFormat(visualParams.getString("format"));
Date date = null;
try {
date = sdf.parse(ValidationUtil.validateString(value));
} catch (ParseException e) {
throw new RuntimeException(e);
}
jsonObject.put("value",sdf.format(date));
}
} else if ("checkbox".equals(xObj.getString("componentKey"))) {
ResponseModel checkboxResult = this.getApiResult(visualParams.getJSONObject("api"), null);
if (!ValidationUtil.isEmpty(checkboxResult) && checkboxResult.getStatus() == 200 && !ValidationUtil.isEmpty(value)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment