调整时间
This commit is contained in:
@@ -4,6 +4,8 @@ import com.tem.bocai.entity.CompletedToday;
|
||||
import com.tem.bocai.entity.LotteryResult;
|
||||
import com.tem.bocai.repository.CompletedTodayRepository;
|
||||
import com.tem.bocai.repository.LotteryResultRepository;
|
||||
import com.tem.bocai.util.DateUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -37,7 +39,7 @@ public class ChartController {
|
||||
// 过滤出今日的数据
|
||||
List<CompletedToday> todayData = new ArrayList<>();
|
||||
for (CompletedToday item : completedTodays) {
|
||||
if (item.getTime() != null && item.getTime().contains(today)) {
|
||||
if (item.getTime() != null && item.getTime().toString().contains(today)) {
|
||||
todayData.add(item);
|
||||
}
|
||||
}
|
||||
@@ -54,11 +56,12 @@ public class ChartController {
|
||||
// 使用resultAmount作为折线图数据
|
||||
data.add(item.getResultAmount());
|
||||
// 使用时间作为标签(只保留时分部分)
|
||||
String time = item.getTime();
|
||||
if (time != null && time.length() >= 16) {
|
||||
labels.add(time.substring(11, 16)); // 提取时分部分
|
||||
Date time = item.getTime();
|
||||
String format = DateFormatUtils.format(time, "yyyy-MM-dd HH:mm:ss");
|
||||
if (time != null && format.length() >= 16) {
|
||||
labels.add(format.substring(11, 16)); // 提取时分部分
|
||||
} else {
|
||||
labels.add(time);
|
||||
labels.add(format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user