|
@@ -1,12 +1,19 @@
|
|
|
package com.ruoyi.zdsz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.ruoyi.common.annotation.DynamicName;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
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.zdsz.domain.ZEngiineeringPhoto;
|
|
|
+import com.ruoyi.zdsz.domain.bo.ZEngiineeringPhotoBo;
|
|
|
+import com.ruoyi.zdsz.domain.bo.ZEngineeringMaterialBo;
|
|
|
+import com.ruoyi.zdsz.domain.bo.ZEngineeringNodeBo;
|
|
|
+import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
|
|
|
+import com.ruoyi.zdsz.service.IZEngineeringMaterialService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo;
|
|
@@ -14,7 +21,10 @@ import com.ruoyi.zdsz.domain.vo.ZEngineeringInfoVo;
|
|
|
import com.ruoyi.zdsz.domain.ZEngineeringInfo;
|
|
|
import com.ruoyi.zdsz.mapper.ZEngineeringInfoMapper;
|
|
|
import com.ruoyi.zdsz.service.IZEngineeringInfoService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Collection;
|
|
@@ -30,6 +40,10 @@ import java.util.Collection;
|
|
|
public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
|
|
|
|
|
|
private final ZEngineeringInfoMapper baseMapper;
|
|
|
+ @Resource
|
|
|
+ private IZEngineeringMaterialService izEngineeringMaterialService;
|
|
|
+ @Resource
|
|
|
+ private IZEngiineeringPhotoService izEngiineeringPhotoService;
|
|
|
|
|
|
/**
|
|
|
* 查询工程详情
|
|
@@ -39,6 +53,19 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
|
|
|
return baseMapper.selectVoById(id);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @DynamicName(spel = "#bo.createTime")
|
|
|
+ public ZEngineeringInfoBo query(ZEngineeringNodeBo bo) {
|
|
|
+ LambdaQueryWrapper<ZEngineeringInfo> lqw = Wrappers.lambdaQuery();
|
|
|
+ ZEngineeringInfo zEngineeringInfoVo= baseMapper.selectOne(lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringInfo::getEngInfoId, bo.getId()));
|
|
|
+ ZEngineeringInfoBo zEngineeringInfoBo1 = BeanUtil.toBean(zEngineeringInfoVo, ZEngineeringInfoBo.class);
|
|
|
+ List<String> photoList=izEngiineeringPhotoService.queryList(zEngineeringInfoBo1.getId());
|
|
|
+ ZEngineeringMaterialBo zEngineeringMaterialBo=izEngineeringMaterialService.query(zEngineeringInfoBo1);
|
|
|
+ zEngineeringInfoBo1.setzEngiineeringPhotoBoList(photoList);
|
|
|
+ zEngineeringInfoBo1.setzEngineeringMaterialBo(zEngineeringMaterialBo);
|
|
|
+ return zEngineeringInfoBo1;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询工程详情列表
|
|
|
*/
|
|
@@ -89,6 +116,35 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 新增工程详情(节点使用)
|
|
|
+ * @param bo
|
|
|
+ * @return ZEngineeringInfo
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @DynamicName(spel = "#bo.createTime")
|
|
|
+ @Transactional(rollbackFor=Exception.class)
|
|
|
+ public ZEngineeringInfo insert(ZEngineeringInfoBo bo) {
|
|
|
+ ZEngineeringInfo add = BeanUtil.toBean(bo, ZEngineeringInfo.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setId(add.getId());
|
|
|
+ }
|
|
|
+ bo.getzEngineeringMaterialBo().setDetailsId(add.getId());
|
|
|
+ bo.getzEngineeringMaterialBo().setCreateTime(bo.getCreateTime());
|
|
|
+ izEngineeringMaterialService.insert( bo.getzEngineeringMaterialBo());
|
|
|
+ List <ZEngiineeringPhoto> photoList=new ArrayList();
|
|
|
+ bo.getzEngiineeringPhotoBoList().stream().forEach(item->{
|
|
|
+ ZEngiineeringPhoto zEngiineeringPhoto=new ZEngiineeringPhoto();
|
|
|
+ zEngiineeringPhoto.setParentId(add.getId());
|
|
|
+ zEngiineeringPhoto.setPicUrl(item);
|
|
|
+ zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
|
|
|
+ photoList.add(zEngiineeringPhoto);
|
|
|
+ });
|
|
|
+ izEngiineeringPhotoService.insertBatch(photoList);
|
|
|
+ return add;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改工程详情
|
|
@@ -100,6 +156,21 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean update(ZEngineeringInfoBo bo) {
|
|
|
+ ZEngineeringInfo update = BeanUtil.toBean(bo, ZEngineeringInfo.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ List <ZEngiineeringPhoto> photoList=new ArrayList();
|
|
|
+ bo.getzEngiineeringPhotoBoList().stream().forEach(item->{
|
|
|
+ ZEngiineeringPhoto zEngiineeringPhoto=new ZEngiineeringPhoto();
|
|
|
+ zEngiineeringPhoto.setParentId(update.getId());
|
|
|
+ zEngiineeringPhoto.setPicUrl(item);
|
|
|
+ photoList.add(zEngiineeringPhoto);
|
|
|
+ });
|
|
|
+ izEngiineeringPhotoService.updateBatch(photoList);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存前的数据校验
|
|
|
*/
|