Commit 162bd448 authored by 刘凡's avatar 刘凡

优化:设备列表是否在用

parent 065548dd
......@@ -1072,6 +1072,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String status = ConstructionEnum.getName.get(integer);
dto2.put(CONSTRUCTIONTYPE, status);
}
dto2.put("record",dto2.get("SEQUENCE_NBR"));
list.add(dto2);
}
// 获取所有设备的Id
......@@ -1084,24 +1085,34 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<JgInstallationNoticeEq> installationNoticeEqList = jgInstallationNoticeEqServiceImpl.getListByEquIds(equIds);
List<JgUseRegistrationEq> useRegistrationEqList = jgUseRegistrationEqServiceImpl.getListByEquIds(equIds);
Map<String, Boolean> equIsUseMap = new HashMap<>();
// if(!ValidationUtil.isEmpty(installationNoticeEqList) ){
// equIsUseMap.putAll(installationNoticeEqList.stream().collect(Collectors.toMap(JgInstallationNoticeEq::getEquId, obj -> true)));
// }
// if(!ValidationUtil.isEmpty(useRegistrationEqList)){
// equIsUseMap.putAll(useRegistrationEqList.stream().collect(Collectors.toMap(JgUseRegistrationEq::getEquId, obj -> true)));
// }
if(!ValidationUtil.isEmpty(installationNoticeEqList) ){
equIsUseMap.putAll(installationNoticeEqList.stream().collect(Collectors.toMap(JgInstallationNoticeEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
if(!ValidationUtil.isEmpty(useRegistrationEqList)){
equIsUseMap.putAll(useRegistrationEqList.stream().collect(Collectors.toMap(JgUseRegistrationEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
// 查询设备地址
List<IdxBizJgUseInfo> useInfoListByEquIds = idxBizJgUseInfoService.getUseInfoListByEquIds(equIds);
Map<String, String> equAddressMap = new HashMap<>();
if(!ValidationUtil.isEmpty(useInfoListByEquIds)){
equAddressMap = useInfoListByEquIds.stream().collect(Collectors.toMap(IdxBizJgUseInfo::getRecord,
useInfo -> useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() + "/" + useInfo.getStreetName() + "/" + useInfo.getAddress()));
useInfo -> {
String fulladdress="";
if(!ValidationUtil.isEmpty(useInfo.getProvinceName())) fulladdress += useInfo.getProvinceName();
if(!ValidationUtil.isEmpty(useInfo.getCityName())) fulladdress += useInfo.getCityName();
if(!ValidationUtil.isEmpty(useInfo.getCountyName())) fulladdress += useInfo.getCountyName();
if(!ValidationUtil.isEmpty(useInfo.getStreetName())) fulladdress += useInfo.getStreetName();
if(!ValidationUtil.isEmpty(useInfo.getAddress())) fulladdress += useInfo.getAddress();
return fulladdress;
}
)
);
}
// 更新设备使用情况和设备地址
for(JSONObject item : list){
Boolean isUse = equIsUseMap.get(item.getString("SEQUENCE_NBR"));
String fullAddress = equAddressMap.get(item.getString("SEQUENCE_NBR"));
// item.put("IS_USE", !ValidationUtil.isEmpty(isUse) ? isUse ? isUse : false : false);
item.put("IS_USE", !ValidationUtil.isEmpty(isUse) ? isUse ? isUse : false : false);
item.put("ADDRESS", !ValidationUtil.isEmpty(fullAddress) ? fullAddress : "");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment