add: 新增立库监控前后端
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
package org.nl;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -70,5 +76,108 @@ public class AppRun {
|
||||
public String index() {
|
||||
return "Backend service started successfully";
|
||||
}
|
||||
@GetMapping("/w") // 最后可以去掉这个方法
|
||||
@SaIgnore
|
||||
public String index2() {
|
||||
// 采用循环+判断进行铺设图标, 可以通过舞台编辑协助完成
|
||||
WQLObject stageTab = WQLObject.getWQLObject("stage");
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
JSONObject save = new JSONObject();
|
||||
JSONArray nodes = new JSONArray();
|
||||
JSONArray edges = new JSONArray();
|
||||
int x = 50; // 首个位置
|
||||
int y = 50;
|
||||
int step = 5;
|
||||
String type = "html-node";
|
||||
int nodeSizeW = 50;
|
||||
int nodeSizeH = 50;
|
||||
for (int i = 2; i < 23; i=i+2) { // 第几块,每两块为一块
|
||||
// 获取列数col_num
|
||||
System.out.println( (i>=10?"3":"30") + i);
|
||||
JSONObject jsonObject = WQL.getWO("ss").addParamMap(MapOf.of("flag", "1"
|
||||
, "block_num", (i>=10?"3":"30") + i)).process().uniqueResult(0);
|
||||
int num = Integer.parseInt(jsonObject.getString("num"));
|
||||
for (int j = 1; j <= num; j++) {
|
||||
// 获取2,1....块的数据
|
||||
JSONArray array = attrTab.query("block_num IN ('" + (i>=10?"3":"30") + i + "','" +
|
||||
((i-1)>=10?"3":"30") + (i - 1) + "') AND " +
|
||||
"layer_num = 3 AND col_num = " + j, "block_num DESC, row_num DESC").getResultJSONArray(0);
|
||||
for (int k = 0; k < array.size(); k++) { // 1,2...块的每列数据
|
||||
JSONObject object = array.getJSONObject(k);
|
||||
if (object.getString("is_delete").equals("1")) {
|
||||
x = x + step + nodeSizeW;
|
||||
continue;
|
||||
}
|
||||
// 设置节点,只需要struct_id, 自定义参数数据都加载properties对象里面
|
||||
JSONObject node = new JSONObject();
|
||||
node.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node.put("type", type);
|
||||
node.put("x", x);
|
||||
node.put("y", y);
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONObject nodeSize = new JSONObject();
|
||||
nodeSize.put("width", nodeSizeW);
|
||||
nodeSize.put("height", nodeSizeH);
|
||||
properties.put("nodeSize", nodeSize);
|
||||
properties.put("struct_id", object.getString("struct_id")); // 灵活配置,其他为固定参数
|
||||
node.put("properties", properties);
|
||||
node.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node);
|
||||
if (k+1 < array.size()) { // 如果块与块不同,空一个距离
|
||||
JSONObject object2 = array.getJSONObject(k+1);
|
||||
if (!object2.getString("block_num").equals(object.getString("block_num"))) {
|
||||
JSONObject node2 = new JSONObject();
|
||||
node2.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node2.put("type", type);
|
||||
node2.put("x", x);
|
||||
node2.put("y", y);
|
||||
JSONObject properties2 = new JSONObject();
|
||||
JSONObject nodeSize2 = new JSONObject();
|
||||
nodeSize2.put("width", nodeSizeW);
|
||||
nodeSize2.put("height", nodeSizeH);
|
||||
properties2.put("nodeSize", nodeSize2);
|
||||
properties2.put("flag", "1");
|
||||
properties2.put("transform", 90);
|
||||
node2.put("properties", properties2);
|
||||
node2.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 下一列
|
||||
x = 50;
|
||||
y = y + step + nodeSizeH;
|
||||
}
|
||||
// 下一个块
|
||||
x = 50;
|
||||
for (int j = 0; j < 16; j++) { // 铺设一行道路
|
||||
JSONObject node2 = new JSONObject();
|
||||
node2.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node2.put("type", type);
|
||||
node2.put("x", x);
|
||||
node2.put("y", y);
|
||||
JSONObject properties2 = new JSONObject();
|
||||
JSONObject nodeSize2 = new JSONObject();
|
||||
nodeSize2.put("width", nodeSizeW);
|
||||
nodeSize2.put("height", nodeSizeH);
|
||||
properties2.put("nodeSize", nodeSize2);
|
||||
properties2.put("flag", "1");
|
||||
node2.put("properties", properties2);
|
||||
node2.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node2);
|
||||
}
|
||||
x = 50;
|
||||
y = y + step + nodeSizeH;
|
||||
}
|
||||
save.put("nodes", nodes);
|
||||
save.put("edges", edges);
|
||||
JSONObject jsonObject = stageTab.query("stage_code = 'AS_3'").uniqueResult(0);
|
||||
jsonObject.put("stage_data", save);
|
||||
stageTab.update(jsonObject);
|
||||
return "Backend service started successfully";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user