|
@@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.ruoyi.framework.obs.ObsService;
|
|
|
import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
|
|
|
import com.ruoyi.zdsz.domain.ZEngineeringNode;
|
|
|
import com.ruoyi.zdsz.domain.bo.ZEngiineeringPhotoBo;
|
|
@@ -209,94 +210,95 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改顶管工程
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor=Exception.class)
|
|
|
- public Boolean updateByBo(ZEngineeringPipeJackingBo bo) {
|
|
|
- ZEngineeringPipeJacking update = BeanUtil.toBean(bo, ZEngineeringPipeJacking.class);
|
|
|
- validEntityBeforeSave(update);
|
|
|
- //民用
|
|
|
- if ("民用工程".equals(bo.getType())){
|
|
|
- List<Map<String, Object>> civil = baseMapper.getCivil(bo.getEnginId());
|
|
|
- if (!civil.isEmpty()){
|
|
|
- update.setEnginAddre((String) civil.get(0).get("name"));
|
|
|
- }
|
|
|
- }
|
|
|
- //市政
|
|
|
- else if("市政工程".equals(bo.getType())){
|
|
|
- List<Map<String, Object>> civil = baseMapper.getSg(bo.getEnginId());
|
|
|
- if (!civil.isEmpty()){
|
|
|
+ private ZEngineeringPipeJacking updateEnginAddre(ZEngineeringPipeJacking update, String type, String enginId) {
|
|
|
+ List<Map<String, Object>> civil = new ArrayList<>();
|
|
|
+
|
|
|
+ if ("民用工程".equals(type)) {
|
|
|
+ civil = baseMapper.getCivil(enginId);
|
|
|
+ if (!civil.isEmpty()) {
|
|
|
update.setEnginAddre((String) civil.get(0).get("name"));
|
|
|
}
|
|
|
- }
|
|
|
- //工业
|
|
|
- else if("工业工程".equals(bo.getType())){
|
|
|
- List<Map<String, Object>> civil = baseMapper.getSg(bo.getEnginId());
|
|
|
- if (!civil.isEmpty()){
|
|
|
+ } else if ("市政工程".equals(type) || "工业工程".equals(type)) {
|
|
|
+ civil = baseMapper.getSg(enginId);
|
|
|
+ if (!civil.isEmpty()) {
|
|
|
update.setEnginAddre((String) civil.get(0).get("name"));
|
|
|
}
|
|
|
- }
|
|
|
- // 危险
|
|
|
- else if("危险作业工程".equals(bo.getType())){
|
|
|
- List<Map<String, Object>> civil = baseMapper.getDangerous(bo.getEnginId());
|
|
|
- if (!civil.isEmpty()){
|
|
|
+ } else if ("危险作业工程".equals(type)) {
|
|
|
+ civil = baseMapper.getDangerous(enginId);
|
|
|
+ if (!civil.isEmpty()) {
|
|
|
update.setEnginName((String) civil.get(0).get("name"));
|
|
|
update.setEnginAddre((String) civil.get(0).get("address"));
|
|
|
}
|
|
|
- }
|
|
|
- //基建
|
|
|
- else if("基建作业工程".equals(bo.getType())){
|
|
|
- List<Map<String, Object>> civil = baseMapper.getInfrastructure(bo.getEnginId());
|
|
|
- if (!civil.isEmpty()){
|
|
|
+ } else if ("基建作业工程".equals(type)) {
|
|
|
+ civil = baseMapper.getInfrastructure(enginId);
|
|
|
+ if (!civil.isEmpty()) {
|
|
|
update.setEnginName((String) civil.get(0).get("name"));
|
|
|
update.setEnginAddre((String) civil.get(0).get("address"));
|
|
|
}
|
|
|
}
|
|
|
+ return update;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改顶管工程
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor=Exception.class)
|
|
|
+ public Boolean updateByBo(ZEngineeringPipeJackingBo bo) {
|
|
|
+ ZEngineeringPipeJacking update = BeanUtil.toBean(bo, ZEngineeringPipeJacking.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ // 调用新方法
|
|
|
+ update = updateEnginAddre(update, bo.getType(), bo.getEnginId());
|
|
|
bo.getzEngineeringNodeBo().setCivliId(bo.getId());
|
|
|
bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
nodeService.update(bo.getzEngineeringNodeBo());
|
|
|
int i = baseMapper.updateById(update);
|
|
|
if (i>0){
|
|
|
- List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
+ this.doPhotos(update,bo);
|
|
|
+ }
|
|
|
+ return i>0;
|
|
|
+ }
|
|
|
|
|
|
- // 查询数据库中已存在的文件列表
|
|
|
- ZEngiineeringPhotoBo bo1 = new ZEngiineeringPhotoBo();
|
|
|
- bo1.setParentId(update.getId());
|
|
|
- List<String> existingPhotos = photoService.queryList(bo1).stream()
|
|
|
- .map(ZEngiineeringPhotoVo::getPicUrl)
|
|
|
- .collect(Collectors.toList());
|
|
|
+ private void doPhotos(ZEngineeringPipeJacking update,ZEngineeringPipeJackingBo bo) {
|
|
|
+ List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
|
|
|
- // 插入前端传来的新文件
|
|
|
- for (ZFileBo pic : bo.getFiles()) {
|
|
|
- if (!existingPhotos.contains(pic)) {
|
|
|
- ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
- newPhoto.setParentId(bo.getId());
|
|
|
- newPhoto.setPicUrl(pic.getUrl());
|
|
|
- newPhoto.setFileName(pic.getName());
|
|
|
- newPhoto.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
- newPhoto.setCreateTime(new Date());
|
|
|
- list.add(newPhoto);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 查询数据库中已存在的文件列表
|
|
|
+ ZEngiineeringPhotoBo bo1 = new ZEngiineeringPhotoBo();
|
|
|
+ bo1.setParentId(update.getId());
|
|
|
+ bo1.setCreateTime(update.getCreateTime());
|
|
|
+ List<String> existingPhotos = photoService.queryList(bo1).stream()
|
|
|
+ .map(ZEngiineeringPhotoVo::getPicUrl)
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
- // 删除数据库中多余的文件
|
|
|
- List<String> photosToDelete = existingPhotos.stream()
|
|
|
- .filter(pic -> !bo.getFiles().contains(pic))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (!photosToDelete.isEmpty()) {
|
|
|
- photosToDelete.forEach(item->{
|
|
|
- photoService.deleteWithValidByurls(item);
|
|
|
- });
|
|
|
+ // 插入前端传来的新文件
|
|
|
+ for (ZFileBo pic : bo.getFiles()) {
|
|
|
+ if (!existingPhotos.contains(pic)) {
|
|
|
+ ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
+ newPhoto.setParentId(bo.getId());
|
|
|
+ newPhoto.setPicUrl(pic.getUrl());
|
|
|
+ newPhoto.setFileName(pic.getName());
|
|
|
+ newPhoto.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
+ newPhoto.setCreateTime(new Date());
|
|
|
+ list.add(newPhoto);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 批量插入新图片
|
|
|
- if (!list.isEmpty()) {
|
|
|
- photoService.insertBatch(list);
|
|
|
- }
|
|
|
+ // 删除数据库中多余的文件
|
|
|
+ List<String> photosToDelete = existingPhotos.stream()
|
|
|
+ .filter(pic -> !bo.getFiles().contains(pic))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!photosToDelete.isEmpty()) {
|
|
|
+ photosToDelete.forEach(item->{
|
|
|
+ photoService.deleteWithValidByurls(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量插入新图片
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ photoService.insertBatch(list);
|
|
|
}
|
|
|
- return i>0;
|
|
|
}
|
|
|
|
|
|
/**
|