|
@@ -175,12 +175,24 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
|
bo.setId(add.getId());
|
|
|
- bo.getzEngineeringNodeBo().setCivliId(add.getId());
|
|
|
- bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
- ZEngineeringNode entity = nodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
- if (!ObjectUtil.isEmpty(entity)){
|
|
|
+ //多表单
|
|
|
+ if (!bo.getzEngineeringNodeBoList().isEmpty()){
|
|
|
+ for (int i = 0; i < bo.getzEngineeringNodeBoList().size(); i++) {
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCivliId(add.getId());
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCreateTime(add.getCreateTime());
|
|
|
+ nodeService.insert(bo.getzEngineeringNodeBoList().get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //单表单
|
|
|
+ else {
|
|
|
+ bo.getzEngineeringNodeBo().setCivliId(add.getId());
|
|
|
+ bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
+ nodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
+ }
|
|
|
+ //文件集合
|
|
|
+ if (!bo.getFiles().isEmpty()){
|
|
|
List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
- bo.getFiles().stream().forEach(o->{
|
|
|
+ bo.getFiles().forEach(o->{
|
|
|
ZEngiineeringPhoto pic = new ZEngiineeringPhoto();
|
|
|
pic.setParentId(bo.getId());
|
|
|
pic.setPicUrl(o.getUrl());
|
|
@@ -195,16 +207,26 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- //存在这个类型工程
|
|
|
- ZEngineeringNodeBo zEngineeringNodeBo = bo.getzEngineeringNodeBo();
|
|
|
- zEngineeringNodeBo.setCivliId(jackingVo.getId());
|
|
|
- zEngineeringNodeBo.setType(zEngineeringNodeBo.getType());
|
|
|
- zEngineeringNodeBo.setCreateTime(jackingVo.getCreateTime());
|
|
|
- ZEngineeringNodeBo query = nodeService.query(zEngineeringNodeBo);
|
|
|
- if (!ObjectUtils.isEmpty(query)) {
|
|
|
- zEngineeringNodeBo.setId(query.getId());
|
|
|
+ //多表单
|
|
|
+ if (!bo.getzEngineeringNodeBoList().isEmpty()){
|
|
|
+ for (int i = 0; i < bo.getzEngineeringNodeBoList().size(); i++) {
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCivliId(add.getId());
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCreateTime(add.getCreateTime());
|
|
|
+ nodeService.insert(bo.getzEngineeringNodeBoList().get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //单表单
|
|
|
+ else {
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = bo.getzEngineeringNodeBo();
|
|
|
+ zEngineeringNodeBo.setCivliId(add.getId());
|
|
|
+ zEngineeringNodeBo.setType(zEngineeringNodeBo.getType());
|
|
|
+ zEngineeringNodeBo.setCreateTime(add.getCreateTime());
|
|
|
+ ZEngineeringNodeBo query = nodeService.query(zEngineeringNodeBo);
|
|
|
+ if (!ObjectUtils.isEmpty(query)) {
|
|
|
+ zEngineeringNodeBo.setId(query.getId());
|
|
|
+ }
|
|
|
+ nodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
}
|
|
|
- nodeService.insert(zEngineeringNodeBo);
|
|
|
flag = true;
|
|
|
}
|
|
|
return flag;
|
|
@@ -251,9 +273,21 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
validEntityBeforeSave(update);
|
|
|
// 调用新方法
|
|
|
update = updateEnginAddre(update, bo.getType(), bo.getEnginId());
|
|
|
- bo.getzEngineeringNodeBo().setCivliId(bo.getId());
|
|
|
- bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
- nodeService.update(bo.getzEngineeringNodeBo());
|
|
|
+ //多表单
|
|
|
+ if (!bo.getzEngineeringNodeBoList().isEmpty()){
|
|
|
+ for (int i = 0; i < bo.getzEngineeringNodeBoList().size(); i++) {
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCivliId(update.getId());
|
|
|
+ bo.getzEngineeringNodeBoList().get(i).setCreateTime(update.getCreateTime());
|
|
|
+ nodeService.update(bo.getzEngineeringNodeBoList().get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //单表单
|
|
|
+ else {
|
|
|
+ bo.getzEngineeringNodeBo().setCivliId(bo.getId());
|
|
|
+ bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
+ nodeService.update(bo.getzEngineeringNodeBo());
|
|
|
+ }
|
|
|
+
|
|
|
int i = baseMapper.updateById(update);
|
|
|
if (i>0){
|
|
|
this.doPhotos(update,bo);
|
|
@@ -274,7 +308,7 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
|
|
|
// 插入前端传来的新文件
|
|
|
for (ZFileBo pic : bo.getFiles()) {
|
|
|
- if (!existingPhotos.contains(pic)) {
|
|
|
+ if (!existingPhotos.contains(pic.getUrl())) {
|
|
|
ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
newPhoto.setParentId(bo.getId());
|
|
|
newPhoto.setPicUrl(pic.getUrl());
|
|
@@ -287,7 +321,7 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
|
|
|
// 删除数据库中多余的文件
|
|
|
List<String> photosToDelete = existingPhotos.stream()
|
|
|
- .filter(pic -> !bo.getFiles().contains(pic))
|
|
|
+ .filter(pic -> !bo.getFiles().stream().map(ZFileBo::getUrl).collect(Collectors.toList()).contains(pic))
|
|
|
.collect(Collectors.toList());
|
|
|
if (!photosToDelete.isEmpty()) {
|
|
|
photosToDelete.forEach(item->{
|