|
@@ -364,7 +364,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
billetHotsends.setShift(shift);
|
|
|
billetHotsends.setIsUpd(false);
|
|
|
billetHotsendDetailsVo.setBilletHotsend(billetHotsends);
|
|
|
-
|
|
|
+
|
|
|
// 根据坯号查询 对应的钢坯基础信息
|
|
|
String[] billetNosparts = billetNos.split(",");
|
|
|
//4 获取所有的坯号集合
|
|
@@ -583,7 +583,43 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
if (strandNoSizeArray == null || strandNoSizeArray.isEmpty()) {
|
|
|
throw new JeecgBootException("流号定尺集合不能为空!");
|
|
|
}
|
|
|
-
|
|
|
+ Map<Integer, String> strandNoMap = new HashMap<>();
|
|
|
+ strandNoMap.put(1, "one");
|
|
|
+ strandNoMap.put(2, "two");
|
|
|
+ strandNoMap.put(3, "three");
|
|
|
+ strandNoMap.put(4, "four");
|
|
|
+ strandNoMap.put(5, "five");
|
|
|
+ strandNoMap.put(6, "six");
|
|
|
+ strandNoMap.put(7, "seven");
|
|
|
+ strandNoMap.put(8, "eight");
|
|
|
+
|
|
|
+ // 遍历JSONArray并更新Redis缓存
|
|
|
+ for (Object obj : strandNoSizeArray) {
|
|
|
+ JSONObject item = (JSONObject) obj;
|
|
|
+ Integer strandNo = item.getInteger("strandNo");
|
|
|
+ Integer length = item.getInteger("length");
|
|
|
+ // 生成Redis键
|
|
|
+ String strandText = strandNoMap.getOrDefault(strandNo, String.valueOf(strandNo));
|
|
|
+ String redisKey = String.format("strandNo:%s:length:%s", strandText, ccmNo);
|
|
|
+ // 判断缓存是否存在
|
|
|
+ boolean keyExists = redisTemplate.hasKey(redisKey);
|
|
|
+ String newValue = length.toString();
|
|
|
+ if (!keyExists) {
|
|
|
+ // 缓存不存在,直接写入
|
|
|
+ redisTemplate.opsForValue().set(redisKey, newValue);
|
|
|
+ log.info("初始化缓存 - 键: {}, 值: {}", redisKey, newValue);
|
|
|
+ } else {
|
|
|
+ // 缓存已存在,获取旧值并比较
|
|
|
+ String oldValue = oConvertUtils.getString(redisTemplate.opsForValue().get(redisKey));
|
|
|
+ if (!oldValue.equals(newValue)) {
|
|
|
+ // 新旧值不同,更新缓存并标记切割类型
|
|
|
+ String redisCuttoLengthKey = String.format("cut:to:length:%s", ccmNo);
|
|
|
+ redisTemplate.opsForValue().set(redisCuttoLengthKey, "2");
|
|
|
+ }
|
|
|
+ // 无论是否变更,都更新缓存(确保一致性)
|
|
|
+ redisTemplate.opsForValue().set(redisKey, newValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
String redisCuttoLengthKey = String.format("cut:to:length:%s", ccmNo);
|
|
|
String cuttolengthType = !oConvertUtils.getString(redisTemplate.opsForValue().get(redisCuttoLengthKey))
|
|
|
.isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(redisCuttoLengthKey)) : "";
|