|
@@ -5,9 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.helper.LoginHelper;
|
|
import com.ruoyi.common.helper.LoginHelper;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
+import com.ruoyi.system.service.ISysDictDataService;
|
|
import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
|
|
import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
|
|
import com.ruoyi.zdsz.domain.ZEngineeringGasOpening;
|
|
import com.ruoyi.zdsz.domain.ZEngineeringGasOpening;
|
|
import com.ruoyi.zdsz.domain.bo.*;
|
|
import com.ruoyi.zdsz.domain.bo.*;
|
|
@@ -57,20 +60,20 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ZEngineeringGasOpeningVo queryById(String id) {
|
|
public ZEngineeringGasOpeningVo queryById(String id) {
|
|
- ZEngineeringGasOpeningVo zEngineeringGasOpeningVo = baseMapper.selectVoById(id);
|
|
|
|
|
|
+ ZEngineeringGasOpeningVo zEngineeringGasOpeningVo = baseMapper.queryVoById(id);
|
|
ZEngiineeringPhotoBo photoBo = new ZEngiineeringPhotoBo();
|
|
ZEngiineeringPhotoBo photoBo = new ZEngiineeringPhotoBo();
|
|
photoBo.setCreateTime(zEngineeringGasOpeningVo.getCreateTime());
|
|
photoBo.setCreateTime(zEngineeringGasOpeningVo.getCreateTime());
|
|
photoBo.setParentId(zEngineeringGasOpeningVo.getId());
|
|
photoBo.setParentId(zEngineeringGasOpeningVo.getId());
|
|
List<ZEngiineeringPhotoVo> photoVoList = photoService.queryList(photoBo);
|
|
List<ZEngiineeringPhotoVo> photoVoList = photoService.queryList(photoBo);
|
|
- zEngineeringGasOpeningVo.setGasCylinderPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasCylinderPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setPressureTestPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("pressureTestPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setGasMeterPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasMeterPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setRearPipePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("rearPipePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setGasChangePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasChangePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setSoftPipePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("softPipePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setWindproofCirclePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("windproofCirclePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setGasEnvironmentPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasEnvironmentPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
- zEngineeringGasOpeningVo.setReceiptFormPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("receiptFormPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
|
|
+ zEngineeringGasOpeningVo.setGasCylinderPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasCylinderPic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasCylinderPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setPressureTestPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("pressureTestPic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("pressureTestPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setGasMeterPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasMeterPic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasMeterPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setRearPipePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("rearPipePic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("rearPipePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setGasChangePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasChangePic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasChangePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setSoftPipePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("softPipePic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("softPipePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setWindproofCirclePic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("windproofCirclePic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("windproofCirclePic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setGasEnvironmentPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasEnvironmentPic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("gasEnvironmentPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
|
|
+ zEngineeringGasOpeningVo.setReceiptFormPic(photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("receiptFormPic")==null?new ArrayList<>():photoVoList.stream().collect(Collectors.groupingBy(ZEngiineeringPhotoVo::getType)).get("receiptFormPic").stream().map(s -> s.getPicUrl()).collect(Collectors.toList()));
|
|
return zEngineeringGasOpeningVo;
|
|
return zEngineeringGasOpeningVo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -129,6 +132,11 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public Boolean insertByBo(ZEngineeringGasOpeningBo bo) {
|
|
public Boolean insertByBo(ZEngineeringGasOpeningBo bo) {
|
|
|
|
+ LambdaQueryWrapper<ZEngineeringGasOpening> lqw = buildQueryWrapper(bo);
|
|
|
|
+ List<ZEngineeringGasOpeningVo> list = baseMapper.selectVoList(lqw);
|
|
|
|
+ if(list.size() > 0){
|
|
|
|
+ throw new ServiceException("当前房间已开栓,不能重复提交!");
|
|
|
|
+ }
|
|
ZEngineeringGasOpening add = BeanUtil.toBean(bo, ZEngineeringGasOpening.class);
|
|
ZEngineeringGasOpening add = BeanUtil.toBean(bo, ZEngineeringGasOpening.class);
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
@@ -166,11 +174,11 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
batchInsertPic(bo.getGasEnvironmentPic(), bo.getId(), "gasEnvironmentPic");
|
|
batchInsertPic(bo.getGasEnvironmentPic(), bo.getId(), "gasEnvironmentPic");
|
|
batchInsertPic(bo.getReceiptFormPic(), bo.getId(), "receiptFormPic");
|
|
batchInsertPic(bo.getReceiptFormPic(), bo.getId(), "receiptFormPic");
|
|
}
|
|
}
|
|
- if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo())) {
|
|
|
|
- bo.getzEngineeringNodeBo().setCivliId(add.getId());
|
|
|
|
- bo.getzEngineeringNodeBo().setCreateTime(new Date());
|
|
|
|
- izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
|
- }
|
|
|
|
|
|
+// if (!ObjectUtils.isEmpty(bo.getzEngineeringNodeBo())) {
|
|
|
|
+// bo.getzEngineeringNodeBo().setCivliId(add.getId());
|
|
|
|
+// bo.getzEngineeringNodeBo().setCreateTime(new Date());
|
|
|
|
+// izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
|
+// }
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -183,69 +191,19 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
ZEngineeringGasOpening update = BeanUtil.toBean(bo, ZEngineeringGasOpening.class);
|
|
ZEngineeringGasOpening update = BeanUtil.toBean(bo, ZEngineeringGasOpening.class);
|
|
validEntityBeforeSave(update);
|
|
validEntityBeforeSave(update);
|
|
boolean flag = baseMapper.updateById(update) > 0;
|
|
boolean flag = baseMapper.updateById(update) > 0;
|
|
- if (flag) {
|
|
|
|
- List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
|
- // 查询数据库中已存在的文件列表
|
|
|
|
- ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
|
|
|
|
- zEngiineeringPhotoBo.setParentId(update.getId());
|
|
|
|
- zEngiineeringPhotoBo.setCreateTime(bo.getCreateTime());
|
|
|
|
- List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
|
|
|
|
- // 插入前端传来的新文件
|
|
|
|
- if (!ObjectUtils.isEmpty(bo.getFiles())) {
|
|
|
|
- for (ZFileBo pic : bo.getFiles()) {
|
|
|
|
- if (!existingPhotos.contains(pic.getUrl())) {
|
|
|
|
- ZEngiineeringPhoto newPhoto = new ZEngiineeringPhoto();
|
|
|
|
- newPhoto.setParentId(bo.getId());
|
|
|
|
- newPhoto.setPicUrl(pic.getUrl());
|
|
|
|
- newPhoto.setFileName(pic.getName());
|
|
|
|
- newPhoto.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
|
- newPhoto.setCreateTime(bo.getCreateTime());
|
|
|
|
- newPhoto.setUpdateTime(new Date());
|
|
|
|
- list.add(newPhoto);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 删除数据库中多余的文件
|
|
|
|
- List<String> photosToDelete = existingPhotos.stream().filter(pic -> !bo.getFiles().stream().map(ZFileBo::getUrl).collect(Collectors.toList()).contains(pic)).collect(Collectors.toList());
|
|
|
|
- if (!photosToDelete.isEmpty()) {
|
|
|
|
- photosToDelete.forEach(item -> {
|
|
|
|
- ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
|
|
|
|
- zEngiineeringPhoto.setPicUrl(item);
|
|
|
|
- zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
|
|
|
|
- photoService.deleteWithValid(zEngiineeringPhoto);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- // 批量插入新图片
|
|
|
|
- if (!list.isEmpty()) {
|
|
|
|
- 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());
|
|
|
|
- bo.getzEngineeringNodeBo().setCreateTime(bo.getCreateTime());
|
|
|
|
- ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
|
- 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.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().setCreateTime(zEngineeringNodeBo.getCreateTime());
|
|
|
|
- izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
|
- System.out.println("izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());");
|
|
|
|
|
|
+ ZEngineeringInfoBo photoBo = new ZEngineeringInfoBo();
|
|
|
|
+ photoBo.setCreateTime(bo.getCreateTime());
|
|
|
|
+ photoBo.setId(bo.getId());
|
|
|
|
+ photoService.delete(photoBo);
|
|
|
|
+ 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");
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -426,31 +384,4 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
|
|
return zEngineeringGasOpeningVo;
|
|
return zEngineeringGasOpeningVo;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public List<ZEngineeringIndustryTypeVo> queryNameByType(ZEngineeringGasOpeningBo bo) {
|
|
|
|
- LambdaQueryWrapper<ZEngineeringGasOpening> zEngineeringGasOpeningBoLambdaQueryWrapper = buildListByType(bo);
|
|
|
|
- zEngineeringGasOpeningBoLambdaQueryWrapper.orderByDesc(ZEngineeringGasOpening::getCreateTime);
|
|
|
|
-// List<ZEngineeringGasOpening> zEngineeringAirWalVos = baseMapper.selectList(zEngineeringGasOpeningBoLambdaQueryWrapper);
|
|
|
|
-// List<ZEngineeringIndustryTypeVo> zEngineeringAirWalTypeVos = zEngineeringAirWalVos.stream().map(ZEngineeringIndustryTypeVo::new).collect(Collectors.toList());
|
|
|
|
-// return zEngineeringAirWalTypeVos;
|
|
|
|
- return new ArrayList<ZEngineeringIndustryTypeVo>();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private LambdaQueryWrapper<ZEngineeringGasOpening> buildListByType(ZEngineeringGasOpeningBo bo) {
|
|
|
|
-
|
|
|
|
- LambdaQueryWrapper<ZEngineeringGasOpening> queryWrapper = new LambdaQueryWrapper<ZEngineeringGasOpening>();
|
|
|
|
- queryWrapper.orderByDesc(ZEngineeringGasOpening::getCreateTime);
|
|
|
|
-// queryWrapper.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringIndustry::getEnginType, bo.getEnginType());
|
|
|
|
-// queryWrapper.eq(StringUtils.isNotBlank(bo.getType()), ZEngineeringIndustry::getType, bo.getType());
|
|
|
|
-// if (!"null".equals(bo.getEnginClassification())) {
|
|
|
|
-// queryWrapper.like(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringIndustry::getEnginClassification, bo.getEnginClassification());
|
|
|
|
-// }
|
|
|
|
- if (!"null".equals(bo.getEnginName())) {
|
|
|
|
- queryWrapper.like(StringUtils.isNotBlank(bo.getEnginName()), ZEngineeringGasOpening::getEnginName, bo.getEnginName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return queryWrapper;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|