diff --git a/erp_web/pages/manage/plugin.html b/erp_web/pages/manage/plugin.html new file mode 100644 index 00000000..94bf0ea8 --- /dev/null +++ b/erp_web/pages/manage/plugin.html @@ -0,0 +1,317 @@ + + + + 插件管理 + + + + + + + + + + + + + + + + +
+
+
+ +
+ +
+
+
+ 查询  + 重置 +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
车牌号码 + +
驾驶员 + +
车辆状态 + +
车辆归属 + +
+
+
+
+ 保存 + 取消 +
+ + + \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/controller/PluginController.java b/src/main/java/com/jsh/erp/controller/PluginController.java index aae54f44..701a6ac0 100644 --- a/src/main/java/com/jsh/erp/controller/PluginController.java +++ b/src/main/java/com/jsh/erp/controller/PluginController.java @@ -3,12 +3,16 @@ package com.jsh.erp.controller; import com.gitee.starblues.integration.application.PluginApplication; import com.gitee.starblues.integration.operator.PluginOperator; import com.gitee.starblues.integration.operator.module.PluginInfo; +import com.jsh.erp.utils.BaseResponseInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import java.nio.file.Paths; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -31,9 +35,24 @@ public class PluginController { * 获取插件信息 * @return 返回插件信息 */ - @GetMapping - public List getPluginInfo(){ - return pluginOperator.getPluginInfo(); + @GetMapping(value = "/list") + public BaseResponseInfo getPluginInfo(@RequestParam("currentPage") Integer currentPage, + @RequestParam("pageSize") Integer pageSize, + HttpServletRequest request) throws Exception{ + BaseResponseInfo res = new BaseResponseInfo(); + Map map = new HashMap(); + try { + List list = pluginOperator.getPluginInfo(); + map.put("rows", list); + map.put("total", list.size()); + res.code = 200; + res.data = map; + } catch(Exception e){ + e.printStackTrace(); + res.code = 500; + res.data = "获取数据失败"; + } + return res; } /** @@ -57,17 +76,26 @@ public class PluginController { * @return 返回操作结果 */ @PostMapping("/stop/{id}") - public String stop(@PathVariable("id") String id){ + public BaseResponseInfo stop(@PathVariable("id") String id){ + BaseResponseInfo res = new BaseResponseInfo(); + Map map = new HashMap(); + String message = ""; try { if(pluginOperator.stop(id)){ - return "plugin '" + id +"' stop success"; + message = "plugin '" + id +"' stop success"; } else { - return "plugin '" + id +"' stop failure"; + message = "plugin '" + id +"' stop failure"; } + map.put("message", message); + res.code = 200; + res.data = map; } catch (Exception e) { e.printStackTrace(); - return "plugin '" + id +"' stop failure. " + e.getMessage(); + map.put("message", "plugin '" + id +"' stop failure. " + e.getMessage()); + res.code = 500; + res.data = map; } + return res; } /** @@ -76,17 +104,26 @@ public class PluginController { * @return 返回操作结果 */ @PostMapping("/start/{id}") - public String start(@PathVariable("id") String id){ + public BaseResponseInfo start(@PathVariable("id") String id){ + BaseResponseInfo res = new BaseResponseInfo(); + Map map = new HashMap(); + String message = ""; try { if(pluginOperator.start(id)){ - return "plugin '" + id +"' start success"; + message = "plugin '" + id +"' start success"; } else { - return "plugin '" + id +"' start failure"; + message = "plugin '" + id +"' start failure"; } + map.put("message", message); + res.code = 200; + res.data = map; } catch (Exception e) { e.printStackTrace(); - return "plugin '" + id +"' start failure. " + e.getMessage(); + map.put("message", "plugin '" + id +"' start failure. " + e.getMessage()); + res.code = 500; + res.data = map; } + return res; }