| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | result.put("notifyEndpoint", endpoint); |
| | | result.put("queueCount", loadQueueRecords(null, null).size()); |
| | | if (!Cools.isEmpty(endpoint)) { |
| | | result.put("logCount", httpRequestLogService.selectCount(new EntityWrapper<HttpRequestLog>().eq("name", endpoint))); |
| | | result.put("logCount", httpRequestLogService.count(new QueryWrapper<HttpRequestLog>().eq("name", endpoint))); |
| | | } else { |
| | | result.put("logCount", 0); |
| | | } |
| | |
| | | @RequestParam(required = false) Integer result, |
| | | @RequestParam(required = false) String condition) { |
| | | String endpoint = buildNotifyEndpoint(getConfigValue("notifyUri"), getConfigValue("notifyUriPath")); |
| | | EntityWrapper<HttpRequestLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<HttpRequestLog> wrapper = new QueryWrapper<>(); |
| | | if (!Cools.isEmpty(endpoint)) { |
| | | wrapper.eq("name", endpoint); |
| | | } else { |
| | |
| | | wrapper.like("request", "\"device\":" + device); |
| | | } |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.andNew().like("request", condition).or().like("response", condition); |
| | | wrapper.and(q -> q.like("request", condition).or().like("response", condition)); |
| | | } |
| | | if (result != null) { |
| | | wrapper.eq("result", result); |
| | | } |
| | | wrapper.orderBy("create_time", false); |
| | | wrapper.orderBy(true, false, "create_time"); |
| | | |
| | | Page<HttpRequestLog> logPage = httpRequestLogService.selectPage(new Page<>(curr, limit), wrapper); |
| | | Page<HttpRequestLog> logPage = httpRequestLogService.page(new Page<>(curr, limit), wrapper); |
| | | Page<NotifyReportVo> resultPage = new Page<>(curr, limit); |
| | | resultPage.setTotal(logPage.getTotal()); |
| | | |
| | |
| | | detail.put("sourceType", "log"); |
| | | detail.put("logId", logId); |
| | | |
| | | HttpRequestLog log = httpRequestLogService.selectById(logId); |
| | | HttpRequestLog log = httpRequestLogService.getById(logId); |
| | | if (log == null) { |
| | | detail.put("success", false); |
| | | detail.put("message", "通知日志不存在"); |
| | |
| | | } |
| | | |
| | | private String getConfigValue(String code) { |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", code)); |
| | | Config config = configService.getOne(new QueryWrapper<Config>().eq("code", code)); |
| | | return config == null ? null : config.getValue(); |
| | | } |
| | | |