2022-07-06 18:32:05 +08:00
|
|
|
|
package org.nl;
|
|
|
|
|
|
|
2022-09-24 10:22:34 +08:00
|
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
2023-04-13 10:28:43 +08:00
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
2022-08-05 13:53:58 +08:00
|
|
|
|
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
|
|
|
|
|
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
2022-07-06 18:32:05 +08:00
|
|
|
|
import io.swagger.annotations.Api;
|
2022-12-29 14:26:55 +08:00
|
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
2023-04-13 10:28:43 +08:00
|
|
|
|
import org.nl.common.utils.MapOf;
|
|
|
|
|
|
import org.nl.modules.wql.WQL;
|
|
|
|
|
|
import org.nl.modules.wql.core.bean.WQLObject;
|
2022-09-26 09:16:28 +08:00
|
|
|
|
import org.nl.modules.wql.util.SpringContextHolder;
|
2022-07-06 18:32:05 +08:00
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
|
|
|
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
|
|
|
|
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
2023-02-09 13:07:57 +08:00
|
|
|
|
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
2022-07-06 18:32:05 +08:00
|
|
|
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
2022-09-24 10:22:34 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
2022-07-06 18:32:05 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 开启审计功能 -> @EnableJpaAuditing
|
|
|
|
|
|
* https://www.cnblogs.com/niceyoo/p/10908647.html
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author ldjun
|
|
|
|
|
|
* @date 2021/2/22 9:20:19
|
|
|
|
|
|
*/
|
|
|
|
|
|
@EnableAsync
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@Api(hidden = true)
|
|
|
|
|
|
@SpringBootApplication(exclude = {
|
|
|
|
|
|
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
|
|
|
|
|
})
|
2022-09-24 09:42:05 +08:00
|
|
|
|
@ServletComponentScan //https://blog.csdn.net/qq_36850813/article/details/101194250
|
2022-07-06 18:32:05 +08:00
|
|
|
|
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
2022-08-05 13:53:58 +08:00
|
|
|
|
@EnableMethodCache(basePackages = "org.nl")
|
|
|
|
|
|
@EnableCreateCacheAnnotation
|
2022-12-29 14:26:55 +08:00
|
|
|
|
@MapperScan("org.nl.**.mapper")
|
2023-02-09 13:07:57 +08:00
|
|
|
|
//@EnableElasticsearchRepositories(basePackages = {"org.nl.modules.logging.repository.*"})
|
2022-07-06 18:32:05 +08:00
|
|
|
|
public class AppRun {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2023-02-05 21:03:37 +08:00
|
|
|
|
try {
|
|
|
|
|
|
SpringApplication.run(AppRun.class, args);
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
2022-07-06 18:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
public SpringContextHolder springContextHolder() {
|
|
|
|
|
|
return new SpringContextHolder();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
public ServletWebServerFactory webServerFactory() {
|
|
|
|
|
|
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
|
|
|
|
|
|
fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
|
|
|
|
|
|
return fa;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 访问首页提示
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return /
|
|
|
|
|
|
*/
|
2022-09-24 10:22:34 +08:00
|
|
|
|
@GetMapping("/")
|
|
|
|
|
|
@SaIgnore
|
2022-07-06 18:32:05 +08:00
|
|
|
|
public String index() {
|
|
|
|
|
|
return "Backend service started successfully";
|
|
|
|
|
|
}
|
2023-04-14 17:50:11 +08:00
|
|
|
|
@GetMapping("/w") // 立库监控初始化
|
2023-04-13 10:28:43 +08:00
|
|
|
|
@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
|
2023-04-14 17:50:11 +08:00
|
|
|
|
System.out.println( (i>=10?"3":"30") + i);
|
2023-04-13 10:28:43 +08:00
|
|
|
|
JSONObject jsonObject = WQL.getWO("ss").addParamMap(MapOf.of("flag", "1"
|
2023-04-14 17:50:11 +08:00
|
|
|
|
, "block_num", (i>=10?"3":"30") + i)).process().uniqueResult(0);
|
2023-04-13 10:28:43 +08:00
|
|
|
|
int num = Integer.parseInt(jsonObject.getString("num"));
|
2023-04-13 15:12:07 +08:00
|
|
|
|
for (int j = 1; j <= num; j++) {// 层数
|
2023-04-13 10:28:43 +08:00
|
|
|
|
// 获取2,1....块的数据
|
2023-04-14 17:50:11 +08:00
|
|
|
|
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);
|
2023-04-13 10:28:43 +08:00
|
|
|
|
for (int k = 0; k < array.size(); k++) { // 1,2...块的每列数据
|
|
|
|
|
|
JSONObject object = array.getJSONObject(k);
|
2023-04-14 08:56:02 +08:00
|
|
|
|
|
2023-04-13 15:12:07 +08:00
|
|
|
|
if (k-1 >= 0) { // 如果块与块不同,空一个距离
|
|
|
|
|
|
JSONObject object2 = array.getJSONObject(k-1);
|
2023-04-14 08:56:02 +08:00
|
|
|
|
if (!object2.getString("block_num").equals(object.getString("block_num")) && object2.getString("is_delete").equals(object.getString("is_delete"))) {
|
2023-04-13 15:12:07 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-04-14 08:56:02 +08:00
|
|
|
|
|
2023-04-13 10:28:43 +08:00
|
|
|
|
if (object.getString("is_delete").equals("1")) {
|
|
|
|
|
|
x = x + step + nodeSizeW;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2023-04-14 08:56:02 +08:00
|
|
|
|
|
2023-04-13 10:28:43 +08:00
|
|
|
|
// 设置节点,只需要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);
|
2023-04-13 15:12:07 +08:00
|
|
|
|
|
2023-04-13 10:28:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 下一列
|
|
|
|
|
|
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);
|
2023-04-14 17:50:11 +08:00
|
|
|
|
JSONObject jsonObject = stageTab.query("stage_code = 'AS_3'").uniqueResult(0);
|
|
|
|
|
|
jsonObject.put("stage_data", save);
|
|
|
|
|
|
stageTab.update(jsonObject);
|
|
|
|
|
|
return "Backend service started successfully";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/f") // 发货区监控初始化
|
|
|
|
|
|
@SaIgnore
|
|
|
|
|
|
public String index3() {
|
|
|
|
|
|
// 采用循环+判断进行铺设图标, 可以通过舞台编辑协助完成
|
|
|
|
|
|
WQLObject stageTab = WQLObject.getWQLObject("stage");
|
|
|
|
|
|
WQLObject attrTab = WQLObject.getWQLObject("sch_base_point");
|
|
|
|
|
|
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 = 1; i <= 4; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray resultJSONArray = attrTab.query("col_num = '" + i + "' and point_type = '9' and layer_num = '1' order by row_num ASC").getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < resultJSONArray.size(); j++) {
|
|
|
|
|
|
JSONObject json = resultJSONArray.getJSONObject(j);
|
|
|
|
|
|
|
|
|
|
|
|
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", json.getString("point_id")); // 灵活配置,其他为固定参数
|
|
|
|
|
|
node.put("properties", properties);
|
|
|
|
|
|
node.put("zIndex", "2023");
|
|
|
|
|
|
x = x + step + nodeSizeW;
|
|
|
|
|
|
nodes.add(node);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
x = 50;
|
|
|
|
|
|
y = y + step + nodeSizeH;
|
|
|
|
|
|
}
|
|
|
|
|
|
save.put("nodes", nodes);
|
|
|
|
|
|
save.put("edges", edges);
|
|
|
|
|
|
JSONObject jsonObject = stageTab.query("stage_code = 'FS'").uniqueResult(0);
|
2023-04-13 10:28:43 +08:00
|
|
|
|
jsonObject.put("stage_data", save);
|
|
|
|
|
|
stageTab.update(jsonObject);
|
|
|
|
|
|
return "Backend service started successfully";
|
|
|
|
|
|
}
|
2022-07-06 18:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|