From edc9a6674eb9b40e33a74c5f022d279712ed3b7c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 30 十二月 2024 17:01:13 +0800 Subject: [PATCH] 添加许可工具 --- se-modules/se-system/src/main/java/com/se/system/controller/SysSoftController.java | 86 +++++++++++++++++++++++++++++------------- 1 files changed, 59 insertions(+), 27 deletions(-) diff --git a/se-modules/se-system/src/main/java/com/se/system/controller/SysSoftController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysSoftController.java index 7e940d2..c75244f 100644 --- a/se-modules/se-system/src/main/java/com/se/system/controller/SysSoftController.java +++ b/se-modules/se-system/src/main/java/com/se/system/controller/SysSoftController.java @@ -1,21 +1,20 @@ package com.se.system.controller; import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; + +import com.se.system.domain.vo.LicenseExtraParamVo; +import com.se.system.domain.vo.NacosConfigVo; +import com.se.system.service.NacosService; +import com.se.system.service.inte.IAServerInfoService; +import org.springframework.web.bind.annotation.*; import com.se.common.log.annotation.Log; import com.se.common.log.enums.BusinessType; import com.se.common.security.annotation.RequiresPermissions; -import com.se.system.domain.SysSoft; -import com.se.system.service.ISysSoftService; +import com.se.system.domain.*; +import com.se.system.service.inte.ISysSoftService; import com.se.common.core.web.controller.BaseController; import com.se.common.core.web.domain.AjaxResult; import com.se.common.core.utils.poi.ExcelUtil; @@ -28,10 +27,13 @@ * @date 2024-11-22 */ @RestController +@SuppressWarnings("ALL") @RequestMapping("/soft") -public class SysSoftController extends BaseController -{ - @Autowired +public class SysSoftController extends BaseController { + @Resource + NacosService nacosService; + + @Resource private ISysSoftService sysSoftService; /** @@ -39,8 +41,7 @@ */ @RequiresPermissions("system:soft:list") @GetMapping("/list") - public TableDataInfo list(SysSoft sysSoft) - { + public TableDataInfo list(SysSoft sysSoft) { startPage(); List<SysSoft> list = sysSoftService.selectSysSoftList(sysSoft); return getDataTable(list); @@ -52,8 +53,7 @@ @RequiresPermissions("system:soft:export") @Log(title = "杞欢", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, SysSoft sysSoft) - { + public void export(HttpServletResponse response, SysSoft sysSoft) { List<SysSoft> list = sysSoftService.selectSysSoftList(sysSoft); ExcelUtil<SysSoft> util = new ExcelUtil<SysSoft>(SysSoft.class); util.exportExcel(response, list, "杞欢鏁版嵁"); @@ -64,8 +64,7 @@ */ @RequiresPermissions("system:soft:query") @GetMapping(value = "/{softId}") - public AjaxResult getInfo(@PathVariable("softId") Long softId) - { + public AjaxResult getInfo(@PathVariable("softId") Long softId) { return success(sysSoftService.selectSysSoftBySoftId(softId)); } @@ -75,8 +74,7 @@ @RequiresPermissions("system:soft:add") @Log(title = "杞欢", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody SysSoft sysSoft) - { + public AjaxResult add(@RequestBody SysSoft sysSoft) { return toAjax(sysSoftService.insertSysSoft(sysSoft)); } @@ -86,8 +84,7 @@ @RequiresPermissions("system:soft:edit") @Log(title = "杞欢", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody SysSoft sysSoft) - { + public AjaxResult edit(@RequestBody SysSoft sysSoft) { return toAjax(sysSoftService.updateSysSoft(sysSoft)); } @@ -96,9 +93,44 @@ */ @RequiresPermissions("system:soft:remove") @Log(title = "杞欢", businessType = BusinessType.DELETE) - @DeleteMapping("/{softIds}") - public AjaxResult remove(@PathVariable Long[] softIds) - { + @DeleteMapping("/{softIds}") + public AjaxResult remove(@PathVariable Long[] softIds) { return toAjax(sysSoftService.deleteSysSoftBySoftIds(softIds)); } + + @Log(title = "杞欢-鑾峰彇閰嶇疆", businessType = BusinessType.OTHER) + @RequiresPermissions("system:soft:query") + @GetMapping(value = "getNacosConfig") + public void getNacosConfig(String dataId, HttpServletRequest req, HttpServletResponse res) { + try { + nacosService.getNacosConfig(dataId, req, res); + } catch (Exception e) { + try { + res.getWriter().print(e.getMessage()); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + } + } + + @Log(title = "杞欢-鏇存柊閰嶇疆", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:soft:edit") + @PostMapping(value = "updateNacosConfig") + public void updateNacosConfig(@RequestBody NacosConfigVo vo, HttpServletRequest req, HttpServletResponse res) { + try { + nacosService.updateNacosConfig(vo, req, res); + } catch (Exception e) { + try { + res.getWriter().print(e.getMessage()); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + } + } + + @GetMapping(value = "/test") + public void test() { + LicenseExtraParamVo serverInfos = IAServerInfoService.getServer("").getServerInfos(); + System.out.println("serverInfos = " + serverInfos); + } } -- Gitblit v1.9.3