You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
3.6 KiB
122 lines
3.6 KiB
package com.system.log.controller; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
import com.google.inject.Inject; |
|
import com.google.inject.servlet.RequestScoped; |
|
import com.hypaas.db.JpaSupport; |
|
import com.hypaas.rpc.ActionRequest; |
|
import com.hypaas.rpc.ActionResponse; |
|
import com.system.log.core.FileUtils; |
|
import com.system.log.service.LogService; |
|
import java.io.File; |
|
import java.io.IOException; |
|
import javax.ws.rs.*; |
|
import javax.ws.rs.core.MediaType; |
|
|
|
/** |
|
* @author zhangqiyang |
|
* @description LogManage |
|
* @date 2024/3/12 |
|
*/ |
|
@RequestScoped |
|
@Produces(MediaType.APPLICATION_JSON) |
|
@Path("/log") |
|
public class LogController extends JpaSupport { |
|
|
|
@Inject LogService logService; |
|
|
|
// 过滤查询日志接口 |
|
/* |
|
* logType 日志类型 |
|
* startTime 需要过滤的日志的开始时间 |
|
* endTime 需要过滤的日志的结束时间 |
|
* keyWord 关键字 |
|
*/ |
|
@GET |
|
@Path("/getDirContent") |
|
public JSONObject getDirContent( |
|
@QueryParam("logType") String logType, |
|
@QueryParam("startTime") String startTime, |
|
@QueryParam("endTime") String endTime, |
|
@QueryParam("keyWord") String keyWord) |
|
throws IOException { |
|
return logService.getDirContent(logType, startTime, endTime, keyWord); |
|
} |
|
|
|
// 以zip形式导出日志文件,并设置解压密码 |
|
/* |
|
* password 密码 |
|
* conditionPassword 确认密码 |
|
* logType 日志类型 |
|
* startTime 需要过滤的日志的开始时间 |
|
* endTime 需要过滤的日志的结束时间 |
|
* keyWord 关键字 |
|
*/ |
|
|
|
@POST |
|
@Path("/getFileZip") |
|
public void getFileZip(ActionRequest request, ActionResponse response) { |
|
File file = logService.getFileZip(request, response); |
|
FileUtils.downloadFile(response, file); |
|
} |
|
|
|
// 导出系统管理员操作日志 |
|
public void exportSystemManageUserLog(ActionRequest request, ActionResponse response) |
|
throws IOException { |
|
File file = logService.exportLog(request, response, "1"); |
|
FileUtils.downloadFile(response, file); |
|
} |
|
|
|
// 导出安全保密员操作日志 |
|
public void exportSecurityUserLog(ActionRequest request, ActionResponse response) |
|
throws IOException { |
|
File file = logService.exportLog(request, response, "2"); |
|
FileUtils.downloadFile(response, file); |
|
} |
|
|
|
// 导出安全审计员操作日志 |
|
public void exportSecurityAuditUserLog(ActionRequest request, ActionResponse response) |
|
throws IOException { |
|
File file = logService.exportLog(request, response, "3"); |
|
FileUtils.downloadFile(response, file); |
|
} |
|
|
|
// 导出业务用户操作日志 |
|
public void exportServiceUserLog(ActionRequest request, ActionResponse response) |
|
throws IOException { |
|
File file = logService.exportLog(request, response, "4"); |
|
FileUtils.downloadFile(response, file); |
|
} |
|
|
|
// 日志配置接口 |
|
/* |
|
* threshold 在线日志存储阈值 |
|
* backupCycle 备份周期 |
|
* backupStartTime 备份开始日期 |
|
*/ |
|
@POST |
|
@Path("/setLogConfig") |
|
public JSONObject setLogConfig(JSONObject jsonObject) { |
|
return logService.setLogConfig( |
|
jsonObject.getInteger("threshold"), |
|
jsonObject.getInteger("backupCycle"), |
|
jsonObject.getString("backupStartTime")); |
|
} |
|
|
|
// 日志配置查询接口 |
|
@GET |
|
@Path("/selectLogConfig") |
|
public JSONObject selectLogConfig() { |
|
return logService.selectLogConfig(); |
|
} |
|
|
|
// 删除系统管理员操作日志备份 |
|
public void deleteSystemManageUserBackup(ActionRequest request, ActionResponse response) { |
|
logService.deleteSystemManageUserBackup(request, response); |
|
} |
|
|
|
// 重新备份系统管理员操作日志 |
|
public void secondBackup(ActionRequest request, ActionResponse response) { |
|
logService.secondBackup(request, response); |
|
} |
|
}
|
|
|