| | |
| | | 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(); |
| | |
| | | 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); |
| | | } |
| | | } |