作者 dong

首頁修改

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 import io.lettuce.core.dynamic.annotation.Param; 6 import io.lettuce.core.dynamic.annotation.Param;
7 import org.jeecg.modules.airag.app.entity.AiragLog; 7 import org.jeecg.modules.airag.app.entity.AiragLog;
8 8
  9 +import java.util.Date;
9 import java.util.List; 10 import java.util.List;
10 import java.util.Map; 11 import java.util.Map;
11 12
@@ -33,4 +34,6 @@ public interface AiragLogMapper extends BaseMapper<AiragLog> { @@ -33,4 +34,6 @@ public interface AiragLogMapper extends BaseMapper<AiragLog> {
33 34
34 List<Map<String, Object>> getDailyCountForLast7Days(); 35 List<Map<String, Object>> getDailyCountForLast7Days();
35 List<Map<String, Object>> getDailyRejectedCountForLast7Days(); 36 List<Map<String, Object>> getDailyRejectedCountForLast7Days();
  37 +
  38 + Date getEarliestTime();
36 } 39 }
@@ -152,4 +152,9 @@ @@ -152,4 +152,9 @@
152 ) log_counts ON date_range.date = log_counts.date 152 ) log_counts ON date_range.date = log_counts.date
153 ORDER BY date_range.date ASC 153 ORDER BY date_range.date ASC
154 </select> 154 </select>
  155 +
  156 + <select id="getEarliestTime" resultType="java.util.Date">
  157 + SELECT MIN(create_time) AS earliest_time
  158 + FROM airag_log
  159 + </select>
155 </mapper> 160 </mapper>
@@ -22,10 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -22,10 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; 22 import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
23 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
24 24
25 -import java.util.HashMap;  
26 -import java.util.LinkedHashMap;  
27 -import java.util.List;  
28 -import java.util.Map; 25 +import java.text.SimpleDateFormat;
  26 +import java.util.*;
29 27
30 /** 28 /**
31 * @Description: 日志管理 29 * @Description: 日志管理
@@ -96,6 +94,10 @@ public class AiragLogServiceImpl extends ServiceImpl<AiragLogMapper, AiragLog> i @@ -96,6 +94,10 @@ public class AiragLogServiceImpl extends ServiceImpl<AiragLogMapper, AiragLog> i
96 todayWrapper.apply("DATE(create_time) = CURDATE()"); 94 todayWrapper.apply("DATE(create_time) = CURDATE()");
97 long todayCount = this.count(todayWrapper); 95 long todayCount = this.count(todayWrapper);
98 96
  97 + Date earlisetTime = airagLogMapper.getEarliestTime();
  98 + SimpleDateFormat sft = new SimpleDateFormat("yyyy年MM月dd日");
  99 + String earliestTime = sft.format(earlisetTime);
  100 +
99 // 2. 获取昨日问答次数 101 // 2. 获取昨日问答次数
100 QueryWrapper<AiragLog> yesterdayWrapper = new QueryWrapper<>(); 102 QueryWrapper<AiragLog> yesterdayWrapper = new QueryWrapper<>();
101 yesterdayWrapper.apply("DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)"); 103 yesterdayWrapper.apply("DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)");
@@ -143,6 +145,7 @@ public class AiragLogServiceImpl extends ServiceImpl<AiragLogMapper, AiragLog> i @@ -143,6 +145,7 @@ public class AiragLogServiceImpl extends ServiceImpl<AiragLogMapper, AiragLog> i
143 result.put("yesterdayCount", yesterdayCount); 145 result.put("yesterdayCount", yesterdayCount);
144 result.put("growthRate", Math.round(growthRate * 100.0) / 100.0); // 保留两位小数 146 result.put("growthRate", Math.round(growthRate * 100.0) / 100.0); // 保留两位小数
145 result.put("todayCount", todayCount); 147 result.put("todayCount", todayCount);
  148 + result.put("earliestTime", earliestTime);
146 result.put("rejectedCount", rejectedCount); 149 result.put("rejectedCount", rejectedCount);
147 result.put("totalCount", totalCount); 150 result.put("totalCount", totalCount);
148 result.put("averageCount", averageCount); 151 result.put("averageCount", averageCount);