From f0b49c21c8d11b954f29494088934e84cb9d7399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 12 Apr 2020 23:40:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=92=E4=BB=B6=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/jsh_erp.sql | 4 +- docs/数据库更新记录-方便升级.txt | 7 ++++ .../jsh/erp/controller/PluginController.java | 41 ++++++++++++++----- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/docs/jsh_erp.sql b/docs/jsh_erp.sql index 0ccd72f2..8cb99eed 100644 --- a/docs/jsh_erp.sql +++ b/docs/jsh_erp.sql @@ -423,7 +423,6 @@ INSERT INTO `jsh_functions` VALUES ('211', '040104', '零售退货', '0401', '/p INSERT INTO `jsh_functions` VALUES ('212', '070407', '收预付款', '0704', '/pages/financial/advance_in.html', '\0', '0495', '', '电脑版', '', 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('217', '01020102', '客户信息', '0102', '/pages/manage/customer.html', '\0', '0262', '', '电脑版', '1,2', 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('218', '01020103', '会员信息', '0102', '/pages/manage/member.html', '\0', '0263', '', '电脑版', '1,2', 'icon-notebook', '0'); -INSERT INTO `jsh_functions` VALUES ('219', '000107', '资产管理', '0001', '/pages/asset/asset.html', '\0', '0170', '\0', '电脑版', null, 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('220', '010103', '计量单位', '0101', '/pages/manage/unit.html', '\0', '0245', '', '电脑版', null, 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('225', '0401', '零售管理', '0', '', '\0', '0101', '', '电脑版', '', 'icon-present', '0'); INSERT INTO `jsh_functions` VALUES ('226', '030106', '入库明细', '0301', '/pages/reports/in_detail.html', '\0', '0640', '', '电脑版', '', 'icon-notebook', '0'); @@ -442,6 +441,7 @@ INSERT INTO `jsh_functions` VALUES ('241', '050202', '采购订单', '0502', '/p INSERT INTO `jsh_functions` VALUES ('242', '060301', '销售订单', '0603', '/pages/materials/sale_orders_list.html', '\0', '0392', '', '电脑版', '3', 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('243', '000108', '机构管理', '0001', '/pages/manage/organization.html', '', '0139', '', '电脑版', '', 'icon-notebook', '0'); INSERT INTO `jsh_functions` VALUES ('244', '030112', '库存预警', '0301', '/pages/reports/stock_warning_report.html', '\0', '0670', '', '电脑版', '', 'icon-notebook', '0'); +INSERT INTO `jsh_functions` VALUES ('245', '000107', '插件管理', '0001', '/pages/manage/plugin.html', '\0', '0170', '', '电脑版', '', 'icon-notebook', '0'); -- ---------------------------- -- Table structure for jsh_inoutitem @@ -1136,7 +1136,7 @@ CREATE TABLE `jsh_userbusiness` ( -- ---------------------------- -- Records of jsh_userbusiness -- ---------------------------- -INSERT INTO `jsh_userbusiness` VALUES ('5', 'RoleFunctions', '4', '[245][13][12][16][243][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][244][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212][246]', '[{\"funId\":\"25\",\"btnStr\":\"1\"},{\"funId\":\"217\",\"btnStr\":\"1\"},{\"funId\":\"218\",\"btnStr\":\"1\"},{\"funId\":\"241\",\"btnStr\":\"3\"},{\"funId\":\"242\",\"btnStr\":\"3\"}]', '0'); +INSERT INTO `jsh_userbusiness` VALUES ('5', 'RoleFunctions', '4', '[245][13][12][16][243][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][244][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212][246][245]', '[{\"funId\":\"25\",\"btnStr\":\"1\"},{\"funId\":\"217\",\"btnStr\":\"1\"},{\"funId\":\"218\",\"btnStr\":\"1\"},{\"funId\":\"241\",\"btnStr\":\"3\"},{\"funId\":\"242\",\"btnStr\":\"3\"}]', '0'); INSERT INTO `jsh_userbusiness` VALUES ('6', 'RoleFunctions', '5', '[22][23][25][26][194][195][31][33][200][201][41][199][202]', null, '0'); INSERT INTO `jsh_userbusiness` VALUES ('7', 'RoleFunctions', '6', '[22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212]', '[{\"funId\":\"33\",\"btnStr\":\"4\"}]', '0'); INSERT INTO `jsh_userbusiness` VALUES ('9', 'RoleFunctions', '7', '[168][13][12][16][14][15][189][18][19][132]', null, '0'); diff --git a/docs/数据库更新记录-方便升级.txt b/docs/数据库更新记录-方便升级.txt index 1003a187..e4805552 100644 --- a/docs/数据库更新记录-方便升级.txt +++ b/docs/数据库更新记录-方便升级.txt @@ -757,3 +757,10 @@ alter table jsh_unit add ratio INT DEFAULT NULL COMMENT '比例' after other_uni -- 给用户表增加 登录用户名 字段 -- ---------------------------- alter table jsh_user change loginame login_name varchar(255) NOT NULL COMMENT '登录用户名'; + +-- ---------------------------- +-- 时间:2020年04月12日 +-- by jishenghua +-- 给功能表增加插件管理 +-- ---------------------------- +INSERT INTO `jsh_functions` VALUES (245,'000107', '插件管理', '0001', '/pages/manage/plugin.html', '\0', '0170', '', '电脑版', '', 'icon-notebook', '0'); \ 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 701a6ac0..9b08219c 100644 --- a/src/main/java/com/jsh/erp/controller/PluginController.java +++ b/src/main/java/com/jsh/erp/controller/PluginController.java @@ -4,16 +4,14 @@ 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 com.jsh.erp.utils.StringUtil; 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; +import java.util.*; /** * 插件jar 包测试功能 @@ -36,15 +34,27 @@ public class PluginController { * @return 返回插件信息 */ @GetMapping(value = "/list") - public BaseResponseInfo getPluginInfo(@RequestParam("currentPage") Integer currentPage, + public BaseResponseInfo getPluginInfo(@RequestParam("name") String name, + @RequestParam("currentPage") Integer currentPage, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) throws Exception{ BaseResponseInfo res = new BaseResponseInfo(); Map map = new HashMap(); try { + List resList = new ArrayList<>(); List list = pluginOperator.getPluginInfo(); - map.put("rows", list); - map.put("total", list.size()); + if(StringUtil.isEmpty(name)) { + resList = list; + } else { + for(PluginInfo pi : list) { + String desc = pi.getPluginDescriptor().getPluginDescription(); + if(desc.contains(name)) { + resList.add(pi); + } + } + } + map.put("rows", resList); + map.put("total", resList.size()); res.code = 200; res.data = map; } catch(Exception e){ @@ -133,17 +143,26 @@ public class PluginController { * @return 返回操作结果 */ @PostMapping("/uninstall/{id}") - public String uninstall(@PathVariable("id") String id){ + public BaseResponseInfo uninstall(@PathVariable("id") String id){ + BaseResponseInfo res = new BaseResponseInfo(); + Map map = new HashMap(); + String message = ""; try { if(pluginOperator.uninstall(id, true)){ - return "plugin '" + id +"' uninstall success"; + message = "plugin '" + id +"' uninstall success"; } else { - return "plugin '" + id +"' uninstall failure"; + message = "plugin '" + id +"' uninstall failure"; } + map.put("message", message); + res.code = 200; + res.data = map; } catch (Exception e) { e.printStackTrace(); - return "plugin '" + id +"' uninstall failure. " + e.getMessage(); + map.put("message", "plugin '" + id +"' uninstall failure. " + e.getMessage()); + res.code = 500; + res.data = map; } + return res; }