mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-03 04:18:21 +08:00
Clean up code
This commit is contained in:
parent
c078e022e2
commit
8fae1a824d
@ -57,28 +57,6 @@ public class LoginControl extends BaseServerController {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
// /**
|
||||
// * 登录页面
|
||||
// *
|
||||
// * @return login
|
||||
// */
|
||||
// @RequestMapping(value = "login.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @NotLogin
|
||||
// public String login() {
|
||||
// if (userService.userListEmpty()) {
|
||||
// // 调整到初始化也
|
||||
// return BaseJpomInterceptor.getRedirect(getRequest(), "/install.html");
|
||||
// }
|
||||
// // 是否显示验证码
|
||||
// setAttribute("showCode", showCode());
|
||||
// return "login";
|
||||
// }
|
||||
|
||||
// private boolean showCode() {
|
||||
// String showCode = getSessionAttribute(SHOW_CODE);
|
||||
// return StrUtil.isNotEmpty(showCode);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*
|
||||
@ -197,17 +175,6 @@ public class LoginControl extends BaseServerController {
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 退出登录
|
||||
// *
|
||||
// * @return page
|
||||
// */
|
||||
// @RequestMapping(value = "logout", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// public String logoutPage() {
|
||||
// getSession().invalidate();
|
||||
// return BaseJpomInterceptor.getRedirect(getRequest(), "/old.html");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*
|
||||
|
@ -43,215 +43,178 @@ import java.util.List;
|
||||
@RequestMapping(value = "/outgiving")
|
||||
@Feature(cls = ClassFeature.OUTGIVING)
|
||||
public class OutGivingController extends BaseServerController {
|
||||
@Resource
|
||||
private OutGivingServer outGivingServer;
|
||||
@Resource
|
||||
private BuildService buildService;
|
||||
@Resource
|
||||
private OutGivingServer outGivingServer;
|
||||
@Resource
|
||||
private BuildService buildService;
|
||||
|
||||
// @RequestMapping(value = "list.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.LIST)
|
||||
// public String list() {
|
||||
// List<OutGivingModel> outGivingModels = outGivingServer.list();
|
||||
// setAttribute("array", outGivingModels);
|
||||
// // 节点数是否大于二
|
||||
// List<NodeModel> list = nodeService.list();
|
||||
// boolean trueNode = list != null && list.size() > 1;
|
||||
// setAttribute("trueNode", trueNode);
|
||||
// return "outgiving/list";
|
||||
// }
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* load dispatch list
|
||||
* 加载分发列表
|
||||
*/
|
||||
@RequestMapping(value = "dispatch-list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String dispatchList() {
|
||||
List<OutGivingModel> list = outGivingServer.list();
|
||||
return JsonMessage.getString(200, "success", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Hotstrip
|
||||
* load dispatch list
|
||||
* 加载分发列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "dispatch-list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String dispatchList() {
|
||||
List<OutGivingModel> list = outGivingServer.list();
|
||||
return JsonMessage.getString(200, "success", list);
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* get reqId for edit feature
|
||||
* 获取编辑时需要的 reqId
|
||||
*/
|
||||
@RequestMapping(value = "get-reqId", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String getReqId() {
|
||||
List<NodeModel> nodeModels = nodeService.listAndProject();
|
||||
String reqId = nodeService.cacheNodeList(nodeModels);
|
||||
return JsonMessage.getString(200, "success", reqId);
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "edit.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.EDIT)
|
||||
// public String edit(String id) {
|
||||
// setAttribute("type", "add");
|
||||
// if (StrUtil.isNotEmpty(id)) {
|
||||
// OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
// if (outGivingModel != null) {
|
||||
// setAttribute("item", outGivingModel);
|
||||
// setAttribute("type", "edit");
|
||||
// }
|
||||
// }
|
||||
// UserModel userModel = getUser();
|
||||
//
|
||||
// List<NodeModel> nodeModels = nodeService.listAndProject();
|
||||
// setAttribute("nodeModels", nodeModels);
|
||||
//
|
||||
// //
|
||||
// String reqId = nodeService.cacheNodeList(nodeModels);
|
||||
// setAttribute("reqId", reqId);
|
||||
//
|
||||
// JSONArray afterOpt = BaseEnum.toJSONArray(AfterOpt.class);
|
||||
// setAttribute("afterOpt", afterOpt);
|
||||
// return "outgiving/edit";
|
||||
// }
|
||||
@RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.SaveOutGiving)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public String save(String type, String id) throws IOException {
|
||||
if ("add".equalsIgnoreCase(type)) {
|
||||
if (!StringUtil.isGeneral(id, 2, 20)) {
|
||||
return JsonMessage.getString(401, "分发id 不能为空并且长度在2-20(英文字母 、数字和下划线)");
|
||||
}
|
||||
return addOutGiving(id);
|
||||
} else {
|
||||
return updateGiving(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Hotstrip
|
||||
* get reqId for edit feature
|
||||
* 获取编辑时需要的 reqId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "get-reqId", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String getReqId() {
|
||||
List<NodeModel> nodeModels = nodeService.listAndProject();
|
||||
String reqId = nodeService.cacheNodeList(nodeModels);
|
||||
return JsonMessage.getString(200, "success", reqId);
|
||||
}
|
||||
private String addOutGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel != null) {
|
||||
return JsonMessage.getString(405, "分发id已经存在啦");
|
||||
}
|
||||
outGivingModel = new OutGivingModel();
|
||||
outGivingModel.setId(id);
|
||||
//
|
||||
String error = doData(outGivingModel);
|
||||
if (error == null) {
|
||||
outGivingServer.addItem(outGivingModel);
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.SaveOutGiving)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public String save(String type, String id) throws IOException {
|
||||
if ("add".equalsIgnoreCase(type)) {
|
||||
if (!StringUtil.isGeneral(id, 2, 20)) {
|
||||
return JsonMessage.getString(401, "分发id 不能为空并且长度在2-20(英文字母 、数字和下划线)");
|
||||
}
|
||||
return addOutGiving(id);
|
||||
} else {
|
||||
return updateGiving(id);
|
||||
}
|
||||
}
|
||||
private String updateGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的分发id");
|
||||
}
|
||||
String error = doData(outGivingModel);
|
||||
if (error == null) {
|
||||
outGivingServer.updateItem(outGivingModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
private String addOutGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel != null) {
|
||||
return JsonMessage.getString(405, "分发id已经存在啦");
|
||||
}
|
||||
outGivingModel = new OutGivingModel();
|
||||
outGivingModel.setId(id);
|
||||
//
|
||||
String error = doData(outGivingModel);
|
||||
if (error == null) {
|
||||
outGivingServer.addItem(outGivingModel);
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
private String doData(OutGivingModel outGivingModel) {
|
||||
outGivingModel.setName(getParameter("name"));
|
||||
if (StrUtil.isEmpty(outGivingModel.getName())) {
|
||||
return JsonMessage.getString(405, "分发名称不能为空");
|
||||
}
|
||||
String reqId = getParameter("reqId");
|
||||
List<NodeModel> list = nodeService.getNodeModel(reqId);
|
||||
if (list == null) {
|
||||
return JsonMessage.getString(401, "页面请求超时");
|
||||
}
|
||||
List<OutGivingModel> outGivingModels = outGivingServer.list();
|
||||
//
|
||||
List<OutGivingNodeProject> outGivingNodeProjects = new ArrayList<>();
|
||||
OutGivingNodeProject outGivingNodeProject;
|
||||
for (NodeModel nodeModel : list) {
|
||||
String nodeIdProject = getParameter("node_" + nodeModel.getId());
|
||||
if (StrUtil.isEmpty(nodeIdProject)) {
|
||||
continue;
|
||||
}
|
||||
String trueProjectId = null;
|
||||
JSONArray jsonArray = nodeModel.getProjects();
|
||||
for (Object o : jsonArray) {
|
||||
JSONObject data = (JSONObject) o;
|
||||
String id1 = data.getString("id");
|
||||
if (id1.equals(nodeIdProject)) {
|
||||
trueProjectId = nodeIdProject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (trueProjectId == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的项目id:" + nodeIdProject);
|
||||
}
|
||||
// 判断项目是否已经被使用过啦
|
||||
if (outGivingModels != null) {
|
||||
for (OutGivingModel outGivingModel1 : outGivingModels) {
|
||||
if (outGivingModel1.getId().equalsIgnoreCase(outGivingModel.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (outGivingModel1.checkContains(nodeModel.getId(), trueProjectId)) {
|
||||
return JsonMessage.getString(405, "已经存在相同的分发项目:" + trueProjectId);
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingNodeProject = outGivingModel.getNodeProject(nodeModel.getId(), trueProjectId);
|
||||
if (outGivingNodeProject == null) {
|
||||
outGivingNodeProject = new OutGivingNodeProject();
|
||||
}
|
||||
outGivingNodeProject.setNodeId(nodeModel.getId());
|
||||
outGivingNodeProject.setProjectId(trueProjectId);
|
||||
outGivingNodeProjects.add(outGivingNodeProject);
|
||||
}
|
||||
if (outGivingNodeProjects.size() < 2) {
|
||||
return JsonMessage.getString(405, "至少选择2个节点项目");
|
||||
}
|
||||
outGivingModel.setOutGivingNodeProjectList(outGivingNodeProjects);
|
||||
//
|
||||
String afterOpt = getParameter("afterOpt");
|
||||
AfterOpt afterOpt1 = BaseEnum.getEnum(AfterOpt.class, Convert.toInt(afterOpt, 0));
|
||||
if (afterOpt1 == null) {
|
||||
return JsonMessage.getString(400, "请选择分发后的操作");
|
||||
}
|
||||
outGivingModel.setAfterOpt(afterOpt1.getCode());
|
||||
return null;
|
||||
}
|
||||
|
||||
private String updateGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的分发id");
|
||||
}
|
||||
String error = doData(outGivingModel);
|
||||
if (error == null) {
|
||||
outGivingServer.updateItem(outGivingModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
private String doData(OutGivingModel outGivingModel) {
|
||||
outGivingModel.setName(getParameter("name"));
|
||||
if (StrUtil.isEmpty(outGivingModel.getName())) {
|
||||
return JsonMessage.getString(405, "分发名称不能为空");
|
||||
}
|
||||
String reqId = getParameter("reqId");
|
||||
List<NodeModel> list = nodeService.getNodeModel(reqId);
|
||||
if (list == null) {
|
||||
return JsonMessage.getString(401, "页面请求超时");
|
||||
}
|
||||
List<OutGivingModel> outGivingModels = outGivingServer.list();
|
||||
//
|
||||
List<OutGivingNodeProject> outGivingNodeProjects = new ArrayList<>();
|
||||
OutGivingNodeProject outGivingNodeProject;
|
||||
for (NodeModel nodeModel : list) {
|
||||
String nodeIdProject = getParameter("node_" + nodeModel.getId());
|
||||
if (StrUtil.isEmpty(nodeIdProject)) {
|
||||
continue;
|
||||
}
|
||||
String trueProjectId = null;
|
||||
JSONArray jsonArray = nodeModel.getProjects();
|
||||
for (Object o : jsonArray) {
|
||||
JSONObject data = (JSONObject) o;
|
||||
String id1 = data.getString("id");
|
||||
if (id1.equals(nodeIdProject)) {
|
||||
trueProjectId = nodeIdProject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (trueProjectId == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的项目id:" + nodeIdProject);
|
||||
}
|
||||
// 判断项目是否已经被使用过啦
|
||||
if (outGivingModels != null) {
|
||||
for (OutGivingModel outGivingModel1 : outGivingModels) {
|
||||
if (outGivingModel1.getId().equalsIgnoreCase(outGivingModel.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (outGivingModel1.checkContains(nodeModel.getId(), trueProjectId)) {
|
||||
return JsonMessage.getString(405, "已经存在相同的分发项目:" + trueProjectId);
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingNodeProject = outGivingModel.getNodeProject(nodeModel.getId(), trueProjectId);
|
||||
if (outGivingNodeProject == null) {
|
||||
outGivingNodeProject = new OutGivingNodeProject();
|
||||
}
|
||||
outGivingNodeProject.setNodeId(nodeModel.getId());
|
||||
outGivingNodeProject.setProjectId(trueProjectId);
|
||||
outGivingNodeProjects.add(outGivingNodeProject);
|
||||
}
|
||||
if (outGivingNodeProjects.size() < 2) {
|
||||
return JsonMessage.getString(405, "至少选择2个节点项目");
|
||||
}
|
||||
outGivingModel.setOutGivingNodeProjectList(outGivingNodeProjects);
|
||||
//
|
||||
String afterOpt = getParameter("afterOpt");
|
||||
AfterOpt afterOpt1 = BaseEnum.getEnum(AfterOpt.class, Convert.toInt(afterOpt, 0));
|
||||
if (afterOpt1 == null) {
|
||||
return JsonMessage.getString(400, "请选择分发后的操作");
|
||||
}
|
||||
outGivingModel.setAfterOpt(afterOpt1.getCode());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分发信息
|
||||
*
|
||||
* @param id 分发id
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DelOutGiving)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public String del(String id) throws IOException {
|
||||
// 判断构建
|
||||
if (buildService.checkOutGiving(id)) {
|
||||
return JsonMessage.getString(400, "当前分发存在构建项,不能删除");
|
||||
}
|
||||
OutGivingModel outGivingServerItem = outGivingServer.getItem(id);
|
||||
if (outGivingServerItem.isOutGivingProject()) {
|
||||
UserModel userModel = getUser();
|
||||
// 解除项目分发独立分发属性
|
||||
List<OutGivingNodeProject> outGivingNodeProjectList = outGivingServerItem.getOutGivingNodeProjectList();
|
||||
if (outGivingNodeProjectList != null) {
|
||||
outGivingNodeProjectList.forEach(outGivingNodeProject -> {
|
||||
NodeModel item = nodeService.getItem(outGivingNodeProject.getNodeId());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", outGivingNodeProject.getProjectId());
|
||||
NodeForward.request(item, NodeUrl.Manage_ReleaseOutGiving, userModel, jsonObject);
|
||||
});
|
||||
}
|
||||
}
|
||||
outGivingServer.deleteItem(id);
|
||||
return JsonMessage.getString(200, "操作成功");
|
||||
}
|
||||
/**
|
||||
* 删除分发信息
|
||||
*
|
||||
* @param id 分发id
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DelOutGiving)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public String del(String id) throws IOException {
|
||||
// 判断构建
|
||||
if (buildService.checkOutGiving(id)) {
|
||||
return JsonMessage.getString(400, "当前分发存在构建项,不能删除");
|
||||
}
|
||||
OutGivingModel outGivingServerItem = outGivingServer.getItem(id);
|
||||
if (outGivingServerItem.isOutGivingProject()) {
|
||||
UserModel userModel = getUser();
|
||||
// 解除项目分发独立分发属性
|
||||
List<OutGivingNodeProject> outGivingNodeProjectList = outGivingServerItem.getOutGivingNodeProjectList();
|
||||
if (outGivingNodeProjectList != null) {
|
||||
outGivingNodeProjectList.forEach(outGivingNodeProject -> {
|
||||
NodeModel item = nodeService.getItem(outGivingNodeProject.getNodeId());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", outGivingNodeProject.getProjectId());
|
||||
NodeForward.request(item, NodeUrl.Manage_ReleaseOutGiving, userModel, jsonObject);
|
||||
});
|
||||
}
|
||||
}
|
||||
outGivingServer.deleteItem(id);
|
||||
return JsonMessage.getString(200, "操作成功");
|
||||
}
|
||||
}
|
||||
|
@ -40,206 +40,173 @@ import java.util.*;
|
||||
@RequestMapping(value = "/outgiving")
|
||||
@Feature(cls = ClassFeature.OUTGIVING)
|
||||
public class OutGivingProjectEditController extends BaseServerController {
|
||||
@Resource
|
||||
private ServerWhitelistServer serverWhitelistServer;
|
||||
@Resource
|
||||
private ServerWhitelistServer serverWhitelistServer;
|
||||
|
||||
@Resource
|
||||
private OutGivingServer outGivingServer;
|
||||
@Resource
|
||||
private OutGivingServer outGivingServer;
|
||||
|
||||
// @RequestMapping(value = "editProject", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.EDIT)
|
||||
// public String editProject(String id) {
|
||||
// setAttribute("type", "add");
|
||||
// OutGivingModel outGivingModel;
|
||||
// if (StrUtil.isNotEmpty(id)) {
|
||||
// outGivingModel = outGivingServer.getItem(id);
|
||||
// if (outGivingModel != null) {
|
||||
// setAttribute("item", outGivingModel);
|
||||
// setAttribute("type", "edit");
|
||||
// }
|
||||
// }
|
||||
// // 运行模式
|
||||
// JSONArray runModes = (JSONArray) JSONArray.toJSON(RunMode.values());
|
||||
// runModes.remove(RunMode.File.name());
|
||||
// //
|
||||
// setAttribute("runModes", runModes);
|
||||
// //
|
||||
// JSONArray afterOpt = BaseEnum.toJSONArray(AfterOpt.class);
|
||||
// setAttribute("afterOpt", afterOpt);
|
||||
// // 权限
|
||||
// List<NodeModel> nodeModels = nodeService.list();
|
||||
// setAttribute("nodeModels", nodeModels);
|
||||
// //
|
||||
// String reqId = nodeService.cacheNodeList(nodeModels);
|
||||
// setAttribute("reqId", reqId);
|
||||
//
|
||||
// // 白名单
|
||||
// List<String> jsonArray = serverWhitelistServer.getOutGiving();
|
||||
// setAttribute("whitelistDirectory", jsonArray);
|
||||
// return "outgiving/editProject";
|
||||
// }
|
||||
/**
|
||||
* 保存节点分发项目
|
||||
*
|
||||
* @param id id
|
||||
* @param type 类型
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "save_project", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.SaveOutgivingProject)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public String save(String id, String type) {
|
||||
if ("add".equalsIgnoreCase(type)) {
|
||||
if (!StringUtil.isGeneral(id, 2, 20)) {
|
||||
return JsonMessage.getString(401, "分发id 不能为空并且长度在2-20(英文字母 、数字和下划线)");
|
||||
}
|
||||
return addOutGiving(id);
|
||||
} else {
|
||||
return updateGiving(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存节点分发项目
|
||||
*
|
||||
* @param id id
|
||||
* @param type 类型
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "save_project", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.SaveOutgivingProject)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public String save(String id, String type) {
|
||||
if ("add".equalsIgnoreCase(type)) {
|
||||
if (!StringUtil.isGeneral(id, 2, 20)) {
|
||||
return JsonMessage.getString(401, "分发id 不能为空并且长度在2-20(英文字母 、数字和下划线)");
|
||||
}
|
||||
return addOutGiving(id);
|
||||
} else {
|
||||
return updateGiving(id);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除分发项目
|
||||
*
|
||||
* @param id 项目id
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "delete_project", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DeleteOutgivingProject)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public String delete(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(200, "没有对应的分发项目");
|
||||
}
|
||||
if (!outGivingModel.isOutGivingProject()) {
|
||||
return JsonMessage.getString(405, "改项目不是节点分发项目,不能在此次删除");
|
||||
}
|
||||
UserModel userModel = getUser();
|
||||
List<OutGivingNodeProject> deleteNodeProject = outGivingModel.getOutGivingNodeProjectList();
|
||||
if (deleteNodeProject != null) {
|
||||
// 删除实际的项目
|
||||
for (OutGivingNodeProject outGivingNodeProject1 : deleteNodeProject) {
|
||||
NodeModel nodeModel = outGivingNodeProject1.getNodeData(true);
|
||||
JsonMessage<String> jsonMessage = deleteNodeProject(nodeModel, userModel, outGivingNodeProject1.getProjectId());
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingServer.deleteItem(id);
|
||||
return JsonMessage.getString(200, "删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分发项目
|
||||
*
|
||||
* @param id 项目id
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "delete_project", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DeleteOutgivingProject)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public String delete(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(200, "没有对应的分发项目");
|
||||
}
|
||||
if (!outGivingModel.isOutGivingProject()) {
|
||||
return JsonMessage.getString(405, "改项目不是节点分发项目,不能在此次删除");
|
||||
}
|
||||
UserModel userModel = getUser();
|
||||
List<OutGivingNodeProject> deleteNodeProject = outGivingModel.getOutGivingNodeProjectList();
|
||||
if (deleteNodeProject != null) {
|
||||
// 删除实际的项目
|
||||
for (OutGivingNodeProject outGivingNodeProject1 : deleteNodeProject) {
|
||||
NodeModel nodeModel = outGivingNodeProject1.getNodeData(true);
|
||||
JsonMessage<String> jsonMessage = deleteNodeProject(nodeModel, userModel, outGivingNodeProject1.getProjectId());
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingServer.deleteItem(id);
|
||||
return JsonMessage.getString(200, "删除成功");
|
||||
}
|
||||
|
||||
private String addOutGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel != null) {
|
||||
return JsonMessage.getString(405, "分发id已经存在啦");
|
||||
}
|
||||
outGivingModel = new OutGivingModel();
|
||||
outGivingModel.setOutGivingProject(true);
|
||||
outGivingModel.setId(id);
|
||||
//
|
||||
String error = doData(outGivingModel, false);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingServer.addItem(outGivingModel);
|
||||
error = saveNodeData(outGivingModel, false);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
private String addOutGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel != null) {
|
||||
return JsonMessage.getString(405, "分发id已经存在啦");
|
||||
}
|
||||
outGivingModel = new OutGivingModel();
|
||||
outGivingModel.setOutGivingProject(true);
|
||||
outGivingModel.setId(id);
|
||||
//
|
||||
String error = doData(outGivingModel, false);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingServer.addItem(outGivingModel);
|
||||
error = saveNodeData(outGivingModel, false);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
|
||||
|
||||
private String updateGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的分发id");
|
||||
}
|
||||
String error = doData(outGivingModel, true);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingServer.updateItem(outGivingModel);
|
||||
error = saveNodeData(outGivingModel, true);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
private String updateGiving(String id) {
|
||||
OutGivingModel outGivingModel = outGivingServer.getItem(id);
|
||||
if (outGivingModel == null) {
|
||||
return JsonMessage.getString(405, "没有找到对应的分发id");
|
||||
}
|
||||
String error = doData(outGivingModel, true);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingServer.updateItem(outGivingModel);
|
||||
error = saveNodeData(outGivingModel, true);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存节点项目数据
|
||||
*
|
||||
* @param outGivingModel 节点分发项目
|
||||
* @param edit 是否为编辑模式
|
||||
* @return 错误信息
|
||||
*/
|
||||
private String saveNodeData(OutGivingModel outGivingModel, boolean edit) {
|
||||
Map<NodeModel, JSONObject> map = outGivingModel.getTempCacheMap();
|
||||
if (map == null) {
|
||||
if (!edit) {
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(405, "数据异常,请重新操作");
|
||||
}
|
||||
UserModel userModel = getUser();
|
||||
List<Map.Entry<NodeModel, JSONObject>> success = new ArrayList<>();
|
||||
boolean fail = false;
|
||||
try {
|
||||
Set<Map.Entry<NodeModel, JSONObject>> entries = map.entrySet();
|
||||
JsonMessage<String> jsonMessage;
|
||||
for (Map.Entry<NodeModel, JSONObject> entry : entries) {
|
||||
NodeModel nodeModel = entry.getKey();
|
||||
jsonMessage = sendData(nodeModel, userModel, entry.getValue(), true);
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
if (!edit) {
|
||||
fail = true;
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
success.add(entry);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("保存分发项目失败", e);
|
||||
if (!edit) {
|
||||
fail = true;
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(500, "保存节点数据失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (fail) {
|
||||
try {
|
||||
for (Map.Entry<NodeModel, JSONObject> entry : success) {
|
||||
deleteNodeProject(entry.getKey(), userModel, outGivingModel.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("还原项目失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 保存节点项目数据
|
||||
*
|
||||
* @param outGivingModel 节点分发项目
|
||||
* @param edit 是否为编辑模式
|
||||
* @return 错误信息
|
||||
*/
|
||||
private String saveNodeData(OutGivingModel outGivingModel, boolean edit) {
|
||||
Map<NodeModel, JSONObject> map = outGivingModel.getTempCacheMap();
|
||||
if (map == null) {
|
||||
if (!edit) {
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(405, "数据异常,请重新操作");
|
||||
}
|
||||
UserModel userModel = getUser();
|
||||
List<Map.Entry<NodeModel, JSONObject>> success = new ArrayList<>();
|
||||
boolean fail = false;
|
||||
try {
|
||||
Set<Map.Entry<NodeModel, JSONObject>> entries = map.entrySet();
|
||||
JsonMessage<String> jsonMessage;
|
||||
for (Map.Entry<NodeModel, JSONObject> entry : entries) {
|
||||
NodeModel nodeModel = entry.getKey();
|
||||
jsonMessage = sendData(nodeModel, userModel, entry.getValue(), true);
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
if (!edit) {
|
||||
fail = true;
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
success.add(entry);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("保存分发项目失败", e);
|
||||
if (!edit) {
|
||||
fail = true;
|
||||
outGivingServer.deleteItem(outGivingModel.getId());
|
||||
}
|
||||
return JsonMessage.getString(500, "保存节点数据失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (fail) {
|
||||
try {
|
||||
for (Map.Entry<NodeModel, JSONObject> entry : success) {
|
||||
deleteNodeProject(entry.getKey(), userModel, outGivingModel.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("还原项目失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*
|
||||
* @param nodeModel 节点
|
||||
* @param userModel 用户
|
||||
* @param project 判断id
|
||||
* @return json
|
||||
*/
|
||||
private JsonMessage<String> deleteNodeProject(NodeModel nodeModel, UserModel userModel, String project) {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("id", project);
|
||||
return NodeForward.request(nodeModel, NodeUrl.Manage_DeleteProject, userModel, data);
|
||||
/**
|
||||
* 删除项目
|
||||
*
|
||||
* @param nodeModel 节点
|
||||
* @param userModel 用户
|
||||
* @param project 判断id
|
||||
* @return json
|
||||
*/
|
||||
private JsonMessage<String> deleteNodeProject(NodeModel nodeModel, UserModel userModel, String project) {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("id", project);
|
||||
return NodeForward.request(nodeModel, NodeUrl.Manage_DeleteProject, userModel, data);
|
||||
// // 发起预检查数据
|
||||
// String url = nodeModel.getRealUrl(NodeUrl.Manage_DeleteProject);
|
||||
// HttpRequest request = HttpUtil.createPost(url);
|
||||
@ -251,184 +218,184 @@ public class OutGivingProjectEditController extends BaseServerController {
|
||||
// String body = request.execute()
|
||||
// .body();
|
||||
// return NodeForward.toJsonMessage(body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建项目管理的默认数据
|
||||
*
|
||||
* @param outGivingModel 分发实体
|
||||
* @param edit 是否为编辑模式
|
||||
* @return String为有异常
|
||||
*/
|
||||
private Object getDefData(OutGivingModel outGivingModel, boolean edit) {
|
||||
JSONObject defData = new JSONObject();
|
||||
defData.put("id", outGivingModel.getId());
|
||||
defData.put("name", outGivingModel.getName());
|
||||
//
|
||||
// 运行模式
|
||||
String runMode = getParameter("runMode");
|
||||
RunMode runMode1 = RunMode.ClassPath;
|
||||
try {
|
||||
runMode1 = RunMode.valueOf(runMode);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
defData.put("runMode", runMode1.name());
|
||||
if (runMode1 == RunMode.ClassPath || runMode1 == RunMode.JavaExtDirsCp) {
|
||||
String mainClass = getParameter("mainClass");
|
||||
defData.put("mainClass", mainClass);
|
||||
}
|
||||
if (runMode1 == RunMode.JavaExtDirsCp) {
|
||||
defData.put("javaExtDirsCp", getParameter("javaExtDirsCp"));
|
||||
}
|
||||
String whitelistDirectory = getParameter("whitelistDirectory");
|
||||
List<String> whitelistServerOutGiving = serverWhitelistServer.getOutGiving();
|
||||
if (!AgentWhitelist.checkPath(whitelistServerOutGiving, whitelistDirectory)) {
|
||||
return JsonMessage.getString(401, "请选择正确的项目路径,或者还没有配置白名单");
|
||||
}
|
||||
defData.put("whitelistDirectory", whitelistDirectory);
|
||||
String lib = getParameter("lib");
|
||||
defData.put("lib", lib);
|
||||
defData.put("group", "节点分发");
|
||||
if (edit) {
|
||||
// 编辑模式
|
||||
defData.put("edit", "on");
|
||||
}
|
||||
defData.put("previewData", true);
|
||||
return defData;
|
||||
}
|
||||
/**
|
||||
* 创建项目管理的默认数据
|
||||
*
|
||||
* @param outGivingModel 分发实体
|
||||
* @param edit 是否为编辑模式
|
||||
* @return String为有异常
|
||||
*/
|
||||
private Object getDefData(OutGivingModel outGivingModel, boolean edit) {
|
||||
JSONObject defData = new JSONObject();
|
||||
defData.put("id", outGivingModel.getId());
|
||||
defData.put("name", outGivingModel.getName());
|
||||
//
|
||||
// 运行模式
|
||||
String runMode = getParameter("runMode");
|
||||
RunMode runMode1 = RunMode.ClassPath;
|
||||
try {
|
||||
runMode1 = RunMode.valueOf(runMode);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
defData.put("runMode", runMode1.name());
|
||||
if (runMode1 == RunMode.ClassPath || runMode1 == RunMode.JavaExtDirsCp) {
|
||||
String mainClass = getParameter("mainClass");
|
||||
defData.put("mainClass", mainClass);
|
||||
}
|
||||
if (runMode1 == RunMode.JavaExtDirsCp) {
|
||||
defData.put("javaExtDirsCp", getParameter("javaExtDirsCp"));
|
||||
}
|
||||
String whitelistDirectory = getParameter("whitelistDirectory");
|
||||
List<String> whitelistServerOutGiving = serverWhitelistServer.getOutGiving();
|
||||
if (!AgentWhitelist.checkPath(whitelistServerOutGiving, whitelistDirectory)) {
|
||||
return JsonMessage.getString(401, "请选择正确的项目路径,或者还没有配置白名单");
|
||||
}
|
||||
defData.put("whitelistDirectory", whitelistDirectory);
|
||||
String lib = getParameter("lib");
|
||||
defData.put("lib", lib);
|
||||
defData.put("group", "节点分发");
|
||||
if (edit) {
|
||||
// 编辑模式
|
||||
defData.put("edit", "on");
|
||||
}
|
||||
defData.put("previewData", true);
|
||||
return defData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理页面数据
|
||||
*
|
||||
* @param outGivingModel 分发实体
|
||||
* @param edit 是否为编辑模式
|
||||
* @return json
|
||||
*/
|
||||
private String doData(OutGivingModel outGivingModel, boolean edit) {
|
||||
outGivingModel.setName(getParameter("name"));
|
||||
if (StrUtil.isEmpty(outGivingModel.getName())) {
|
||||
return JsonMessage.getString(405, "分发名称不能为空");
|
||||
}
|
||||
String reqId = getParameter("reqId");
|
||||
List<NodeModel> nodeModelList = nodeService.getNodeModel(reqId);
|
||||
if (nodeModelList == null) {
|
||||
return JsonMessage.getString(401, "当前页面请求超时");
|
||||
}
|
||||
//
|
||||
String afterOpt = getParameter("afterOpt");
|
||||
AfterOpt afterOpt1 = BaseEnum.getEnum(AfterOpt.class, Convert.toInt(afterOpt, 0));
|
||||
if (afterOpt1 == null) {
|
||||
return JsonMessage.getString(400, "请选择分发后的操作");
|
||||
}
|
||||
outGivingModel.setAfterOpt(afterOpt1.getCode());
|
||||
Object object = getDefData(outGivingModel, edit);
|
||||
if (object instanceof String) {
|
||||
return object.toString();
|
||||
}
|
||||
JSONObject defData = (JSONObject) object;
|
||||
UserModel userModel = getUser();
|
||||
//
|
||||
List<OutGivingModel> outGivingModels = outGivingServer.list();
|
||||
List<OutGivingNodeProject> outGivingNodeProjects = new ArrayList<>();
|
||||
OutGivingNodeProject outGivingNodeProject;
|
||||
//
|
||||
Iterator<NodeModel> iterator = nodeModelList.iterator();
|
||||
Map<NodeModel, JSONObject> cache = new HashMap<>(nodeModelList.size());
|
||||
while (iterator.hasNext()) {
|
||||
NodeModel nodeModel = iterator.next();
|
||||
String add = getParameter("add_" + nodeModel.getId());
|
||||
if (!nodeModel.getId().equals(add)) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
// 判断项目是否已经被使用过啦
|
||||
if (outGivingModels != null) {
|
||||
for (OutGivingModel outGivingModel1 : outGivingModels) {
|
||||
if (outGivingModel1.getId().equalsIgnoreCase(outGivingModel.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (outGivingModel1.checkContains(nodeModel.getId(), outGivingModel.getId())) {
|
||||
return JsonMessage.getString(405, "已经存在相同的分发项目:" + outGivingModel.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingNodeProject = outGivingModel.getNodeProject(nodeModel.getId(), outGivingModel.getId());
|
||||
if (outGivingNodeProject == null) {
|
||||
outGivingNodeProject = new OutGivingNodeProject();
|
||||
}
|
||||
outGivingNodeProject.setNodeId(nodeModel.getId());
|
||||
outGivingNodeProject.setProjectId(outGivingModel.getId());
|
||||
outGivingNodeProjects.add(outGivingNodeProject);
|
||||
// 检查数据
|
||||
JSONObject allData = (JSONObject) defData.clone();
|
||||
String token = getParameter(StrUtil.format("{}_token", nodeModel.getId()));
|
||||
allData.put("token", token);
|
||||
String jvm = getParameter(StrUtil.format("{}_jvm", nodeModel.getId()));
|
||||
allData.put("jvm", jvm);
|
||||
String args = getParameter(StrUtil.format("{}_args", nodeModel.getId()));
|
||||
allData.put("args", args);
|
||||
// 项目副本
|
||||
String javaCopyIds = getParameter(StrUtil.format("{}_javaCopyIds", nodeModel.getId()));
|
||||
allData.put("javaCopyIds", javaCopyIds);
|
||||
if (StrUtil.isNotEmpty(javaCopyIds)) {
|
||||
String[] split = StrUtil.splitToArray(javaCopyIds, StrUtil.COMMA);
|
||||
for (String copyId : split) {
|
||||
String copyJvm = getParameter(StrUtil.format("{}_jvm_{}", nodeModel.getId(), copyId));
|
||||
String copyArgs = getParameter(StrUtil.format("{}_args_{}", nodeModel.getId(), copyId));
|
||||
allData.put("jvm_" + copyId, copyJvm);
|
||||
allData.put("args_" + copyId, copyArgs);
|
||||
}
|
||||
}
|
||||
JsonMessage<String> jsonMessage = sendData(nodeModel, userModel, allData, false);
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
cache.put(nodeModel, allData);
|
||||
}
|
||||
// 删除已经删除的项目
|
||||
String error = deleteProject(outGivingModel, outGivingNodeProjects, userModel);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingModel.setOutGivingNodeProjectList(outGivingNodeProjects);
|
||||
outGivingModel.setTempCacheMap(cache);
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 处理页面数据
|
||||
*
|
||||
* @param outGivingModel 分发实体
|
||||
* @param edit 是否为编辑模式
|
||||
* @return json
|
||||
*/
|
||||
private String doData(OutGivingModel outGivingModel, boolean edit) {
|
||||
outGivingModel.setName(getParameter("name"));
|
||||
if (StrUtil.isEmpty(outGivingModel.getName())) {
|
||||
return JsonMessage.getString(405, "分发名称不能为空");
|
||||
}
|
||||
String reqId = getParameter("reqId");
|
||||
List<NodeModel> nodeModelList = nodeService.getNodeModel(reqId);
|
||||
if (nodeModelList == null) {
|
||||
return JsonMessage.getString(401, "当前页面请求超时");
|
||||
}
|
||||
//
|
||||
String afterOpt = getParameter("afterOpt");
|
||||
AfterOpt afterOpt1 = BaseEnum.getEnum(AfterOpt.class, Convert.toInt(afterOpt, 0));
|
||||
if (afterOpt1 == null) {
|
||||
return JsonMessage.getString(400, "请选择分发后的操作");
|
||||
}
|
||||
outGivingModel.setAfterOpt(afterOpt1.getCode());
|
||||
Object object = getDefData(outGivingModel, edit);
|
||||
if (object instanceof String) {
|
||||
return object.toString();
|
||||
}
|
||||
JSONObject defData = (JSONObject) object;
|
||||
UserModel userModel = getUser();
|
||||
//
|
||||
List<OutGivingModel> outGivingModels = outGivingServer.list();
|
||||
List<OutGivingNodeProject> outGivingNodeProjects = new ArrayList<>();
|
||||
OutGivingNodeProject outGivingNodeProject;
|
||||
//
|
||||
Iterator<NodeModel> iterator = nodeModelList.iterator();
|
||||
Map<NodeModel, JSONObject> cache = new HashMap<>(nodeModelList.size());
|
||||
while (iterator.hasNext()) {
|
||||
NodeModel nodeModel = iterator.next();
|
||||
String add = getParameter("add_" + nodeModel.getId());
|
||||
if (!nodeModel.getId().equals(add)) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
// 判断项目是否已经被使用过啦
|
||||
if (outGivingModels != null) {
|
||||
for (OutGivingModel outGivingModel1 : outGivingModels) {
|
||||
if (outGivingModel1.getId().equalsIgnoreCase(outGivingModel.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (outGivingModel1.checkContains(nodeModel.getId(), outGivingModel.getId())) {
|
||||
return JsonMessage.getString(405, "已经存在相同的分发项目:" + outGivingModel.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
outGivingNodeProject = outGivingModel.getNodeProject(nodeModel.getId(), outGivingModel.getId());
|
||||
if (outGivingNodeProject == null) {
|
||||
outGivingNodeProject = new OutGivingNodeProject();
|
||||
}
|
||||
outGivingNodeProject.setNodeId(nodeModel.getId());
|
||||
outGivingNodeProject.setProjectId(outGivingModel.getId());
|
||||
outGivingNodeProjects.add(outGivingNodeProject);
|
||||
// 检查数据
|
||||
JSONObject allData = (JSONObject) defData.clone();
|
||||
String token = getParameter(StrUtil.format("{}_token", nodeModel.getId()));
|
||||
allData.put("token", token);
|
||||
String jvm = getParameter(StrUtil.format("{}_jvm", nodeModel.getId()));
|
||||
allData.put("jvm", jvm);
|
||||
String args = getParameter(StrUtil.format("{}_args", nodeModel.getId()));
|
||||
allData.put("args", args);
|
||||
// 项目副本
|
||||
String javaCopyIds = getParameter(StrUtil.format("{}_javaCopyIds", nodeModel.getId()));
|
||||
allData.put("javaCopyIds", javaCopyIds);
|
||||
if (StrUtil.isNotEmpty(javaCopyIds)) {
|
||||
String[] split = StrUtil.splitToArray(javaCopyIds, StrUtil.COMMA);
|
||||
for (String copyId : split) {
|
||||
String copyJvm = getParameter(StrUtil.format("{}_jvm_{}", nodeModel.getId(), copyId));
|
||||
String copyArgs = getParameter(StrUtil.format("{}_args_{}", nodeModel.getId(), copyId));
|
||||
allData.put("jvm_" + copyId, copyJvm);
|
||||
allData.put("args_" + copyId, copyArgs);
|
||||
}
|
||||
}
|
||||
JsonMessage<String> jsonMessage = sendData(nodeModel, userModel, allData, false);
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
cache.put(nodeModel, allData);
|
||||
}
|
||||
// 删除已经删除的项目
|
||||
String error = deleteProject(outGivingModel, outGivingNodeProjects, userModel);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
outGivingModel.setOutGivingNodeProjectList(outGivingNodeProjects);
|
||||
outGivingModel.setTempCacheMap(cache);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已经删除过的项目
|
||||
*
|
||||
* @param outGivingModel 分发项目
|
||||
* @param outGivingNodeProjects 新的节点项目
|
||||
* @param userModel 用户
|
||||
* @return 错误信息
|
||||
*/
|
||||
private String deleteProject(OutGivingModel outGivingModel, List<OutGivingNodeProject> outGivingNodeProjects, UserModel userModel) {
|
||||
if (outGivingNodeProjects.size() < 2) {
|
||||
return JsonMessage.getString(406, "至少选择两个节点及以上");
|
||||
}
|
||||
// 删除
|
||||
List<OutGivingNodeProject> deleteNodeProject = outGivingModel.getDelete(outGivingNodeProjects);
|
||||
if (deleteNodeProject != null) {
|
||||
JsonMessage jsonMessage;
|
||||
// 删除实际的项目
|
||||
for (OutGivingNodeProject outGivingNodeProject1 : deleteNodeProject) {
|
||||
NodeModel nodeModel = outGivingNodeProject1.getNodeData(true);
|
||||
jsonMessage = deleteNodeProject(nodeModel, userModel, outGivingNodeProject1.getProjectId());
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 删除已经删除过的项目
|
||||
*
|
||||
* @param outGivingModel 分发项目
|
||||
* @param outGivingNodeProjects 新的节点项目
|
||||
* @param userModel 用户
|
||||
* @return 错误信息
|
||||
*/
|
||||
private String deleteProject(OutGivingModel outGivingModel, List<OutGivingNodeProject> outGivingNodeProjects, UserModel userModel) {
|
||||
if (outGivingNodeProjects.size() < 2) {
|
||||
return JsonMessage.getString(406, "至少选择两个节点及以上");
|
||||
}
|
||||
// 删除
|
||||
List<OutGivingNodeProject> deleteNodeProject = outGivingModel.getDelete(outGivingNodeProjects);
|
||||
if (deleteNodeProject != null) {
|
||||
JsonMessage<String> jsonMessage;
|
||||
// 删除实际的项目
|
||||
for (OutGivingNodeProject outGivingNodeProject1 : deleteNodeProject) {
|
||||
NodeModel nodeModel = outGivingNodeProject1.getNodeData(true);
|
||||
jsonMessage = deleteNodeProject(nodeModel, userModel, outGivingNodeProject1.getProjectId());
|
||||
if (jsonMessage.getCode() != HttpStatus.HTTP_OK) {
|
||||
return JsonMessage.getString(406, nodeModel.getName() + "节点失败:" + jsonMessage.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JsonMessage<String> sendData(NodeModel nodeModel, UserModel userModel, JSONObject data, boolean save) {
|
||||
if (save) {
|
||||
data.remove("previewData");
|
||||
}
|
||||
data.put("outGivingProject", true);
|
||||
// 发起预检查数据
|
||||
return NodeForward.request(nodeModel, NodeUrl.Manage_SaveProject, userModel, data);
|
||||
}
|
||||
private JsonMessage<String> sendData(NodeModel nodeModel, UserModel userModel, JSONObject data, boolean save) {
|
||||
if (save) {
|
||||
data.remove("previewData");
|
||||
}
|
||||
data.put("outGivingProject", true);
|
||||
// 发起预检查数据
|
||||
return NodeForward.request(nodeModel, NodeUrl.Manage_SaveProject, userModel, data);
|
||||
}
|
||||
}
|
||||
|
@ -37,31 +37,6 @@ import java.util.Map;
|
||||
@Feature(cls = ClassFeature.SYSTEM)
|
||||
public class CacheManageController extends BaseServerController {
|
||||
|
||||
// @RequestMapping(value = "cache.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.CACHE)
|
||||
// public String cache() {
|
||||
// if (tryGetNode() == null) {
|
||||
// //
|
||||
// File file = ConfigBean.getInstance().getTempPath();
|
||||
// String fileSize = FileUtil.readableFileSize(FileUtil.size(file));
|
||||
// setAttribute("cacheFileSize", fileSize);
|
||||
//
|
||||
// int size = LoginControl.LFU_CACHE.size();
|
||||
// setAttribute("ipSize", size);
|
||||
// int oneLineCount = ServiceFileTailWatcher.getOneLineCount();
|
||||
// setAttribute("readFileOnLineCount", oneLineCount);
|
||||
//
|
||||
// File buildDataDir = BuildUtil.getBuildDataDir();
|
||||
// if (buildDataDir.exists()) {
|
||||
// fileSize = FileUtil.readableFileSize(FileUtil.size(buildDataDir));
|
||||
// setAttribute("cacheBuildFileSize", fileSize);
|
||||
// } else {
|
||||
// setAttribute("cacheBuildFileSize", 0);
|
||||
// }
|
||||
// }
|
||||
// return "system/cache";
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
|
@ -39,69 +39,64 @@ import java.util.concurrent.TimeUnit;
|
||||
@Feature(cls = ClassFeature.SYSTEM)
|
||||
public class LogManageController extends BaseServerController {
|
||||
|
||||
// @RequestMapping(value = "log.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.LOG)
|
||||
// public String log() {
|
||||
// return "system/log";
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "log_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LOG)
|
||||
public String logData(String nodeId) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.SystemLog).toString();
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
JSONArray data = LayuiTreeUtil.getTreeData(webAopLog.getPropertyValue());
|
||||
return JsonMessage.getString(200, "", data);
|
||||
}
|
||||
@RequestMapping(value = "log_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LOG)
|
||||
public String logData(String nodeId) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.SystemLog).toString();
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
JSONArray data = LayuiTreeUtil.getTreeData(webAopLog.getPropertyValue());
|
||||
return JsonMessage.getString(200, "", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 需要验证是否最后修改时间
|
||||
*
|
||||
* @param nodeId 节点
|
||||
* @param path 路径
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "log_del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DelSysLog)
|
||||
@Feature(method = MethodFeature.DEL_LOG)
|
||||
public String logData(String nodeId,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.DelSystemLog).toString();
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
File file = FileUtil.file(webAopLog.getPropertyValue(), path);
|
||||
// 判断修改时间
|
||||
long modified = file.lastModified();
|
||||
if (System.currentTimeMillis() - modified < TimeUnit.DAYS.toMillis(1)) {
|
||||
return JsonMessage.getString(405, "不能删除当天的日志");
|
||||
}
|
||||
if (FileUtil.del(file)) {
|
||||
// 离线上一个日志
|
||||
ServiceFileTailWatcher.offlineFile(file);
|
||||
return JsonMessage.getString(200, "删除成功");
|
||||
}
|
||||
return JsonMessage.getString(500, "删除失败");
|
||||
}
|
||||
/**
|
||||
* 删除 需要验证是否最后修改时间
|
||||
*
|
||||
* @param nodeId 节点
|
||||
* @param path 路径
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "log_del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.DelSysLog)
|
||||
@Feature(method = MethodFeature.DEL_LOG)
|
||||
public String logData(String nodeId,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.DelSystemLog).toString();
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
File file = FileUtil.file(webAopLog.getPropertyValue(), path);
|
||||
// 判断修改时间
|
||||
long modified = file.lastModified();
|
||||
if (System.currentTimeMillis() - modified < TimeUnit.DAYS.toMillis(1)) {
|
||||
return JsonMessage.getString(405, "不能删除当天的日志");
|
||||
}
|
||||
if (FileUtil.del(file)) {
|
||||
// 离线上一个日志
|
||||
ServiceFileTailWatcher.offlineFile(file);
|
||||
return JsonMessage.getString(200, "删除成功");
|
||||
}
|
||||
return JsonMessage.getString(500, "删除失败");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "log_download", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.DOWNLOAD)
|
||||
public void logDownload(String nodeId,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
NodeForward.requestDownload(getNode(), getRequest(), getResponse(), NodeUrl.DownloadSystemLog);
|
||||
return;
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
File file = FileUtil.file(webAopLog.getPropertyValue(), path);
|
||||
if (file.isFile()) {
|
||||
ServletUtil.write(getResponse(), file);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "log_download", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.DOWNLOAD)
|
||||
public void logDownload(String nodeId,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
if (StrUtil.isNotEmpty(nodeId)) {
|
||||
NodeForward.requestDownload(getNode(), getRequest(), getResponse(), NodeUrl.DownloadSystemLog);
|
||||
return;
|
||||
}
|
||||
WebAopLog webAopLog = SpringUtil.getBean(WebAopLog.class);
|
||||
File file = FileUtil.file(webAopLog.getPropertyValue(), path);
|
||||
if (file.isFile()) {
|
||||
ServletUtil.write(getResponse(), file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,21 +48,6 @@ public class SystemConfigController extends BaseServerController {
|
||||
this.systemIpConfigService = systemIpConfigService;
|
||||
}
|
||||
|
||||
|
||||
// @RequestMapping(value = "config.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @SystemPermission
|
||||
// public String config(String nodeId) throws IOException {
|
||||
// String content;
|
||||
// if (StrUtil.isNotEmpty(nodeId)) {
|
||||
// JSONObject jsonObject = NodeForward.requestData(getNode(), NodeUrl.SystemGetConfig, getRequest(), JSONObject.class);
|
||||
// content = jsonObject.getString("content");
|
||||
// } else {
|
||||
// content = IoUtil.read(ExtConfigBean.getResource().getInputStream(), CharsetUtil.CHARSET_UTF_8);
|
||||
// }
|
||||
// setAttribute("content", content);
|
||||
// return "system/config";
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param nodeId
|
||||
* @return
|
||||
|
@ -32,74 +32,58 @@ import javax.mail.Transport;
|
||||
@RequestMapping(value = "system")
|
||||
public class SystemMailConfigController extends BaseServerController {
|
||||
|
||||
@Resource
|
||||
private SystemMailConfigService systemMailConfigService;
|
||||
@Resource
|
||||
private SystemMailConfigService systemMailConfigService;
|
||||
|
||||
// /**
|
||||
// * 展示监控页面
|
||||
// *
|
||||
// * @return page
|
||||
// */
|
||||
// @RequestMapping(value = "mailConfig.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @SystemPermission
|
||||
// public String mailConfig() {
|
||||
// UserModel userModel = getUser();
|
||||
// if (userModel.isSystemUser()) {
|
||||
// MailAccountModel item = systemMailConfigService.getConfig();
|
||||
// setAttribute("item", item);
|
||||
// }
|
||||
// return "monitor/mailConfig";
|
||||
// }
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* load mail config data
|
||||
* 加载邮件配置
|
||||
*/
|
||||
@RequestMapping(value = "mail-config-data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SystemPermission
|
||||
@ResponseBody
|
||||
public String mailConfigData() {
|
||||
UserModel userModel = getUser();
|
||||
MailAccountModel item = null;
|
||||
if (userModel.isSystemUser()) {
|
||||
item = systemMailConfigService.getConfig();
|
||||
}
|
||||
return JsonMessage.getString(200, "success", item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* load mail config data
|
||||
* 加载邮件配置
|
||||
*/
|
||||
@RequestMapping(value = "mail-config-data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SystemPermission
|
||||
@ResponseBody
|
||||
public String mailConfigData() {
|
||||
UserModel userModel = getUser();
|
||||
MailAccountModel item = null;
|
||||
if (userModel.isSystemUser()) {
|
||||
item = systemMailConfigService.getConfig();
|
||||
}
|
||||
return JsonMessage.getString(200, "success", item);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "mailConfig_save.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.EditMailConfig)
|
||||
@SystemPermission
|
||||
public String listData(MailAccountModel mailAccountModel) {
|
||||
if (mailAccountModel == null) {
|
||||
return JsonMessage.getString(405, "请填写信息,并检查是否填写合法");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getHost())) {
|
||||
return JsonMessage.getString(405, "请填写host");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getUser())) {
|
||||
return JsonMessage.getString(405, "请填写user");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getPass())) {
|
||||
return JsonMessage.getString(405, "请填写pass");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getFrom())) {
|
||||
return JsonMessage.getString(405, "请填写from");
|
||||
}
|
||||
systemMailConfigService.save(mailAccountModel);
|
||||
// 验证是否正确
|
||||
try {
|
||||
MailAccount account = EmailUtil.getAccountNew();
|
||||
Session session = MailUtil.getSession(account, false);
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect();
|
||||
transport.close();
|
||||
} catch (Exception e) {
|
||||
return JsonMessage.getString(406, "验证邮箱信息失败,请检查配置的邮箱信息。端口号、授权码等。" + e.getMessage());
|
||||
}
|
||||
return JsonMessage.getString(200, "保存成功");
|
||||
}
|
||||
@RequestMapping(value = "mailConfig_save.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@OptLog(UserOperateLogV1.OptType.EditMailConfig)
|
||||
@SystemPermission
|
||||
public String listData(MailAccountModel mailAccountModel) {
|
||||
if (mailAccountModel == null) {
|
||||
return JsonMessage.getString(405, "请填写信息,并检查是否填写合法");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getHost())) {
|
||||
return JsonMessage.getString(405, "请填写host");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getUser())) {
|
||||
return JsonMessage.getString(405, "请填写user");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getPass())) {
|
||||
return JsonMessage.getString(405, "请填写pass");
|
||||
}
|
||||
if (StrUtil.isBlank(mailAccountModel.getFrom())) {
|
||||
return JsonMessage.getString(405, "请填写from");
|
||||
}
|
||||
systemMailConfigService.save(mailAccountModel);
|
||||
// 验证是否正确
|
||||
try {
|
||||
MailAccount account = EmailUtil.getAccountNew();
|
||||
Session session = MailUtil.getSession(account, false);
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect();
|
||||
transport.close();
|
||||
} catch (Exception e) {
|
||||
return JsonMessage.getString(406, "验证邮箱信息失败,请检查配置的邮箱信息。端口号、授权码等。" + e.getMessage());
|
||||
}
|
||||
return JsonMessage.getString(200, "保存成功");
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,6 @@ import java.util.Objects;
|
||||
@RequestMapping(value = "system")
|
||||
public class SystemUpdateController extends BaseServerController {
|
||||
|
||||
// @RequestMapping(value = "update.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @SystemPermission
|
||||
// public String update() {
|
||||
// return "system/update";
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@SystemPermission
|
||||
|
@ -35,89 +35,85 @@ import java.util.concurrent.TimeUnit;
|
||||
@RequestMapping(value = "/user")
|
||||
public class UserBasicInfoController extends BaseServerController {
|
||||
|
||||
private static final TimedCache<String, Integer> CACHE = new TimedCache<>(TimeUnit.MINUTES.toMillis(30));
|
||||
private static final TimedCache<String, Integer> CACHE = new TimedCache<>(TimeUnit.MINUTES.toMillis(30));
|
||||
|
||||
@Resource
|
||||
private SystemMailConfigService systemMailConfigService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private SystemMailConfigService systemMailConfigService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
// @RequestMapping(value = "userInfo.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// public String userInfo() {
|
||||
// return "user/userInfo";
|
||||
// }
|
||||
|
||||
/**
|
||||
* @author Hotstrip
|
||||
* get user basic info
|
||||
* 获取管理员基本信息接口
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "user-basic-info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String getUserBasicInfo() {
|
||||
UserModel userModel = getUser();
|
||||
userModel = userService.getItem(userModel.getId());
|
||||
// return basic info
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", userModel.getId());
|
||||
map.put("name", userModel.getName());
|
||||
map.put("systemUser", userModel.isSystemUser());
|
||||
map.put("email", userModel.getEmail());
|
||||
map.put("dingDing", userModel.getDingDing());
|
||||
map.put("workWx", userModel.getWorkWx());
|
||||
return JsonMessage.getString(200, "success", map);
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* get user basic info
|
||||
* 获取管理员基本信息接口
|
||||
*/
|
||||
@RequestMapping(value = "user-basic-info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String getUserBasicInfo() {
|
||||
UserModel userModel = getUser();
|
||||
userModel = userService.getItem(userModel.getId());
|
||||
// return basic info
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", userModel.getId());
|
||||
map.put("name", userModel.getName());
|
||||
map.put("systemUser", userModel.isSystemUser());
|
||||
map.put("email", userModel.getEmail());
|
||||
map.put("dingDing", userModel.getDingDing());
|
||||
map.put("workWx", userModel.getWorkWx());
|
||||
return JsonMessage.getString(200, "success", map);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "save_basicInfo.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String saveBasicInfo(@ValidatorItem(value = ValidatorRule.EMAIL, msg = "邮箱格式不正确") String email,
|
||||
String dingDing, String workWx, String code) {
|
||||
UserModel userModel = getUser();
|
||||
userModel = userService.getItem(userModel.getId());
|
||||
// 判断是否一样
|
||||
if (!StrUtil.equals(email, userModel.getEmail())) {
|
||||
Integer cacheCode = CACHE.get(email);
|
||||
if (cacheCode == null || !Objects.equals(cacheCode.toString(), code)) {
|
||||
return JsonMessage.getString(405, "请输入正确验证码");
|
||||
}
|
||||
}
|
||||
userModel.setEmail(email);
|
||||
//
|
||||
if (StrUtil.isNotEmpty(dingDing) && !Validator.isUrl(dingDing)) {
|
||||
return JsonMessage.getString(405, "请输入正确钉钉地址");
|
||||
}
|
||||
userModel.setDingDing(dingDing);
|
||||
if (StrUtil.isNotEmpty(workWx) && !Validator.isUrl(workWx)) {
|
||||
return JsonMessage.getString(405, "请输入正确企业微信地址");
|
||||
}
|
||||
userModel.setWorkWx(workWx);
|
||||
userService.updateItem(userModel);
|
||||
setSessionAttribute(LoginInterceptor.SESSION_NAME, userModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
@RequestMapping(value = "save_basicInfo.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String saveBasicInfo(@ValidatorItem(value = ValidatorRule.EMAIL, msg = "邮箱格式不正确") String email,
|
||||
String dingDing, String workWx, String code) {
|
||||
UserModel userModel = getUser();
|
||||
userModel = userService.getItem(userModel.getId());
|
||||
// 判断是否一样
|
||||
if (!StrUtil.equals(email, userModel.getEmail())) {
|
||||
Integer cacheCode = CACHE.get(email);
|
||||
if (cacheCode == null || !Objects.equals(cacheCode.toString(), code)) {
|
||||
return JsonMessage.getString(405, "请输入正确验证码");
|
||||
}
|
||||
}
|
||||
userModel.setEmail(email);
|
||||
//
|
||||
if (StrUtil.isNotEmpty(dingDing) && !Validator.isUrl(dingDing)) {
|
||||
return JsonMessage.getString(405, "请输入正确钉钉地址");
|
||||
}
|
||||
userModel.setDingDing(dingDing);
|
||||
if (StrUtil.isNotEmpty(workWx) && !Validator.isUrl(workWx)) {
|
||||
return JsonMessage.getString(405, "请输入正确企业微信地址");
|
||||
}
|
||||
userModel.setWorkWx(workWx);
|
||||
userService.updateItem(userModel);
|
||||
setSessionAttribute(LoginInterceptor.SESSION_NAME, userModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮箱验证
|
||||
*
|
||||
* @param email 邮箱
|
||||
* @return msg
|
||||
*/
|
||||
@RequestMapping(value = "sendCode.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String sendCode(@ValidatorItem(value = ValidatorRule.EMAIL, msg = "邮箱格式不正确") String email) {
|
||||
MailAccountModel config = systemMailConfigService.getConfig();
|
||||
if (config == null) {
|
||||
return JsonMessage.getString(405, "管理员还没有配置系统邮箱");
|
||||
}
|
||||
int randomInt = RandomUtil.randomInt(1000, 9999);
|
||||
try {
|
||||
EmailUtil.send(email, "Jpom 验证码", "验证码是:" + randomInt);
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("发送失败", e);
|
||||
return JsonMessage.getString(500, "发送邮件失败:" + e.getMessage());
|
||||
}
|
||||
CACHE.put(email, randomInt);
|
||||
return JsonMessage.getString(200, "发送成功");
|
||||
}
|
||||
/**
|
||||
* 发送邮箱验证
|
||||
*
|
||||
* @param email 邮箱
|
||||
* @return msg
|
||||
*/
|
||||
@RequestMapping(value = "sendCode.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public String sendCode(@ValidatorItem(value = ValidatorRule.EMAIL, msg = "邮箱格式不正确") String email) {
|
||||
MailAccountModel config = systemMailConfigService.getConfig();
|
||||
if (config == null) {
|
||||
return JsonMessage.getString(405, "管理员还没有配置系统邮箱");
|
||||
}
|
||||
int randomInt = RandomUtil.randomInt(1000, 9999);
|
||||
try {
|
||||
EmailUtil.send(email, "Jpom 验证码", "验证码是:" + randomInt);
|
||||
} catch (Exception e) {
|
||||
DefaultSystemLog.getLog().error("发送失败", e);
|
||||
return JsonMessage.getString(500, "发送邮件失败:" + e.getMessage());
|
||||
}
|
||||
CACHE.put(email, randomInt);
|
||||
return JsonMessage.getString(200, "发送成功");
|
||||
}
|
||||
}
|
||||
|
@ -33,152 +33,129 @@ import java.util.List;
|
||||
@Feature(cls = ClassFeature.USER)
|
||||
public class UserEditController extends BaseServerController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param id 登录名
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "addUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@OptLog(UserOperateLogV1.OptType.AddUer)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@ResponseBody
|
||||
public String addUser(String id) {
|
||||
if (JpomApplication.SYSTEM_ID.equalsIgnoreCase(id)) {
|
||||
return JsonMessage.getString(400, "当前登录名已经被系统占用啦");
|
||||
}
|
||||
UserModel userName = getUser();
|
||||
//
|
||||
int size = userService.userSize();
|
||||
if (size >= ServerExtConfigBean.getInstance().userMaxCount) {
|
||||
return JsonMessage.getString(500, "当前用户个数超过系统上限");
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "edit", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.EDIT)
|
||||
// public String edit(String id) {
|
||||
// UserModel item = userService.getItem(id);
|
||||
// if (item != null) {
|
||||
// item.setPassword(null);
|
||||
// setAttribute("userItem", item);
|
||||
// }
|
||||
// List<RoleModel> list = roleService.list();
|
||||
// JSONArray roles = new JSONArray();
|
||||
// list.forEach(userModel -> {
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("title", userModel.getName());
|
||||
// jsonObject.put("value", userModel.getId());
|
||||
// roles.add(jsonObject);
|
||||
// });
|
||||
// setAttribute("roles", roles);
|
||||
// return "user/edit";
|
||||
// }
|
||||
UserModel userModel = userService.getItem(id);
|
||||
if (userModel != null) {
|
||||
return JsonMessage.getString(401, "登录名已经存在");
|
||||
}
|
||||
userModel = new UserModel();
|
||||
// 隐藏系统管理员登录名
|
||||
if (userName.isSystemUser()) {
|
||||
userModel.setParent(UserModel.SYSTEM_OCCUPY_NAME);
|
||||
} else {
|
||||
userModel.setParent(userName.getId());
|
||||
}
|
||||
String msg = parseUser(userModel, true);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
}
|
||||
userService.addItem(userModel);
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param id 登录名
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "addUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@OptLog(UserOperateLogV1.OptType.AddUer)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@ResponseBody
|
||||
public String addUser(String id) {
|
||||
if (JpomApplication.SYSTEM_ID.equalsIgnoreCase(id)) {
|
||||
return JsonMessage.getString(400, "当前登录名已经被系统占用啦");
|
||||
}
|
||||
UserModel userName = getUser();
|
||||
//
|
||||
int size = userService.userSize();
|
||||
if (size >= ServerExtConfigBean.getInstance().userMaxCount) {
|
||||
return JsonMessage.getString(500, "当前用户个数超过系统上限");
|
||||
}
|
||||
private String parseUser(UserModel userModel, boolean create) {
|
||||
String id = getParameter("id");
|
||||
if (StrUtil.isEmpty(id) || id.length() < UserModel.USER_NAME_MIN_LEN) {
|
||||
return JsonMessage.getString(400, "登录名不能为空,并且长度必须不小于" + UserModel.USER_NAME_MIN_LEN);
|
||||
}
|
||||
if (UserModel.SYSTEM_OCCUPY_NAME.equals(id) || UserModel.SYSTEM_ADMIN.equals(id)) {
|
||||
return JsonMessage.getString(401, "当前登录名已经被系统占用");
|
||||
}
|
||||
if (!checkPathSafe(id)) {
|
||||
return JsonMessage.getString(400, "登录名不能包含特殊字符");
|
||||
}
|
||||
userModel.setId(id);
|
||||
|
||||
UserModel userModel = userService.getItem(id);
|
||||
if (userModel != null) {
|
||||
return JsonMessage.getString(401, "登录名已经存在");
|
||||
}
|
||||
userModel = new UserModel();
|
||||
// 隐藏系统管理员登录名
|
||||
if (userName.isSystemUser()) {
|
||||
userModel.setParent(UserModel.SYSTEM_OCCUPY_NAME);
|
||||
} else {
|
||||
userModel.setParent(userName.getId());
|
||||
}
|
||||
String msg = parseUser(userModel, true);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
}
|
||||
userService.addItem(userModel);
|
||||
return JsonMessage.getString(200, "添加成功");
|
||||
}
|
||||
String name = getParameter("name");
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
return JsonMessage.getString(405, "请输入账户昵称");
|
||||
}
|
||||
int len = name.length();
|
||||
if (len > 10 || len < 2) {
|
||||
return JsonMessage.getString(405, "昵称长度只能是2-10");
|
||||
}
|
||||
userModel.setName(name);
|
||||
|
||||
private String parseUser(UserModel userModel, boolean create) {
|
||||
String id = getParameter("id");
|
||||
if (StrUtil.isEmpty(id) || id.length() < UserModel.USER_NAME_MIN_LEN) {
|
||||
return JsonMessage.getString(400, "登录名不能为空,并且长度必须不小于" + UserModel.USER_NAME_MIN_LEN);
|
||||
}
|
||||
if (UserModel.SYSTEM_OCCUPY_NAME.equals(id) || UserModel.SYSTEM_ADMIN.equals(id)) {
|
||||
return JsonMessage.getString(401, "当前登录名已经被系统占用");
|
||||
}
|
||||
if (!checkPathSafe(id)) {
|
||||
return JsonMessage.getString(400, "登录名不能包含特殊字符");
|
||||
}
|
||||
userModel.setId(id);
|
||||
UserModel userName = getUser();
|
||||
String password = getParameter("password");
|
||||
if (create || StrUtil.isNotEmpty(password)) {
|
||||
if (StrUtil.isEmpty(password)) {
|
||||
return JsonMessage.getString(400, "密码不能为空");
|
||||
}
|
||||
// 修改用户
|
||||
if (!create && !userName.isSystemUser()) {
|
||||
return JsonMessage.getString(401, "只有系统管理员才能重置用户密码");
|
||||
}
|
||||
userModel.setPassword(password);
|
||||
}
|
||||
//
|
||||
String roles = getParameter("roles");
|
||||
JSONArray jsonArray = JSONArray.parseArray(roles);
|
||||
List<String> rolesList = jsonArray.toJavaList(String.class);
|
||||
if (rolesList == null || rolesList.isEmpty()) {
|
||||
return JsonMessage.getString(405, "请选择一个角色");
|
||||
}
|
||||
userModel.setRoles(rolesList);
|
||||
return null;
|
||||
}
|
||||
|
||||
String name = getParameter("name");
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
return JsonMessage.getString(405, "请输入账户昵称");
|
||||
}
|
||||
int len = name.length();
|
||||
if (len > 10 || len < 2) {
|
||||
return JsonMessage.getString(405, "昵称长度只能是2-10");
|
||||
}
|
||||
userModel.setName(name);
|
||||
|
||||
UserModel userName = getUser();
|
||||
String password = getParameter("password");
|
||||
if (create || StrUtil.isNotEmpty(password)) {
|
||||
if (StrUtil.isEmpty(password)) {
|
||||
return JsonMessage.getString(400, "密码不能为空");
|
||||
}
|
||||
// 修改用户
|
||||
if (!create && !userName.isSystemUser()) {
|
||||
return JsonMessage.getString(401, "只有系统管理员才能重置用户密码");
|
||||
}
|
||||
userModel.setPassword(password);
|
||||
}
|
||||
//
|
||||
String roles = getParameter("roles");
|
||||
JSONArray jsonArray = JSONArray.parseArray(roles);
|
||||
List<String> rolesList = jsonArray.toJavaList(String.class);
|
||||
if (rolesList == null || rolesList.isEmpty()) {
|
||||
return JsonMessage.getString(405, "请选择一个角色");
|
||||
}
|
||||
userModel.setRoles(rolesList);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param id 登录名
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "updateUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@OptLog(UserOperateLogV1.OptType.EditUer)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@ResponseBody
|
||||
public String updateUser(String id) {
|
||||
UserModel userModel = userService.getItem(id);
|
||||
if (userModel == null) {
|
||||
return JsonMessage.getString(400, "修改失败:-1");
|
||||
}
|
||||
// 禁止修改系统管理员信息
|
||||
if (userModel.isSystemUser()) {
|
||||
return JsonMessage.getString(401, "WEB端不能修改系统管理员信息");
|
||||
}
|
||||
UserModel me = getUser();
|
||||
if (userModel.getId().equals(me.getId())) {
|
||||
return JsonMessage.getString(401, "不能修改自己的信息");
|
||||
}
|
||||
// 非系统管理员不能修改演示账号信息
|
||||
if (!me.isSystemUser() && userModel.isDemoUser()) {
|
||||
return JsonMessage.getString(402, "不支持修改演示账号信息");
|
||||
}
|
||||
String msg = parseUser(userModel, false);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
}
|
||||
// 记录修改时间,如果在线用户线退出
|
||||
userModel.setModifyTime(DateUtil.currentSeconds());
|
||||
userService.updateItem(userModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param id 登录名
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "updateUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@OptLog(UserOperateLogV1.OptType.EditUer)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@ResponseBody
|
||||
public String updateUser(String id) {
|
||||
UserModel userModel = userService.getItem(id);
|
||||
if (userModel == null) {
|
||||
return JsonMessage.getString(400, "修改失败:-1");
|
||||
}
|
||||
// 禁止修改系统管理员信息
|
||||
if (userModel.isSystemUser()) {
|
||||
return JsonMessage.getString(401, "WEB端不能修改系统管理员信息");
|
||||
}
|
||||
UserModel me = getUser();
|
||||
if (userModel.getId().equals(me.getId())) {
|
||||
return JsonMessage.getString(401, "不能修改自己的信息");
|
||||
}
|
||||
// 非系统管理员不能修改演示账号信息
|
||||
if (!me.isSystemUser() && userModel.isDemoUser()) {
|
||||
return JsonMessage.getString(402, "不支持修改演示账号信息");
|
||||
}
|
||||
String msg = parseUser(userModel, false);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
}
|
||||
// 记录修改时间,如果在线用户线退出
|
||||
userModel.setModifyTime(DateUtil.currentSeconds());
|
||||
userService.updateItem(userModel);
|
||||
return JsonMessage.getString(200, "修改成功");
|
||||
}
|
||||
}
|
||||
|
@ -31,67 +31,51 @@ import java.util.stream.Collectors;
|
||||
@Feature(cls = ClassFeature.USER)
|
||||
public class UserListController extends BaseServerController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
// /**
|
||||
// * 展示用户列表
|
||||
// *
|
||||
// * @return page
|
||||
// */
|
||||
// @RequestMapping(value = "list", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
// @Feature(method = MethodFeature.LIST)
|
||||
// public String list() {
|
||||
// List<RoleModel> roleModels = roleService.list();
|
||||
// setAttribute("roleEmpty", roleModels == null || roleModels.isEmpty());
|
||||
// return "user/list";
|
||||
// }
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "getUserList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String getUserList() {
|
||||
UserModel userName = getUser();
|
||||
List<UserModel> userList = userService.list();
|
||||
if (userList != null) {
|
||||
userList = userList.stream().filter(userModel -> {
|
||||
// 不显示自己的信息
|
||||
return !userModel.getId().equals(userName.getId());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return JsonMessage.getString(200, "", userList);
|
||||
}
|
||||
/**
|
||||
* 查询所有用户
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "getUserList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String getUserList() {
|
||||
UserModel userName = getUser();
|
||||
List<UserModel> userList = userService.list();
|
||||
if (userList != null) {
|
||||
userList = userList.stream().filter(userModel -> {
|
||||
// 不显示自己的信息
|
||||
return !userModel.getId().equals(userName.getId());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return JsonMessage.getString(200, "", userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* get all admin user list
|
||||
* 获取所有管理员信息
|
||||
*/
|
||||
@RequestMapping(value = "get-admin-user-list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String getAdminUserList() {
|
||||
List<UserModel> list = userService.list(false);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
list.forEach(userModel -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("title", userModel.getName());
|
||||
jsonObject.put("value", userModel.getId());
|
||||
if (StrUtil.isAllEmpty(userModel.getEmail(), userModel.getDingDing(), userModel.getWorkWx())) {
|
||||
jsonObject.put("disabled", true);
|
||||
}
|
||||
jsonArray.add(jsonObject);
|
||||
});
|
||||
return JsonMessage.getString(200, "success", jsonArray);
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
* @author Hotstrip
|
||||
* get all admin user list
|
||||
* 获取所有管理员信息
|
||||
*/
|
||||
@RequestMapping(value = "get-admin-user-list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public String getAdminUserList() {
|
||||
List<UserModel> list = userService.list(false);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
list.forEach(userModel -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("title", userModel.getName());
|
||||
jsonObject.put("value", userModel.getId());
|
||||
if (StrUtil.isAllEmpty(userModel.getEmail(), userModel.getDingDing(), userModel.getWorkWx())) {
|
||||
jsonObject.put("disabled", true);
|
||||
}
|
||||
jsonArray.add(jsonObject);
|
||||
});
|
||||
return JsonMessage.getString(200, "success", jsonArray);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
{
|
||||
"title": "节点分发",
|
||||
"icon_v3": "apartment",
|
||||
"dynamic": "showOutGiving",
|
||||
"childs": [
|
||||
{
|
||||
"id": "outgiving",
|
||||
|
Loading…
Reference in New Issue
Block a user