Browse Source

opt:优化超威大屏接口。

master
龚宝雄 3 weeks ago
parent
commit
0328ccb566
  1. 5
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java
  2. 7
      acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  3. 2
      acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  4. 118
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java
  5. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  6. 4
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml
  7. 4
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

5
acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java

@ -47,7 +47,7 @@ public class SyncDeviceStatus {
private void device() {
//long startTime = System.currentTimeMillis();
long startTime = System.currentTimeMillis();
try {
JSONArray tbxList1 = new JSONArray();
JSONArray tbxList2 = new JSONArray();
@ -194,7 +194,8 @@ public class SyncDeviceStatus {
//
// }
//redisUtils.set("agvList", agvList);
//log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
long startTime1 = System.currentTimeMillis();
log.info("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
} catch (Exception e) {
log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage());
}

7
acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -7,8 +7,9 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456789}
# 初始连接数
initial-size: 5
@ -70,7 +71,7 @@ spring:
baseline-on-migrate: true
redis:
#数据库索引
database: ${REDIS_DB:5}
database: ${REDIS_DB:2}
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
# password: ${REDIS_PWD:}
@ -168,7 +169,7 @@ sa-token:
token-session-check-login: false
alone-redis:
# Redis数据库索引(默认为0)
database: 5
database: 2
# Redis服务器地址
host: 127.0.0.1
# Redis服务器连接端口

2
acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: prod
active: dev
jackson:
time-zone: GMT+8
data:

118
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java

@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.utils.RedisUtils;
@ -13,7 +11,6 @@ import org.nl.wms.cockpit.service.CockpitService;
import org.nl.wms.cockpit.service.dao.PointInfo;
import org.nl.wms.cockpit.service.dao.TaskInfo;
import org.nl.wms.cockpit.service.mapper.CockpitMapper;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@ -250,28 +247,29 @@ public class CockpitServiceImpl implements CockpitService {
JSONObject jsonObject = new JSONObject();
//涂板线
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> {
// todo 初始化点位所在排信息
List<SchBasePoint> list = schBasePoint.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getIs_used, 1));
List<SchBasePoint> list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList());
for (SchBasePoint r : list1) {
if (r.getRow_num() == 0) {
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, r.getPoint_code());
String pointId = r.getPoint_code().substring(5, 9);
updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
schBasePoint.update(null, updateWrapper);
}
}
List<SchBasePoint> basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(basePointList)) {
if ("A1".equals(basePointList.get(0).getWorkshop_code())) {
List<String> regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2"));
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
.in(SchBasePoint::getRegion_code, regionList);
updateWrapper.set(SchBasePoint::getWorkshop_code, "A2");
schBasePoint.update(null, updateWrapper);
}
}
long startTime1 = System.currentTimeMillis();
//初始化点位所在排信息
// List<SchBasePoint> list = schBasePoint.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getIs_used, 1));
// List<SchBasePoint> list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList());
// for (SchBasePoint r : list1) {
// if (r.getRow_num() == 0) {
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
// .eq(SchBasePoint::getPoint_code, r.getPoint_code());
// String pointId = r.getPoint_code().substring(5, 9);
// updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
// schBasePoint.update(null, updateWrapper);
// }
// }
// List<SchBasePoint> basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList());
// if (ObjectUtil.isNotEmpty(basePointList)) {
// if ("A1".equals(basePointList.get(0).getWorkshop_code())) {
// List<String> regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2"));
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
// .in(SchBasePoint::getRegion_code, regionList);
// updateWrapper.set(SchBasePoint::getWorkshop_code, "A2");
// schBasePoint.update(null, updateWrapper);
// }
// }
// todo 未对接的涂板线数据
JSONObject tbx01 = new JSONObject();
tbx01.put("mode", "0");
@ -297,6 +295,7 @@ public class CockpitServiceImpl implements CockpitService {
} else {
jsonObject.put("9", new JSONArray());
}
log.info("读取涂板线设备缓存信息耗时{}", System.currentTimeMillis() - startTime1);
return null;
}, pool);
task1.exceptionally((e) -> {
@ -304,6 +303,7 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
CompletableFuture<List<Map<String, Object>>> task2 = CompletableFuture.supplyAsync(() -> {
long startTime2 = System.currentTimeMillis();
JSONArray ghs1 = (JSONArray) redisUtils.get("ghsList1");
List<JSONObject> ghsList1 = getSortedList(ghs1);
JSONArray ghs2 = (JSONArray) redisUtils.get("ghsList2");
@ -318,6 +318,7 @@ public class CockpitServiceImpl implements CockpitService {
} else {
jsonObject.put("11", new JSONArray());
}
log.info("读取固化室设备缓存信息{}", System.currentTimeMillis() - startTime2);
return null;
}, pool);
task2.exceptionally((e) -> {
@ -325,6 +326,7 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
CompletableFuture<List<Map<String, Object>>> task3 = CompletableFuture.supplyAsync(() -> {
long startTime3 = System.currentTimeMillis();
JSONArray bpjList = (JSONArray) redisUtils.get("bpjList");
List<JSONObject> bpjList1 = getSortedList(bpjList);
if (ObjectUtil.isNotEmpty(bpjList1)) {
@ -336,6 +338,7 @@ public class CockpitServiceImpl implements CockpitService {
JSONArray deviceA2 = (JSONArray) redisUtils.get("deviceA2");
jsonObject.put("17", deviceA1);
jsonObject.put("19", deviceA2);
log.info("读取包片机设备缓存信息{}", System.currentTimeMillis() - startTime3);
return null;
}, pool);
task3.exceptionally((e) -> {
@ -343,6 +346,7 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
CompletableFuture<List<Map<String, Object>>> task4 = CompletableFuture.supplyAsync(() -> {
long startTime4 = System.currentTimeMillis();
//正极板空架回收位
JSONArray zjbKjHswList = (JSONArray) redisUtils.get("zjbKjHswList");
List<JSONObject> zjbKjHswList1 = getSortedList(zjbKjHswList);
@ -367,6 +371,7 @@ public class CockpitServiceImpl implements CockpitService {
} else {
jsonObject.put("15", new JSONArray());
}
log.info("读取包片机设备缓存信息耗时{}", System.currentTimeMillis() - startTime4);
return null;
}, pool);
task4.exceptionally((e) -> {
@ -374,68 +379,33 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
CompletableFuture<JSONArray> task5 = CompletableFuture.supplyAsync(() -> {
long startTime5 = System.currentTimeMillis();
JSONArray jsonArray = cockpitMapper.getZCList();
List<PointInfo> pointInfoList = jsonArray.stream()
.map(r -> JSON.parseObject(r.toString(), PointInfo.class))
.collect(Collectors.toList());
//正极板空固化架缓存区A1
List<PointInfo> hcq6 = pointInfoList.stream().filter(r -> "HCQ6".equals(r.getRegion_code())).sorted(Comparator.comparing(PointInfo::getRow_num)).collect(Collectors.toList());
AtomicReference<List<PointInfo>> list1 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task01 = CompletableFuture.supplyAsync(() -> {
//边负极板缓存区
List<PointInfo> hcq1 = pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList());
list1.set(getPointInfoList(hcq1));
return null;
}, pool);
AtomicReference<List<PointInfo>> list2 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task02 = CompletableFuture.supplyAsync(() -> {
//边负极板缓存区
List<PointInfo> list1 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList()));
//负极板缓存区
List<PointInfo> hcq2 = pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList());
list2.set(getPointInfoList(hcq2));
return null;
}, pool);
AtomicReference<List<PointInfo>> list3 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task03 = CompletableFuture.supplyAsync(() -> {
List<PointInfo> list2 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList()));
//负极板空架缓存区
List<PointInfo> hcq3 = pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList());
list3.set(getPointInfoList(hcq3));
return null;
}, pool);
AtomicReference<List<PointInfo>> list4 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task04 = CompletableFuture.supplyAsync(() -> {
List<PointInfo> list3 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList()));
//正极板缓存区
List<PointInfo> hcq4 = pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList());
list4.set(getPointInfoList(hcq4));
return null;
}, pool);
AtomicReference<List<PointInfo>> list5 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task05 = CompletableFuture.supplyAsync(() -> {
List<PointInfo> list4 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList()));
//正极板空固化架缓存区
List<PointInfo> hcq5 = pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList());
list5.set(getPointInfoList(hcq5));
return null;
}, pool);
AtomicReference<List<PointInfo>> list7 = new AtomicReference<>();
CompletableFuture<List<Map<String, Object>>> task07 = CompletableFuture.supplyAsync(() -> {
List<PointInfo> list5 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList()));
//涂板线空固化架缓存区
List<PointInfo> hcq7 = pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList());
list7.set(getPointInfoList(hcq7));
return null;
}, pool);
CompletableFuture<Void> allQuery = CompletableFuture.allOf(task01, task02, task03, task04, task05, task07);
CompletableFuture<JSONObject> future = allQuery.thenApply((result) -> jsonObject).exceptionally((e) -> {
log.error(e.getMessage(), e);
return null;
});
future.join();
List<PointInfo> list7 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList()));
jsonObject.put("8", hcq6);
jsonObject.put("4", list1.get());
jsonObject.put("5", list2.get());
jsonObject.put("6", list3.get());
jsonObject.put("12", list4.get());
jsonObject.put("10", list5.get());
jsonObject.put("3", list7.get());
jsonObject.put("4", list1);
jsonObject.put("5", list2);
jsonObject.put("6", list3);
jsonObject.put("12", list4);
jsonObject.put("10", list5);
jsonObject.put("3", list7);
log.info("读取缓冲库信息耗时: {}", System.currentTimeMillis() - startTime5);
return null;
}, pool);
task5.exceptionally((e) -> {

2
lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -6,7 +6,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:123456789}

4
lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml

@ -55,7 +55,7 @@ spring:
redis:
#数据库索引
database: ${REDIS_DB:2}
host: ${REDIS_HOST:127.0.0.1}
host: ${REDIS_HOST:192.168.200.210}
port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:}
@ -154,7 +154,7 @@ sa-token:
# Redis数据库索引(默认为0)
database: 2
# Redis服务器地址
host: 127.0.0.1
host: 192.168.200.210
# Redis服务器连接端口
port: 6379
# Redis服务器连接密码(默认为空)

4
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:
@ -29,6 +29,8 @@ task:
keep-alive-seconds: 60
# 队列容量
queue-capacity: 50
# 主线程等待子线程执行时间
awaitTerminationSeconds: 50
#七牛云
qiniu:

Loading…
Cancel
Save