SysServerController.java 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package com.xunmei.system.controller;
  2. import com.xunmei.common.core.web.controller.BaseController;
  3. import com.xunmei.common.core.web.domain.AjaxResult;
  4. import com.xunmei.common.core.web.page.TableDataInfo;
  5. import com.xunmei.common.log.annotation.Log;
  6. import com.xunmei.common.log.enums.BusinessType;
  7. import com.xunmei.system.dto.server.SysServerEditDto;
  8. import com.xunmei.system.dto.server.SysServerPageDto;
  9. import com.xunmei.system.dto.server.TransferLogDto;
  10. import com.xunmei.system.service.ISysServerService;
  11. import com.xunmei.system.vo.server.SysServerPageVo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import javax.servlet.http.HttpServletResponse;
  17. import javax.validation.Valid;
  18. /**
  19. * 服务器维护Controller
  20. *
  21. * @author xunmei
  22. * @date 2024-09-29
  23. */
  24. @Api(tags = {"SysServer"})
  25. @RestController
  26. @RequestMapping("/server")
  27. public class SysServerController extends BaseController {
  28. @Autowired
  29. private ISysServerService sysServerService;
  30. @ApiOperation(value = "查询SysServer列表")
  31. //@RequiresPermissions("system:server:list")
  32. @GetMapping("/list")
  33. public TableDataInfo<SysServerPageVo> list(SysServerPageDto req) {
  34. return sysServerService.selectPage(req);
  35. }
  36. @ApiOperation(value = "获取SysServer详细信息")
  37. //@RequiresPermissions("system:server:query")
  38. @GetMapping(value = "/{id}")
  39. public AjaxResult getInfo(@PathVariable("id") Long id) {
  40. return success(sysServerService.selectSysServerById(id));
  41. }
  42. @ApiOperation(value = "新增SysServer")
  43. //@RequiresPermissions("system:server:add")
  44. @Log(title = "服务器维护", businessType = BusinessType.INSERT)
  45. @PostMapping
  46. public AjaxResult edit(@RequestBody @Valid SysServerEditDto req) {
  47. return toAjax(sysServerService.editSysServer(req));
  48. }
  49. @ApiOperation(value = "删除SysServer")
  50. //@RequiresPermissions("system:server:remove")
  51. @Log(title = "服务器删除", businessType = BusinessType.DELETE)
  52. @DeleteMapping("/{ids}")
  53. public AjaxResult remove(@PathVariable Long[] ids) {
  54. return toAjax(sysServerService.deleteSysServerByIds(ids));
  55. }
  56. @ApiOperation(value = "获取服务下的日志")
  57. @GetMapping("/getLogList/{serverId}/{checkId}")
  58. public AjaxResult getLogList(@PathVariable Long serverId, @PathVariable Long checkId) {
  59. Object logs = sysServerService.getLogList(serverId,checkId);
  60. return success(logs);
  61. }
  62. @ApiOperation(value = "转存目标服务器上的日志")
  63. @PostMapping("/transferLog")
  64. public AjaxResult transferLog(@RequestBody TransferLogDto req) {
  65. sysServerService.transferLog(req);
  66. return success();
  67. }
  68. @ApiOperation(value = "转存目标服务器上的日志")
  69. @PostMapping("/downloadLogData")
  70. public AjaxResult downloadLogData(TransferLogDto req, HttpServletResponse response) {
  71. sysServerService.downloadLogData(req,response);
  72. return success();
  73. }
  74. }