|
|
@ -573,13 +573,13 @@ public class MonitoringAssetServiceImpl implements MonitoringAssetService { |
|
|
MonitoringAssetSearchParams assetSearchParam = new MonitoringAssetSearchParams(); |
|
|
MonitoringAssetSearchParams assetSearchParam = new MonitoringAssetSearchParams(); |
|
|
assetSearchParam.setCompanyIdList(subCompanyList); |
|
|
assetSearchParam.setCompanyIdList(subCompanyList); |
|
|
List<MonitoringAssetPageVO> dbAssetList = basicMonitoringAssetMapperExt.getListPage4Import(assetSearchParam); |
|
|
List<MonitoringAssetPageVO> dbAssetList = basicMonitoringAssetMapperExt.getListPage4Import(assetSearchParam); |
|
|
Set<String> udfAssetIdSet = dbAssetList.stream() |
|
|
// Set<String> udfAssetIdSet = dbAssetList.stream()
|
|
|
.map(vo -> vo.getUdfBuildingId() + "$" + vo.getSymbol()) |
|
|
// .map(vo -> vo.getUdfBuildingId() + "$" + vo.getSymbol())
|
|
|
.collect(Collectors.toSet()); |
|
|
// .collect(Collectors.toSet());
|
|
|
Map<String, MonitoringAssetPageVO> udfAssetIdMap = dbAssetList.stream() |
|
|
Map<String, MonitoringAssetPageVO> udfAssetIdMap = dbAssetList.stream() |
|
|
.filter(vo -> StringUtils.isNotBlank(vo.getSymbol())) |
|
|
.filter(vo -> StringUtils.isNotBlank(vo.getSymbol())) |
|
|
.collect(Collectors.toMap( |
|
|
.collect(Collectors.toMap( |
|
|
vo -> vo.getUdfBuildingId() + "$" +vo.getUdfSpaceId() + "$" +vo.getSymbol(), |
|
|
vo -> vo.getUdfBuildingId() + "$" +vo.getSymbol(), |
|
|
vo -> vo, |
|
|
vo -> vo, |
|
|
(existing, replacement) -> replacement//用后来的值替换原有值
|
|
|
(existing, replacement) -> replacement//用后来的值替换原有值
|
|
|
)); |
|
|
)); |
|
|
@ -696,12 +696,7 @@ public class MonitoringAssetServiceImpl implements MonitoringAssetService { |
|
|
|
|
|
|
|
|
// Check if [company name + asset symbol] in the spreadsheet duplicates any existing assets in the database.
|
|
|
// Check if [company name + asset symbol] in the spreadsheet duplicates any existing assets in the database.
|
|
|
int assetOptFlag = 1;// 1 indicates insert, 2 indicates update
|
|
|
int assetOptFlag = 1;// 1 indicates insert, 2 indicates update
|
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getSymbol()) && |
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getSymbol()) && udfAssetIdMap.containsKey(compBuilding+ "$" + buildingExcelCn.getSymbol())) { |
|
|
(udfAssetIdMap.containsKey(compBuilding+ "$" + buildingExcelCn.getUdfSpaceId()+ "$" + buildingExcelCn.getSymbol()) |
|
|
|
|
|
|| |
|
|
|
|
|
udfAssetIdSet.contains(compBuilding + "$" + buildingExcelCn.getSymbol()) |
|
|
|
|
|
) |
|
|
|
|
|
) { |
|
|
|
|
|
if (assetDuplicateOptType == 1) { |
|
|
if (assetDuplicateOptType == 1) { |
|
|
lineError = true; |
|
|
lineError = true; |
|
|
commonOpt.appendMsg(lineMsg, msgLanguageChange.getParameterMapByCode(languageType, "dbAssetDuplicate")); |
|
|
commonOpt.appendMsg(lineMsg, msgLanguageChange.getParameterMapByCode(languageType, "dbAssetDuplicate")); |
|
|
@ -722,12 +717,9 @@ public class MonitoringAssetServiceImpl implements MonitoringAssetService { |
|
|
// Process asset
|
|
|
// Process asset
|
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getSymbol())) { |
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getSymbol())) { |
|
|
String compAsset = buildingExcelCn.getUdfBuildingId() |
|
|
String compAsset = buildingExcelCn.getUdfBuildingId() |
|
|
+ "$" + buildingExcelCn.getUdfSpaceId() |
|
|
|
|
|
+ "$" + buildingExcelCn.getSymbol(); |
|
|
+ "$" + buildingExcelCn.getSymbol(); |
|
|
BasicMonitoringAsset basicMonitoringAsset = new BasicMonitoringAsset(); |
|
|
BasicMonitoringAsset basicMonitoringAsset = new BasicMonitoringAsset(); |
|
|
basicMonitoringAsset.setCompanyId(companyId); |
|
|
basicMonitoringAsset.setCompanyId(companyId); |
|
|
basicMonitoringAsset.setCreateTime(currentUnix); |
|
|
|
|
|
basicMonitoringAsset.setCreatorId(userId); |
|
|
|
|
|
basicMonitoringAsset.setName(buildingExcelCn.getAssetName()); |
|
|
basicMonitoringAsset.setName(buildingExcelCn.getAssetName()); |
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getClassBig())) { |
|
|
if (StringUtils.isNotBlank(buildingExcelCn.getClassBig())) { |
|
|
basicMonitoringAsset.setClassBigId( |
|
|
basicMonitoringAsset.setClassBigId( |
|
|
@ -763,11 +755,15 @@ public class MonitoringAssetServiceImpl implements MonitoringAssetService { |
|
|
String compSpace = buildingExcelCn.getUdfBuildingId() |
|
|
String compSpace = buildingExcelCn.getUdfBuildingId() |
|
|
+ "$" + buildingExcelCn.getUdfSpaceId(); |
|
|
+ "$" + buildingExcelCn.getUdfSpaceId(); |
|
|
|
|
|
|
|
|
|
|
|
basicMonitoringAsset.setSpaceId(udfSpaceIdMap.get(compSpace).getSpaceId()); |
|
|
|
|
|
|
|
|
noAssetDul.add(compAsset); |
|
|
noAssetDul.add(compAsset); |
|
|
|
|
|
|
|
|
if(1 == assetOptFlag) { |
|
|
if(1 == assetOptFlag) { |
|
|
if (!insertAssetInfo.containsKey(compSpace)) { |
|
|
if (!insertAssetInfo.containsKey(compSpace)) { |
|
|
List<BasicMonitoringAsset> asset = new ArrayList<>(); |
|
|
List<BasicMonitoringAsset> asset = new ArrayList<>(); |
|
|
|
|
|
basicMonitoringAsset.setCreateTime(currentUnix); |
|
|
|
|
|
basicMonitoringAsset.setCreatorId(userId); |
|
|
asset.add(basicMonitoringAsset); |
|
|
asset.add(basicMonitoringAsset); |
|
|
insertAssetInfo.put(compSpace, asset); |
|
|
insertAssetInfo.put(compSpace, asset); |
|
|
} else { |
|
|
} else { |
|
|
@ -776,6 +772,8 @@ public class MonitoringAssetServiceImpl implements MonitoringAssetService { |
|
|
} else { |
|
|
} else { |
|
|
if (!updateAssetInfo.containsKey(compAsset)) { |
|
|
if (!updateAssetInfo.containsKey(compAsset)) { |
|
|
List<BasicMonitoringAsset> asset = new ArrayList<>(); |
|
|
List<BasicMonitoringAsset> asset = new ArrayList<>(); |
|
|
|
|
|
basicMonitoringAsset.setModifyTime(currentUnix);; |
|
|
|
|
|
basicMonitoringAsset.setModifierId(userId); |
|
|
asset.add(basicMonitoringAsset); |
|
|
asset.add(basicMonitoringAsset); |
|
|
updateAssetInfo.put(compAsset, asset); |
|
|
updateAssetInfo.put(compAsset, asset); |
|
|
} else { |
|
|
} else { |
|
|
|