|
@@ -63,7 +63,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
@Resource
|
|
@Resource
|
|
private IZEngiineeringPhotoService photoService;
|
|
private IZEngiineeringPhotoService photoService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private ZEngineeringCivilMapper zEngineeringCivilMapper;
|
|
private ZEngineeringCivilMapper zEngineeringCivilMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -390,6 +390,8 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
else if (StringUtils.isNotBlank(bo.getId())){
|
|
else if (StringUtils.isNotBlank(bo.getId())){
|
|
ZEngineeringIndustryVo voById = baseMapper.selectVoById(bo.getId());
|
|
ZEngineeringIndustryVo voById = baseMapper.selectVoById(bo.getId());
|
|
List<ZEngineeringNodeBo> zEngineeringNodeBoList = bo.getzEngineeringNodeBoList();
|
|
List<ZEngineeringNodeBo> zEngineeringNodeBoList = bo.getzEngineeringNodeBoList();
|
|
|
|
+ ZEngineeringNodeBo entity = bo.getzEngineeringNodeBo();
|
|
|
|
+ //pc
|
|
if (!ObjectUtils.isEmpty(zEngineeringNodeBoList)) {
|
|
if (!ObjectUtils.isEmpty(zEngineeringNodeBoList)) {
|
|
for (ZEngineeringNodeBo zEngineeringNodeBo : zEngineeringNodeBoList) {
|
|
for (ZEngineeringNodeBo zEngineeringNodeBo : zEngineeringNodeBoList) {
|
|
zEngineeringNodeBo.setCivliId(voById.getId());
|
|
zEngineeringNodeBo.setCivliId(voById.getId());
|
|
@@ -401,6 +403,16 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
izEngineeringNodeService.insert(zEngineeringNodeBo);
|
|
izEngineeringNodeService.insert(zEngineeringNodeBo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //uniapp
|
|
|
|
+ if (!ObjectUtils.isEmpty(entity)) {
|
|
|
|
+ entity.setCivliId(voById.getId());
|
|
|
|
+ entity.setCreateTime(voById.getCreateTime());
|
|
|
|
+ ZEngineeringNodeBo query = izEngineeringNodeService.query(entity);
|
|
|
|
+ if (!ObjectUtils.isEmpty(query)) {
|
|
|
|
+ entity.setId(query.getId());
|
|
|
|
+ }
|
|
|
|
+ izEngineeringNodeService.insert(entity);
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -458,100 +470,11 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
//节点表与info表
|
|
//节点表与info表
|
|
if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo())) {
|
|
if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo())) {
|
|
bo.getzEngineeringNodeBo().setCreateTime(voById.getCreateTime());
|
|
bo.getzEngineeringNodeBo().setCreateTime(voById.getCreateTime());
|
|
- izEngineeringNodeService.updateMuch(bo.getzEngineeringNodeBo());
|
|
|
|
|
|
+ izEngineeringNodeService.update(bo.getzEngineeringNodeBo());
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
- private void batchUpdatePic(ZEngineeringIndustryBo bo, String methodName, String type) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
|
|
|
- // 获取类对象
|
|
|
|
- Class<?> cls = ZEngineeringInfoBo.class;
|
|
|
|
- // 获取指定方法
|
|
|
|
- Method method = cls.getDeclaredMethod(methodName);
|
|
|
|
-// System.out.println("method.invoke(obj);==="+method.invoke(bo.getzEngineeringNodeBo().getzEngineeringInfoBoList().get(0)));
|
|
|
|
- // 故事正文开始
|
|
|
|
- List<ZEngineeringInfoBo> zEngineeringInfoBoList = bo.getzEngineeringNodeBo().getzEngineeringInfoBoList();
|
|
|
|
- for (int i = 0; i < zEngineeringInfoBoList.size(); i++) {
|
|
|
|
- ZEngineeringInfoBo zEngineeringInfoBo = zEngineeringInfoBoList.get(i);
|
|
|
|
- if (!ObjectUtils.isEmpty(method.invoke(zEngineeringInfoBo))) {
|
|
|
|
- List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
|
- // 查询数据库中已存在的文件列表
|
|
|
|
- ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
|
|
|
|
- zEngiineeringPhotoBo.setCreateTime(zEngineeringInfoBo.getCreateTime());//
|
|
|
|
- zEngiineeringPhotoBo.setType(type);
|
|
|
|
- zEngiineeringPhotoBo.setParentId(zEngineeringInfoBo.getId());
|
|
|
|
- List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
|
|
|
|
- // 插入前端传来的新文件
|
|
|
|
- for (String pic : (List<String>)method.invoke(zEngineeringInfoBo)) {
|
|
|
|
- if (!existingPhotos.contains(pic)) {
|
|
|
|
- ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
|
- newPhoto.setParentId(zEngineeringInfoBo.getId());
|
|
|
|
- newPhoto.setPicUrl(pic);
|
|
|
|
- newPhoto.setFileName(pic);
|
|
|
|
- newPhoto.setType(type);
|
|
|
|
- newPhoto.setCreateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
|
- newPhoto.setCreateTime(bo.getCreateTime());
|
|
|
|
- newPhoto.setUpdateTime(new Date());
|
|
|
|
- list.add(newPhoto);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 删除数据库中多余的文件
|
|
|
|
- List<String> photosToDelete = existingPhotos.stream().filter(pic -> {
|
|
|
|
- try {
|
|
|
|
- return !((List<String>)(method.invoke(zEngineeringInfoBo))).contains(pic);
|
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
- } catch (InvocationTargetException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
- }
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- if (!photosToDelete.isEmpty()) {
|
|
|
|
- photosToDelete.forEach(item -> {
|
|
|
|
- ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
|
|
|
|
- zEngiineeringPhoto.setType(type);
|
|
|
|
- zEngiineeringPhoto.setPicUrl(item);
|
|
|
|
- zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
|
|
|
|
- photoService.deleteWithValid(zEngiineeringPhoto);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- // 批量插入新图片
|
|
|
|
- if (!list.isEmpty()) {
|
|
|
|
- photoService.insertBatch(list);
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- // 查询数据库中已存在的文件列表
|
|
|
|
- ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
|
|
|
|
- zEngiineeringPhotoBo.setCreateTime(zEngineeringInfoBo.getCreateTime());//
|
|
|
|
- zEngiineeringPhotoBo.setParentId(zEngineeringInfoBo.getId());
|
|
|
|
- zEngiineeringPhotoBo.setType(type);
|
|
|
|
- List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
|
|
|
|
- // 删除数据库中多余的文件
|
|
|
|
- List<String> photosToDelete = null;
|
|
|
|
- try {
|
|
|
|
- photosToDelete = existingPhotos.stream().filter(pic -> {
|
|
|
|
- try {
|
|
|
|
- return !((List<String>)(method.invoke(zEngineeringInfoBo))).contains(pic);
|
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
- } catch (InvocationTargetException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
- }
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- }catch (Exception e){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if (!photosToDelete.isEmpty()) {
|
|
|
|
- photosToDelete.forEach(item -> {
|
|
|
|
- ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
|
|
|
|
- zEngiineeringPhoto.setType(type);
|
|
|
|
- zEngiineeringPhoto.setPicUrl(item);
|
|
|
|
- zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
|
|
|
|
- photoService.deleteWithValid(zEngiineeringPhoto);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改市政工程
|
|
* 修改市政工程
|
|
@@ -599,31 +522,6 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
photoService.insertBatch(list);
|
|
photoService.insertBatch(list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-// // 市政施工-沟上施工 焊接
|
|
|
|
-// public List<String> welding;
|
|
|
|
-// // 市政施工-沟上施工 防腐
|
|
|
|
-// public List<String> aczoiling;
|
|
|
|
-// // 市政施工-沟下施工 管道下沟
|
|
|
|
-// public List<String> piping;
|
|
|
|
-// // 市政施工-沟下施工 警示带铺设
|
|
|
|
-// public List<String> warning;
|
|
|
|
-// // 市政施工-沟下施工 回填
|
|
|
|
-// public List<String> backfilling;
|
|
|
|
- /**
|
|
|
|
- * 焊接照片
|
|
|
|
- * 防腐照片
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
- try {
|
|
|
|
- batchUpdatePic(bo, "getWelding", "welding");
|
|
|
|
- batchUpdatePic(bo, "getAczoiling", "aczoiling");
|
|
|
|
- batchUpdatePic(bo, "getPiping", "piping");
|
|
|
|
- batchUpdatePic(bo, "getWarning", "warning");
|
|
|
|
- batchUpdatePic(bo, "getBackfilling", "backfilling");
|
|
|
|
- }catch (Exception e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|