Commit 08932d09 authored by tangwei's avatar tangwei

转换时间

parent ca903819
...@@ -23,7 +23,7 @@ public class DateUtils { ...@@ -23,7 +23,7 @@ public class DateUtils {
public static final String YEAR_PATTERN = "yyyy"; public static final String YEAR_PATTERN = "yyyy";
public static final String MINUTE_ONLY_PATTERN = "mm"; public static final String MINUTE_ONLY_PATTERN = "mm";
public static final String HOUR_ONLY_PATTERN = "HH"; public static final String HOUR_ONLY_PATTERN = "HH";
public static final String DATE_TIME_T_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; public static final String DATE_TIME_T_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
/** /**
* 获取当前时间 * 获取当前时间
* *
......
...@@ -31,6 +31,7 @@ import org.springframework.data.domain.Page; ...@@ -31,6 +31,7 @@ import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -866,11 +867,13 @@ public class TopographyController extends AbstractBaseController { ...@@ -866,11 +867,13 @@ public class TopographyController extends AbstractBaseController {
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<>();
for (IotDataVO vo : timeList) { for (IotDataVO vo : timeList) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_T_PATTERN); SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_T_PATTERN);
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
logger.info("返回时间===================================(" + vo.getValue() + ") ======================================="); logger.info("返回时间===================================(" + vo.getValue() + ") =======================================");
Date date=sdf.parse(String.valueOf(vo.getValue())); Date date=sdf.parse(String.valueOf(vo.getValue()));
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String time= sdf.format(date); // String time= sdf.format(date);
dates.add(sdf.parse(time)); String time= DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
dates.add(sdf1.parse(time));
logger.info("返回时间===================================(" + sdf.parse(String.valueOf(vo.getValue())) + ") ======================================="); logger.info("返回时间===================================(" + sdf.parse(String.valueOf(vo.getValue())) + ") =======================================");
} }
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode); List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode);
...@@ -928,4 +931,6 @@ public class TopographyController extends AbstractBaseController { ...@@ -928,4 +931,6 @@ public class TopographyController extends AbstractBaseController {
} }
} }
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