jar 运行不扫描 子目录

This commit is contained in:
jiangzeyin 2019-04-22 11:49:35 +08:00
parent 3f8100face
commit ee55395dd1
3 changed files with 53 additions and 30 deletions

View File

@ -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<File> listJars(ProjectInfoModel projectInfoModel) {
File fileLib = new File(projectInfoModel.getLib());
return FileUtil.loopFiles(fileLib, pathname -> {
if (!pathname.isFile()) {
return false;
File[] files = fileLib.listFiles();
List<File> files1 = new ArrayList<>();
if (files != null) {
for (File file : files) {
if (!file.isFile()) {
continue;
}
return StrUtil.endWith(pathname.getName(), ".jar", true);
});
if (StrUtil.endWith(file.getName(), ".jar", true)) {
continue;
}
files1.add(file);
}
}
return files1;
}
/**

View File

@ -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<NodeModel> nodeModels = nodeService.listAndProject();
setAttribute("nodeModels", nodeModels);
//
String reqId = nodeService.cacheNodeList(nodeModels);
setAttribute("reqId", reqId);
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<NodeModel> 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 = 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

View File

@ -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<NodeProject> 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 {
/**
*