puzhibing
4 天以前 a7d9fba4c1d0b021e017abd70d1b37ba87ebae1e
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TStationCollectServiceImpl.java
@@ -325,8 +325,9 @@
            JSONObject json = JSONObject.parseObject(item.toString());
            String collectId = firstNotBlank(json.getString("devDn"), json.getString("esnCode"));
            String stationId = json.getString("stationCode");
            Integer devTypeId = json.getInteger("devTypeId");
            if (StringUtils.isBlank(collectId) || StringUtils.isBlank(stationId)
                    || existingKeys.contains(collectId) || !pendingKeys.add(collectId)) {
                    || existingKeys.contains(collectId) || !pendingKeys.add(collectId) || devTypeId != 1) {
                continue;
            }
            TStationCollect collect = new TStationCollect();
@@ -349,6 +350,13 @@
            fillDefaults(collect);
            insertList.add(collect);
        }
        // 设置电站名称
        List<TStationInfo> infoList = stationInfoMapper.selectList(new LambdaQueryWrapper<>());
        insertList.forEach(s -> infoList.forEach(info -> {
            if(StringUtils.isNotEmpty(s.getStationId()) && s.getStationId().equals(info.getStationId())) {
                s.setStationName(info.getStationName());
            }
        }));
        return CollectionUtils.isNotEmpty(insertList) && saveBatch(insertList);
    }
}