From 312710045c2b5d84ed0dc97af4a4fe7704f619d5 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 30 一月 2026 10:31:01 +0800
Subject: [PATCH] 增加定时校验网关是否在线
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java | 70 +++++++++++++++++++++++++++-------
1 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
index 6406358..1ce91a6 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fzzy.igds.constant.RedisConst;
import com.fzzy.igds.domain.Depot;
+import com.fzzy.igds.domain.DepotStore;
import com.fzzy.igds.mapper.DepotMapper;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.core.redis.RedisCache;
@@ -55,6 +56,17 @@
}
return depotMapper.selectList(queryWrapper);
+ }
+
+ /**
+ * 鏍规嵁搴撳瓨琛ㄤ俊鎭紝鏇存柊浠撳簱搴撳瓨
+ * @param data
+ */
+ public void updateByDepotStore(DepotStore data) {
+ UpdateWrapper<Depot> updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("id", data.getDepotId()).set("storage_real", data.getStorageReal());
+
+ depotMapper.update(null, updateWrapper);
}
/**
@@ -187,25 +199,25 @@
if (StringUtils.isEmpty(companyId)) {
companyId = ContextUtil.getCompanyId();
}
- String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT) + "*";
-
- Collection<String> keys = redisCache.keys(patten);
- if (null == keys) {
- return null;
- }
-
List<Depot> list = new ArrayList<>();
- for (String key : keys) {
- list.add((Depot) redisCache.getCacheObject(key));
+
+ String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT) + "*";
+ Collection<String> keys = redisCache.keys(patten);
+ if (null != keys) {
+ for (String key : keys) {
+ list.add((Depot) redisCache.getCacheObject(key));
+ }
}
+
//缂撳瓨鑾峰彇涓虹┖锛屽垯鏌ヨ鏁版嵁搴�
- if (list.size() < 1) {
+ if (list.isEmpty()) {
list = this.getData(companyId,null, false);
setCacheDepotList(list, companyId);
}
-
- //閲嶆柊鎺掑簭
- Collections.sort(list, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
+ if(!list.isEmpty()){
+ //閲嶆柊鎺掑簭
+ Collections.sort(list, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
+ }
return list;
}
@@ -230,8 +242,10 @@
result.add(depot);
}
}
- //閲嶆柊鎺掑簭
- Collections.sort(result, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
+ if(!result.isEmpty()){
+ //閲嶆柊鎺掑簭
+ Collections.sort(list, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
+ }
return result;
}
@@ -257,4 +271,30 @@
}
return depot;
}
+
+ /**
+ * 鑾峰彇浠撳簱淇℃伅-鏍规嵁浠撳簱鍚嶇О鑾峰彇浠撳簱ID
+ *
+ * @param deptId
+ * @return
+ */
+ public String getDepotId(String deptId, String depotName) {
+ if (StringUtils.isEmpty(deptId)) {
+ return null;
+ }
+ if (StringUtils.isEmpty(depotName)) {
+ return null;
+ }
+
+ List<Depot> depotList = getCacheDepotList(ContextUtil.getCompanyId(), deptId);
+ if(null == depotList || depotList.isEmpty()){
+ return null;
+ }
+ for (Depot depot : depotList) {
+ if(depotName.equals(depot.getName())){
+ return depot.getId();
+ }
+ }
+ return null;
+ }
}
--
Gitblit v1.9.3