山西正式配置文件

dev
songwenxuan 2025-09-30 12:00:52 +08:00
parent ea8b0b473d
commit e875693d8c
5 changed files with 73 additions and 35 deletions

10
pom.xml
View File

@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.zcloud</groupId> <groupId>com.zcloud</groupId>
<artifactId>integrated_yjb_scheduled</artifactId> <artifactId>sx_yjb_scheduled</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging><!-- 以war运行是改成war --> <packaging>war</packaging><!-- 以war运行是改成war -->
<name>integrated_yjb_scheduled</name> <name>sx_yjb_scheduled</name>
<description>integrated_yjb_scheduled for Spring Boot</description> <description>sx_yjb_scheduled for Spring Boot</description>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -451,7 +451,7 @@
</dependencies> </dependencies>
<build> <build>
<!-- <finalName>integrated_yjb_scheduled</finalName> <!-- <finalName>sx_yjb_scheduled</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -478,7 +478,7 @@
</includes> </includes>
</resource> </resource>
</resources> --> </resources> -->
<finalName>integrated_yjb_scheduled</finalName> <finalName>sx_yjb_scheduled</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -1,20 +1,17 @@
package com.zcloud.controller; package com.zcloud.controller;
import com.alibaba.fastjson.JSONObject;
import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.context.XxlJobHelper;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.tbIron.TbIronPlcMapper; import com.zcloud.mapper.datasource.tbIron.TbIronPlcMapper;
import com.zcloud.mapper.dsno2.target.MesDeviceMonitoringMapper; import com.zcloud.mapper.dsno2.target.MesDeviceMonitoringMapper;
import com.zcloud.util.DateUtil; import com.zcloud.util.*;
import com.zcloud.util.R;
import com.zcloud.util.Tools;
import com.zcloud.util.UuidUtil;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.tools.Tool;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -28,8 +25,29 @@ public class AppPosiDeviceController {
@Resource @Resource
private MesDeviceMonitoringMapper mesDeviceMonitoringMapper; private MesDeviceMonitoringMapper mesDeviceMonitoringMapper;
@Resource
private RedisUtil redisUtil;
@PostMapping("/test1") @PostMapping("/test1")
public R test1(@RequestBody HashMap<String, String> parma) throws Exception { public R test1(@RequestBody HashMap<String, String> parma) throws Exception {
System.out.println("测试接口,请更换正式接口!");
// 打印接收的数据 排序分类显示
printReceiveData(parma);
// 批量存储数据
batchInsert(parma);
return R.ok();
}
@PostMapping("/receiver")
public R receiver(@RequestBody HashMap<String, String> parma) throws Exception {
// 打印接收的数据 排序分类显示
printReceiveData(parma);
// 批量存储数据
batchInsert(parma);
return R.ok();
}
void printReceiveData(HashMap<String, String> parma) {
System.out.println("———————————————————————————————————————————————————————————————————————————————————————————————————————————"); System.out.println("———————————————————————————————————————————————————————————————————————————————————————————————————————————");
// 1. 初始化分组Map确保键唯一使用LinkedHashMap保持插入顺序可选 // 1. 初始化分组Map确保键唯一使用LinkedHashMap保持插入顺序可选
Map<String, List<Map.Entry<String, String>>> groupMap = new LinkedHashMap<>(); Map<String, List<Map.Entry<String, String>>> groupMap = new LinkedHashMap<>();
@ -72,7 +90,6 @@ public class AppPosiDeviceController {
System.out.println("【" + prefix + "组】:" + groupContent); System.out.println("【" + prefix + "组】:" + groupContent);
}); });
System.out.println("———————————————————————————————————————————————————————————————————————————————————————————————————————————"); System.out.println("———————————————————————————————————————————————————————————————————————————————————————————————————————————");
return R.ok();
} }
/** /**
@ -130,9 +147,7 @@ public class AppPosiDeviceController {
} }
} }
@PostMapping("/receiver") void batchInsert(HashMap<String, String> parma) {
public R receiver(@RequestBody HashMap<String, String> parma) throws Exception {
System.out.println("parma数据" +parma);
// 定义处理批次数据 ID // 定义处理批次数据 ID
String processingBatchId = UuidUtil.get32UUID(); String processingBatchId = UuidUtil.get32UUID();
// 批处理时间 // 批处理时间
@ -153,19 +168,35 @@ public class AppPosiDeviceController {
} else if (parma.containsKey("t2td1")) { } else if (parma.containsKey("t2td1")) {
dataList.add(saveData(parma.get("t2td1"), "cf0c414e21e0413aac3ac53e53c33058", targetAllList, processingBatchId, processingTime)); dataList.add(saveData(parma.get("t2td1"), "cf0c414e21e0413aac3ac53e53c33058", targetAllList, processingBatchId, processingTime));
} }
} else if (location.equals("2#高炉控制室")) { } else if (location.equals("2#高炉中控室")) {
System.out.println("2#高炉控制室"); if (parma.containsKey("t2td1")) {
} else if (location.equals("3#高炉控制室")) { dataList.add(saveData(parma.get("t2td1"), "90313d5f6a22cefcd2ea44c871481723", targetAllList, processingBatchId, processingTime));
System.out.println("3#高炉控制室"); }
} else if (location.equals("型钢加热炉")) { } else if (location.equals("3#高炉中控室")) {
System.out.println("型钢加热炉"); if (parma.containsKey("t2td1")) {
} else if (location.equals("15万高炉煤气柜")) { dataList.add(saveData(parma.get("t2td1"), "8cf0093ec99a1d09cac2e8bc207c0d8b", targetAllList, processingBatchId, processingTime));
System.out.println("15万高炉煤气柜"); }
} else if (location.equals("型钢中控室")) {
if (parma.containsKey("td1")) {
dataList.add(saveData(parma.get("td1"), "da04c8ae4e7b2bacaafae391a3baa0aa", targetAllList, processingBatchId, processingTime));
} else if (parma.containsKey("t2td1")) {
dataList.add(saveData(parma.get("t2td1"), "60ef896d9f6af5705430cf6aa8d52174", targetAllList, processingBatchId, processingTime));
}
} else if (location.equals("15万高炉煤气柜中控室")) {
if (parma.containsKey("td1")) {
dataList.add(saveData(parma.get("td1"), "07d5be0f912ae11418772b39d447665b", targetAllList, processingBatchId, processingTime));
}
} else if (location.equals("新跨大包热修")) {
if (parma.containsKey("td1")) {
dataList.add(saveData(parma.get("td1"), "188624b575d36e4bc2cffd57c78b3314", targetAllList, processingBatchId, processingTime));
}
} }
// 存储集合中处理好的数据 // 存储集合中处理好的数据
mesDeviceMonitoringMapper.saveBatchFromMes(dataList); mesDeviceMonitoringMapper.saveBatchFromMes(dataList);
// 将物联网数据存入Redis缓存
redisUtil.set("WMK_DATA_LIST", JSONObject.toJSONString(dataList));
XxlJobHelper.log("成功保存{}条物联网模块数据到本地数据库", dataList.size()); XxlJobHelper.log("成功保存{}条物联网模块数据到本地数据库", dataList.size());
return R.ok();
} }
// 定义一个通用的保存数据的方法 // 定义一个通用的保存数据的方法
@ -176,13 +207,14 @@ public class AppPosiDeviceController {
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
data.put("MONITORING_ID", UuidUtil.get32UUID()); data.put("MONITORING_ID", UuidUtil.get32UUID());
data.put("CURRENT_VALUE", CURRENT_VALUE); data.put("CURRENT_VALUE", CURRENT_VALUE);
data.put("PROCESSING_TIME", processingBatchId); data.put("PROCESSING_TIME", processingTime);
data.put("PROCESSING_BATCH_ID", processingTime); data.put("PROCESSING_BATCH_ID", processingBatchId);
data.put("INSERT_TIME", DateUtil.date2Str(new Date())); data.put("INSERT_TIME", DateUtil.date2Str(new Date()));
data.put("WARNING", 0); // 是否告警 要完善相关告警逻辑进行判断 data.put("WARNING", 0); // 是否告警 要完善相关告警逻辑进行判断
data.put("GATHER_TIME", 5); data.put("GATHER_TIME", 5);
data.put("PLC_NAME", ""); data.put("PLC_NAME", "");
data.put("OVERVIEW_OF_ALERTS", ""); data.put("OVERVIEW_OF_ALERTS", "");
data.put("EQUIPMENT_ID", EQUIPMENT_ID);
// 每个设备只有一个监测数据阈值,也就是一氧化碳浓度 // 每个设备只有一个监测数据阈值,也就是一氧化碳浓度
if (collect.size() > 0) { if (collect.size() > 0) {
PageData pageData = collect.get(0); PageData pageData = collect.get(0);
@ -204,6 +236,7 @@ public class AppPosiDeviceController {
data.put("ALARM_VALUE", pageData.getString("ALARM_VALUE")); data.put("ALARM_VALUE", pageData.getString("ALARM_VALUE"));
data.put("TARGET_STATUS", pageData.getString("TARGET_STATUS")); data.put("TARGET_STATUS", pageData.getString("TARGET_STATUS"));
data.put("CORPINFO_ID", pageData.getString("CORPINFO_ID")); data.put("CORPINFO_ID", pageData.getString("CORPINFO_ID"));
data.put("REPORT_ID", pageData.getString("REPORT_ID"));
} else { } else {
data.put("IPCDEVICE_ID", ""); data.put("IPCDEVICE_ID", "");
data.put("PLC_ID", ""); data.put("PLC_ID", "");
@ -222,6 +255,7 @@ public class AppPosiDeviceController {
data.put("ALARM_VALUE", ""); data.put("ALARM_VALUE", "");
data.put("TARGET_STATUS", ""); data.put("TARGET_STATUS", "");
data.put("CORPINFO_ID", ""); data.put("CORPINFO_ID", "");
data.put("REPORT_ID", "");
} }
return data; return data;
} }

View File

@ -73,6 +73,7 @@ public class MesDataScheduled extends IJobHandler {
} }
@Scheduled(cron ="*/5 * * * * ?") @Scheduled(cron ="*/5 * * * * ?")
// @Scheduled(cron ="0 0/5 * * * ?")
public void scheduled() throws Exception { public void scheduled() throws Exception {
this.execute(); this.execute();
} }
@ -145,8 +146,8 @@ public class MesDataScheduled extends IJobHandler {
mesData.put("MONITORING_ID", UuidUtil.get32UUID()); mesData.put("MONITORING_ID", UuidUtil.get32UUID());
mesData.put("TARGET_NAME", key); mesData.put("TARGET_NAME", key);
mesData.put("CURRENT_VALUE", map.get(key)); mesData.put("CURRENT_VALUE", map.get(key));
mesData.put("PROCESSING_TIME", processingBatchId); mesData.put("PROCESSING_TIME", processingTime);
mesData.put("PROCESSING_BATCH_ID", processingTime); mesData.put("PROCESSING_BATCH_ID", processingBatchId);
mesData.put("INSERT_TIME", DateUtil.date2Str(new Date())); mesData.put("INSERT_TIME", DateUtil.date2Str(new Date()));
mesData.put("WARNING", 0); // 是否告警 要完善相关告警逻辑进行判断 mesData.put("WARNING", 0); // 是否告警 要完善相关告警逻辑进行判断
mesData.put("GATHER_TIME", 5); mesData.put("GATHER_TIME", 5);
@ -171,16 +172,16 @@ public class MesDataScheduled extends IJobHandler {
} else if (suffix.equals("A2") || suffix.equals("B2")) { } else if (suffix.equals("A2") || suffix.equals("B2")) {
mesData.put("EQUIPMENT_ID", "2c83b99df54e80a674be5657b11db55c"); mesData.put("EQUIPMENT_ID", "2c83b99df54e80a674be5657b11db55c");
collect = zl2TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList()); collect = zl2TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList());
} else if (key.equals("TAG325") || key.equals("TAG326") || key.equals("TAG317") || key.equals("TAG318")) { } else if (key.contains("1#")) {
mesData.put("EQUIPMENT_ID", "c6825a6e1c959c3e5c800433516b2e8d"); mesData.put("EQUIPMENT_ID", "c6825a6e1c959c3e5c800433516b2e8d");
collect = gl1TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList()); collect = gl1TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList());
} else if (key.equals("TAG327") || key.equals("TAG328") || key.equals("TAG319") || key.equals("TAG320")) { } else if (key.contains("2#")) {
mesData.put("EQUIPMENT_ID", "7face71b8cb7b47872cbe94f9b16831d"); mesData.put("EQUIPMENT_ID", "7face71b8cb7b47872cbe94f9b16831d");
collect = gl2TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList()); collect = gl2TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList());
} else if (key.equals("TAG329") || key.equals("TAG330") || key.equals("TAG321") || key.equals("TAG322")) { } else if (key.contains("3#")) {
mesData.put("EQUIPMENT_ID", "2cb052450581597064b510118c076e2a"); mesData.put("EQUIPMENT_ID", "2cb052450581597064b510118c076e2a");
collect = gl3TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList()); collect = gl3TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList());
} else if (key.equals("TAG331") || key.equals("TAG332") || key.equals("TAG333") || key.equals("TAG334") || key.equals("TAG323") || key.equals("TAG324")) { } else if (key.contains("4#")) {
mesData.put("EQUIPMENT_ID", "67c2e8315ca57d68201762e4ce9db351"); mesData.put("EQUIPMENT_ID", "67c2e8315ca57d68201762e4ce9db351");
collect = gl4TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList()); collect = gl4TargetList.stream().filter(item -> item.getString("TARGET_NAME").equals(key)).collect(Collectors.toList());
} }
@ -203,6 +204,7 @@ public class MesDataScheduled extends IJobHandler {
mesData.put("ALARM_VALUE", pageData.getString("ALARM_VALUE")); mesData.put("ALARM_VALUE", pageData.getString("ALARM_VALUE"));
mesData.put("TARGET_STATUS", pageData.getString("TARGET_STATUS")); mesData.put("TARGET_STATUS", pageData.getString("TARGET_STATUS"));
mesData.put("CORPINFO_ID", pageData.getString("CORPINFO_ID")); mesData.put("CORPINFO_ID", pageData.getString("CORPINFO_ID"));
mesData.put("REPORT_ID", pageData.getString("REPORT_ID"));
} else { } else {
mesData.put("IPCDEVICE_ID", ""); mesData.put("IPCDEVICE_ID", "");
mesData.put("PLC_ID", ""); mesData.put("PLC_ID", "");
@ -221,6 +223,7 @@ public class MesDataScheduled extends IJobHandler {
mesData.put("ALARM_VALUE", ""); mesData.put("ALARM_VALUE", "");
mesData.put("TARGET_STATUS", ""); mesData.put("TARGET_STATUS", "");
mesData.put("CORPINFO_ID", ""); mesData.put("CORPINFO_ID", "");
mesData.put("REPORT_ID", "");
} }
mesSaveList.add(mesData); mesSaveList.add(mesData);
} }

