Skip to content
Snippets Groups Projects
Commit 82c8338b authored by cs's avatar cs
Browse files

修复删除全部数组元素导致数组空指针的问题

parent c26e2cf8
Branches
Tags
No related merge requests found
...@@ -176,21 +176,29 @@ public class ComponentDetailServiceImpl extends ServiceImpl<ComponentDetailMappe ...@@ -176,21 +176,29 @@ public class ComponentDetailServiceImpl extends ServiceImpl<ComponentDetailMappe
log.info("84转百度的经度: {}, 以及纬度: {}",WGS84Lng,WGS84Lat); log.info("84转百度的经度: {}, 以及纬度: {}",WGS84Lng,WGS84Lat);
List<ComponentDetailVo> componentDetails = componentDetailMapper.judgeAIComponentIsExist(componentTypeName,WGS84Lng,WGS84Lat); List<ComponentDetailVo> componentDetails = componentDetailMapper.judgeAIComponentIsExist(componentTypeName,WGS84Lng,WGS84Lat);
if(CollectionUtil.isEmpty(componentDetails)) {
throw new LocalBusinessException(430,componentTypeName);
}
log.info("从数据库查询到的部件"+componentDetails.toString()); log.info("从数据库查询到的部件"+componentDetails.toString());
/* Iterator<ComponentDetailVo> componentDetailIterator = componentDetails.iterator();
while (componentDetailIterator.hasNext()) {
PlatformAudit platformAudit = platformAuditMapper.selectByComponentId(componentDetailIterator.next().getId());
if (ObjectUtil.isNotNull(platformAudit) && platformAudit.getAuditStatus().equalsIgnoreCase(ARInspectionConstants.TWO)) {
componentDetailIterator.remove();
}
}*/
//剔除审核不通过的部件 //剔除审核不通过的部件
for (ComponentDetailVo componentDetailVo : componentDetails) { for(int i=0; i< componentDetails.size();i++) {
PlatformAudit platformAudit = platformAuditMapper.selectByComponentId(componentDetailVo.getId()); PlatformAudit platformAudit = platformAuditMapper.selectByComponentId(componentDetails.get(i).getId());
if (ObjectUtil.isNotNull(platformAudit) && platformAudit.getAuditStatus().equalsIgnoreCase(ARInspectionConstants.TWO)) { if (ObjectUtil.isNotNull(platformAudit) && platformAudit.getAuditStatus().equalsIgnoreCase(ARInspectionConstants.TWO)) {
componentDetails.remove(componentDetailVo); componentDetails.remove(i);
i--;
} }
} }
log.info("剔除审核不通过的部件"+componentDetails.toString()); log.info("剔除审核不通过的部件"+componentDetails.toString());
if(CollectionUtil.isEmpty(componentDetails)) {
throw new LocalBusinessException(430,componentTypeName);
}
componentDetails componentDetails
.stream() .stream()
.forEach(componentDetail -> { .forEach(componentDetail -> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment