|
@@ -77,8 +77,8 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
@Override
|
|
|
public TableDataInfo<ZEngineeringGasOpeningVo> queryPageList(ZEngineeringGasOpeningBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<ZEngineeringGasOpening> lqw = buildQueryWrapper(bo);
|
|
|
- lqw.like(StringUtils.isNotBlank(bo.getEnginName()), ZEngineeringGasOpening::getEnginName, bo.getEnginName());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringGasOpening::getEnginType, bo.getEnginType());
|
|
|
+// lqw.like(StringUtils.isNotBlank(bo.getEnginName()), ZEngineeringGasOpening::getEnginName, bo.getEnginName());
|
|
|
+// lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringGasOpening::getEnginType, bo.getEnginType());
|
|
|
Page<ZEngineeringGasOpeningVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
@@ -111,6 +111,25 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
return lqw;
|
|
|
}
|
|
|
|
|
|
+ private void batchInsertPic(List<String> picList, String parentId, String type){
|
|
|
+ List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
+// bo.getFiles().forEach(o -> {
|
|
|
+ picList.forEach(o -> {
|
|
|
+ ZEngiineeringPhoto pic = new ZEngiineeringPhoto();
|
|
|
+ pic.setParentId(parentId);
|
|
|
+ pic.setType(type);
|
|
|
+ pic.setPicUrl(o);
|
|
|
+// pic.setPicUrl(o.getUrl());
|
|
|
+// pic.setFileName(o.getName());
|
|
|
+ pic.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
+ pic.setCreateTime(new Date());
|
|
|
+ list.add(pic);
|
|
|
+ });
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ photoService.insertBatch(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增开栓施工
|
|
|
*/
|
|
@@ -122,7 +141,7 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
|
bo.setId(add.getId());
|
|
|
- List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
+ /*List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
bo.getFiles().forEach(o -> {
|
|
|
ZEngiineeringPhoto pic = new ZEngiineeringPhoto();
|
|
|
pic.setParentId(bo.getId());
|
|
@@ -134,7 +153,25 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
});
|
|
|
if (!list.isEmpty()) {
|
|
|
photoService.insertBatch(list);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+// gasCylinderPic: [], // 燃气立杠图片
|
|
|
+// pressureTestPic: [], // 气密测试图片
|
|
|
+// gasMeterPic: [], // 燃气表图片
|
|
|
+// rearPipePic: [], // 表后管图片
|
|
|
+// gasChangePic: [], // 灶前阀门图片
|
|
|
+// softPipePic: [], // 软管图片
|
|
|
+// windproofCirclePic: [], // 灶具阀门图片
|
|
|
+// gasEnvironmentPic: [], // 用气环境图片
|
|
|
+// receiptFormPic: [], // 回执单图片
|
|
|
+ batchInsertPic(bo.getGasCylinderPic(), bo.getId(), "gasCylinderPic");
|
|
|
+ batchInsertPic(bo.getPressureTestPic(), bo.getId(), "pressureTestPic");
|
|
|
+ batchInsertPic(bo.getGasMeterPic(), bo.getId(), "gasMeterPic");
|
|
|
+ batchInsertPic(bo.getRearPipePic(), bo.getId(), "rearPipePic");
|
|
|
+ batchInsertPic(bo.getGasChangePic(), bo.getId(), "gasChangePic");
|
|
|
+ batchInsertPic(bo.getSoftPipePic(), bo.getId(), "softPipePic");
|
|
|
+ batchInsertPic(bo.getWindproofCirclePic(), bo.getId(), "windproofCirclePic");
|
|
|
+ batchInsertPic(bo.getGasEnvironmentPic(), bo.getId(), "gasEnvironmentPic");
|
|
|
+ batchInsertPic(bo.getReceiptFormPic(), bo.getId(), "receiptFormPic");
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo())) {
|
|
|
bo.getzEngineeringNodeBo().setCivliId(add.getId());
|
|
@@ -189,6 +226,15 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
photoService.insertBatch(list);
|
|
|
}
|
|
|
}
|
|
|
+ batchUpdatePic(bo.getGasCylinderPic(), bo.getId(), "gasCylinderPic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getPressureTestPic(), bo.getId(), "pressureTestPic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getGasMeterPic(), bo.getId(), "gasMeterPic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getRearPipePic(), bo.getId(), "rearPipePic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getGasChangePic(), bo.getId(), "gasChangePic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getSoftPipePic(), bo.getId(), "softPipePic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getWindproofCirclePic(), bo.getId(), "windproofCirclePic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getGasEnvironmentPic(), bo.getId(), "gasEnvironmentPic", bo.getCreateTime());
|
|
|
+ batchUpdatePic(bo.getReceiptFormPic(), bo.getId(), "receiptFormPic", bo.getCreateTime());
|
|
|
}
|
|
|
bo.getzEngineeringNodeBo().setCivliId(bo.getId());
|
|
|
// bo.getzEngineeringNodeBo().setType(bo.getType());
|
|
@@ -197,19 +243,91 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
|
zEngineeringNodeBo.setCivliId(update.getId());
|
|
|
// zEngineeringNodeBo.setType(bo.getType());
|
|
|
// zEngineeringNodeBo.setType(bo.getzEngineeringNodeBo().getType()); // zEngineeringNodeBo.setType(bo.getzEngineeringNodeBo().getType());
|
|
|
- zEngineeringNodeBo.setType("带气封堵施工"); // zEngineeringNodeBo.setType(bo.getzEngineeringNodeBo().getType());
|
|
|
+ zEngineeringNodeBo.setType("开栓施工"); // zEngineeringNodeBo.setType(bo.getzEngineeringNodeBo().getType());
|
|
|
zEngineeringNodeBo.setCreateTime(baseMapper.selectVoById(bo.getId()).getCreateTime());
|
|
|
ZEngineeringNodeBo query = izEngineeringNodeService.query(zEngineeringNodeBo);
|
|
|
if (!ObjectUtils.isEmpty(query)) {
|
|
|
bo.getzEngineeringNodeBo().setId(query.getId());
|
|
|
}
|
|
|
- bo.getzEngineeringNodeBo().setType("带气封堵施工");
|
|
|
+ bo.getzEngineeringNodeBo().setType("开栓施工");
|
|
|
bo.getzEngineeringNodeBo().setCreateTime(zEngineeringNodeBo.getCreateTime());
|
|
|
izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
System.out.println("izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());");
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 本故事根据管道厚度功能模块改编
|
|
|
+ */
|
|
|
+ private void batchUpdatePic(List<String> picList, String parentId, String type, Date createTime){
|
|
|
+// if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getIronPipelineThickness())) {
|
|
|
+// if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo().getzEngineeringInfoBoList().get(0).getIronPipelineThickness())) {
|
|
|
+ if (!ObjectUtils.isEmpty(picList)){
|
|
|
+ List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
+ // 查询数据库中已存在的文件列表
|
|
|
+ ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
|
|
|
+// zEngiineeringPhotoBo.setCreateTime(bo.getzEngineeringNodeBo().getzEngineeringInfoBoList().get(0).getCreateTime());//
|
|
|
+ zEngiineeringPhotoBo.setCreateTime(createTime);//
|
|
|
+// zEngiineeringPhotoBo.setParentId(update.getId());
|
|
|
+// zEngiineeringPhotoBo.setParentId(bo.getzEngineeringNodeBo().getzEngineeringInfoBoList().get(0).getId());
|
|
|
+ zEngiineeringPhotoBo.setParentId(parentId);
|
|
|
+ List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
|
|
|
+ // 插入前端传来的新文件
|
|
|
+// for (ZFileBo pic : bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getIronPipelineThickness()) {
|
|
|
+// for (String pic : bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getIronPipelineThickness()) {
|
|
|
+ for (String pic : picList) {
|
|
|
+ if (!existingPhotos.contains(pic)) {
|
|
|
+ ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
+// newPhoto.setParentId(bo.getId());
|
|
|
+// newPhoto.setParentId(bo.getzEngineeringNodeBo().getzEngineeringInfoBoList().get(0).getId());
|
|
|
+ newPhoto.setParentId(parentId);
|
|
|
+ newPhoto.setPicUrl(pic);
|
|
|
+// newPhoto.setFileName(pic);
|
|
|
+ newPhoto.setType(type);
|
|
|
+ newPhoto.setCreateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
+ newPhoto.setCreateTime(createTime);
|
|
|
+ newPhoto.setUpdateTime(new Date());
|
|
|
+ list.add(newPhoto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 删除数据库中多余的文件
|
|
|
+// List<String> photosToDelete = existingPhotos.stream().filter(pic -> !bo.getzEngineeringNodeBo().getzEngineeringInfoBo().getIronPipelineThickness().contains(pic)).collect(Collectors.toList());
|
|
|
+ List<String> photosToDelete = existingPhotos.stream().filter(pic -> !picList.contains(pic)).collect(Collectors.toList());
|
|
|
+ if (!photosToDelete.isEmpty()) {
|
|
|
+ photosToDelete.forEach(item -> {
|
|
|
+ ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
|
|
|
+// zEngiineeringPhoto.setType("ironPipelineThickness");
|
|
|
+ zEngiineeringPhoto.setType(type);
|
|
|
+ zEngiineeringPhoto.setPicUrl(item);
|
|
|
+// zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
|
|
|
+ zEngiineeringPhoto.setCreateTime(createTime);
|
|
|
+ photoService.deleteWithValid(zEngiineeringPhoto);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 批量插入新图片
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ photoService.insertBatch(list);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // 查询数据库中已存在的文件列表
|
|
|
+ ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
|
|
|
+ zEngiineeringPhotoBo.setCreateTime(createTime);//
|
|
|
+ zEngiineeringPhotoBo.setParentId(parentId);
|
|
|
+ List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
|
|
|
+ // 删除数据库中多余的文件
|
|
|
+ List<String> photosToDelete = existingPhotos.stream().filter(pic -> !picList.contains(pic)).collect(Collectors.toList());
|
|
|
+ if (!photosToDelete.isEmpty()) {
|
|
|
+ photosToDelete.forEach(item -> {
|
|
|
+ ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
|
|
|
+ zEngiineeringPhoto.setCreateTime(createTime);
|
|
|
+ zEngiineeringPhoto.setPicUrl(item);
|
|
|
+ zEngiineeringPhoto.setType(type);
|
|
|
+ photoService.deleteWithValid(zEngiineeringPhoto);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改开栓施工
|
|
|
*/
|