View File

@ -1,10 +1,10 @@
datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no1.url=jdbc:mysql://172.16.112.250:33080/sx_yjb?allowPublicKeyRetrieval=true&serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 datasource.no1.url=jdbc:mysql://172.16.70.228:33080/sx_yjb?allowPublicKeyRetrieval=true&serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.username=root datasource.no1.username=root
datasource.no1.password=Mysql@zcloud33080 datasource.no1.password=Mysql@zcloud33080
# #
datasource.no2.driver-class-name:org.postgresql.Driver datasource.no2.driver-class-name:org.postgresql.Driver
datasource.no2.url=jdbc:postgresql://172.16.112.250:15431/postgres?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=UTC datasource.no2.url=jdbc:postgresql://172.16.70.228:15431/postgres?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=UTC
datasource.no2.username=postgres datasource.no2.username=postgres
datasource.no2.password=Mysql@zcloud15431 datasource.no2.password=Mysql@zcloud15431
#MES系统数据库配置 #MES系统数据库配置
@ -17,7 +17,7 @@ datasource.mes2.url=jdbc:oracle:thin:@172.16.90.227:1521/emsdb
datasource.mes2.username=drzf datasource.mes2.username=drzf
datasource.mes2.password=drzf datasource.mes2.password=drzf
#redis #redis
spring.redis.host=172.16.112.251 spring.redis.host=172.16.70.226
spring.redis.password=Zcloud@redis16379 spring.redis.password=Zcloud@redis16379
spring.redis.database=10 spring.redis.database=10
spring.redis.port=16379 spring.redis.port=16379

View File

@ -60,7 +60,8 @@
p.CREATTIME, p.CREATTIME,
p.OPERATOR, p.OPERATOR,
p.OPERATTIME, p.OPERATTIME,
p.ISDELETE p.ISDELETE,
p.REPORT_ID
from from
tb_iron_monitoring_target p tb_iron_monitoring_target p
left join tb_iron_plc plc ON p.PLC_ID = plc.PLC_ID left join tb_iron_plc plc ON p.PLC_ID = plc.PLC_ID