|
@@ -1,6 +1,7 @@
|
|
|
package com.ruoyi.zdsz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.ruoyi.common.helper.LoginHelper;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
@@ -58,24 +59,11 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
zEngineeringNodeBo.setCreateTime(vo.getCreateTime());
|
|
|
zEngineeringNodeBo.setCivliId(vo.getId());
|
|
|
vo.setzEngineeringNodeBoList(izEngineeringNodeService.queryListDetails(zEngineeringNodeBo));
|
|
|
- List<ZEngineeringNodeBo> nodeList = vo.getzEngineeringNodeBoList();
|
|
|
//文件
|
|
|
ZEngiineeringPhotoBo bo1 = new ZEngiineeringPhotoBo();
|
|
|
bo1.setParentId(vo.getId());
|
|
|
bo1.setCreateTime(vo.getCreateTime());
|
|
|
vo.setPics(photoService.queryList(bo1));
|
|
|
-
|
|
|
- if(nodeList != null && nodeList.size() > 0){
|
|
|
- for (ZEngineeringNodeBo node : nodeList) {
|
|
|
- String type = node.getType();
|
|
|
-// if(node.getType().equals("construction_entrance")){
|
|
|
- if(type.equals("construction_hydroelectricity") || type.equals("construction_waterproof")){ // 水电施工、防水
|
|
|
- ZEngineeringReviewBo reviewBo = izEngineeringReviewService.query(node);
|
|
|
- boolean review = (reviewBo!=null) && (reviewBo.getReviewStatus().equals("1"));
|
|
|
- node.setReviewStatus(review?"1":"0"); // 通过-1 未通过、未审核-0 无需审核-null
|
|
|
- }
|
|
|
- } // else null
|
|
|
- }
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
@@ -90,18 +78,6 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
zEngineeringNodeBo.setCivliId(vo.getId());
|
|
|
zEngineeringNodeBo.setType(type);
|
|
|
ZEngineeringNodeBo node = izEngineeringNodeService.query(zEngineeringNodeBo);
|
|
|
- if(node != null){
|
|
|
-// for (ZEngineeringNodeBo node : nodeList) {
|
|
|
- String type1 = node.getType();
|
|
|
-// if(node.getType().equals("construction_entrance")){
|
|
|
- if(type1.equals("construction_hydroelectricity") || type1.equals("construction_waterproof")){ // 水电施工、防水
|
|
|
- ZEngineeringReviewBo reviewBo = izEngineeringReviewService.query(node);
|
|
|
- boolean review = (reviewBo!=null) && (reviewBo.getReviewStatus().equals("1"));
|
|
|
- node.setReviewStatus(review?"1":"0"); // 通过-1 未通过、未审核-0 无需审核-null
|
|
|
- }
|
|
|
-// } // else null
|
|
|
- }
|
|
|
-
|
|
|
vo.setzEngineeringNodeBo(node);
|
|
|
return vo;
|
|
|
}
|
|
@@ -113,7 +89,7 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
public List<ZEngineeringInfrastructureSelectVo> select(ZEngineeringInfrastructureBo bo) {
|
|
|
LambdaQueryWrapper<ZEngineeringInfrastructure> lqw = buildQueryWrapper(bo);
|
|
|
List<ZEngineeringInfrastructureVo> result = baseMapper.selectVoList(lqw);
|
|
|
- List<ZEngineeringInfrastructureSelectVo> list = new ArrayList();
|
|
|
+ List<ZEngineeringInfrastructureSelectVo> list = new ArrayList<>();
|
|
|
for (ZEngineeringInfrastructureVo vo: result) {
|
|
|
ZEngineeringInfrastructureSelectVo select = BeanUtil.toBean(vo, ZEngineeringInfrastructureSelectVo.class);
|
|
|
list.add(select);
|
|
@@ -164,7 +140,7 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
|
List<ZEngineeringNodeBo> nodeBoList = bo.getzEngineeringNodeBoList();
|
|
|
- if(nodeBoList != null && nodeBoList.size() != 0){
|
|
|
+ if(nodeBoList != null && !nodeBoList.isEmpty()){
|
|
|
for (ZEngineeringNodeBo nodeBo:nodeBoList) {
|
|
|
bo.setId(add.getId());
|
|
|
ZEngineeringNodeBo zEngineeringNodeBo = nodeBo;
|
|
@@ -173,7 +149,6 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
izEngineeringNodeService.insert(zEngineeringNodeBo);
|
|
|
}
|
|
|
}else {
|
|
|
-
|
|
|
bo.setId(add.getId());
|
|
|
ZEngineeringNodeBo zEngineeringNodeBo = bo.getzEngineeringNodeBo();
|
|
|
zEngineeringNodeBo.setCivliId(add.getId());
|
|
@@ -193,9 +168,9 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
pic.setParentId(bo.getId());
|
|
|
pic.setPicUrl(o.getUrl());
|
|
|
pic.setFileName(o.getName());
|
|
|
- pic.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
+ pic.setCreateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
pic.setCreateTime(new Date());
|
|
|
- pic.setUpdateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
+ pic.setUpdateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
pic.setUpdateTime(new Date());
|
|
|
list.add(pic);
|
|
|
});
|
|
@@ -206,6 +181,32 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增基建工程App
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean insertByBoApp(ZEngineeringInfrastructureBo bo) {
|
|
|
+ ZEngineeringInfrastructure add = BeanUtil.toBean(bo, ZEngineeringInfrastructure.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ LambdaQueryWrapper<ZEngineeringInfrastructure> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringInfrastructure::getId, bo.getId());
|
|
|
+ ZEngineeringInfrastructureVo infrastructureVo = baseMapper.selectVoOne(lqw);
|
|
|
+ boolean flag = false;
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = bo.getzEngineeringNodeBo();
|
|
|
+ zEngineeringNodeBo.setCivliId(infrastructureVo.getId());
|
|
|
+ zEngineeringNodeBo.setType(zEngineeringNodeBo.getType());
|
|
|
+ zEngineeringNodeBo.setCreateTime(infrastructureVo.getCreateTime());
|
|
|
+ ZEngineeringNodeBo query = izEngineeringNodeService.query(zEngineeringNodeBo);
|
|
|
+ if (!ObjectUtils.isEmpty(query)) {
|
|
|
+ zEngineeringNodeBo.setId(query.getId());
|
|
|
+ }
|
|
|
+ izEngineeringNodeService.insert(bo.getzEngineeringNodeBo());
|
|
|
+ flag = true;
|
|
|
+
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
private void doPhotos(ZEngineeringInfrastructure update, ZEngineeringInfrastructureBo bo) {
|
|
|
List<ZEngiineeringPhoto> list = new ArrayList<>();
|
|
|
|
|
@@ -224,8 +225,8 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
newPhoto.setParentId(bo.getId());
|
|
|
newPhoto.setPicUrl(pic.getUrl());
|
|
|
newPhoto.setFileName(pic.getName());
|
|
|
- newPhoto.setCreateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
- newPhoto.setUpdateBy(String.valueOf(LoginHelper.getUserId()));
|
|
|
+ newPhoto.setCreateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
+ newPhoto.setUpdateBy(String.valueOf(LoginHelper.getUsername()));
|
|
|
newPhoto.setCreateTime(bo.getCreateTime());
|
|
|
newPhoto.setUpdateTime(new Date());
|
|
|
list.add(newPhoto);
|
|
@@ -275,20 +276,30 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
public Boolean updateByBo(ZEngineeringInfrastructureBo bo) {
|
|
|
ZEngineeringInfrastructure update = BeanUtil.toBean(bo, ZEngineeringInfrastructure.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
- boolean flag = baseMapper.updateById(update) > 0;
|
|
|
- if (flag) {
|
|
|
- ZEngineeringInfrastructureVo vo = baseMapper.selectVoById(update.getId());
|
|
|
- //文件
|
|
|
- this.doPhotos(update,bo);
|
|
|
+ int i = baseMapper.updateById(update);
|
|
|
+ if (i>0){
|
|
|
+ ZEngineeringInfrastructureVo jackingVo = baseMapper.selectVoById(update.getId());
|
|
|
ZEngineeringNodeBo zEngineeringNodeBo = bo.getzEngineeringNodeBo();
|
|
|
if (!ObjectUtils.isEmpty(zEngineeringNodeBo)){
|
|
|
- zEngineeringNodeBo.setCivliId(vo.getId());
|
|
|
- zEngineeringNodeBo.setCreateTime(vo.getCreateTime());
|
|
|
- izEngineeringNodeService.update(zEngineeringNodeBo);
|
|
|
+ //多info
|
|
|
+ if (zEngineeringNodeBo.getzEngineeringInfoBoList()!=null&&!zEngineeringNodeBo.getzEngineeringInfoBoList().isEmpty()){
|
|
|
+ List<ZEngineeringInfoBo> engineeringInfoBoList = zEngineeringNodeBo.getzEngineeringInfoBoList();
|
|
|
+ if (engineeringInfoBoList != null && !engineeringInfoBoList.isEmpty()) {
|
|
|
+ izEngineeringNodeService.updateMuch(zEngineeringNodeBo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //单info
|
|
|
+ if (!ObjectUtil.isEmpty(zEngineeringNodeBo.getzEngineeringInfoBo())) {
|
|
|
+ zEngineeringNodeBo.setCivliId(jackingVo.getId());
|
|
|
+ zEngineeringNodeBo.setCreateTime(jackingVo.getCreateTime());
|
|
|
+ izEngineeringNodeService.update(zEngineeringNodeBo);
|
|
|
+ }
|
|
|
}
|
|
|
+ if (bo.getFiles()!=null&&!bo.getFiles().isEmpty()) {
|
|
|
+ this.doPhotos(update,bo);
|
|
|
}
|
|
|
-// }
|
|
|
- return flag;
|
|
|
+ }
|
|
|
+ return i>0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -309,13 +320,12 @@ public class ZEngineeringInfrastructureServiceImpl implements IZEngineeringInfra
|
|
|
}
|
|
|
ids.forEach(item -> {
|
|
|
ZEngineeringInfrastructureVo vo = baseMapper.selectVoById(item);
|
|
|
- if(vo==null)
|
|
|
- {return;}
|
|
|
+ if(vo==null){return;}
|
|
|
ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
zEngineeringNodeBo.setCreateTime(vo.getCreateTime());
|
|
|
zEngineeringNodeBo.setCivliId(vo.getId());
|
|
|
List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
|
|
|
- zEngineeringNodeBos.forEach(ite -> izEngineeringNodeService.delete(ite));
|
|
|
+ zEngineeringNodeBos.forEach(izEngineeringNodeService::delete);
|
|
|
}); return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
}
|
|
|
}
|