获取时间

This commit is contained in:
2025-07-29 11:10:19 +08:00
parent 5942a9b728
commit fe24c563a0
3 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package com.ycwl.basic.repository;
import cn.hutool.core.date.DateUtil;
import com.ycwl.basic.utils.JacksonUtil;
import com.ycwl.basic.mapper.TaskMapper;
import com.ycwl.basic.mapper.VideoMapper;
@@ -53,8 +54,8 @@ public class VideoTaskRepository {
var jsonArray = paramJson.getJSONArray(any.get());
if (jsonArray != null && !jsonArray.isEmpty()) {
JacksonUtil.JSONObjectCompat jsonObject = jsonArray.get(0);
if (jsonObject.getLong("createTime") != null) {
shotTime = new Date(jsonObject.getLong("createTime"));
if (jsonObject.getString("createTime") != null) {
shotTime = DateUtil.parse(jsonObject.getString("createTime"));
}
}
}

View File

@@ -250,9 +250,9 @@ public class OrderServiceImpl implements OrderService {
goods.setGoodsType(0);
goods.setScenicId(memberVideoEntity.getScenicId());
goods.setTemplateCoverUrl(template.getCoverUrl());
goods.setCreateTime(videoTaskRepository.getTaskShotDate(memberVideoEntity.getTaskId()));
VideoEntity video = videoRepository.getVideo(memberVideoEntity.getVideoId());
if (video != null) {
goods.setCreateTime(videoTaskRepository.getTaskShotDate(video.getTaskId()));
goods.setUrl(video.getVideoUrl());
}
goodsList.add(goods);

View File

@@ -10,6 +10,7 @@ import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.List;
import java.util.Map;
@@ -25,6 +26,7 @@ public class JacksonUtil {
static {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
objectMapper.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Asia/Shanghai")));
}