diff --git a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java index c20ddebdd..8c98a254b 100644 --- a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java +++ b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java @@ -1,6 +1,5 @@ package cn.keepbx.jpom.model.data; -import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.jiangzeyin.common.DefaultSystemLog; import cn.keepbx.jpom.BaseJpomApplication; @@ -8,6 +7,7 @@ import cn.keepbx.jpom.common.commander.AbstractProjectCommander; import cn.keepbx.jpom.model.BaseModel; import java.io.File; +import java.util.ArrayList; import java.util.List; /** @@ -180,12 +180,20 @@ public class ProjectInfoModel extends BaseModel { */ public static List listJars(ProjectInfoModel projectInfoModel) { File fileLib = new File(projectInfoModel.getLib()); - return FileUtil.loopFiles(fileLib, pathname -> { - if (!pathname.isFile()) { - return false; + File[] files = fileLib.listFiles(); + List files1 = new ArrayList<>(); + if (files != null) { + for (File file : files) { + if (!file.isFile()) { + continue; + } + if (StrUtil.endWith(file.getName(), ".jar", true)) { + continue; + } + files1.add(file); } - return StrUtil.endWith(pathname.getName(), ".jar", true); - }); + } + return files1; } /** diff --git a/modules/server/src/main/java/cn/keepbx/jpom/controller/outgiving/OutGivingController.java b/modules/server/src/main/java/cn/keepbx/jpom/controller/outgiving/OutGivingController.java index 3931751fc..787015302 100644 --- a/modules/server/src/main/java/cn/keepbx/jpom/controller/outgiving/OutGivingController.java +++ b/modules/server/src/main/java/cn/keepbx/jpom/controller/outgiving/OutGivingController.java @@ -56,21 +56,24 @@ public class OutGivingController extends BaseServerController { @RequestMapping(value = "edit.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public String edit(String id) throws IOException { - UserModel userModel = getUser(); - if (StrUtil.isNotEmpty(id) && userModel.isServerManager()) { - List nodeModels = nodeService.listAndProject(); - setAttribute("nodeModels", nodeModels); - // - String reqId = nodeService.cacheNodeList(nodeModels); - setAttribute("reqId", reqId); - setAttribute("type", "add"); - + setAttribute("type", "add"); + if (StrUtil.isNotEmpty(id)) { OutGivingModel outGivingModel = outGivingServer.getItem(id); if (outGivingModel != null) { setAttribute("item", outGivingModel); setAttribute("type", "edit"); } } + UserModel userModel = getUser(); + if (userModel.isServerManager()) { + List nodeModels = nodeService.listAndProject(); + setAttribute("nodeModels", nodeModels); + + // + String reqId = nodeService.cacheNodeList(nodeModels); + setAttribute("reqId", reqId); + + } return "outgiving/edit"; } @@ -160,7 +163,10 @@ public class OutGivingController extends BaseServerController { } } } - nodeProject = new OutGivingModel.NodeProject(); + nodeProject = outGivingModel.getNodeProject(nodeModel.getId(), trueProjectId); + if (nodeProject == null) { + nodeProject = new OutGivingModel.NodeProject(); + } nodeProject.setNodeId(nodeModel.getId()); nodeProject.setProjectId(trueProjectId); nodeProjects.add(nodeProject); @@ -173,10 +179,10 @@ public class OutGivingController extends BaseServerController { } /** - * 删除节点信息 + * 删除分发信息 * - * @param id - * @return + * @param id 分发id + * @return json */ @RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody diff --git a/modules/server/src/main/java/cn/keepbx/jpom/model/data/OutGivingModel.java b/modules/server/src/main/java/cn/keepbx/jpom/model/data/OutGivingModel.java index f53116d0d..ab4589c9e 100644 --- a/modules/server/src/main/java/cn/keepbx/jpom/model/data/OutGivingModel.java +++ b/modules/server/src/main/java/cn/keepbx/jpom/model/data/OutGivingModel.java @@ -71,6 +71,26 @@ public class OutGivingModel extends BaseModel { return false; } + /** + * 获取节点的项目信息 + * + * @param nodeId 节点 + * @param projectId 项目 + * @return nodeProject + */ + public NodeProject getNodeProject(String nodeId, String projectId) { + List thisPs = getNodeProjectList(); + if (thisPs == null) { + return null; + } + for (NodeProject nodeProject1 : thisPs) { + if (StrUtil.equalsIgnoreCase(nodeProject1.getProjectId(), projectId) && StrUtil.equalsIgnoreCase(nodeProject1.getNodeId(), nodeId)) { + return nodeProject1; + } + } + return null; + } + public enum AfterOpt implements BaseEnum { /** * 操作 @@ -158,17 +178,6 @@ public class OutGivingModel extends BaseModel { this.projectId = projectId; } - public boolean checkEquals(NodeProject nodeProject) { - if (nodeProject == null) { - return false; - } - if (nodeProject == this) { - return true; - } - return StrUtil.equalsIgnoreCase(this.getNodeId(), nodeProject.getNodeId()) && - StrUtil.equalsIgnoreCase(this.getProjectId(), nodeProject.getProjectId()); - } - public enum Status implements BaseEnum { /** *