فهرست منبع

调整告警查询不出最后一天的问题

wukai 8 ماه پیش
والد
کامیت
01a4281ca1

+ 2 - 2
jjt-admin/src/main/resources/application-prod.yml

@@ -34,8 +34,8 @@ server:
 # 日志配置
 logging:
   level:
-    com.jjt: debug
-    org.springframework: warn
+    com.jjt: error
+    org.springframework: error
 
 # 用户配置
 user:

+ 1 - 1
jjt-admin/src/main/resources/application-tt.yml

@@ -7,7 +7,7 @@ jjt:
   # 版权年份
   copyrightYear: 2024
   # 文件路径 示例( Windows配置D:/jjt/uploadPath,Linux配置 /home/jjt/uploadPath)
-  profile: D:/jjt/uploadPath
+  profile: /app
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数字计算 char 字符验证

+ 16 - 16
jjt-biz/src/main/java/com/jjt/biz/controller/AlarmRecordController.java

@@ -71,14 +71,14 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("业务类型统计")
     @GetMapping("/list/bizType")
-    public AjaxResult listBizType(@ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult listBizType(@ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
         List<BizTypeVO> list = new ArrayList();
         String sql = "SELECT b.obj_type,COUNT(*) num FROM alarm_record a,biz_obj b WHERE a.obj_id=b.obj_id";
         Vector<Object> v = new Vector<>();
         if (start != null && end != null) {
             sql += " AND a.alarm_time BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
         sql += " GROUP BY b.obj_type";
         List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, v.toArray());
@@ -107,7 +107,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("业务组件统计")
     @GetMapping("/list/bizObj")
-    public AjaxResult listBizObj(@ApiParam(value = "业务类型") String type, @ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult listBizObj(@ApiParam(value = "业务类型") String type, @ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
         List<BizTypeVO> list = new ArrayList();
         String sql = "SELECT b.obj_id,b.obj_name,COUNT(*) num FROM alarm_record a,biz_obj b WHERE a.obj_id=b.obj_id";
         Vector<Object> v = new Vector<>();
@@ -118,7 +118,7 @@ public class AlarmRecordController extends BaseController {
         if (start != null && end != null) {
             sql += " AND a.alarm_time BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
         sql += " GROUP BY b.obj_id,b.obj_name";
         List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, v.toArray());
@@ -138,7 +138,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("业务指标统计")
     @GetMapping("/list/getMetrics")
-    public AjaxResult getMetrics(@ApiParam(value = "对象ID") Long objId, @ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult getMetrics(@ApiParam(value = "对象ID") Long objId, @ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
         List<BizTypeVO> list = new ArrayList();
         String sql = "SELECT a.obj_metrics_id,b.metrics_name,COUNT(*) num FROM alarm_record a,biz_obj_metrics b WHERE a.obj_metrics_id=b.obj_metrics_id";
         Vector<Object> v = new Vector<>();
@@ -149,7 +149,7 @@ public class AlarmRecordController extends BaseController {
         if (start != null && end != null) {
             sql += " AND a.alarm_time BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
         sql += "  GROUP by a.obj_metrics_id,b.metrics_name order by num desc";
         List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, v.toArray());
@@ -168,7 +168,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("应用组件统计")
     @GetMapping("/list/bizSort")
-    public AjaxResult listBizSort(@ApiParam(value = "分类") String bizType, @ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult listBizSort(@ApiParam(value = "分类") String bizType, @ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
         List<BizSortVO> list = new ArrayList();
 //          暂时使用模拟数据
         String sql = "SELECT a.obj_id,b.obj_name,b.obj_type,COUNT(*) num FROM alarm_record a,biz_obj b WHERE a.obj_id=b.obj_id";
@@ -180,7 +180,7 @@ public class AlarmRecordController extends BaseController {
         if (start != null && end != null) {
             sql += " AND a.alarm_time BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
         sql += " GROUP BY a.obj_id,b.obj_name,b.obj_type";
         List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, v.toArray());
@@ -203,7 +203,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("系统压力排名")
     @GetMapping("/list/bizAccess")
-    public AjaxResult listBizAccess(@ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult listBizAccess(@ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
         List<BizAccessVO> list = new ArrayList<>();
 //        //还是得先用模拟数据。
         String sql = "SELECT model_id,model_name FROM biz_model";
@@ -220,7 +220,7 @@ public class AlarmRecordController extends BaseController {
             if (start != null && end != null) {
                 sql1 += " AND alarm_time BETWEEN ? AND ?";
                 v.add(start);
-                v.add(end);
+                v.add(end + " 23:59:59");
             }
             Long num = jdbcTemplate.queryForObject(sql1, Long.class, v.toArray());
             vo.setNum(num);
@@ -234,7 +234,7 @@ public class AlarmRecordController extends BaseController {
             if (start != null && end != null) {
                 sql2 += " AND CREATE_TIME BETWEEN ? AND ?";
                 v1.add(start);
-                v1.add(end);
+                v1.add(end + " 23:59:59");
             }
             Long access = jdbcTemplate.queryForObject(sql2, Long.class, v1.toArray());
             vo.setAccess(access);
@@ -262,7 +262,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("组件告警数量排名")
     @GetMapping("/list/objAlarm")
-    public AjaxResult objAlarm(@ApiParam(value = "对象ID") Long modelId, @ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult objAlarm(@ApiParam(value = "对象ID") Long modelId, @ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
 
         List<BizSortVO> list = new ArrayList();
         String sql = "SELECT a.obj_id,c.obj_name,COUNT(*) num FROM alarm_record a,biz_model_detail b,biz_obj c WHERE a.obj_id=b.obj_id AND b.obj_id=c.obj_id";
@@ -277,7 +277,7 @@ public class AlarmRecordController extends BaseController {
         if (start != null && end != null) {
             sql += " AND a.alarm_time BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
         sql += " GROUP BY a.obj_id,c.obj_name order by num desc";
         List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, v.toArray());
@@ -293,7 +293,7 @@ public class AlarmRecordController extends BaseController {
 
     @ApiOperation("组件压力排名")
     @GetMapping("/list/objAccess")
-    public AjaxResult objAccess(@ApiParam(value = "对象ID") Long modelId, @ApiParam(value = "开始时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @ApiParam(value = "结束时间yyyy-mm-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    public AjaxResult objAccess(@ApiParam(value = "对象ID") Long modelId, @ApiParam(value = "开始时间yyyy-mm-dd")  String start, @ApiParam(value = "结束时间yyyy-mm-dd") String end) {
 //        依然得用模拟数据
         Map<String, Object> result = new HashMap<>(16);
         List<BizAccessVO> list = new ArrayList<>();
@@ -324,7 +324,7 @@ public class AlarmRecordController extends BaseController {
                 totSql += " AND CREATE_TIME BETWEEN ? AND ?";
                 errSql += " AND CREATE_TIME BETWEEN ? AND ?";
                 v.add(start);
-                v.add(end);
+                v.add(end + " 23:59:59");
             }
 
             Long access = jdbcTemplate.queryForObject(totSql, Long.class, v.toArray());
@@ -355,7 +355,7 @@ public class AlarmRecordController extends BaseController {
             totSql += " AND CREATE_TIME BETWEEN ? AND ?";
             errSql += " AND CREATE_TIME BETWEEN ? AND ?";
             v.add(start);
-            v.add(end);
+            v.add(end + " 23:59:59");
         }
 
         totSql += " group by create_time";

+ 3 - 3
jjt-biz/src/main/resources/mapper/alarm/AlarmRecordMapper.xml

@@ -84,7 +84,7 @@
                 and ALARM_Status = #{alarmStatus}
             </if>
             <if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''">
-                and ALARM_TIME between #{params.beginAlarmTime} and #{params.endAlarmTime}
+                and ALARM_TIME between #{params.beginAlarmTime} and CONCAT(#{params.endAlarmTime}, ' 23:59:59')
             </if>
             <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                 and CREATE_TIME between #{params.beginCreateTime} and #{params.endCreateTime}
@@ -156,7 +156,7 @@
                 and ALARM_Status = #{alarmStatus}
             </if>
             <if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''">
-                and ALARM_TIME between #{params.beginAlarmTime} and #{params.endAlarmTime}
+                and ALARM_TIME between #{params.beginAlarmTime} and CONCAT(#{params.endAlarmTime}, ' 23:59:59')
             </if>
             <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                 and CREATE_TIME between #{params.beginCreateTime} and #{params.endCreateTime}
@@ -224,7 +224,7 @@
                 and ALARM_Status = #{alarmStatus}
             </if>
             <if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''">
-                and ALARM_TIME between #{params.beginAlarmTime} and #{params.endAlarmTime}
+                and ALARM_TIME between #{params.beginAlarmTime} and CONCAT(#{params.endAlarmTime}, ' 23:59:59')
             </if>
             <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                 and CREATE_TIME between #{params.beginCreateTime} and #{params.endCreateTime}