Browse Source

BUG相关

liuyc 2 years ago
parent
commit
b8258cca8f
15 changed files with 2419 additions and 2357 deletions
  1. 16 3
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java
  2. 591 561
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java
  3. 1736 1715
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  4. 0 23
      blade-service/blade-business/src/main/java/org/springblade/business/controller/UserViewProjectContractController.java
  5. 1 4
      blade-service/blade-business/src/main/java/org/springblade/business/service/IDefaultProjectService.java
  6. 0 3
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/DefaultProjectServiceImpl.java
  7. 10 7
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java
  8. 11 8
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java
  9. 11 8
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  10. 11 7
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
  11. 10 7
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java
  12. 14 9
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java
  13. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  14. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  15. 1 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

+ 16 - 3
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java

@@ -14,7 +14,7 @@ import java.util.List;
 
 import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;
 
-@FeignClient(value = APPLICATION_NAME_PREFIX +  "manager")
+@FeignClient(value = APPLICATION_NAME_PREFIX + "manager")
 public interface WbsTreeContractClient {
 
     /**
@@ -84,6 +84,7 @@ public interface WbsTreeContractClient {
 
     /**
      * 根据primaryKeyId获取合同段划分树的节点信息
+     *
      * @param primaryKeyId 节点唯一主键
      * @return 信息
      */
@@ -95,6 +96,7 @@ public interface WbsTreeContractClient {
 
     /**
      * 根据项目ID获取合同段
+     *
      * @return 结果集
      */
     @GetMapping(API_PREFIX + "/queryContractWbsTreeByContractIdAndType")
@@ -105,8 +107,9 @@ public interface WbsTreeContractClient {
 
     /**
      * 获取当前节点的所有父节点
+     *
      * @param contractId 合同段ID
-     * @param parentId 父节点ID
+     * @param parentId   父节点ID
      * @return 结果
      */
     @PostMapping(API_PREFIX + "/queryCurrentNodeAllParent")
@@ -114,11 +117,21 @@ public interface WbsTreeContractClient {
 
     /**
      * 获取当前节点的所有子节点
+     *
      * @param contractId 合同段ID
-     * @param parentId 当前节点ID
+     * @param parentId   当前节点ID
      * @return 结果
      */
     @PostMapping(API_PREFIX + "/queryCurrentNodeAllChild")
     List<WbsTreeContract> queryCurrentNodeAllChild(@RequestParam Long contractId, @RequestParam Long parentId);
 
+    /**
+     * 查询合同段树所有节点
+     *
+     * @param contractId
+     * @return
+     */
+    @GetMapping(API_PREFIX +"/selectAllByContractId")
+    List<WbsTreeContract> selectAllByContractId(@RequestParam String contractId);
+
 }

+ 591 - 561
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -6,12 +6,14 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.lowagie.text.pdf.BaseFont;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.util.IOUtils;
 import org.springblade.business.entity.ImageClassificationShow;
@@ -19,6 +21,7 @@ import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.RecycleBinClient;
 import org.springblade.business.service.ImageClassificationShowService;
 import org.springblade.business.utils.FileUtils;
+import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.ImageClassificationShowVO;
 import org.springblade.business.vo.TreeVo;
 import org.springblade.common.constant.CommonConstant;
@@ -65,7 +68,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- *  影音资料控制器(客户端)
+ * 影音资料控制器(客户端)
  *
  * @author BladeX
  * @since 2022-05-24
@@ -76,565 +79,592 @@ import java.util.stream.Collectors;
 @Api(tags = "影音资料接口(客户端)")
 public class ImageClassificationFileController extends BladeController {
 
-	private final IImageClassificationFileService imageClassificationFileService;
-
-	private final ImageClassificationShowService imageClassificationShowService;
-
-	/**
-	 * 调用blade-manager的api
-	 */
-	private final ImageClassificationConfigClient imageClassificationConfigClient;
-
-	private final WbsTreeContractClient wbsTreeContractClient;
-
-	private final IDictClient dictClient;
-
-	private final ExcelTabClient excelTabClient;
-
-	private final CommonFileClient commonFileClient;
-
-	private final NewIOSSClient newIOSSClient;
-
-	private final OperationLogClient operationLogClient;
-
-	private final RecycleBinClient recycleBinClient;
-
-	private final ContractClient contractClient;
-
-	/**
-	 * 批量下载
-	 */
-	@PostMapping("/batchDownloadFileToZip")
-	@ApiOperationSupport(order = 13)
-	@ApiOperation(value = "批量下载")
-	public void batchDownloadFileToZip(String ids, HttpServletResponse response){
-		if(StringUtils.isNotEmpty(ids)){
-			//查询数据
-			List<ImageClassificationFile> result = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
-			List<String> urls = new ArrayList<>();
-			for(ImageClassificationFile file : result){
-				if(StringUtils.isNotEmpty(file.getImageUrl())){
-					urls.addAll(Arrays.asList(file.getImageUrl().split(",")));
-				}
-			}
-
-			//打包下载
-			FileUtils.batchDownloadFileToZip(urls, response);
-		}
-	}
-
-	/**
-	 * 影音资料览(图片)
-	 */
-	@PostMapping("/preview")
-	@ApiOperationSupport(order = 12)
-	@ApiOperation(value = "影音资料览(图片)")
-	public R<String> preview(@RequestParam String ids){
-		//获取固定表格
-		ExcelTab excelTab = this.excelTabClient.getById("1550363881879781377");
-
-		//获取配置的路径
-		String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-
-		List<String> result = new ArrayList<>();
-		if(excelTab != null){
-			//获取数据
-			List<ImageClassificationFile> fileResult = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
-
-			try{
-				if(fileResult != null && fileResult.size() > 0){
-					//需要删除的本地文件集合
-					List<String> removeList = new ArrayList<>();
-					for(ImageClassificationFile file : fileResult){
-						//获取图片文件流
-						String[] uris = file.getImageUrl().split(",");
-						//处理多个文件
-						if(uris.length > 0){
-							//获取模板文件流
-							InputStream modInput = null;
-							FileInputStream excelFileInput = null;
-							FileOutputStream outputStream = null;
-							Workbook workbook = null;
-
-							List<String> pdfFileList = new ArrayList<>();
-							//两个图片一组
-							List<List<String>> groupUrls = CommonUtil.getBatchSize(JSONObject.parseArray(JSONObject.toJSONString(uris), String.class), 2);
-							for(List<String> urls : groupUrls){
-								try{
-									//创建模板Workbook
-									modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
-									workbook = WorkbookFactory.create(modInput);
-
-									for(int i = 0, l = urls.size(); i < l; i ++){
-										try{
-											CreationHelper helper = workbook.getCreationHelper();
-											Sheet sheet = workbook.getSheetAt(0);
-											Drawing<?> drawing = sheet.createDrawingPatriarch();
-											ClientAnchor anchor = helper.createClientAnchor();
-											if(i == 0){
-												anchor.setRow1(0);
-												anchor.setCol1(0);
-											} else {
-												anchor.setRow1(28);
-												anchor.setCol1(1);
-											}
-
-											//创建图片
-											drawing.createPicture(anchor, workbook.addPicture(CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i))), Workbook.PICTURE_TYPE_PNG));
-											//图片定位
-											FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(1, 28) : new DataVO(0, 0));
-
-											//定位其它信息
-											//文字说明
-											sheet.getRow(i == 0 ? 1 : 29).getCell(i == 0 ? 5 : 0).setCellValue(file.getTextContent());
-											//照片号
-											sheet.getRow(i == 0 ? 11 : 39).getCell(i == 0 ? 5 : 0).setCellValue(file.getPhotoCode());
-											//底片号
-											sheet.getRow(i == 0 ? 17 : 45).getCell(i == 0 ? 5 : 0).setCellValue(file.getFilmCode());
-											//题名
-											sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 0 : 3).setCellValue(file.getTitle());
-											//参见号
-											sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 3 : 0).setCellValue(file.getSeeAlsoCode());
-											//拍摄时间
-											sheet.getRow(i == 0 ? 25 : 53).getCell(i == 0 ? 3 : 0).setCellValue(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
-											//拍摄者
-											sheet.getRow(i == 0 ? 27 : 55).getCell(i == 0 ? 3 : 0).setCellValue(file.getShootingUser());
-
-										}catch (Exception e){
-											e.printStackTrace();
-										}
-									}
-
-									String locationFile = file_path + "/print//" + SnowFlakeUtil.getId() + ".xlsx";
-									outputStream = new FileOutputStream(locationFile);
-									//记录文件删除
-									removeList.add(locationFile);
-
-									//生成一份新的excel
-									workbook.write(outputStream);
-									//将excel转PDF
-									File excelFile = new File(locationFile);
-									excelFileInput = new FileInputStream(excelFile);
-									MultipartFile files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
-									NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
-									if(bladeFile != null){
-										pdfFileList.add(bladeFile.getPdfUrl());
-									}
-
-								} catch (Exception e){
-									e.printStackTrace();
-								} finally {
-									if(outputStream != null){
-										IoUtil.closeQuietly(outputStream);
-									}
-									if(modInput != null){
-										IoUtil.closeQuietly(modInput);
-									}
-									if(excelFileInput != null){
-										IoUtil.closeQuietly(excelFileInput);
-									}
-									if(workbook != null){
-										IoUtil.closeQuietly(workbook);
-									}
-								}
-							}
-
-							//合并pdf并上传
-							String mergeName = SnowFlakeUtil.getId() + ".pdf";
-							if(StringUtils.isNotEmpty(file.getMargePdfUrl())){
-								String[] urls = file.getMargePdfUrl().split("/");
-								mergeName = urls[urls.length - 1];
-							}
-							String mergeUrl = "/Users/doc/print/" + mergeName;
-							FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
-							//记录文件删除
-							removeList.add(mergeUrl);
-							//上传
-							BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
-							if(bladeFile != null){
-								result.add(bladeFile.getLink());
-								if(StringUtils.isEmpty(file.getMargePdfUrl())){
-									file.setMargePdfUrl(bladeFile.getLink());
-									this.imageClassificationFileService.update(Wrappers.<ImageClassificationFile>lambdaUpdate().set(ImageClassificationFile::getMargePdfUrl, bladeFile.getLink()).eq(ImageClassificationFile::getId, file.getId().toString()));
-								}
-							}
-						}
-					}
-					if(removeList.size() > 0){
-						//删除本地文件
-						CommonUtil.removeFile(removeList);
-					}
-				}
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-		}
-		//暂时没有多选,返回第一个
-		return result.size() > 0 ? R.data(result.get(0)) : R.data(null);
-	}
-
-	/**
-	 * 获取当前合同段的工程划分
-	 * @param parentId 父节点,为空则查询第一级节点
-	 * @return tree
-	 */
-	@GetMapping("/queryContractWbsTreeByContractIdAndType")
-	@ApiOperationSupport(order = 11)
-	@ApiOperation(value = "获取当前合同段的工程划分")
-	@ApiImplicitParams(value = {
-			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点")
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String parentId, @RequestParam String contractId){
-		List<WbsTreeContractTreeVOS> rootTreeNode;
-		if(StringUtils.isEmpty(parentId)){
-			//为空,说明初始化
-			//获取根节点
-			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
-		} else {
-			//不为空,获取其下子节点
-			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
-		}
-		return R.data(rootTreeNode);
-	}
-
-	/**
-	 * 保存或修改客户端显隐记录
-	 * @param showsVo 需要保存或修改的数据集合
-	 * @return 操作结果
-	 */
-	@PostMapping("/saveClassifyShowConfig")
-	@ApiOperationSupport(order = 10)
-	@ApiOperation(value = "保存客户端分类显隐记录")
-	public R<Boolean> saveOrUpdateClassifyShowConfig(@RequestBody ImageClassificationShowVO showsVo){
-		if(showsVo == null || showsVo.getShowList() == null || showsVo.getShowList().size() == 0){
-			return R.data(-1, false, "提交数据异常");
-		}
-		//获取集合
-		List<ImageClassificationShow> shows = showsVo.getShowList();
-		//判断提交的数据哪些是新增哪些是修改
-		List<ImageClassificationShow> saveShow = new ArrayList<>(), updateShow = new ArrayList<>();
-		shows.forEach(show -> {
-			if(show.getId() == null || show.getId() == -1){
-				//校验一下是否已经存在数据
-				long count = this.imageClassificationShowService.count(Wrappers.<ImageClassificationShow>lambdaQuery().eq(ImageClassificationShow::getClassifyId, show.getClassifyId()).eq(ImageClassificationShow::getProjectId, show.getProjectId()).eq(ImageClassificationShow::getContractId, show.getContractId()));
-				if(count == 0){
-					setUserData(show, null, true);
-					ImageClassificationShow newShow = new ImageClassificationShow();
-					BeanUtils.copyProperties(show, newShow);
-					newShow.setId(null);
-					saveShow.add(newShow);
-				} else {
-					setUserData(show, null, false);
-					updateShow.add(show);
-				}
-			} else {
-				setUserData(show, null, false);
-				updateShow.add(show);
-			}
-		});
-
-		boolean result = this.imageClassificationShowService.saveOrUpdateClassifyShowConfig(saveShow, updateShow);
-		if(!result){
-			return R.data(-1, false, "新增或修改失败");
-		}
-		return R.data(true);
-	}
-
-	/**
-	 * 获取当前项目类型的显隐配置列表
-	 * @return 结果数据集合
-	 */
-	@GetMapping("/getClassifyShowConfigList")
-	@ApiOperationSupport(order = 9)
-	@ApiOperation(value = "获取当前项目类型的显隐配置列表")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<List<ImageClassificationConfigVO>> getClassifyShowConfigList(@RequestParam String projectId, @RequestParam String contractId){
-		//首先获取显隐
-		List<ImageClassificationShow> showClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, null);
-		//获取当前系统配置的所有有效分类
-		List<ImageClassificationConfig> sysClassifyConfigList = this.imageClassificationConfigClient.queryClassificationConfigList(this.contractClient.getContractById(Long.parseLong(contractId)).getContractType());
-
-		if(sysClassifyConfigList == null || sysClassifyConfigList.size() == 0){
-			return R.data(-1, null, "不存在数据,请联系管理员或维护人员");
-		}
-		//返回的数据
-		List<ImageClassificationConfigVO> sysClassifyConfigVoList = JSONArray.parseArray(JSONObject.toJSONString(sysClassifyConfigList), ImageClassificationConfigVO.class);
-		if(showClassifyIdList != null && showClassifyIdList.size() != 0){
-			//存在显隐记录,只要存在一条记录其它的就默认不显示
-			showClassifyIdList.forEach(show -> {
-				for(ImageClassificationConfigVO vo : sysClassifyConfigVoList){
-					if(show.getClassifyId().equals(vo.getId())){
-						vo.setIsShow(new Integer("1").equals(show.getIsShow()));
-						vo.setShowId(show.getId());
-						break;
-					}
-				}
-			});
-
-			//获取项目阶段字典
-			List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
-
-			//处理没有显隐的数据
-			sysClassifyConfigVoList.forEach(vo -> {
-				//转换项目阶段
-				for(Dict biz : dictBizList){
-					if(biz.getDictKey().equals(vo.getProjectStage())){
-						vo.setProjectStage(biz.getDictValue());
-						break;
-					}
-				}
-
-
-				if(StringUtils.isEmpty(String.valueOf(vo.getShowId()))){
-					//默认为不显示
-					vo.setIsShow(false);
-				}
-			});
-		} else {
-			//不存在显隐记录,全部默认为显示
-			sysClassifyConfigVoList.forEach(vo -> vo.setIsShow(true));
-		}
-
-		return R.data(sysClassifyConfigVoList);
-	}
-
-	/**
-	 * 获取类型列表(类型主页)
-	 * @return 结果列表集合
-	 */
-	@GetMapping("/getClassIfyList")
-	@ApiOperationSupport(order = 8)
-	@ApiOperation(value = "获取类型列表(类型主页)")
-	public R<List<ImageClassificationConfigVO>> getClassIfyList(@RequestParam String projectId, @RequestParam String contractId){
-
-		//获取当前项目下的类型显隐情况
-		List<ImageClassificationShow> allShowClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, null);
-
-		//根据当前项目显示的类型ID获取系统默认的分类
-		List<ImageClassificationConfig> configList = new ArrayList<>();
-		if(allShowClassifyIdList == null || allShowClassifyIdList.size() == 0){
-			//说明没有控制显隐,全查
-			configList = this.imageClassificationConfigClient.queryClassificationConfigList(this.contractClient.getContractById(Long.parseLong(contractId)).getContractType());
-		} else {
-			//获取分类ID集合
-			List<Long> classifyIds = new ArrayList<>();
-			allShowClassifyIdList.forEach(classify -> {
-				if(new Integer("1").equals(classify.getIsShow())){
-					classifyIds.add(classify.getClassifyId());
-				}
-			});
-			if(classifyIds.size() > 0){
-				configList = this.imageClassificationConfigClient.queryClassificationConfigListByIds(classifyIds);
-			}
-		}
-		//转换类型
-		List<ImageClassificationConfigVO> configVoList = JSONArray.parseArray(JSONObject.toJSONString(configList), ImageClassificationConfigVO.class);
-
-		//获取项目阶段字典
-		List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
-
-		configVoList.forEach(vo -> {
-			//转换项目阶段
-			for(Dict biz : dictBizList){
-				if(biz.getDictKey().equals(vo.getProjectStage())){
-					vo.setProjectStage(biz.getDictValue());
-					break;
-				}
-			}
-
-			//获取当前节点下的文件
-			Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId());
-			vo.setCount(count);
-
-		});
-
-		return R.data(configVoList);
-	}
-
-	/**
-	 * 获取时间结构树
-	 * @param classifyId 分类ID
-	 * @return 树结构
-	 */
-	@GetMapping("/getYearDateTree")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "获取时间结构")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "classifyId", value = "分类ID"),
-			@ApiImplicitParam(name = "projectId", value = "项目ID"),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID")
-	})
-	public R<List<TreeVo>> getYearDateTree(@RequestParam String classifyId, @RequestParam String projectId, @RequestParam String contractId){
-		//获取当前分类下当前项目的拍摄时间并形成tree结构
-		return R.data(this.imageClassificationFileService.getYearDateTree(classifyId, projectId, contractId));
-	}
-
-	/**
-	 * 自定义分页
-	 * @param fileVO 查询条件
-	 * @param query 分页信息
-	 * @return 列表集合
-	 */
-	@GetMapping("/page")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "分页")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "classifyId", value = "分类ID"),
-			@ApiImplicitParam(name = "projectId", value = "项目ID"),
-			@ApiImplicitParam(name = "queryStr", value = "输入框查询"),
-			@ApiImplicitParam(name = "queryDate", value = "时间查询"),
-			@ApiImplicitParam(name = "wbsIdsStr", value = "节点查询"),
-	})
-	public R<IPage<ImageClassificationFileVO>> page(ImageClassificationFileVO fileVO, Query query){
-		IPage<ImageClassificationFileVO> page = this.imageClassificationFileService.selectImageClassificationFilePage(Condition.getPage(query), fileVO);
-		page.getRecords().forEach(vos -> vos.setShootingTimeStr(DateUtil.format(vos.getShootingTime(), "yyyy-MM-dd")));
-
-		return R.data(page);
-	}
-
-	/**
-	 * 详情页
-	 * @param id 主键
-	 * @return 详情信息
-	 */
-	@PostMapping("/queryById")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "详情", notes = "传入主键")
-	public R<ImageClassificationFileVO> queryById(@RequestParam String id){
-		ImageClassificationFile file = this.imageClassificationFileService.getById(id);
-		if(file != null){
-			ImageClassificationFileVO vo = new ImageClassificationFileVO();
-			BeanUtils.copyProperties(file, vo);
-			vo.setShootingTimeStr(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
-			return R.data(vo);
-		}
-		return R.data(null);
-	}
-
-	/**
-	 * 修改数据
-	 * @param fileVO 表单数据
-	 * @return 修改结果
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
-	public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO){
-		ImageClassificationFile newData = this.copyBeanData(fileVO, false);
-		newData.setMargePdfUrl("");
-		return R.data(this.imageClassificationFileService.updateById(newData));
-	}
-
-	/**
-	 * 新增数据
-	 * @param fileVO 表单参数
-	 * @return 新增结果
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "新增影音资料信息", notes = "传入表单数据")
-	public R<Boolean> save(@Valid @RequestBody ImageClassificationFileVO fileVO){
-		try{
-			ImageClassificationFile newFile = this.copyBeanData(fileVO, true);
-			this.setUserData(null, newFile, false);
-			//落库数据
-			return R.status(this.imageClassificationFileService.save(newFile));
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return R.data(-1, false, "数据操作失败");
-	}
-
-	//处理参数
-	private ImageClassificationFile copyBeanData(ImageClassificationFileVO fileVO, boolean isCreate){
-		ImageClassificationFile newFile = new ImageClassificationFile();
-		//复制数据
-		BeanUtils.copyProperties(fileVO, newFile);
-		try{
-			String shootingTime = fileVO.getShootingTimeStr();
-			String format = "yyyy-MM-dd";
-			if(shootingTime.contains(":")){
-				format = "yyyy-MM-dd HH:mm:ss";
-			}
-			newFile.setShootingTime(DateUtil.parseLocalDateTime(shootingTime, format));
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		//设置用户信息
-		setUserData(null, newFile, isCreate);
-		return newFile;
-	}
-
-	/**
-	 * 删除 
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "影音资料信息逻辑删除", notes = "传入ids")
-	public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-
-		List<ImageClassificationFile> fileList = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
-
-		try{
-			String title = fileList.stream().map(ImageClassificationFile::getFileName).distinct().collect(Collectors.joining(","));
-
-			String position = "";
-			try{
-				//获取节点集合
-				List<Long> wbsIds = fileList.stream().map(ImageClassificationFile::getWbsId).distinct().collect(Collectors.toList());
-				if(wbsIds.size() > 0){
-					//查询这些节点的信息
-					List<WbsTreeContract> wbsNodeList = this.wbsTreeContractClient.queryContractTreeNodeByPKIds(wbsIds);
-					if(wbsNodeList != null && wbsNodeList.size() > 0){
-						position = wbsNodeList.stream().map(node -> StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName()).distinct().collect(Collectors.joining());
-					}
-				}
-
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-
-			//保存操作日志
-			JSONObject json = new JSONObject();
-			json.put("operationObjIds", Func.toStrList(ids));
-			json.put("operationObjName", title);
-
-			this.operationLogClient.saveUserOperationLog(31, "其它文件", "影像资料", json);
-
-			//保存回收站记录
-			this.recycleBinClient.saveDelBusinessData(Func.toStrList(ids), title, 1, position, fileList.get(0).getProjectId().toString(), fileList.get(0).getContractId().toString());
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		//逻辑删除数据
-		return R.status(imageClassificationFileService.deleteLogic(Func.toLongList(ids)));
-	}
-
-	//设置登录用户信息
-	private void setUserData(ImageClassificationShow imageClassificationShow, ImageClassificationFile imageClassificationFile, boolean isCreate){
-		//记录操作人信息
-		if(isCreate){
-			if(imageClassificationShow != null){
-				imageClassificationShow.setCreateUser(AuthUtil.getUserId());
-				imageClassificationShow.setCreateDept(AuthUtil.getDeptId().contains(",") ? Long.parseLong(AuthUtil.getDeptId().split(",")[0]) : Long.parseLong(AuthUtil.getDeptId()));
-			}
-			if(imageClassificationFile != null){
-				imageClassificationFile.setCreateUser(AuthUtil.getUserId());
-				imageClassificationFile.setCreateDept(AuthUtil.getDeptId().contains(",") ? Long.parseLong(AuthUtil.getDeptId().split(",")[0]) : Long.parseLong(AuthUtil.getDeptId()));
-			}
-		} else {
-			if(imageClassificationShow != null){
-				imageClassificationShow.setUpdateUser(AuthUtil.getUserId());
-				imageClassificationShow.setUpdateTime(new Date());
-			}
-			if(imageClassificationFile != null){
-				imageClassificationFile.setUpdateUser(AuthUtil.getUserId());
-				imageClassificationFile.setUpdateTime(new Date());
-			}
-		}
-	}
+    private final IImageClassificationFileService imageClassificationFileService;
+
+    private final ImageClassificationShowService imageClassificationShowService;
+
+    /**
+     * 调用blade-manager的api
+     */
+    private final ImageClassificationConfigClient imageClassificationConfigClient;
+
+    private final WbsTreeContractClient wbsTreeContractClient;
+
+    private final IDictClient dictClient;
+
+    private final ExcelTabClient excelTabClient;
+
+    private final CommonFileClient commonFileClient;
+
+    private final NewIOSSClient newIOSSClient;
+
+    private final OperationLogClient operationLogClient;
+
+    private final RecycleBinClient recycleBinClient;
+
+    private final ContractClient contractClient;
+
+    /**
+     * 批量下载
+     */
+    @PostMapping("/batchDownloadFileToZip")
+    @ApiOperationSupport(order = 13)
+    @ApiOperation(value = "批量下载")
+    public void batchDownloadFileToZip(String ids, HttpServletResponse response) {
+        if (StringUtils.isNotEmpty(ids)) {
+            //查询数据
+            List<ImageClassificationFile> result = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
+            List<String> urls = new ArrayList<>();
+            for (ImageClassificationFile file : result) {
+                if (StringUtils.isNotEmpty(file.getImageUrl())) {
+                    urls.addAll(Arrays.asList(file.getImageUrl().split(",")));
+                }
+            }
+
+            //打包下载
+            FileUtils.batchDownloadFileToZip(urls, response);
+        }
+    }
+
+    /**
+     * 影音资料览(图片)
+     */
+    @PostMapping("/preview")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "影音资料览(图片)")
+    public R<String> preview(@RequestParam String ids) {
+        //获取固定表格
+        ExcelTab excelTab = this.excelTabClient.getById("1550363881879781377"); //影像资料模板
+
+        //获取配置的路径
+        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = null;
+        if (SystemUtils.isWindows()) {
+            //windows
+            file_path = "C:\\pdfFiles\\";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+        if (SystemUtils.isLinux()) {
+            //linux
+            file_path = "/home/pdfFiles";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+
+        List<String> result = new ArrayList<>();
+        if (excelTab != null) {
+            //获取数据
+            List<ImageClassificationFile> fileResult = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
+
+            try {
+                if (fileResult != null && fileResult.size() > 0) {
+                    //需要删除的本地文件集合
+                    List<String> removeList = new ArrayList<>();
+                    for (ImageClassificationFile file : fileResult) {
+                        //获取图片文件流
+                        String[] uris = file.getImageUrl().split(",");
+                        //处理多个文件
+                        if (uris.length > 0) {
+                            //获取模板文件流
+                            InputStream modInput = null;
+                            FileInputStream excelFileInput = null;
+                            FileOutputStream outputStream = null;
+                            Workbook workbook = null;
+
+                            List<String> pdfFileList = new ArrayList<>();
+                            //两个图片一组
+                            List<List<String>> groupUrls = CommonUtil.getBatchSize(JSONObject.parseArray(JSONObject.toJSONString(uris), String.class), 2);
+                            for (List<String> urls : groupUrls) {
+                                try {
+                                    //创建模板Workbook
+                                    modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+                                    workbook = WorkbookFactory.create(modInput);
+
+                                    for (int i = 0, l = urls.size(); i < l; i++) {
+                                        try {
+                                            CreationHelper helper = workbook.getCreationHelper();
+                                            Sheet sheet = workbook.getSheetAt(0);
+                                            Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                            ClientAnchor anchor = helper.createClientAnchor();
+                                            if (i == 0) {
+                                                anchor.setRow1(0);
+                                                anchor.setCol1(0);
+                                            } else {
+                                                anchor.setRow1(28);
+                                                anchor.setCol1(1);
+                                            }
+
+                                            //创建图片
+                                            drawing.createPicture(anchor, workbook.addPicture(CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i))), Workbook.PICTURE_TYPE_PNG));
+                                            //图片定位
+                                            FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(1, 28) : new DataVO(0, 0));
+
+                                            //定位其它信息
+                                            //文字说明
+                                            sheet.getRow(i == 0 ? 1 : 29).getCell(i == 0 ? 5 : 0).setCellValue(file.getTextContent());
+                                            //照片号
+                                            sheet.getRow(i == 0 ? 11 : 39).getCell(i == 0 ? 5 : 0).setCellValue(file.getPhotoCode());
+                                            //底片号
+                                            sheet.getRow(i == 0 ? 17 : 45).getCell(i == 0 ? 5 : 0).setCellValue(file.getFilmCode());
+                                            //题名
+                                            sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 0 : 3).setCellValue(file.getTitle());
+                                            //参见号
+                                            sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 3 : 0).setCellValue(file.getSeeAlsoCode());
+                                            //拍摄时间
+                                            sheet.getRow(i == 0 ? 25 : 53).getCell(i == 0 ? 3 : 0).setCellValue(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
+                                            //拍摄者
+                                            sheet.getRow(i == 0 ? 27 : 55).getCell(i == 0 ? 3 : 0).setCellValue(file.getShootingUser());
+
+                                        } catch (Exception e) {
+                                            e.printStackTrace();
+                                        }
+                                    }
+
+                                    String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
+                                    outputStream = new FileOutputStream(locationFile);
+                                    //记录文件删除
+                                    removeList.add(locationFile);
+
+                                    //生成一份新的excel
+                                    workbook.write(outputStream);
+                                    //将excel转PDF
+                                    File excelFile = new File(locationFile);
+                                    excelFileInput = new FileInputStream(excelFile);
+                                    MultipartFile files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
+                                    NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
+                                    if (bladeFile != null) {
+                                        pdfFileList.add(bladeFile.getPdfUrl());
+                                    }
+
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                } finally {
+                                    if (outputStream != null) {
+                                        IoUtil.closeQuietly(outputStream);
+                                    }
+                                    if (modInput != null) {
+                                        IoUtil.closeQuietly(modInput);
+                                    }
+                                    if (excelFileInput != null) {
+                                        IoUtil.closeQuietly(excelFileInput);
+                                    }
+                                    if (workbook != null) {
+                                        IoUtil.closeQuietly(workbook);
+                                    }
+                                }
+                            }
+
+                            //合并pdf并上传
+                            String mergeName = SnowFlakeUtil.getId() + ".pdf";
+                            if (StringUtils.isNotEmpty(file.getMargePdfUrl())) {
+                                String[] urls = file.getMargePdfUrl().split("/");
+                                mergeName = urls[urls.length - 1];
+                            }
+                            //String mergeUrl = "/Users/doc/print/" + mergeName;
+                            String mergeUrl = file_path + mergeName;
+                            FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
+                            //记录文件删除
+                            removeList.add(mergeUrl);
+                            //上传
+                            BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+                            if (bladeFile != null) {
+                                result.add(bladeFile.getLink());
+                                if (StringUtils.isEmpty(file.getMargePdfUrl())) {
+                                    file.setMargePdfUrl(bladeFile.getLink());
+                                    this.imageClassificationFileService.update(Wrappers.<ImageClassificationFile>lambdaUpdate().set(ImageClassificationFile::getMargePdfUrl, bladeFile.getLink()).eq(ImageClassificationFile::getId, file.getId().toString()));
+                                }
+                            }
+                        }
+                    }
+                    if (removeList.size() > 0) {
+                        //删除本地文件
+                        CommonUtil.removeFile(removeList);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        //暂时没有多选,返回第一个
+        return result.size() > 0 ? R.data(result.get(0)) : R.data(null);
+    }
+
+    /**
+     * 获取当前合同段的工程划分
+     *
+     * @param parentId 父节点,为空则查询第一级节点
+     * @return tree
+     */
+    @GetMapping("/queryContractWbsTreeByContractIdAndType")
+    @ApiOperationSupport(order = 11)
+    @ApiOperation(value = "获取当前合同段的工程划分")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点")
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String parentId, @RequestParam String contractId) {
+        List<WbsTreeContractTreeVOS> rootTreeNode;
+        if (StringUtils.isEmpty(parentId)) {
+            //为空,说明初始化
+            //获取根节点
+            rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
+        } else {
+            //不为空,获取其下子节点
+            rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
+        }
+        return R.data(rootTreeNode);
+    }
+
+    /**
+     * 保存或修改客户端显隐记录
+     *
+     * @param showsVo 需要保存或修改的数据集合
+     * @return 操作结果
+     */
+    @PostMapping("/saveClassifyShowConfig")
+    @ApiOperationSupport(order = 10)
+    @ApiOperation(value = "保存客户端分类显隐记录")
+    public R<Boolean> saveOrUpdateClassifyShowConfig(@RequestBody ImageClassificationShowVO showsVo) {
+        if (showsVo == null || showsVo.getShowList() == null || showsVo.getShowList().size() == 0) {
+            return R.data(-1, false, "提交数据异常");
+        }
+        //获取集合
+        List<ImageClassificationShow> shows = showsVo.getShowList();
+        //判断提交的数据哪些是新增哪些是修改
+        List<ImageClassificationShow> saveShow = new ArrayList<>(), updateShow = new ArrayList<>();
+        shows.forEach(show -> {
+            if (show.getId() == null || show.getId() == -1) {
+                //校验一下是否已经存在数据
+                long count = this.imageClassificationShowService.count(Wrappers.<ImageClassificationShow>lambdaQuery().eq(ImageClassificationShow::getClassifyId, show.getClassifyId()).eq(ImageClassificationShow::getProjectId, show.getProjectId()).eq(ImageClassificationShow::getContractId, show.getContractId()));
+                if (count == 0) {
+                    setUserData(show, null, true);
+                    ImageClassificationShow newShow = new ImageClassificationShow();
+                    BeanUtils.copyProperties(show, newShow);
+                    newShow.setId(null);
+                    saveShow.add(newShow);
+                } else {
+                    setUserData(show, null, false);
+                    updateShow.add(show);
+                }
+            } else {
+                setUserData(show, null, false);
+                updateShow.add(show);
+            }
+        });
+
+        boolean result = this.imageClassificationShowService.saveOrUpdateClassifyShowConfig(saveShow, updateShow);
+        if (!result) {
+            return R.data(-1, false, "新增或修改失败");
+        }
+        return R.data(true);
+    }
+
+    /**
+     * 获取当前项目类型的显隐配置列表
+     *
+     * @return 结果数据集合
+     */
+    @GetMapping("/getClassifyShowConfigList")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "获取当前项目类型的显隐配置列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<List<ImageClassificationConfigVO>> getClassifyShowConfigList(@RequestParam String projectId, @RequestParam String contractId) {
+        //首先获取显隐
+        List<ImageClassificationShow> showClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, null);
+        //获取当前系统配置的所有有效分类
+        List<ImageClassificationConfig> sysClassifyConfigList = this.imageClassificationConfigClient.queryClassificationConfigList(this.contractClient.getContractById(Long.parseLong(contractId)).getContractType());
+
+        if (sysClassifyConfigList == null || sysClassifyConfigList.size() == 0) {
+            return R.data(-1, null, "不存在数据,请联系管理员或维护人员");
+        }
+        //返回的数据
+        List<ImageClassificationConfigVO> sysClassifyConfigVoList = JSONArray.parseArray(JSONObject.toJSONString(sysClassifyConfigList), ImageClassificationConfigVO.class);
+        if (showClassifyIdList != null && showClassifyIdList.size() != 0) {
+            //存在显隐记录,只要存在一条记录其它的就默认不显示
+            showClassifyIdList.forEach(show -> {
+                for (ImageClassificationConfigVO vo : sysClassifyConfigVoList) {
+                    if (show.getClassifyId().equals(vo.getId())) {
+                        vo.setIsShow(new Integer("1").equals(show.getIsShow()));
+                        vo.setShowId(show.getId());
+                        break;
+                    }
+                }
+            });
+
+            //获取项目阶段字典
+            List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
+
+            //处理没有显隐的数据
+            sysClassifyConfigVoList.forEach(vo -> {
+                //转换项目阶段
+                for (Dict biz : dictBizList) {
+                    if (biz.getDictKey().equals(vo.getProjectStage())) {
+                        vo.setProjectStage(biz.getDictValue());
+                        break;
+                    }
+                }
+
+
+                if (StringUtils.isEmpty(String.valueOf(vo.getShowId()))) {
+                    //默认为不显示
+                    vo.setIsShow(false);
+                }
+            });
+        } else {
+            //不存在显隐记录,全部默认为显示
+            sysClassifyConfigVoList.forEach(vo -> vo.setIsShow(true));
+        }
+
+        return R.data(sysClassifyConfigVoList);
+    }
+
+    /**
+     * 获取类型列表(类型主页)
+     *
+     * @return 结果列表集合
+     */
+    @GetMapping("/getClassIfyList")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "获取类型列表(类型主页)")
+    public R<List<ImageClassificationConfigVO>> getClassIfyList(@RequestParam String projectId, @RequestParam String contractId) {
+
+        //获取当前项目下的类型显隐情况
+        List<ImageClassificationShow> allShowClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, null);
+
+        //根据当前项目显示的类型ID获取系统默认的分类
+        List<ImageClassificationConfig> configList = new ArrayList<>();
+        if (allShowClassifyIdList == null || allShowClassifyIdList.size() == 0) {
+            //说明没有控制显隐,全查
+            configList = this.imageClassificationConfigClient.queryClassificationConfigList(this.contractClient.getContractById(Long.parseLong(contractId)).getContractType());
+        } else {
+            //获取分类ID集合
+            List<Long> classifyIds = new ArrayList<>();
+            allShowClassifyIdList.forEach(classify -> {
+                if (new Integer("1").equals(classify.getIsShow())) {
+                    classifyIds.add(classify.getClassifyId());
+                }
+            });
+            if (classifyIds.size() > 0) {
+                configList = this.imageClassificationConfigClient.queryClassificationConfigListByIds(classifyIds);
+            }
+        }
+        //转换类型
+        List<ImageClassificationConfigVO> configVoList = JSONArray.parseArray(JSONObject.toJSONString(configList), ImageClassificationConfigVO.class);
+
+        //获取项目阶段字典
+        List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
+
+        configVoList.forEach(vo -> {
+            //转换项目阶段
+            for (Dict biz : dictBizList) {
+                if (biz.getDictKey().equals(vo.getProjectStage())) {
+                    vo.setProjectStage(biz.getDictValue());
+                    break;
+                }
+            }
+
+            //获取当前节点下的文件
+            Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId());
+            vo.setCount(count);
+
+        });
+
+        return R.data(configVoList);
+    }
+
+    /**
+     * 获取时间结构树
+     *
+     * @param classifyId 分类ID
+     * @return 树结构
+     */
+    @GetMapping("/getYearDateTree")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "获取时间结构")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "classifyId", value = "分类ID"),
+            @ApiImplicitParam(name = "projectId", value = "项目ID"),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID")
+    })
+    public R<List<TreeVo>> getYearDateTree(@RequestParam String classifyId, @RequestParam String projectId, @RequestParam String contractId) {
+        //获取当前分类下当前项目的拍摄时间并形成tree结构
+        return R.data(this.imageClassificationFileService.getYearDateTree(classifyId, projectId, contractId));
+    }
+
+    /**
+     * 自定义分页
+     *
+     * @param fileVO 查询条件
+     * @param query  分页信息
+     * @return 列表集合
+     */
+    @GetMapping("/page")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "分页")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "classifyId", value = "分类ID"),
+            @ApiImplicitParam(name = "projectId", value = "项目ID"),
+            @ApiImplicitParam(name = "queryStr", value = "输入框查询"),
+            @ApiImplicitParam(name = "queryDate", value = "时间查询"),
+            @ApiImplicitParam(name = "wbsIdsStr", value = "节点查询"),
+    })
+    public R<IPage<ImageClassificationFileVO>> page(ImageClassificationFileVO fileVO, Query query) {
+        IPage<ImageClassificationFileVO> page = this.imageClassificationFileService.selectImageClassificationFilePage(Condition.getPage(query), fileVO);
+        page.getRecords().forEach(vos -> vos.setShootingTimeStr(DateUtil.format(vos.getShootingTime(), "yyyy-MM-dd")));
+
+        return R.data(page);
+    }
+
+    /**
+     * 详情页
+     *
+     * @param id 主键
+     * @return 详情信息
+     */
+    @PostMapping("/queryById")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "详情", notes = "传入主键")
+    public R<ImageClassificationFileVO> queryById(@RequestParam String id) {
+        ImageClassificationFile file = this.imageClassificationFileService.getById(id);
+        if (file != null) {
+            ImageClassificationFileVO vo = new ImageClassificationFileVO();
+            BeanUtils.copyProperties(file, vo);
+            vo.setShootingTimeStr(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
+            return R.data(vo);
+        }
+        return R.data(null);
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param fileVO 表单数据
+     * @return 修改结果
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
+    public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO) {
+        ImageClassificationFile newData = this.copyBeanData(fileVO, false);
+        newData.setMargePdfUrl("");
+        return R.data(this.imageClassificationFileService.updateById(newData));
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param fileVO 表单参数
+     * @return 新增结果
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "新增影音资料信息", notes = "传入表单数据")
+    public R<Boolean> save(@Valid @RequestBody ImageClassificationFileVO fileVO) {
+        try {
+            ImageClassificationFile newFile = this.copyBeanData(fileVO, true);
+            this.setUserData(null, newFile, false);
+            //落库数据
+            return R.status(this.imageClassificationFileService.save(newFile));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return R.data(-1, false, "数据操作失败");
+    }
+
+    //处理参数
+    private ImageClassificationFile copyBeanData(ImageClassificationFileVO fileVO, boolean isCreate) {
+        ImageClassificationFile newFile = new ImageClassificationFile();
+        //复制数据
+        BeanUtils.copyProperties(fileVO, newFile);
+        try {
+            String shootingTime = fileVO.getShootingTimeStr();
+            String format = "yyyy-MM-dd";
+            if (shootingTime.contains(":")) {
+                format = "yyyy-MM-dd HH:mm:ss";
+            }
+            newFile.setShootingTime(DateUtil.parseLocalDateTime(shootingTime, format));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //设置用户信息
+        setUserData(null, newFile, isCreate);
+        return newFile;
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "影音资料信息逻辑删除", notes = "传入ids")
+    public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+
+        List<ImageClassificationFile> fileList = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
+
+        try {
+            String title = fileList.stream().map(ImageClassificationFile::getFileName).distinct().collect(Collectors.joining(","));
+
+            String position = "";
+            try {
+                //获取节点集合
+                List<Long> wbsIds = fileList.stream().map(ImageClassificationFile::getWbsId).distinct().collect(Collectors.toList());
+                if (wbsIds.size() > 0) {
+                    //查询这些节点的信息
+                    List<WbsTreeContract> wbsNodeList = this.wbsTreeContractClient.queryContractTreeNodeByPKIds(wbsIds);
+                    if (wbsNodeList != null && wbsNodeList.size() > 0) {
+                        position = wbsNodeList.stream().map(node -> StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName()).distinct().collect(Collectors.joining());
+                    }
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            //保存操作日志
+            JSONObject json = new JSONObject();
+            json.put("operationObjIds", Func.toStrList(ids));
+            json.put("operationObjName", title);
+
+            this.operationLogClient.saveUserOperationLog(31, "其它文件", "影像资料", json);
+
+            //保存回收站记录
+            this.recycleBinClient.saveDelBusinessData(Func.toStrList(ids), title, 1, position, fileList.get(0).getProjectId().toString(), fileList.get(0).getContractId().toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //逻辑删除数据
+        return R.status(imageClassificationFileService.deleteLogic(Func.toLongList(ids)));
+    }
+
+    //设置登录用户信息
+    private void setUserData(ImageClassificationShow imageClassificationShow, ImageClassificationFile imageClassificationFile, boolean isCreate) {
+        //记录操作人信息
+        if (isCreate) {
+            if (imageClassificationShow != null) {
+                imageClassificationShow.setCreateUser(AuthUtil.getUserId());
+                imageClassificationShow.setCreateDept(AuthUtil.getDeptId().contains(",") ? Long.parseLong(AuthUtil.getDeptId().split(",")[0]) : Long.parseLong(AuthUtil.getDeptId()));
+            }
+            if (imageClassificationFile != null) {
+                imageClassificationFile.setCreateUser(AuthUtil.getUserId());
+                imageClassificationFile.setCreateDept(AuthUtil.getDeptId().contains(",") ? Long.parseLong(AuthUtil.getDeptId().split(",")[0]) : Long.parseLong(AuthUtil.getDeptId()));
+            }
+        } else {
+            if (imageClassificationShow != null) {
+                imageClassificationShow.setUpdateUser(AuthUtil.getUserId());
+                imageClassificationShow.setUpdateTime(new Date());
+            }
+            if (imageClassificationFile != null) {
+                imageClassificationFile.setUpdateUser(AuthUtil.getUserId());
+                imageClassificationFile.setUpdateTime(new Date());
+            }
+        }
+    }
 
 }

+ 1736 - 1715
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -8,8 +8,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
+
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+
 import org.apache.commons.lang.StringUtils;
 import org.jetbrains.annotations.NotNull;
 import org.springblade.business.entity.*;
@@ -54,7 +56,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- *  资料填报及查询控制器
+ * 资料填报及查询控制器
  *
  * @author BladeX
  * @since 2022-06-08
@@ -65,431 +67,435 @@ import java.util.stream.Collectors;
 @Api(tags = "资料查询接口")
 public class InformationWriteQueryController extends BladeController {
 
-	private final ContractClient contractClient;
-
-	private final WbsTreeContractClient wbsTreeContractClient;
-
-	private final WbsTreePrivateClient wbsTreePrivateClient;
-
-	private final IInformationQueryService informationQueryService;
-
-	private final IInformationQueryFileService informationQueryFileService;
-
-	private final IDictBizClient dictBizClient;
-
-	private final IConstructionLedgerService constructionLedgerService;
-
-	private final TaskClient taskClient;
-
-	private final OperationLogClient operationLogClient;
-
-	private final EVisaClient eVisaClient;
-
-	private final JdbcTemplate jdbcTemplate;
-
-	private final RecycleBinClient recycleBinClient;
-
-	private final NewIOSSClient newIOSSClient;
-
-	private final MessageWarningClient messageWarningClient;
-
-	private final ProjectClient projectClient;
-
-	/**
-	 * 获取文件题名
-	 */
-	@GetMapping("/queryFirstDocumentTitle")
-	@ApiOperationSupport(order = 29)
-	@ApiOperation(value = "获取文件题名")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "queryId", value = "列表ID", required = true)
-	})
-	public R<String> queryFirstDocumentTitle(@RequestParam String queryId){
-		InformationQuery query = this.informationQueryService.getById(queryId);
-		if(query != null){
-			return R.data(query.getName());
-		}
-		return R.data(300, null, "未找到文件题名");
-	}
-
-	/**
-	 * 获取文件题名
-	 */
-	@GetMapping("/queryDocumentTitle")
-	@ApiOperationSupport(order = 28)
-	@ApiOperation(value = "获取文件题名")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "primaryKeyId", value = "节点的primaryKeyId", required = true),
-			@ApiImplicitParam(name = "classify", value = "当前所选的类型", required = true)
-	})
-	public R<String> queryDocumentTitle(@RequestParam String primaryKeyId, @RequestParam Integer classify){
-		List<InformationQuery> result = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getClassify, classify).eq(InformationQuery::getWbsId, primaryKeyId));
-		if(result != null && result.size() > 0){
-			return R.data(result.get(0).getName());
-		}
-		return R.data(300, null, "未找到文件题名");
-	}
-
-	/**
-	 * 初始化合同段导图树
-	 */
-	@PostMapping("/initMappingStructureTree")
-	@ApiOperationSupport(order = 27)
-	@ApiOperation(value = "初始化合同段导图树(只有接口,功能未写)")
-	public R<List<WbsTreeContractTreeVOS>> initMappingStructureTree(@RequestBody List<String> ids){
-		System.out.println(ids);
-		return null;
-	}
-
-	/**
-	 * 输入框查询合同段树
-	 */
-	@GetMapping("/searchContractTree")
-	@ApiOperationSupport(order = 26)
-	@ApiOperation(value = "输入框查询合同段树")
-	public R<List<WbsTreeContractTreeVOS>> searchContractTree(@RequestParam String queryValue, @RequestParam String contractId){
-		//设置返回结果
-		List<WbsTreeContractTreeVOS> result = new ArrayList<>();
-		//获取合同段信息
-		ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
-		if(new Integer("2").equals(contract.getContractType())){
-			//监理,需要获取监理合同段关联的施工方合同段ID
-			List<ContractRelationJlyz> jlyzList = this.wbsTreeContractClient.selectContractRelationInfo(contractId);
-			if(jlyzList != null && jlyzList.size() > 0){
-				//施工合同段子节点
-				List<WbsTreeContractTreeVOS> sgChildNodeList = new ArrayList<>();
-
-				for(ContractRelationJlyz jlkz : jlyzList){
-					List<WbsTreeContract> queryValueList = this.wbsTreeContractClient.selectQueryValueLikeNodeName(queryValue, jlkz.getContractIdSg().toString());
-					if(queryValueList != null && queryValueList.size() > 0){
-						//查询与当前节点相关联的数据
-						List<WbsTreeContractTreeVOS> associatedVONodeList = new ArrayList<>();
-						List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(queryValueList.stream().map(WbsTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
-						//查询相关联的数据
-						List<WbsTreeContract> associatedList = this.wbsTreeContractClient.selectQueryCurrentNodeByAncestors(ids, jlkz.getContractIdSg().toString());
-						if(associatedList != null){
-							queryValueList.addAll(associatedList);
-						}
-						//处理参数
-						this.queryContractTree(associatedVONodeList, queryValueList, 2);
-
-						if(associatedVONodeList.size() > 0){
-							List<WbsTreeContractTreeVOS> list = ForestNodeMerger.merge(associatedVONodeList);
-							list.removeIf(vos -> !"0".equals(vos.getParentId().toString()));
-							sgChildNodeList.addAll(list);
-						}
-					}
-				}
-				if(sgChildNodeList.size() > 0){
-					//给个顶点
-					WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
-					vos.setTitle(contract.getContractName());
-					vos.setChildren(sgChildNodeList);
-					result.add(vos);
-				}
-				return R.data(result);
-			}
-		} else {
-			//施工,直接查询
-			//获取当前合同段下所有的数据
-			List<WbsTreeContract> queryValueList = this.wbsTreeContractClient.selectQueryValueLikeNodeName(queryValue, contractId);
-			if(queryValueList != null && queryValueList.size() > 0){
-				//查询与当前节点相关联的数据
-				List<WbsTreeContractTreeVOS> associatedVONodeList = new ArrayList<>();
-				List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(queryValueList.stream().map(WbsTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
-				//查询相关联的数据
-				List<WbsTreeContract> associatedList = this.wbsTreeContractClient.selectQueryCurrentNodeByAncestors(ids, contractId);
-				if(associatedList != null && associatedList.size() > 0){
-					queryValueList.addAll(associatedList);
-				}
-				//处理参数
-				this.queryContractTree(associatedVONodeList, queryValueList, 1);
-
-				if(associatedVONodeList.size() > 0){
-					List<WbsTreeContractTreeVOS> list = ForestNodeMerger.merge(associatedVONodeList);
-					list.removeIf(vos -> !"0".equals(vos.getParentId().toString()));
-					result.addAll(list);
-				}
-				return R.data(result);
-			}
-		}
-
-		return R.data(300, null, "未找到相关数据");
-	}
-
-	/**
-	 * 转换参数
-	 */
-	private void queryContractTree(List<WbsTreeContractTreeVOS> associatedVONodeList, List<WbsTreeContract> associatedList, Integer contractType) {
-		List<String> exsitList =  new ArrayList<>();
-		for(WbsTreeContract tree : associatedList){
-			if(exsitList.contains(tree.getId().toString())){
-				continue;
-			}
-			//转换类型
-			WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
-			//设置参数
-			vos.setId(new Integer("1").equals(contractType) ? tree.getId() : tree.getPKeyId());
-			vos.setKey(tree.getId().toString());
-			vos.setPrimaryKeyId(new Integer("1").equals(contractType) ? tree.getPKeyId().toString() : tree.getId().toString());
-			if(new Integer("2").equals(contractType)){
-				vos.setContractIdRelation(tree.getContractId());
-			}
-			vos.setParentId(tree.getParentId());
-			vos.setTitle(StringUtils.isNotEmpty(tree.getFullName()) ? tree.getFullName() : tree.getNodeName());
-			vos.setType(tree.getType());
-			vos.setWbsType(tree.getWbsType());
-
-			//判断当前节点是否存在子节点
-			for(WbsTreeContract treeNode : associatedList){
-				if(treeNode.getParentId().equals(tree.getId())){
-					//存在一个,即认为存在
-					vos.setNotExsitChild(false);
-					break;
-				}
-			}
-			associatedVONodeList.add(vos);
-			exsitList.add(tree.getId().toString());
-		}
-	}
-
-	/**
-	 * 复制节点填报数据
-	 */
-	@PostMapping("/copyContractNodeSubmitBusinessData")
-	@ApiOperationSupport(order = 25)
-	@ApiOperation(value = "复制节点填报数据")
-	public R<Boolean> copyContractNodeSubmitBusinessData(@RequestBody CopyContractTreeNodeVO copyVO){
-		if(StringUtils.isNotEmpty(copyVO.getNeedCopyPrimaryKeyId()) && copyVO.getCopyBatchToPaths().size() > 0){
-		    //查询被复制节点
+    private final ContractClient contractClient;
+
+    private final WbsTreeContractClient wbsTreeContractClient;
+
+    private final WbsTreePrivateClient wbsTreePrivateClient;
+
+    private final IInformationQueryService informationQueryService;
+
+    private final IInformationQueryFileService informationQueryFileService;
+
+    private final IDictBizClient dictBizClient;
+
+    private final IConstructionLedgerService constructionLedgerService;
+
+    private final TaskClient taskClient;
+
+    private final OperationLogClient operationLogClient;
+
+    private final EVisaClient eVisaClient;
+
+    private final JdbcTemplate jdbcTemplate;
+
+    private final RecycleBinClient recycleBinClient;
+
+    private final NewIOSSClient newIOSSClient;
+
+    private final MessageWarningClient messageWarningClient;
+
+    private final ProjectClient projectClient;
+
+    /**
+     * 获取文件题名
+     */
+    @GetMapping("/queryFirstDocumentTitle")
+    @ApiOperationSupport(order = 29)
+    @ApiOperation(value = "获取文件题名")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "queryId", value = "列表ID", required = true)
+    })
+    public R<String> queryFirstDocumentTitle(@RequestParam String queryId) {
+        InformationQuery query = this.informationQueryService.getById(queryId);
+        if (query != null) {
+            return R.data(query.getName());
+        }
+        return R.data(300, null, "未找到文件题名");
+    }
+
+    /**
+     * 获取文件题名
+     */
+    @GetMapping("/queryDocumentTitle")
+    @ApiOperationSupport(order = 28)
+    @ApiOperation(value = "获取文件题名")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "primaryKeyId", value = "节点的primaryKeyId", required = true),
+            @ApiImplicitParam(name = "classify", value = "当前所选的类型", required = true)
+    })
+    public R<String> queryDocumentTitle(@RequestParam String primaryKeyId, @RequestParam Integer classify) {
+        List<InformationQuery> result = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getClassify, classify).eq(InformationQuery::getWbsId, primaryKeyId));
+        if (result != null && result.size() > 0) {
+            return R.data(result.get(0).getName());
+        }
+        return R.data(300, null, "未找到文件题名");
+    }
+
+    /**
+     * 初始化合同段导图树
+     */
+    @PostMapping("/initMappingStructureTree")
+    @ApiOperationSupport(order = 27)
+    @ApiOperation(value = "初始化合同段导图树(只有接口,功能未写)")
+    public R<List<WbsTreeContractTreeVOS>> initMappingStructureTree(@RequestBody List<String> ids) {
+        System.out.println(ids);
+        return null;
+    }
+
+    /**
+     * 输入框查询合同段树
+     */
+    @GetMapping("/searchContractTree")
+    @ApiOperationSupport(order = 26)
+    @ApiOperation(value = "输入框查询合同段树")
+    public R<List<WbsTreeContractTreeVOS>> searchContractTree(@RequestParam String queryValue, @RequestParam String contractId) {
+        //设置返回结果
+        List<WbsTreeContractTreeVOS> result = new ArrayList<>();
+        //获取合同段信息
+        ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
+
+        if (contract.getContractType().equals(2)) {
+            //监理,需要获取监理合同段关联的施工方合同段ID
+            List<ContractRelationJlyz> jlyzList = this.wbsTreeContractClient.selectContractRelationInfo(contractId);
+            if (jlyzList != null && jlyzList.size() > 0) {
+                //施工合同段子节点
+                List<WbsTreeContractTreeVOS> sgChildNodeList = new ArrayList<>();
+
+                for (ContractRelationJlyz jlkz : jlyzList) {
+                    List<WbsTreeContract> queryValueList = this.wbsTreeContractClient.selectQueryValueLikeNodeName(queryValue, jlkz.getContractIdSg().toString());
+                    if (queryValueList != null && queryValueList.size() > 0) {
+                        //查询与当前节点相关联的数据
+                        List<WbsTreeContractTreeVOS> associatedVONodeList = new ArrayList<>();
+                        List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(queryValueList.stream().map(WbsTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
+                        //查询相关联的数据
+                        List<WbsTreeContract> associatedList = this.wbsTreeContractClient.selectQueryCurrentNodeByAncestors(ids, jlkz.getContractIdSg().toString());
+                        if (associatedList != null) {
+                            queryValueList.addAll(associatedList);
+                        }
+                        //处理参数
+                        this.queryContractTree(associatedVONodeList, queryValueList, 2);
+
+                        if (associatedVONodeList.size() > 0) {
+                            List<WbsTreeContractTreeVOS> list = ForestNodeMerger.merge(associatedVONodeList);
+                            list.removeIf(vos -> !"0".equals(vos.getParentId().toString()));
+                            sgChildNodeList.addAll(list);
+                        }
+                    }
+                }
+                if (sgChildNodeList.size() > 0) {
+                    //给个顶点
+                    WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+                    vos.setTitle(contract.getContractName());
+                    vos.setChildren(sgChildNodeList);
+                    result.add(vos);
+                }
+                return R.data(result);
+            }
+        } else if (contract.getContractType().equals(1)) {
+            //施工,直接查询
+            //获取当前合同段下所有的数据
+            //List<WbsTreeContract> queryValueList = this.wbsTreeContractClient.selectQueryValueLikeNodeName(queryValue, contractId);
+            List<WbsTreeContract> wbsTreeContracts = this.wbsTreeContractClient.selectAllByContractId(contractId);
+            List<WbsTreeContract> queryValueList = wbsTreeContracts.stream().filter(f -> f.getNodeName().contains(queryValue)).collect(Collectors.toList());
+
+            if (queryValueList.size() > 0) {
+                //查询与当前节点相关联的数据
+                List<WbsTreeContractTreeVOS> associatedVONodeList = new ArrayList<>();
+                List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(queryValueList.stream().map(WbsTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
+                //查询相关联的数据
+                List<WbsTreeContract> associatedList = this.wbsTreeContractClient.selectQueryCurrentNodeByAncestors(ids, contractId);
+                if (associatedList != null && associatedList.size() > 0) {
+                    queryValueList.addAll(associatedList);
+                }
+                //处理参数
+                this.queryContractTree(associatedVONodeList, queryValueList, 1);
+
+                if (associatedVONodeList.size() > 0) {
+                    List<WbsTreeContractTreeVOS> list = ForestNodeMerger.merge(associatedVONodeList);
+                    list.removeIf(vos -> !"0".equals(vos.getParentId().toString()));
+                    result.addAll(list);
+                }
+                return R.data(result);
+            }
+        }
+
+        return R.data(300, null, "未找到相关数据");
+    }
+
+    /**
+     * 转换参数
+     */
+    private void queryContractTree(List<WbsTreeContractTreeVOS> associatedVONodeList, List<WbsTreeContract> associatedList, Integer contractType) {
+        List<String> exsitList = new ArrayList<>();
+        for (WbsTreeContract tree : associatedList) {
+            if (exsitList.contains(tree.getId().toString())) {
+                continue;
+            }
+            //转换类型
+            WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+            //设置参数
+            vos.setId(new Integer("1").equals(contractType) ? tree.getId() : tree.getPKeyId());
+            vos.setKey(tree.getId().toString());
+            vos.setPrimaryKeyId(new Integer("1").equals(contractType) ? tree.getPKeyId().toString() : tree.getId().toString());
+            if (new Integer("2").equals(contractType)) {
+                vos.setContractIdRelation(tree.getContractId());
+            }
+            vos.setParentId(tree.getParentId());
+            vos.setTitle(StringUtils.isNotEmpty(tree.getFullName()) ? tree.getFullName() : tree.getNodeName());
+            vos.setType(tree.getType());
+            vos.setWbsType(tree.getWbsType());
+
+            //判断当前节点是否存在子节点
+            for (WbsTreeContract treeNode : associatedList) {
+                if (treeNode.getParentId().equals(tree.getId())) {
+                    //存在一个,即认为存在
+                    vos.setNotExsitChild(false);
+                    break;
+                }
+            }
+            associatedVONodeList.add(vos);
+            exsitList.add(tree.getId().toString());
+        }
+    }
+
+    /**
+     * 复制节点填报数据
+     */
+    @PostMapping("/copyContractNodeSubmitBusinessData")
+    @ApiOperationSupport(order = 25)
+    @ApiOperation(value = "复制节点填报数据")
+    public R<Boolean> copyContractNodeSubmitBusinessData(@RequestBody CopyContractTreeNodeVO copyVO) {
+        if (StringUtils.isNotEmpty(copyVO.getNeedCopyPrimaryKeyId()) && copyVO.getCopyBatchToPaths().size() > 0) {
+            //查询被复制节点
             WbsTreeContract wbsTreeContract = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyVO.getNeedCopyPrimaryKeyId());
-			//获取被复制节点的表格
-			List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(wbsTreeContract, "queryTable", "");
-			if(tableList != null && tableList.size() > 0){
-
-				//获取表格的业务数据
-				Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
-				for(WbsTreeContract treeContract : tableList){
-					List<Map<String, Object>> tableBusinessData = this.jdbcTemplate.queryForList("select * from " + treeContract.getInitTableName() + " where p_key_id = " + treeContract.getPKeyId());
-					if(tableBusinessData.size() > 0){
-						//设置参数
-						List<List<Map<String, Object>>> list;
-						if(tableBusinessDataMap.containsKey(treeContract.getId().toString())){
-							list = tableBusinessDataMap.get(treeContract.getId().toString());
-						} else {
-							list = new ArrayList<>();
-						}
-						list.add(tableBusinessData);
-						tableBusinessDataMap.put(treeContract.getId().toString(), list);
-					}
-				}
-
-				//获取数据写入的节点信息
-				List<CopyContractTreeNodeVO.CopyBatch> batchPathList = copyVO.getCopyBatchToPaths();
-				//删除数据SQL
+            //获取被复制节点的表格
+            List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(wbsTreeContract, "queryTable", "");
+            if (tableList != null && tableList.size() > 0) {
+
+                //获取表格的业务数据
+                Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
+                for (WbsTreeContract treeContract : tableList) {
+                    List<Map<String, Object>> tableBusinessData = this.jdbcTemplate.queryForList("select * from " + treeContract.getInitTableName() + " where p_key_id = " + treeContract.getPKeyId());
+                    if (tableBusinessData.size() > 0) {
+                        //设置参数
+                        List<List<Map<String, Object>>> list;
+                        if (tableBusinessDataMap.containsKey(treeContract.getId().toString())) {
+                            list = tableBusinessDataMap.get(treeContract.getId().toString());
+                        } else {
+                            list = new ArrayList<>();
+                        }
+                        list.add(tableBusinessData);
+                        tableBusinessDataMap.put(treeContract.getId().toString(), list);
+                    }
+                }
+
+                //获取数据写入的节点信息
+                List<CopyContractTreeNodeVO.CopyBatch> batchPathList = copyVO.getCopyBatchToPaths();
+                //删除数据SQL
                 List<String> removeSqlList = new ArrayList<>();
-				//新增数据SQL
-				List<String> saveSqlList = new ArrayList<>();
-				for(CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList){
-					//获取选择的节点信息
-					WbsTreeContract selectNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
-
-					//获取合同段信息
-					ContractInfo contract = this.contractClient.getContractById(Long.parseLong(selectNode.getContractId()));
-
-					//实际获取的数据
-					Map<String, List<List<Map<String, Object>>>> currentDataMap = new HashMap<>();
-					if(new Integer("1").equals(contract.getIsCopyData())){
-						//说明开启数据复制限制,根据合同段类型判断哪些数据是能够被复制的
-						String removeString = new Integer("1").equals(contract.getContractType()) ? "1,2,3" : "5,6,7";
-						//找符合条件的表格
-						List<WbsTreeContract> tables = tableList.stream().filter(tree -> Arrays.asList(removeString.split(",")).contains(tree.getTableOwner())).distinct().collect(Collectors.toList());
-						if(tables.size() <= 0){
-							continue;
-						}
-						for(WbsTreeContract node : tables){
-							if(tableBusinessDataMap.containsKey(node.getId().toString()) && !currentDataMap.containsKey(node.getId().toString())){
-								currentDataMap.put(node.getId().toString(), tableBusinessDataMap.get(node.getId().toString()));
-							}
-						}
-					}
-
-					//获取表格信息
-					List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(selectNode, "queryTable", "");
-					if(copyToTableList != null && copyToTableList.size() > 0){
+                //新增数据SQL
+                List<String> saveSqlList = new ArrayList<>();
+                for (CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList) {
+                    //获取选择的节点信息
+                    WbsTreeContract selectNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
+
+                    //获取合同段信息
+                    ContractInfo contract = this.contractClient.getContractById(Long.parseLong(selectNode.getContractId()));
+
+                    //实际获取的数据
+                    Map<String, List<List<Map<String, Object>>>> currentDataMap = new HashMap<>();
+                    if (new Integer("1").equals(contract.getIsCopyData())) {
+                        //说明开启数据复制限制,根据合同段类型判断哪些数据是能够被复制的
+                        String removeString = new Integer("1").equals(contract.getContractType()) ? "1,2,3" : "5,6,7";
+                        //找符合条件的表格
+                        List<WbsTreeContract> tables = tableList.stream().filter(tree -> Arrays.asList(removeString.split(",")).contains(tree.getTableOwner())).distinct().collect(Collectors.toList());
+                        if (tables.size() <= 0) {
+                            continue;
+                        }
+                        for (WbsTreeContract node : tables) {
+                            if (tableBusinessDataMap.containsKey(node.getId().toString()) && !currentDataMap.containsKey(node.getId().toString())) {
+                                currentDataMap.put(node.getId().toString(), tableBusinessDataMap.get(node.getId().toString()));
+                            }
+                        }
+                    }
+
+                    //获取表格信息
+                    List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(selectNode, "queryTable", "");
+                    if (copyToTableList != null && copyToTableList.size() > 0) {
                         //首先,记录数据删除sql
-                        for(WbsTreeContract table : copyToTableList){
-                            if(StringUtils.isNotEmpty(table.getInitTableName())){
+                        for (WbsTreeContract table : copyToTableList) {
+                            if (StringUtils.isNotEmpty(table.getInitTableName())) {
                                 removeSqlList.add("delete from " + table.getInitTableName() + " where p_key_id = " + table.getPKeyId());
                             }
                         }
 
-						//其次,检测是否表格是否存在差异(如果存在oldId则优先使用这个字段,不存在时才使用id)
-						List<WbsTreeContract> remainTableList = copyToTableList.stream().filter(toTable -> currentDataMap.containsKey(StringUtils.isNotEmpty(toTable.getOldId()) ? toTable.getOldId() : toTable.getId().toString())).collect(Collectors.toList());
-						//循环有数据的表格
-						for(WbsTreeContract remainTable : remainTableList){
-							if(StringUtils.isNotEmpty(remainTable.getInitTableName())){
-								//获取主键
-								String id = StringUtils.isNotEmpty(remainTable.getOldId()) ? remainTable.getOldId() : remainTable.getId().toString();
-								if(currentDataMap.containsKey(id)){
-									//获取对应表格的数据
-									Iterator<List<Map<String, Object>>> oneLevelIterator = currentDataMap.get(id).iterator();
-									while (oneLevelIterator.hasNext()){
-										List<Map<String, Object>> dataMapList = oneLevelIterator.next();
-										Iterator<Map<String, Object>> iterator = dataMapList.iterator();
-
-										while (iterator.hasNext()){
-											Map<String, Object> map = iterator.next();
-											map.remove("id");
-											map.remove("p_key_id");
-											//拼接sql
-											StringBuilder sql = new StringBuilder("insert into " + remainTable.getInitTableName() + " (id, p_key_id");
-											StringBuilder valueSql = new StringBuilder(" values (" + SnowFlakeUtil.getId() + "," + remainTable.getPKeyId());
-											//循环需要复制的数据
-											for(Map.Entry<String, Object> mapEntry : map.entrySet()){
-												sql.append(",").append(mapEntry.getKey());
-												if(mapEntry.getValue() == null){
-													valueSql.append(",").append(mapEntry.getValue());
-												} else {
-													valueSql.append(",'").append(mapEntry.getValue()).append("'");
-												}
-											}
-											//生成最终sql
-											saveSqlList.add(sql.append(")").append(valueSql).append(")").toString());
-											iterator.remove();
-											break;
-										}
-										if(dataMapList.size() <= 0){
-											oneLevelIterator.remove();
-										}
-										break;
-									}
-								}
-							}
-						}
-					}
-				}
+                        //其次,检测是否表格是否存在差异(如果存在oldId则优先使用这个字段,不存在时才使用id)
+                        List<WbsTreeContract> remainTableList = copyToTableList.stream().filter(toTable -> currentDataMap.containsKey(StringUtils.isNotEmpty(toTable.getOldId()) ? toTable.getOldId() : toTable.getId().toString())).collect(Collectors.toList());
+                        //循环有数据的表格
+                        for (WbsTreeContract remainTable : remainTableList) {
+                            if (StringUtils.isNotEmpty(remainTable.getInitTableName())) {
+                                //获取主键
+                                String id = StringUtils.isNotEmpty(remainTable.getOldId()) ? remainTable.getOldId() : remainTable.getId().toString();
+                                if (currentDataMap.containsKey(id)) {
+                                    //获取对应表格的数据
+                                    Iterator<List<Map<String, Object>>> oneLevelIterator = currentDataMap.get(id).iterator();
+                                    while (oneLevelIterator.hasNext()) {
+                                        List<Map<String, Object>> dataMapList = oneLevelIterator.next();
+                                        Iterator<Map<String, Object>> iterator = dataMapList.iterator();
+
+                                        while (iterator.hasNext()) {
+                                            Map<String, Object> map = iterator.next();
+                                            map.remove("id");
+                                            map.remove("p_key_id");
+                                            //拼接sql
+                                            StringBuilder sql = new StringBuilder("insert into " + remainTable.getInitTableName() + " (id, p_key_id");
+                                            StringBuilder valueSql = new StringBuilder(" values (" + SnowFlakeUtil.getId() + "," + remainTable.getPKeyId());
+                                            //循环需要复制的数据
+                                            for (Map.Entry<String, Object> mapEntry : map.entrySet()) {
+                                                sql.append(",").append(mapEntry.getKey());
+                                                if (mapEntry.getValue() == null) {
+                                                    valueSql.append(",").append(mapEntry.getValue());
+                                                } else {
+                                                    valueSql.append(",'").append(mapEntry.getValue()).append("'");
+                                                }
+                                            }
+                                            //生成最终sql
+                                            saveSqlList.add(sql.append(")").append(valueSql).append(")").toString());
+                                            iterator.remove();
+                                            break;
+                                        }
+                                        if (dataMapList.size() <= 0) {
+                                            oneLevelIterator.remove();
+                                        }
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
                 //删除原本填写的数据
-                if(removeSqlList.size() > 0){
-                    for(String sql : removeSqlList){
+                if (removeSqlList.size() > 0) {
+                    for (String sql : removeSqlList) {
+                        this.jdbcTemplate.execute(sql);
+                    }
+                }
+
+                //保存新获取的数据
+                if (saveSqlList.size() > 0) {
+                    for (String sql : saveSqlList) {
                         this.jdbcTemplate.execute(sql);
                     }
                 }
+                return R.data(true);
+            }
+        }
 
-				//保存新获取的数据
-				if(saveSqlList.size() > 0){
-					for(String sql : saveSqlList){
-						this.jdbcTemplate.execute(sql);
-					}
-				}
-				return R.data(true);
-			}
-		}
-
-		return R.data(300, false, "被复制节点未找到业务数据");
-	}
-
-	/**
-	 * 单个废除
-	 */
-	@PostMapping("/abolishOne")
-	@ApiOperationSupport(order = 24)
-	@ApiOperation(value = "单个废除")
-	public R<Boolean> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify){
-		//查询填报状态
-		InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify));
-		if(businessData != null){
-			//使用批量废除接口
-			return this.batchAbolish(businessData.getId().toString());
-		}
-		return R.data(300, false, "废除失败,未找到业务数据");
-	}
-
-	/**
-	 * 查询节点状态
-	 */
-	@PostMapping("/queryNodeStatus")
-	@ApiOperationSupport(order = 23)
-	@ApiOperation(value = "/查询节点状态")
-	public R<String> queryNodeStatus(@RequestParam String primaryKeyId, @RequestParam String classify){
-		//记录状态
-		String status = "1";
-		//查询填报状态
-		InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).ne(InformationQuery::getType, 3));
-		if(businessData != null){
-			switch (businessData.getStatus()){
-				case 0:
-				case 3:
-					//0属于未上报,3属于已废除,统一为待上报
-					status = "2";
-					break;
-				case 1:
-				case 2:
-					//1属于待审批,2属于已审批,统一为已上报
-					status = "3";
-					break;
-				default:
-					//如果不匹配,默认为未填报
-					status = "1";
-					//查询表格
-					List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
-					if(tableList != null && tableList.size() > 0){
-						for(WbsTreeContract table : tableList){
-							if(new Integer("2").equals(table.getIsTabPdf())){
-								//这些表格中,但凡有一个能够预览,就开放预览
-								status = "2";
-								break;
-							}
-						}
-					}
-					break;
-			}
-		} else {
-			//查询表格
-			List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
-			if(tableList != null && tableList.size() > 0){
-				for(WbsTreeContract table : tableList){
-					if(new Integer("2").equals(table.getIsTabPdf())){
-						//这些表格中,但凡有一个能够预览,就开放预览
-						status = "2";
-						break;
-					}
-				}
-			}
-		}
-
-		return R.data(status);
-	}
-
-	/**
-	 * 填报页单个上报
-	 */
-	@PostMapping("/taskOne")
-	@ApiOperationSupport(order = 22)
-	@ApiOperation(value = "填报页单个上报")
-	public R<Boolean> taskOne(@RequestBody StartTaskVO startTaskVO){
-		//此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
-		InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()));
-
-		//处理上报信息
-		if(businessData != null){
-			//设置业务数据ID
-			startTaskVO.setIds(businessData.getId().toString());
-			return this.batchTask(startTaskVO);
-		}
-		return R.data(300,false,"上报失败");
-	}
-
-	/**
-	 * 本地验签
-	 */
-	@PostMapping("/localVerify")
-	@ApiOperationSupport(order = 21)
-	@ApiOperation(value = "本地验签")
-	public R<Boolean> localVerify(@RequestParam String ids){
-		System.out.println(ids);
-		return R.data(false);
-	}
+        return R.data(300, false, "被复制节点未找到业务数据");
+    }
+
+    /**
+     * 单个废除
+     */
+    @PostMapping("/abolishOne")
+    @ApiOperationSupport(order = 24)
+    @ApiOperation(value = "单个废除")
+    public R<Boolean> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify) {
+        //查询填报状态
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify));
+        if (businessData != null) {
+            //使用批量废除接口
+            return this.batchAbolish(businessData.getId().toString());
+        }
+        return R.data(300, false, "废除失败,未找到业务数据");
+    }
+
+    /**
+     * 查询节点状态
+     */
+    @PostMapping("/queryNodeStatus")
+    @ApiOperationSupport(order = 23)
+    @ApiOperation(value = "/查询节点状态")
+    public R<String> queryNodeStatus(@RequestParam String primaryKeyId, @RequestParam String classify) {
+        //记录状态
+        String status = "1";
+        //查询填报状态
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).ne(InformationQuery::getType, 3));
+        if (businessData != null) {
+            switch (businessData.getStatus()) {
+                case 0:
+                case 3:
+                    //0属于未上报,3属于已废除,统一为待上报
+                    status = "2";
+                    break;
+                case 1:
+                case 2:
+                    //1属于待审批,2属于已审批,统一为已上报
+                    status = "3";
+                    break;
+                default:
+                    //如果不匹配,默认为未填报
+                    status = "1";
+                    //查询表格
+                    List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
+                    if (tableList != null && tableList.size() > 0) {
+                        for (WbsTreeContract table : tableList) {
+                            if (new Integer("2").equals(table.getIsTabPdf())) {
+                                //这些表格中,但凡有一个能够预览,就开放预览
+                                status = "2";
+                                break;
+                            }
+                        }
+                    }
+                    break;
+            }
+        } else {
+            //查询表格
+            List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
+            if (tableList != null && tableList.size() > 0) {
+                for (WbsTreeContract table : tableList) {
+                    if (new Integer("2").equals(table.getIsTabPdf())) {
+                        //这些表格中,但凡有一个能够预览,就开放预览
+                        status = "2";
+                        break;
+                    }
+                }
+            }
+        }
+
+        return R.data(status);
+    }
+
+    /**
+     * 填报页单个上报
+     */
+    @PostMapping("/taskOne")
+    @ApiOperationSupport(order = 22)
+    @ApiOperation(value = "填报页单个上报")
+    public R<Boolean> taskOne(@RequestBody StartTaskVO startTaskVO) {
+        //此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()));
+
+        //处理上报信息
+        if (businessData != null) {
+            //设置业务数据ID
+            startTaskVO.setIds(businessData.getId().toString());
+            return this.batchTask(startTaskVO);
+        }
+        return R.data(300, false, "上报失败");
+    }
+
+    /**
+     * 本地验签
+     */
+    @PostMapping("/localVerify")
+    @ApiOperationSupport(order = 21)
+    @ApiOperation(value = "本地验签")
+    public R<Boolean> localVerify(@RequestParam String ids) {
+        System.out.println(ids);
+        return R.data(false);
+    }
 
     /**
      * 在线验签
@@ -498,14 +504,14 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperationSupport(order = 21)
     @ApiOperation(value = "在线验签")
     public R<CertBeanVO> onlineVerify(@RequestParam String ids) {
-    	//查询业务数据
-		InformationQuery query = this.informationQueryService.getById(ids);
-    	if(query != null && (StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl()))){
-			CertBeanVO reVO = this.eVisaClient.onlineCheckSeal(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
-			if(reVO != null){
-				return R.data(reVO, reVO.getCertBeanVOList().size() > 0 ? "校验成功" : "未找到签字信息");
-			}
-		}
+        //查询业务数据
+        InformationQuery query = this.informationQueryService.getById(ids);
+        if (query != null && (StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl()))) {
+            CertBeanVO reVO = this.eVisaClient.onlineCheckSeal(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+            if (reVO != null) {
+                return R.data(reVO, reVO.getCertBeanVOList().size() > 0 ? "校验成功" : "未找到签字信息");
+            }
+        }
         return R.data(300, null, "校验失败");
     }
 
@@ -516,49 +522,49 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperationSupport(order = 20)
     @ApiOperation(value = "批量打印")
     public R<String> batchPrint(@RequestParam String ids) {
-		//获取勾选的数据
-    	List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(ids.split(",")));
-		//pdf集合
-		List<String> pdfList = new ArrayList<>();
-
-		//获取配置的路径
-		String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-
-    	for(InformationQuery query : queries){
-    		switch (query.getType()){
-				case 1:
-					//资料填报
-					pdfList.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
-					break;
-				case 3:
-					//首件,需要查出关联的数据
-					//先存放本表
-					pdfList.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
-					//存放关联表
-					pdfList.add(query.getLinkMergePdfUrl());
-					//查询总结报告
-					InformationQueryFile linkFile = this.informationQueryFileService.getOne(Wrappers.<InformationQueryFile>lambdaQuery().eq(InformationQueryFile::getQueryId, query.getId()));
-					if(linkFile != null){
-						pdfList.add(linkFile.getPdfUrl());
-					}
-					break;
-				default:
-					break;
-			}
-		}
-		//去掉空元素
-		pdfList.removeIf(StringUtils::isEmpty);
-
-    	//执行合并
-		String mergeName = SnowFlakeUtil.getId() + ".pdf", mergeUrl = file_path + "/print//" + mergeName;
-		FileUtils.mergePdfPublicMethods(pdfList, mergeUrl);
-
-		//上传
-		BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
-		if(StringUtils.isNotEmpty(bladeFile.getLink())){
-			//执行本地文件删除
-			CommonUtil.removeFile(Arrays.asList(mergeUrl.split(",")));
-		}
+        //获取勾选的数据
+        List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(ids.split(",")));
+        //pdf集合
+        List<String> pdfList = new ArrayList<>();
+
+        //获取配置的路径
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+
+        for (InformationQuery query : queries) {
+            switch (query.getType()) {
+                case 1:
+                    //资料填报
+                    pdfList.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+                    break;
+                case 3:
+                    //首件,需要查出关联的数据
+                    //先存放本表
+                    pdfList.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+                    //存放关联表
+                    pdfList.add(query.getLinkMergePdfUrl());
+                    //查询总结报告
+                    InformationQueryFile linkFile = this.informationQueryFileService.getOne(Wrappers.<InformationQueryFile>lambdaQuery().eq(InformationQueryFile::getQueryId, query.getId()));
+                    if (linkFile != null) {
+                        pdfList.add(linkFile.getPdfUrl());
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+        //去掉空元素
+        pdfList.removeIf(StringUtils::isEmpty);
+
+        //执行合并
+        String mergeName = SnowFlakeUtil.getId() + ".pdf", mergeUrl = file_path + "/print//" + mergeName;
+        FileUtils.mergePdfPublicMethods(pdfList, mergeUrl);
+
+        //上传
+        BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+        if (StringUtils.isNotEmpty(bladeFile.getLink())) {
+            //执行本地文件删除
+            CommonUtil.removeFile(Arrays.asList(mergeUrl.split(",")));
+        }
 
         return R.data(bladeFile.getLink());
     }
@@ -570,1258 +576,1273 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperationSupport(order = 19)
     @ApiOperation(value = "批量下载")
     public void batchDownloadFileToZip(String ids, HttpServletResponse response) {
-    	if(StringUtils.isNotEmpty(ids)){
-    		//获取文件
-			List<InformationQuery> result = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids.split(","))));
-			if(result != null && result.size() > 0){
-				//删除掉pdfUrl和eVisaPdfUrl都为空的数据
-				result.removeIf(query -> StringUtils.isEmpty(query.getPdfUrl()) && StringUtils.isEmpty(query.getPdfUrl()));
-				if(result.size() > 0){
-					List<String> urls = new ArrayList<>();
-					result.forEach(query -> urls.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() + "@@@" + query.getName() + "-" + query.getId() : query.getPdfUrl() + "@@@" + query.getName() + "-" + query.getId()));
-					//删除空数据
-					urls.removeIf(StringUtils::isEmpty);
-					//打包下载
-					FileUtils.batchDownloadFileToZip(urls, response);
-				}
-			}
-		}
-	}
-
-	/**
-	 * 批量废除
-	 */
-	@PostMapping("/batchAbolish")
-	@ApiOperationSupport(order = 18)
-	@ApiOperation(value = "批量废除")
-	public R<Boolean> batchAbolish(@RequestParam String ids){
-		//获取所有相关任务记录
-		List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
-		if(taskList != null && taskList.size() > 0){
-			try{
-				//执行废除
-				for(Task task : taskList){
-					if(new Integer("1").equals(task.getStatus())){
-						//正在审批,调用废除
-						this.taskClient.abolishTask(task);
-					} else if(new Integer("2").equals(task.getStatus())) {
-						//已审批的任务,修改业务数据的审批状态为未上报并撤签即可
-						LambdaUpdateWrapper<InformationQuery> wrapper = Wrappers.lambdaUpdate();
-						//更改状态为未上报
-						wrapper.set(InformationQuery::getStatus, 0);
-						//将电签的pdf路径置空
-						wrapper.set(InformationQuery::getEVisaPdfUrl, null);
-						//将上报批次置空
-						wrapper.set(InformationQuery::getReportNumber, null);
-						//置空审批人
-						wrapper.set(InformationQuery::getAuditUserIdAndName, null);
-
-						this.informationQueryService.update(wrapper.in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
-					}
-
-					List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
-					String title = "批量废除";
-					if(queries != null && queries.size() > 0){
-						title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
-
-						List<Long> projectIds = queries.stream().map(InformationQuery::getProjectId).distinct().collect(Collectors.toList());
-						List<Long> contractIds = queries.stream().map(InformationQuery::getContractId).distinct().collect(Collectors.toList());
-
-						List<ProjectInfo> projects = this.projectClient.queryProjectList(JSONArray.parseArray(JSONObject.toJSONString(projectIds), String.class));
-						List<ContractInfo> contracts = this.contractClient.getContractByIds(contractIds);
-
-						Map<String, ProjectInfo> projectMap = new HashMap<>();
-						Map<String, ContractInfo> contractMap = new HashMap<>();
-						projects.forEach(project -> projectMap.put(project.getId().toString(), project));
-						contracts.forEach(contract -> contractMap.put(contract.getId().toString(), contract));
-
-						//获取当前任务的环节审批人
-						List<TaskParallel> linkList = this.taskClient.queryApprovalUserByTaskId(task.getProcessInstanceId());
-
-						for(InformationQuery query : queries){
-							if(StringUtils.isNotEmpty(query.getFileUserIdAndName())){
-								String[] userArray = query.getFileUserIdAndName().split(",");
-								for(String str : userArray){
-									String[] strs = str.split("-");
-									try{
-										String projectName = "", contractName = "";
-										if(projectMap.containsKey(query.getProjectId().toString())){
-											ProjectInfo project = projectMap.get(query.getProjectId().toString());
-											projectName = StringUtils.isNotEmpty(project.getProjectAlias()) ? project.getProjectAlias() : project.getProjectName();
-										}
-										if(contractMap.containsKey(query.getContractId().toString())){
-											ContractInfo contract = contractMap.get(query.getContractId().toString());
-											contractName = contract.getContractName();
-										}
-
-
-										//保存通知记录
-										this.messageWarningClient.savePushUserMessageWarning(
-												new MessageWarningVO(
-														query.getProjectId(),
-														query.getContractId(),
-														//废除通知
-														3,
-														//内容
-														projectName + contractName + "的用户【" + AuthUtil.getNickName() + "】废除了【" + query.getName() + "】",
-														//推送的目标人
-														Long.parseLong(strs[0]),
-														//默认未读
-														0
-												));
-									}catch (Exception e){
-										e.printStackTrace();
-									}
-								}
-							}
-
-							if(linkList != null && linkList.size() > 0){
-								ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(task.getProjectId())).get(0);
-								ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(task.getContractId()));
-
-								List<MessageWarningVO> messageList = new ArrayList<>();
-								for(TaskParallel taskParallel : linkList){
-									messageList.add(new MessageWarningVO(
-											Long.parseLong(task.getProjectId()),
-											Long.parseLong(task.getContractId()),
-											//废除通知
-											3,
-											//内容
-											(StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户" + AuthUtil.getNickName() + "废除了【" + query.getName() + "】流程,请及时查看",
-											//推送的目标人
-											Long.parseLong(taskParallel.getTaskUser()),
-											//默认未读
-											0
-									));
-								}
-								if(messageList.size() > 0){
-									this.messageWarningClient.savePushUserMessageWarning(messageList);
-								}
-							}
-
-						}
-					}
-
-					try{
-						JSONObject json = new JSONObject();
-						json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
-						json.put("operationObjName", title);
-
-						//保存操作记录
-						this.operationLogClient.saveUserOperationLog(6, "资料管理", "工序资料", json);
-					}catch (Exception e){
-						e.printStackTrace();
-					}
-				}
-				return R.data(true, "废除成功");
-			}catch (Exception e){
-				e.printStackTrace();
-				return R.data(300, false, "废除失败");
-			}
-		}
-		return R.data(300, false, "废除失败");
-	}
-
-	/**
-	 * 批量上报
-	 */
-	@PostMapping("/batchTask")
-	@ApiOperationSupport(order = 17)
-	@ApiOperation(value = "批量上报")
-	public R<Boolean> batchTask(@RequestBody StartTaskVO startTaskVO){
-		if(StringUtils.isNotEmpty(startTaskVO.getIds())){
-			//获取数据源id
-			String[] ids = startTaskVO.getIds().split(",");
-			if(ids.length > 0){
-				List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids)));
-				Map<String, String> queryMap = new HashMap<>();
-				queryList.forEach(query -> queryMap.put(query.getId().toString(), query.getName()));
-				try{
-					for(String id : ids){
-						//生成任务实体
-						TaskVO taskVO = new TaskVO();
-						BeanUtils.copyProperties(startTaskVO, taskVO);
-						if(taskVO.getUserTasks() != null && taskVO.getUserTasks().size() > 0){
-							//标记为自定义流程
-							taskVO.setFixedFlowId(Long.parseLong("0"));
-						}
-						//设置任务名称
-						if(StringUtils.isNotEmpty(queryMap.get(id))){
-							taskVO.setTaskName(queryMap.get(id));
-						}
-						//设置数据源指向
-						taskVO.setFormDataId(id);
-						//设置上报类型
-						taskVO.setApprovalType(1);
-						//上报
-						if(this.taskClient.startTask(taskVO).getData()){
-							LambdaUpdateWrapper<InformationQuery> wrappers = Wrappers.lambdaUpdate();
-							wrappers.set(InformationQuery::getReportNumber, taskVO.getBatch()).set(InformationQuery::getStatus, 1);
-
-							//查询审批人
-							List<TaskParallel> taskUsers = this.taskClient.queryApprovalUser(id);
-							if(taskUsers.size() > 0){
-								//生成审批人信息
-								StringBuilder stringBuilder = new StringBuilder();
-								taskUsers.forEach(users -> stringBuilder.append(",").append(users.getTaskUser()).append("-").append(users.getTaskUserName()));
-								//设置审批人
-								wrappers.set(InformationQuery::getAuditUserIdAndName, stringBuilder.substring(1));
-							}
-							wrappers.eq(InformationQuery::getId, id);
-
-							//修改记录
-							this.informationQueryService.update(wrappers);
-						}
-					}
-				}catch (Exception e){
-					e.printStackTrace();
-					return R.data(300, false, "上报失败");
-				}
-
-				List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(startTaskVO.getIds().split(",")));
-				String title = "批量上报";
-				if(queries != null && queries.size() > 0){
-					title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
-				}
-
-				try{
-					//保存操作记录
-					JSONObject json = new JSONObject();
-					json.put("operationObjIds", Func.toStrList(startTaskVO.getIds()));
-					json.put("operationObjName", title);
-
-					this.operationLogClient.saveUserOperationLog(5, "资料管理", "工序资料", json);
-				}catch (Exception e){
-					e.printStackTrace();
-				}
-				return R.data(true);
-			}
-		}
-		return R.data(false);
-	}
-
-	/**
-	 * 自定义排序
-	 */
-	@PostMapping("/diySort")
-	@ApiOperationSupport(order = 16)
-	@ApiOperation(value = "自定义排序")
-	public R<Boolean> diySort(@RequestBody DiySortVO vo){
-		//获取排序集合
-		List<String> sortList = vo.getSortList();
-		if(sortList.size() > 0){
-			for(int i = 0, l = sortList.size(); i < l; i ++){
-				try{
-					WbsTreeContract newData = new WbsTreeContract();
-					newData.setPKeyId(Long.parseLong(sortList.get(i)));
-					newData.setSort(i);
-					//修改排序
-					this.wbsTreeContractClient.updateContractNodeParameter(newData);
-				}catch (Exception e){
-					e.printStackTrace();
-				}
-			}
-		}
-
-		return R.data(false);
-	}
-
-	/**
-	 * 复制节点
-	 */
-	@PostMapping("/copyContractTreeNode")
-	@ApiOperationSupport(order = 15)
-	@ApiOperation(value = "复制节点")
-	public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo){
-
-		//首先查询需要复制的节点及其下级所有子节点的信息
-		WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
-
-		//获取当前合同段所有节点
-		List<WbsTreeContract> allContractNodeList = this.wbsTreeContractClient.searchContractTree(needCopyNode.getContractId());
-
-		//设置父子节点关系
-		Map<String, List<WbsTreeContract>> contractAllNodeMap = new HashMap<>();
-		if(allContractNodeList != null && allContractNodeList.size() > 0){
-			allContractNodeList.forEach(contractTree -> {
-				List<WbsTreeContract> parentList;
-				if(contractAllNodeMap.containsKey(contractTree.getParentId().toString())){
-					parentList = contractAllNodeMap.get(contractTree.getParentId().toString());
-				} else {
-					parentList = new ArrayList<>();
-				}
-				parentList.add(contractTree);
-				contractAllNodeMap.put(contractTree.getParentId().toString(), parentList);
-
-				if(!contractAllNodeMap.containsKey(contractTree.getId().toString())){
-					contractAllNodeMap.put(contractTree.getId().toString(), new ArrayList<>());
-				}
-
-			});
-		}
-
-		List<WbsTreeContract> parentList = new ArrayList<>(), childList = new ArrayList<>(), allList = new ArrayList<>(), saveList = new ArrayList<>();
-		//新增施工台账
-		List<ConstructionLedger> saveLedger = new ArrayList<>();
-
-		parentList.add(needCopyNode);
-
-		//查询所有有效子节点
-		this.foreachQueryChildContract(parentList, childList, contractAllNodeMap);
-		allList.addAll(parentList);
-		allList.addAll(childList);
-
-		if("1".equals(vo.getCopyType())){
-			if(StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())){
-				WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
-
-				//重塑关键信息
-				Map<Long,Long> oldToNewIdMap = new HashMap<>();
-				//节点信息
-				Map<String, WbsTreeContract> nodeMap = new HashMap<>();
-				allList.forEach(node -> {
-					oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
-					nodeMap.put(node.getId().toString(), node);
-				});
-				//todo 单份复制
-				allList.forEach(node -> {
-					WbsTreeContract newData = new WbsTreeContract();
-					BeanUtils.copyProperties(node, newData);
-
-					//重塑关键信息
-					//重塑primaryKeyId
-					newData.setPKeyId(SnowFlakeUtil.getId());
-					//设置旧ID
-					newData.setOldId(node.getId().toString());
-					//设置新ID
-					if(new Integer("1").equals(node.getType())){
-						//如果是节点类型才重塑ID
-						newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
-					}
-					//设置父节点ID
-					if(vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())){
-						//找到复制的节点,将parentId更改为 parent.getId()
-						newData.setParentId(parent.getId());
-						//设置新名称
-						newData.setNodeName(vo.getNeedCopyNodeName());
-						newData.setFullName(vo.getNeedCopyNodeName());
-					} else {
-						newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
-					}
-					newData.setCreateTime(new Date());
-					newData.setUpdateTime(new Date());
-					//初始化是否显示表格,默认显示
-					newData.setIsBussShow(1);
-					//初始化表格是否上传附件,默认未上传
-					newData.setTabFileType(1);
-					//初始化单表是否可以预览,默认不能
-					newData.setIsTabPdf(1);
-					//初始化PDF路径
-					newData.setPdfUrl(null);
-					newData.setCreateUser(AuthUtil.getUserId());
-
-					//重塑父节点关联关系
-					this.restoreParent(newData, oldToNewIdMap);
-
-					//保存到集合中
-					saveList.add(newData);
-
-					if(new Integer("6").equals(node.getNodeType())){
-						//生成施工日志
-						this.createLedger(newData, saveLedger, nodeMap, null);
-					}
-				});
-			}
-
-		} else {
-			//todo 多份复制
-			//获取需要复制到的位置集合
-			List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
-			if(copyBatches.size() > 0){
-				copyBatches.forEach(copyBatch -> {
-					//查询复制到的位置信息
-					WbsTreeContract copyPath = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
-
-					//重塑关键信息
-					Map<Long,Long> oldToNewIdMap = new HashMap<>();
-					Map<String, WbsTreeContract> nodeMap = new HashMap<>();
-					allList.forEach(node -> {
-						oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
-						nodeMap.put(node.getId().toString(), node);
-					});
-
-					allList.forEach(node -> {
-						WbsTreeContract newData = new WbsTreeContract();
-						BeanUtils.copyProperties(node, newData);
-
-						//重塑关键信息
-						//设置旧ID
-						newData.setOldId(StringUtils.isNotEmpty(node.getOldId()) ? node.getOldId() : node.getId().toString());
-						//重塑primaryKeyId
-						newData.setPKeyId(SnowFlakeUtil.getId());
-						//设置新ID
-						if(new Integer("1").equals(node.getType())){
-							newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
-						}
-						//设置父节点ID
-						if(vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())){
-							//找到复制的节点,将parentId更改为 parent.getId()
-							newData.setParentId(copyPath.getId());
-							//设置新名称
-							newData.setNodeName(copyBatch.getNodeName());
-							newData.setFullName(copyBatch.getNodeName());
-						} else {
-							newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
-						}
-						newData.setCreateTime(new Date());
-						newData.setUpdateTime(new Date());
-						newData.setCreateUser(AuthUtil.getUserId());
-						//初始化是否显示表格,默认显示
-						newData.setIsBussShow(1);
-						//初始化表格是否上传附件,默认未上传
-						newData.setTabFileType(1);
-						//初始化单表是否可以预览,默认不能
-						newData.setIsTabPdf(1);
-						//初始化PDF路径
-						newData.setPdfUrl(null);
-
-						//重塑父节点关联关系
-						this.restoreParent(newData, oldToNewIdMap);
-
-						//保存到集合中
-						saveList.add(newData);
-
-						if(new Integer("6").equals(node.getNodeType())){
-							//生成施工日志
-							this.createLedger(newData, saveLedger, nodeMap, null);
-						}
-					});
-
-				});
-			}
-		}
-		return this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
-	}
-
-	/**
-	 * 重塑父节点链
-	 */
-	private void restoreParent(WbsTreeContract newData, Map<Long,Long> oldToNewIdMap){
-		String ancestors = newData.getAncestors();
-		if(StringUtils.isNotEmpty(ancestors)){
-			//重组后的链表
-			StringBuilder stringBuilder = new StringBuilder();
-			//拆分重组
-			String[] ancestorsArray = ancestors.split(",");
-			for(String oldParentId : ancestorsArray){
-				if(StringUtils.isNotEmpty(oldParentId)){
-					//获取新的
-					Long newParentId = oldToNewIdMap.get(Long.parseLong(oldParentId));
-					//如果新的id为空,说明不变
-					stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
-				}
-			}
-			//将新链表设置进对象中
-			newData.setAncestors(stringBuilder.substring(1));
-		}
-	}
-
-	/**
-	 * 生成施工日志记录
-	 */
-	private void createLedger(WbsTreeContract newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreePrivate> projectNodeMap){
-		//工序,需要新增施工台账
-		ConstructionLedger ledger = new ConstructionLedger();
-		//获取这个节点的原始信息
-		if(contractNodeMap != null){
-			if(contractNodeMap.containsKey(newData.getOldId())){
-				WbsTreeContract contractNode = contractNodeMap.get(newData.getOldId());
-				if(contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())){
-					WbsTreeContract parentNode;
-					if(contractNodeMap.containsKey(contractNode.getParentId().toString())){
-						parentNode = contractNodeMap.get(contractNode.getParentId().toString());
-					} else {
-						parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(contractNode.getContractId()), contractNode.getParentId());
-					}
-
-					if(parentNode != null){
-						ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
-					}
-				}
-			}
-		} else if(projectNodeMap != null) {
-			if(projectNodeMap.containsKey(newData.getOldId())){
-				WbsTreePrivate contractNode = projectNodeMap.get(newData.getOldId());
-				if(contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())){
-					WbsTreePrivate parentNode;
-					if(projectNodeMap.containsKey(contractNode.getParentId().toString())){
-						parentNode = projectNodeMap.get(contractNode.getParentId().toString());
-					} else {
-						parentNode = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(contractNode.getProjectId(), contractNode.getParentId());
-					}
-					if(parentNode != null){
-						ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
-					}
-				}
-			}
-		}
-
-		ledger.setSite(StringUtils.isNotEmpty(newData.getFullName()) ? newData.getFullName() : newData.getNodeName());
-		ledger.setIsBeton(newData.getIsConcrete());
-		ledger.setWbsId(newData.getPKeyId());
-		ledger.setContractId(Long.parseLong(newData.getContractId()));
-		ledger.setProjectId(Long.parseLong(newData.getProjectId()));
-		ledger.setCreateTime(new Date());
-		ledger.setCreateUser(AuthUtil.getUserId());
-		ledger.setIsDeleted(0);
-		saveLedger.add(ledger);
-	}
-
-	/**
-	 * 循环查询子节点
-	 * @param parentList 父节点集合
-	 * @param childList 保存集合
-	 */
-	private void foreachQueryChildContract(List<WbsTreeContract> parentList, List<WbsTreeContract> childList, Map<String, List<WbsTreeContract>> contractAllNodeMap){
-		parentList.forEach(parent -> {
-			List<WbsTreeContract> childs;
-			if(contractAllNodeMap.containsKey(parent.getId().toString())){
-				childs = contractAllNodeMap.get(parent.getId().toString());
-			} else {
-				childs = new ArrayList<>();
-			}
-			if(childs.size() <= 0){
-				if(!Arrays.asList("1,2,3,4".split(",")).contains(parent.getMajorDataType().toString())){
-					childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable", "");
-				} else {
-					childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable", "");
-				}
-			}
-
-			if(childs != null && childs.size() > 0){
-				//添加入结果集
-				childList.addAll(childs);
-
-				//还有子级,继续向下
-				this.foreachQueryChildContract(childs, childList, contractAllNodeMap);
-			}
-
-		});
-
-	}
-
-	/**
-	 * 导图结构树节点查询
-	 * @return 结果
-	 */
-	@GetMapping("/queryMappingStructureTree")
-	@ApiOperationSupport(order = 14)
-	@ApiOperation(value = "导图结构树节点查询")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "parentId", value = "父节点,首次进入传0、null、''", required = true),
-			@ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
-		List<WbsTreeContractTreeVOS> result = this.queryContractTree(parentId, contractId, contractIdRelation);
-		if(result.size() == 1){
-			//只有一个子节点,继续向下
-			int size;
-			WbsTreeContractTreeVOS vos = result.get(0);
-			do {
-				try{
-					List<WbsTreeContractTreeVOS> childResult = this.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation());
-
-					vos.setChildren(childResult);
-					size = childResult.size();
-					if(size != 1){
-						break;
-					}
-
-					vos = childResult.get(0);
-				}catch (Exception e){
-					e.printStackTrace();
-					break;
-				}
-
-			} while (true);
-		}
-
-		//获取合同段,检查是否是监理/业主合同段
-		ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
-
-		if((new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) && StringUtils.isEmpty(contractIdRelation) && StringUtils.isEmpty(parentId)){
-			//给个顶点
-			WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
-			vos.setTitle(contractInfo.getContractName());
-			vos.setChildren(result);
-			result = new ArrayList<>();
-			result.add(vos);
-		}
-
-		return R.data(result);
-	}
-
-	/**
-	 * 修改节点信息
-	 * @return 修改结果
-	 */
-	@PostMapping("/updateContractNodeParameter")
-	@ApiOperationSupport(order = 13)
-	@ApiOperation(value = "修改节点信息")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "pKeyId", value = "节点的primaryKeyId", required = true),
-			@ApiImplicitParam(name = "nodeName", value = "节点的title", required = true),
-			@ApiImplicitParam(name = "partitionCode", value = "划分编号")
-	})
-	public R<Boolean> updateContractNodeParameter(@RequestParam Long pKeyId, @RequestParam String nodeName, @RequestParam String partitionCode){
-		WbsTreeContract node = new WbsTreeContract();
-		node.setPKeyId(pKeyId);
-		node.setNodeName(nodeName);
-		node.setPartitionCode(partitionCode);
-
-		//只允许修改节点名称
-		if(StringUtils.isEmpty(node.getNodeName()) || "null".equals(String.valueOf(node.getPKeyId())) || StringUtils.isEmpty(String.valueOf(node.getPKeyId()))){
-			return R.data(-1, false , "缺少参数");
-		}
-
-		WbsTreeContract queries = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(pKeyId);
-
-		//保存操作记录
-		try{
-			JSONObject json = new JSONObject();
-			json.put("operationObjIds", Func.toStrList(pKeyId.toString()));
-			json.put("operationObjName", StringUtils.isNotEmpty(queries.getFullName()) ? queries.getFullName() : queries.getNodeName());
-
-			this.operationLogClient.saveUserOperationLog(3, "资料管理", "工序资料", json);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-
-		return R.data(this.wbsTreeContractClient.updateContractNodeParameter(node));
-	}
-
-	/**
-	 * 获取节点信息
-	 * @param primaryKeyId 节点的primaryKeyId
-	 * @return 节点信息
-	 */
-	@GetMapping("/getContractNodeByPrimaryKeyId")
-	@ApiOperationSupport(order = 12)
-	@ApiOperation(value = "获取节点信息")
-	@ApiImplicitParam(name = "primaryKeyId", value = "节点的primaryKeyId")
-	public R<WbsTreeContract> getContractNodeByPrimaryKeyId(@RequestParam String primaryKeyId){
-		return R.data(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId));
-	}
-
-	/**
-	 * 获取所有父节点
-	 */
-	private void currentNodeAllParent(StringBuilder nodeName, WbsTreeContract currentNode){
-		if(!"0".equals(String.valueOf(currentNode.getParentId()))){
-			//如果父节点不是0说明没到顶层
-			WbsTreeContract parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(currentNode.getContractId()), currentNode.getParentId());
-			if(parentNode != null){
-				nodeName.append("-").append(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
-				this.currentNodeAllParent(nodeName, parentNode);
-			}
-		}
-	}
-
-	/**
-	 * 删除节点
-	 * @param ids 节点的primaryKeyId(只有一个值)
-	 * @return 删除结果
-	 */
-	@PostMapping("/removeContractTreeNode")
-	@ApiOperationSupport(order = 11)
-	@ApiOperation(value = "删除节点")
-	@ApiImplicitParam(name = "ids", value = "节点的primaryKeyId")
-	public R<Boolean> removeContractTreeNode(@RequestParam String ids){
-		//根据传入的节点,将其所有子节点删除
-		WbsTreeContract removeNode = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(ids));
-		//查询当前操作的节点的父级关系
-		StringBuilder parentNodeName = new StringBuilder();
+        if (StringUtils.isNotEmpty(ids)) {
+            //获取文件
+            List<InformationQuery> result = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids.split(","))));
+            if (result != null && result.size() > 0) {
+                //删除掉pdfUrl和eVisaPdfUrl都为空的数据
+                result.removeIf(query -> StringUtils.isEmpty(query.getPdfUrl()) && StringUtils.isEmpty(query.getPdfUrl()));
+                if (result.size() > 0) {
+                    List<String> urls = new ArrayList<>();
+                    result.forEach(query -> urls.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() + "@@@" + query.getName() + "-" + query.getId() : query.getPdfUrl() + "@@@" + query.getName() + "-" + query.getId()));
+                    //删除空数据
+                    urls.removeIf(StringUtils::isEmpty);
+                    //打包下载
+                    FileUtils.batchDownloadFileToZip(urls, response);
+                }
+            }
+        }
+    }
+
+    /**
+     * 批量废除
+     */
+    @PostMapping("/batchAbolish")
+    @ApiOperationSupport(order = 18)
+    @ApiOperation(value = "批量废除")
+    public R<Boolean> batchAbolish(@RequestParam String ids) {
+        //获取所有相关任务记录
+        List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
+        if (taskList != null && taskList.size() > 0) {
+            try {
+                //执行废除
+                for (Task task : taskList) {
+                    if (new Integer("1").equals(task.getStatus())) {
+                        //正在审批,调用废除
+                        this.taskClient.abolishTask(task);
+                    } else if (new Integer("2").equals(task.getStatus())) {
+                        //已审批的任务,修改业务数据的审批状态为未上报并撤签即可
+                        LambdaUpdateWrapper<InformationQuery> wrapper = Wrappers.lambdaUpdate();
+                        //更改状态为未上报
+                        wrapper.set(InformationQuery::getStatus, 0);
+                        //将电签的pdf路径置空
+                        wrapper.set(InformationQuery::getEVisaPdfUrl, null);
+                        //将上报批次置空
+                        wrapper.set(InformationQuery::getReportNumber, null);
+                        //置空审批人
+                        wrapper.set(InformationQuery::getAuditUserIdAndName, null);
+
+                        this.informationQueryService.update(wrapper.in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
+                    }
+
+                    List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
+                    String title = "批量废除";
+                    if (queries != null && queries.size() > 0) {
+                        title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
+
+                        List<Long> projectIds = queries.stream().map(InformationQuery::getProjectId).distinct().collect(Collectors.toList());
+                        List<Long> contractIds = queries.stream().map(InformationQuery::getContractId).distinct().collect(Collectors.toList());
+
+                        List<ProjectInfo> projects = this.projectClient.queryProjectList(JSONArray.parseArray(JSONObject.toJSONString(projectIds), String.class));
+                        List<ContractInfo> contracts = this.contractClient.getContractByIds(contractIds);
+
+                        Map<String, ProjectInfo> projectMap = new HashMap<>();
+                        Map<String, ContractInfo> contractMap = new HashMap<>();
+                        projects.forEach(project -> projectMap.put(project.getId().toString(), project));
+                        contracts.forEach(contract -> contractMap.put(contract.getId().toString(), contract));
+
+                        //获取当前任务的环节审批人
+                        List<TaskParallel> linkList = this.taskClient.queryApprovalUserByTaskId(task.getProcessInstanceId());
+
+                        for (InformationQuery query : queries) {
+                            if (StringUtils.isNotEmpty(query.getFileUserIdAndName())) {
+                                String[] userArray = query.getFileUserIdAndName().split(",");
+                                for (String str : userArray) {
+                                    String[] strs = str.split("-");
+                                    try {
+                                        String projectName = "", contractName = "";
+                                        if (projectMap.containsKey(query.getProjectId().toString())) {
+                                            ProjectInfo project = projectMap.get(query.getProjectId().toString());
+                                            projectName = StringUtils.isNotEmpty(project.getProjectAlias()) ? project.getProjectAlias() : project.getProjectName();
+                                        }
+                                        if (contractMap.containsKey(query.getContractId().toString())) {
+                                            ContractInfo contract = contractMap.get(query.getContractId().toString());
+                                            contractName = contract.getContractName();
+                                        }
+
+
+                                        //保存通知记录
+                                        this.messageWarningClient.savePushUserMessageWarning(
+                                                new MessageWarningVO(
+                                                        query.getProjectId(),
+                                                        query.getContractId(),
+                                                        //废除通知
+                                                        3,
+                                                        //内容
+                                                        projectName + contractName + "的用户【" + AuthUtil.getNickName() + "】废除了【" + query.getName() + "】",
+                                                        //推送的目标人
+                                                        Long.parseLong(strs[0]),
+                                                        //默认未读
+                                                        0
+                                                ));
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                            }
+
+                            if (linkList != null && linkList.size() > 0) {
+                                ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(task.getProjectId())).get(0);
+                                ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(task.getContractId()));
+
+                                List<MessageWarningVO> messageList = new ArrayList<>();
+                                for (TaskParallel taskParallel : linkList) {
+                                    messageList.add(new MessageWarningVO(
+                                            Long.parseLong(task.getProjectId()),
+                                            Long.parseLong(task.getContractId()),
+                                            //废除通知
+                                            3,
+                                            //内容
+                                            (StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户" + AuthUtil.getNickName() + "废除了【" + query.getName() + "】流程,请及时查看",
+                                            //推送的目标人
+                                            Long.parseLong(taskParallel.getTaskUser()),
+                                            //默认未读
+                                            0
+                                    ));
+                                }
+                                if (messageList.size() > 0) {
+                                    this.messageWarningClient.savePushUserMessageWarning(messageList);
+                                }
+                            }
+
+                        }
+                    }
+
+                    try {
+                        JSONObject json = new JSONObject();
+                        json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
+                        json.put("operationObjName", title);
+
+                        //保存操作记录
+                        this.operationLogClient.saveUserOperationLog(6, "资料管理", "工序资料", json);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                return R.data(true, "废除成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return R.data(300, false, "废除失败");
+            }
+        }
+        return R.data(300, false, "废除失败");
+    }
+
+    /**
+     * 批量上报
+     */
+    @PostMapping("/batchTask")
+    @ApiOperationSupport(order = 17)
+    @ApiOperation(value = "批量上报")
+    public R<Boolean> batchTask(@RequestBody StartTaskVO startTaskVO) {
+        if (StringUtils.isNotEmpty(startTaskVO.getIds())) {
+            //获取数据源id
+            String[] ids = startTaskVO.getIds().split(",");
+            if (ids.length > 0) {
+                List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids)));
+                Map<String, String> queryMap = new HashMap<>();
+                queryList.forEach(query -> queryMap.put(query.getId().toString(), query.getName()));
+                try {
+                    for (String id : ids) {
+                        //生成任务实体
+                        TaskVO taskVO = new TaskVO();
+                        BeanUtils.copyProperties(startTaskVO, taskVO);
+                        if (taskVO.getUserTasks() != null && taskVO.getUserTasks().size() > 0) {
+                            //标记为自定义流程
+                            taskVO.setFixedFlowId(Long.parseLong("0"));
+                        }
+                        //设置任务名称
+                        if (StringUtils.isNotEmpty(queryMap.get(id))) {
+                            taskVO.setTaskName(queryMap.get(id));
+                        }
+                        //设置数据源指向
+                        taskVO.setFormDataId(id);
+                        //设置上报类型
+                        taskVO.setApprovalType(1);
+                        //上报
+                        if (this.taskClient.startTask(taskVO).getData()) {
+                            LambdaUpdateWrapper<InformationQuery> wrappers = Wrappers.lambdaUpdate();
+                            wrappers.set(InformationQuery::getReportNumber, taskVO.getBatch()).set(InformationQuery::getStatus, 1);
+
+                            //查询审批人
+                            List<TaskParallel> taskUsers = this.taskClient.queryApprovalUser(id);
+                            if (taskUsers.size() > 0) {
+                                //生成审批人信息
+                                StringBuilder stringBuilder = new StringBuilder();
+                                taskUsers.forEach(users -> stringBuilder.append(",").append(users.getTaskUser()).append("-").append(users.getTaskUserName()));
+                                //设置审批人
+                                wrappers.set(InformationQuery::getAuditUserIdAndName, stringBuilder.substring(1));
+                            }
+                            wrappers.eq(InformationQuery::getId, id);
+
+                            //修改记录
+                            this.informationQueryService.update(wrappers);
+                        }
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    return R.data(300, false, "上报失败");
+                }
+
+                List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(startTaskVO.getIds().split(",")));
+                String title = "批量上报";
+                if (queries != null && queries.size() > 0) {
+                    title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
+                }
+
+                try {
+                    //保存操作记录
+                    JSONObject json = new JSONObject();
+                    json.put("operationObjIds", Func.toStrList(startTaskVO.getIds()));
+                    json.put("operationObjName", title);
+
+                    this.operationLogClient.saveUserOperationLog(5, "资料管理", "工序资料", json);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                return R.data(true);
+            }
+        }
+        return R.data(false);
+    }
+
+    /**
+     * 自定义排序
+     */
+    @PostMapping("/diySort")
+    @ApiOperationSupport(order = 16)
+    @ApiOperation(value = "自定义排序")
+    public R<Boolean> diySort(@RequestBody DiySortVO vo) {
+        //获取排序集合
+        List<String> sortList = vo.getSortList();
+        if (sortList.size() > 0) {
+            for (int i = 0, l = sortList.size(); i < l; i++) {
+                try {
+                    WbsTreeContract newData = new WbsTreeContract();
+                    newData.setPKeyId(Long.parseLong(sortList.get(i)));
+                    newData.setSort(i);
+                    //修改排序
+                    this.wbsTreeContractClient.updateContractNodeParameter(newData);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        return R.data(false);
+    }
+
+    /**
+     * 复制节点
+     */
+    @PostMapping("/copyContractTreeNode")
+    @ApiOperationSupport(order = 15)
+    @ApiOperation(value = "复制节点")
+    public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
+
+        //首先查询需要复制的节点及其下级所有子节点的信息
+        WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
+
+        //获取当前合同段所有节点
+        List<WbsTreeContract> allContractNodeList = this.wbsTreeContractClient.searchContractTree(needCopyNode.getContractId());
+
+        //设置父子节点关系
+        Map<String, List<WbsTreeContract>> contractAllNodeMap = new HashMap<>();
+        if (allContractNodeList != null && allContractNodeList.size() > 0) {
+            allContractNodeList.forEach(contractTree -> {
+                List<WbsTreeContract> parentList;
+                if (contractAllNodeMap.containsKey(contractTree.getParentId().toString())) {
+                    parentList = contractAllNodeMap.get(contractTree.getParentId().toString());
+                } else {
+                    parentList = new ArrayList<>();
+                }
+                parentList.add(contractTree);
+                contractAllNodeMap.put(contractTree.getParentId().toString(), parentList);
+
+                if (!contractAllNodeMap.containsKey(contractTree.getId().toString())) {
+                    contractAllNodeMap.put(contractTree.getId().toString(), new ArrayList<>());
+                }
+
+            });
+        }
+
+        List<WbsTreeContract> parentList = new ArrayList<>(), childList = new ArrayList<>(), allList = new ArrayList<>(), saveList = new ArrayList<>();
+        //新增施工台账
+        List<ConstructionLedger> saveLedger = new ArrayList<>();
+
+        parentList.add(needCopyNode);
+
+        //查询所有有效子节点
+        this.foreachQueryChildContract(parentList, childList, contractAllNodeMap);
+        allList.addAll(parentList);
+        allList.addAll(childList);
+
+        if ("1".equals(vo.getCopyType())) {
+            if (StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())) {
+                WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
+
+                //重塑关键信息
+                Map<Long, Long> oldToNewIdMap = new HashMap<>();
+                //节点信息
+                Map<String, WbsTreeContract> nodeMap = new HashMap<>();
+                allList.forEach(node -> {
+                    oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
+                    nodeMap.put(node.getId().toString(), node);
+                });
+                //todo 单份复制
+                allList.forEach(node -> {
+                    WbsTreeContract newData = new WbsTreeContract();
+                    BeanUtils.copyProperties(node, newData);
+
+                    //重塑关键信息
+                    //重塑primaryKeyId
+                    newData.setPKeyId(SnowFlakeUtil.getId());
+                    //设置旧ID
+                    newData.setOldId(node.getId().toString());
+                    //设置新ID
+                    if (new Integer("1").equals(node.getType())) {
+                        //如果是节点类型才重塑ID
+                        newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
+                    }
+                    //设置父节点ID
+                    if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
+                        //找到复制的节点,将parentId更改为 parent.getId()
+                        newData.setParentId(parent.getId());
+                        //设置新名称
+                        newData.setNodeName(vo.getNeedCopyNodeName());
+                        newData.setFullName(vo.getNeedCopyNodeName());
+                    } else {
+                        newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
+                    }
+                    newData.setCreateTime(new Date());
+                    newData.setUpdateTime(new Date());
+                    //初始化是否显示表格,默认显示
+                    newData.setIsBussShow(1);
+                    //初始化表格是否上传附件,默认未上传
+                    newData.setTabFileType(1);
+                    //初始化单表是否可以预览,默认不能
+                    newData.setIsTabPdf(1);
+                    //初始化PDF路径
+                    newData.setPdfUrl(null);
+                    newData.setCreateUser(AuthUtil.getUserId());
+
+                    //重塑父节点关联关系
+                    this.restoreParent(newData, oldToNewIdMap);
+
+                    //保存到集合中
+                    saveList.add(newData);
+
+                    if (new Integer("6").equals(node.getNodeType())) {
+                        //生成施工日志
+                        this.createLedger(newData, saveLedger, nodeMap, null);
+                    }
+                });
+            }
+
+        } else {
+            //todo 多份复制
+            //获取需要复制到的位置集合
+            List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
+            if (copyBatches.size() > 0) {
+                copyBatches.forEach(copyBatch -> {
+                    //查询复制到的位置信息
+                    WbsTreeContract copyPath = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
+
+                    //重塑关键信息
+                    Map<Long, Long> oldToNewIdMap = new HashMap<>();
+                    Map<String, WbsTreeContract> nodeMap = new HashMap<>();
+                    allList.forEach(node -> {
+                        oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
+                        nodeMap.put(node.getId().toString(), node);
+                    });
+
+                    allList.forEach(node -> {
+                        WbsTreeContract newData = new WbsTreeContract();
+                        BeanUtils.copyProperties(node, newData);
+
+                        //重塑关键信息
+                        //设置旧ID
+                        newData.setOldId(StringUtils.isNotEmpty(node.getOldId()) ? node.getOldId() : node.getId().toString());
+                        //重塑primaryKeyId
+                        newData.setPKeyId(SnowFlakeUtil.getId());
+                        //设置新ID
+                        if (new Integer("1").equals(node.getType())) {
+                            newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
+                        }
+                        //设置父节点ID
+                        if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
+                            //找到复制的节点,将parentId更改为 parent.getId()
+                            newData.setParentId(copyPath.getId());
+                            //设置新名称
+                            newData.setNodeName(copyBatch.getNodeName());
+                            newData.setFullName(copyBatch.getNodeName());
+                        } else {
+                            newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
+                        }
+                        newData.setCreateTime(new Date());
+                        newData.setUpdateTime(new Date());
+                        newData.setCreateUser(AuthUtil.getUserId());
+                        //初始化是否显示表格,默认显示
+                        newData.setIsBussShow(1);
+                        //初始化表格是否上传附件,默认未上传
+                        newData.setTabFileType(1);
+                        //初始化单表是否可以预览,默认不能
+                        newData.setIsTabPdf(1);
+                        //初始化PDF路径
+                        newData.setPdfUrl(null);
+
+                        //重塑父节点关联关系
+                        this.restoreParent(newData, oldToNewIdMap);
+
+                        //保存到集合中
+                        saveList.add(newData);
+
+                        if (new Integer("6").equals(node.getNodeType())) {
+                            //生成施工日志
+                            this.createLedger(newData, saveLedger, nodeMap, null);
+                        }
+                    });
+
+                });
+            }
+        }
+        return this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
+    }
+
+    /**
+     * 重塑父节点链
+     */
+    private void restoreParent(WbsTreeContract newData, Map<Long, Long> oldToNewIdMap) {
+        String ancestors = newData.getAncestors();
+        if (StringUtils.isNotEmpty(ancestors)) {
+            //重组后的链表
+            StringBuilder stringBuilder = new StringBuilder();
+            //拆分重组
+            String[] ancestorsArray = ancestors.split(",");
+            for (String oldParentId : ancestorsArray) {
+                if (StringUtils.isNotEmpty(oldParentId)) {
+                    //获取新的
+                    Long newParentId = oldToNewIdMap.get(Long.parseLong(oldParentId));
+                    //如果新的id为空,说明不变
+                    stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
+                }
+            }
+            //将新链表设置进对象中
+            newData.setAncestors(stringBuilder.substring(1));
+        }
+    }
+
+    /**
+     * 生成施工日志记录
+     */
+    private void createLedger(WbsTreeContract newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreePrivate> projectNodeMap) {
+        //工序,需要新增施工台账
+        ConstructionLedger ledger = new ConstructionLedger();
+        //获取这个节点的原始信息
+        if (contractNodeMap != null) {
+            if (contractNodeMap.containsKey(newData.getOldId())) {
+                WbsTreeContract contractNode = contractNodeMap.get(newData.getOldId());
+                if (contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())) {
+                    WbsTreeContract parentNode;
+                    if (contractNodeMap.containsKey(contractNode.getParentId().toString())) {
+                        parentNode = contractNodeMap.get(contractNode.getParentId().toString());
+                    } else {
+                        parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(contractNode.getContractId()), contractNode.getParentId());
+                    }
+
+                    if (parentNode != null) {
+                        ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
+                    }
+                }
+            }
+        } else if (projectNodeMap != null) {
+            if (projectNodeMap.containsKey(newData.getOldId())) {
+                WbsTreePrivate contractNode = projectNodeMap.get(newData.getOldId());
+                if (contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())) {
+                    WbsTreePrivate parentNode;
+                    if (projectNodeMap.containsKey(contractNode.getParentId().toString())) {
+                        parentNode = projectNodeMap.get(contractNode.getParentId().toString());
+                    } else {
+                        parentNode = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(contractNode.getProjectId(), contractNode.getParentId());
+                    }
+                    if (parentNode != null) {
+                        ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
+                    }
+                }
+            }
+        }
+
+        ledger.setSite(StringUtils.isNotEmpty(newData.getFullName()) ? newData.getFullName() : newData.getNodeName());
+        ledger.setIsBeton(newData.getIsConcrete());
+        ledger.setWbsId(newData.getPKeyId());
+        ledger.setContractId(Long.parseLong(newData.getContractId()));
+        ledger.setProjectId(Long.parseLong(newData.getProjectId()));
+        ledger.setCreateTime(new Date());
+        ledger.setCreateUser(AuthUtil.getUserId());
+        ledger.setIsDeleted(0);
+        saveLedger.add(ledger);
+    }
+
+    /**
+     * 循环查询子节点
+     *
+     * @param parentList 父节点集合
+     * @param childList  保存集合
+     */
+    private void foreachQueryChildContract(List<WbsTreeContract> parentList, List<WbsTreeContract> childList, Map<String, List<WbsTreeContract>> contractAllNodeMap) {
+        parentList.forEach(parent -> {
+            List<WbsTreeContract> childs;
+            if (contractAllNodeMap.containsKey(parent.getId().toString())) {
+                childs = contractAllNodeMap.get(parent.getId().toString());
+            } else {
+                childs = new ArrayList<>();
+            }
+            if (childs.size() <= 0) {
+                if (!Arrays.asList("1,2,3,4".split(",")).contains(parent.getMajorDataType().toString())) {
+                    childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable", "");
+                } else {
+                    childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable", "");
+                }
+            }
+
+            if (childs != null && childs.size() > 0) {
+                //添加入结果集
+                childList.addAll(childs);
+
+                //还有子级,继续向下
+                this.foreachQueryChildContract(childs, childList, contractAllNodeMap);
+            }
+
+        });
+
+    }
+
+    /**
+     * 导图结构树节点查询
+     *
+     * @return 结果
+     */
+    @GetMapping("/queryMappingStructureTree")
+    @ApiOperationSupport(order = 14)
+    @ApiOperation(value = "导图结构树节点查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "parentId", value = "父节点,首次进入传0、null、''", required = true),
+            @ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+        List<WbsTreeContractTreeVOS> result = this.queryContractTree(parentId, contractId, contractIdRelation);
+        if (result.size() == 1) {
+            //只有一个子节点,继续向下
+            int size;
+            WbsTreeContractTreeVOS vos = result.get(0);
+            do {
+                try {
+                    List<WbsTreeContractTreeVOS> childResult = this.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation());
+
+                    vos.setChildren(childResult);
+                    size = childResult.size();
+                    if (size != 1) {
+                        break;
+                    }
+
+                    vos = childResult.get(0);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    break;
+                }
+
+            } while (true);
+        }
+
+        //获取合同段,检查是否是监理/业主合同段
+        ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
+
+        if ((new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) && StringUtils.isEmpty(contractIdRelation) && StringUtils.isEmpty(parentId)) {
+            //给个顶点
+            WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+            vos.setTitle(contractInfo.getContractName());
+            vos.setChildren(result);
+            result = new ArrayList<>();
+            result.add(vos);
+        }
+
+        return R.data(result);
+    }
+
+    /**
+     * 修改节点信息
+     *
+     * @return 修改结果
+     */
+    @PostMapping("/updateContractNodeParameter")
+    @ApiOperationSupport(order = 13)
+    @ApiOperation(value = "修改节点信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pKeyId", value = "节点的primaryKeyId", required = true),
+            @ApiImplicitParam(name = "nodeName", value = "节点的title", required = true),
+            @ApiImplicitParam(name = "partitionCode", value = "划分编号")
+    })
+    public R<Boolean> updateContractNodeParameter(@RequestParam Long pKeyId, @RequestParam String nodeName, @RequestParam String partitionCode) {
+        WbsTreeContract node = new WbsTreeContract();
+        node.setPKeyId(pKeyId);
+        node.setNodeName(nodeName);
+        node.setPartitionCode(partitionCode);
+
+        //只允许修改节点名称
+        if (StringUtils.isEmpty(node.getNodeName()) || "null".equals(String.valueOf(node.getPKeyId())) || StringUtils.isEmpty(String.valueOf(node.getPKeyId()))) {
+            return R.data(-1, false, "缺少参数");
+        }
+
+        WbsTreeContract queries = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(pKeyId);
+
+        //保存操作记录
+        try {
+            JSONObject json = new JSONObject();
+            json.put("operationObjIds", Func.toStrList(pKeyId.toString()));
+            json.put("operationObjName", StringUtils.isNotEmpty(queries.getFullName()) ? queries.getFullName() : queries.getNodeName());
+
+            this.operationLogClient.saveUserOperationLog(3, "资料管理", "工序资料", json);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return R.data(this.wbsTreeContractClient.updateContractNodeParameter(node));
+    }
+
+    /**
+     * 获取节点信息
+     *
+     * @param primaryKeyId 节点的primaryKeyId
+     * @return 节点信息
+     */
+    @GetMapping("/getContractNodeByPrimaryKeyId")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "获取节点信息")
+    @ApiImplicitParam(name = "primaryKeyId", value = "节点的primaryKeyId")
+    public R<WbsTreeContract> getContractNodeByPrimaryKeyId(@RequestParam String primaryKeyId) {
+        return R.data(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId));
+    }
+
+    /**
+     * 获取所有父节点
+     */
+    private void currentNodeAllParent(StringBuilder nodeName, WbsTreeContract currentNode) {
+        if (!"0".equals(String.valueOf(currentNode.getParentId()))) {
+            //如果父节点不是0说明没到顶层
+            WbsTreeContract parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(currentNode.getContractId()), currentNode.getParentId());
+            if (parentNode != null) {
+                nodeName.append("-").append(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
+                this.currentNodeAllParent(nodeName, parentNode);
+            }
+        }
+    }
+
+    /**
+     * 删除节点
+     *
+     * @param ids 节点的primaryKeyId(只有一个值)
+     * @return 删除结果
+     */
+    @PostMapping("/removeContractTreeNode")
+    @ApiOperationSupport(order = 11)
+    @ApiOperation(value = "删除节点")
+    @ApiImplicitParam(name = "ids", value = "节点的primaryKeyId")
+    public R<Boolean> removeContractTreeNode(@RequestParam String ids) {
+        //根据传入的节点,将其所有子节点删除
+        WbsTreeContract removeNode = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(ids));
+        //查询当前操作的节点的父级关系
+        StringBuilder parentNodeName = new StringBuilder();
         this.currentNodeAllParent(parentNodeName, removeNode);
 
-		//查询所有子节点
-		List<WbsTreeContract> removeNodeList = this.wbsTreeContractClient.queryCurrentNodeAllChild(Long.parseLong(removeNode.getContractId()), removeNode.getId());
-		//获取pKeyId
-		List<Long> removeList = removeNodeList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList());
-		//拼接
-		ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
-		//删除掉表格
+        //查询所有子节点
+        List<WbsTreeContract> removeNodeList = this.wbsTreeContractClient.queryCurrentNodeAllChild(Long.parseLong(removeNode.getContractId()), removeNode.getId());
+        //获取pKeyId
+        List<Long> removeList = removeNodeList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList());
+        //拼接
+        ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
+        //删除掉表格
         removeNodeList.removeIf(tree -> tree.getType() != null && new Integer("2").equals(tree.getType()));
-		//获取被删除节点名称
-		String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());
-
-		//获取当前节点下所有填报节点
-		List<QueryProcessDataVO> queryProcess = new ArrayList<>();
-		if(!Arrays.asList("1,2,3,4".split(",")).contains(removeNode.getMajorDataType().toString())){
-			queryProcess = this.informationQueryService.queryProcessDataByParentIdAndContractId(removeNode.getId().toString(), 1, removeNode.getContractId());
-			if(queryProcess == null || queryProcess.size() == 0){
-				//填报节点
-				queryProcess = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(removeNode.getPKeyId().toString(), 1);
-			}
-		}
-
-		if(queryProcess != null && queryProcess.size() > 0){
-			//检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
-			List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
-			List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
-			if(approvalList.size() > 0 || runTaskList.size() > 0){
-				//说明存在已经审批或已经上报的节点,不允许删除
-				return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
-			}
-		}
-
-		//保存操作记录
-		List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
-
-		JSONObject json = new JSONObject();
-		json.put("operationObjIds", idArray);
-		json.put("operationObjName", nodeName);
-		this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", json);
-
-		//保存进回收站
-		this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
-
-		return R.data(this.wbsTreeContractClient.removeContractTreeNode(idArray));
-	}
-
-	/**
-	 * 新增子节点
-	 * @return 新增结果
-	 */
-	@PostMapping("/saveContractTreeNode")
-	@ApiOperationSupport(order = 10)
-	@ApiOperation(value = "新增节点及其子节点")
-	public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo){
-		//先获取当前节点的信息
-		WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(vo.getCurrentNodePrimaryKeyId()));
-
-		//半选
-		List<AddContractTreeNodeVO.Node> halfSelectedNodeList = vo.getHalfSelectedList();
-		//全选
-		List<AddContractTreeNodeVO.Node> allSelectedNodeList = vo.getAllSelectedList();
-		//勾选的数据
-		List<AddContractTreeNodeVO.Node> selectList = new ArrayList<>();
-		selectList.addAll(halfSelectedNodeList);
-		selectList.addAll(allSelectedNodeList);
-
-		//所有相关节点集合
-		List<WbsTreePrivate> selectedNodeList = new ArrayList<>();
-
-		//检查新增类型
-		if("1".equals(vo.getSaveType())){
-			//todo 当前节点及其子节点
-			//当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
-			if(allSelectedNodeList.size() > 0){
-				//查询数据
-				selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
-
-				//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
-				List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
-
-				List<WbsTreePrivate> childList = new ArrayList<>();
-				if(submitNodeList.size() > 0){
-					this.foreachQueryChild(submitNodeList, childList);
-					//将表格数据设置
-					selectedNodeList.addAll(childList);
-				}
-
-				if(childList.size() > 0){
-					//处理重复的数据
-					Iterator<WbsTreePrivate> iterator = childList.iterator();
-					while (iterator.hasNext()){
-						WbsTreePrivate next = iterator.next();
-						for(WbsTreePrivate treePrivate : selectedNodeList){
-							if(treePrivate.getPKeyId().equals(next.getPKeyId())){
-								//删掉重复数据
-								iterator.remove();
-								break;
-							}
-						}
-					}
-				}
-				//处理完重复数据后,设置进集合中
-				selectedNodeList.addAll(childList);
-			}
-
-			//处理半选
-			this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
-
-		} else {
-			//todo 仅当前节点操作
-			if(allSelectedNodeList.size() > 0){
-				//查询数据
-				selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
-
-				//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
-				List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
-
-				List<WbsTreePrivate> childList = new ArrayList<>();
-				if(submitNodeList.size() > 0){
-					this.foreachQueryChild(submitNodeList, childList);
-					//将表格数据设置
-					selectedNodeList.addAll(childList);
-				}
-			}
-			//处理半选
-			this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
-
-		}
-
-		//保存集合
-		List<WbsTreeContract> saveList = new ArrayList<>();
-		List<ConstructionLedger> saveLedger = new ArrayList<>();
-		if(selectedNodeList.size() > 0){
-			//重塑关键信息
-			Map<Long, Long> OldIdToNewIdMap = new HashMap<>();
-			Map<String, WbsTreePrivate> nodeMap = new HashMap<>();
-			selectedNodeList.forEach(half -> {
-				OldIdToNewIdMap.put(half.getId(), SnowFlakeUtil.getId());
-				nodeMap.put(half.getId().toString(), half);
-			});
-
-			//处理数据
-			selectedNodeList.forEach(half -> {
-				//处理合同段数据
-				WbsTreeContract newData = new WbsTreeContract();
-				BeanUtils.copyProperties(half, newData);
-
-				//重塑pKeyId、id和parentId
-				newData.setPKeyId(SnowFlakeUtil.getId());
-				if(new Integer("1").equals(half.getType())){
-					newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
-				}
-				newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
-				//记录旧ID
-				newData.setOldId(half.getId().toString());
-				//设置合同段等信息
-				newData.setWbsType(treeContract.getWbsType());
-				newData.setContractId(treeContract.getContractId());
-				newData.setContractIdRelation(treeContract.getContractIdRelation());
-				newData.setContractType(treeContract.getContractType());
-				newData.setCreateTime(new Date());
-				if(half.getType() != null && new Integer("2").equals(half.getType())){
-					newData.setIsTypePrivatePid(half.getPKeyId());
-				}
-
-				//设置节点名称
-				for(AddContractTreeNodeVO.Node addVO : selectList){
-					if(half.getPKeyId().toString().equals(addVO.getPrimaryKeyId())){
-						if(StringUtils.isNotEmpty(addVO.getNodeName())){
-							newData.setFullName(addVO.getNodeName());
-						}
-						break;
-					}
-				}
-
-				//重塑父节点关联关系
-				String ancestors = newData.getAncestors();
-				if(StringUtils.isNotEmpty(ancestors)){
-					//重组后的链表
-					StringBuilder stringBuilder = new StringBuilder();
-					//拆分重组
-					String[] ancestorsArray = ancestors.split(",");
-					for(String oldParentId : ancestorsArray){
-						if(StringUtils.isNotEmpty(oldParentId)){
-							//获取新的
-							Long newParentId = OldIdToNewIdMap.get(Long.parseLong(oldParentId));
-							//如果新的id为空,说明不变
-							stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
-						}
-					}
-					//将新链表设置进对象中
-					newData.setAncestors(stringBuilder.substring(1));
-				}
-
-				//设置名称
-				Iterator<AddContractTreeNodeVO.Node> iterator = selectList.iterator();
-				while (iterator.hasNext()){
-					AddContractTreeNodeVO.Node next = iterator.next();
-					if(next.getPrimaryKeyId().equals(half.getPKeyId().toString())){
-						newData.setFullName(next.getNodeName());
-						iterator.remove();
-						break;
-					}
-				}
-
-				//设置到保存集合中
-				saveList.add(newData);
-
-				if(new Integer("6").equals(newData.getNodeType())){
-					//生成施工日志
-					this.createLedger(newData, saveLedger, null, nodeMap);
-				}
-
-			});
-		}
-
-		return this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
-	}
-
-	private List<WbsTreePrivate> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract){
-		//获取主键
-		List<String> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
-		//查询数据
-		List<WbsTreePrivate> selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
-		//剔除与当前操作节点相同的ID
-		selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
-
-		return selectedNodeList;
-	}
-
-	@NotNull
-	private R<Boolean> saveOrCopyNodeTree(List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer operationType, WbsTreeContract currentNode) {
-		if(saveList.size() > 0){
-			//保存施工日志
-			if(saveLedger.size() > 0){
-				this.constructionLedgerService.saveBatch(saveLedger);
-			}
-
-			try{
-				//获取当前节点的所有父节点
-				List<WbsTreeContract> result = new ArrayList<>();
-				result.add(currentNode);
-				this.queryParentNode(currentNode, result);
-				StringBuilder pathName = new StringBuilder();
-				for(int i = 1, l = result.size(); i <= l; i ++){
-					WbsTreeContract node = result.get(result.size() - i);
-					pathName.append("-").append(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
-				}
-
-				JSONObject json = new JSONObject();
-				json.put("operationObjIds", JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class));
-				json.put("operationObjName", pathName.substring(1));
-				//保存操作记录
-				this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料", json);
-
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-			//保存节点
-			return R.data(this.wbsTreeContractClient.saveBatch(saveList));
-		}
-
-		return R.data(false);
-	}
-
-	private void queryParentNode(WbsTreeContract currentNode, List<WbsTreeContract> result){
-		WbsTreeContract parentNode = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(currentNode.getParentId(), Long.parseLong(currentNode.getContractId()));
-		if(parentNode != null){
-			result.add(parentNode);
-			this.queryParentNode(parentNode, result);
-		}
-	}
-
-	/**
-	 * 处理半选集合
-	 */
-	private void disposeHalfSelectList(@RequestBody WbsTreeContract treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
-		if(allSelectedNodeList != null && allSelectedNodeList.size() > 0){
-			//获取主键
-			List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
-			//查询对应数据
-			List<WbsTreePrivate> allSelectedNodeLists = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
-			//剔除与当前操作节点相同的ID
-			allSelectedNodeLists.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
-			//设置到集合中
-			selectedNodeList.addAll(allSelectedNodeLists);
-		}
-	}
-
-	/**
-	 * 循环查询子节点
-	 * @param parentList 父节点集合
-	 * @param childList 保存集合
-	 */
-	private void foreachQueryChild(List<WbsTreePrivate> parentList, List<WbsTreePrivate> childList){
-		parentList.forEach(parent -> {
-			List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
-
-			if(childs != null && childs.size() > 0){
-				//添加入结果集
-				childList.addAll(childs);
-				//继续向下检查子集
-				this.foreachQueryChild(childs, childList);
-			}
-		});
-	}
-
-	/**
-	 * 懒加载项目级工程划分树
-	 * @param projectId 项目ID
-	 * @param id 节点ID
-	 * @return 结果集
-	 */
-	@PostMapping("/queryWbsTreePrivateByProjectIdAndId")
-	@ApiOperationSupport(order = 9)
-	@ApiOperation(value = "懒加载项目级工程划分树")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "projectId", value = "项目ID"),
-			@ApiImplicitParam(name = "id", value = "点击节点ID")
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String projectId, @RequestParam String id){
-		List<WbsTreeContractTreeVOS> result = new ArrayList<>();
-
-		if(StringUtils.isNotEmpty(id)){
-			WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
-			WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(projectId, Long.parseLong(id));
-			//设置参数
-			vos.setId(wbsTreePrivate.getId());
-			vos.setKey(wbsTreePrivate.getId().toString());
-			vos.setPrimaryKeyId(wbsTreePrivate.getPKeyId().toString());
-			vos.setParentId(wbsTreePrivate.getParentId());
-			vos.setTitle(wbsTreePrivate.getNodeName());
-			vos.setType(wbsTreePrivate.getType());
-			vos.setWbsType(Integer.parseInt(wbsTreePrivate.getWbsType()));
-			//设置子级
-			vos.setChildren(this.wbsTreePrivateClient.queryWbsTreePrivateByProjectIdAndId(projectId, Long.parseLong(id)));
-			//添加进结果集合中
-			result.add(vos);
-		}
-
-		return R.data(result);
-	}
-
-	/**
-	 * 获取与当前节点平级的项目级节点
-	 * @param primaryKeyId 主键
-	 * @return 结果
-	 */
-	@PostMapping("/queryPeersNode")
-	@ApiOperationSupport(order = 8)
-	@ApiOperation(value = "获取与当前节点平级的项目级节点")
-	@ApiImplicitParam(name = "primaryKeyId", value = "需要新增子节点的节点ID,即当前点出菜单栏的节点ID")
-	public R<WbsTreePrivate> queryPeersNode(@RequestParam String primaryKeyId){
-		if(StringUtils.isEmpty(primaryKeyId) || "null".equals(primaryKeyId)){
-			return R.data(null);
-		}
-
-		//首先获取当前节点信息
-		WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(primaryKeyId));
-		//获取与其平级对应的项目级节点
-		WbsTreePrivate treePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
-
-		return R.data(treePrivate);
-	}
-
-
-	/**
-	 * 获取流程状态分类和文件类型分类
-	 */
-	@GetMapping("/getDictBizClassifyByCode")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "获取流程状态分类和文件类型分类")
-	@ApiImplicitParam(name = "code", value = "获取流程状态分类:flowTaskStatus;获取文件类型分类:fileType")
-	public R<List<DictBiz>> getDictBizClassifyByCode(@RequestParam String code){
-		return this.dictBizClient.getList(code, "notRoot");
-	}
-
-	/**
-	 * 获取当前合同段下所有的上报批次
-	 * @param contractId 合同段ID
-	 * @return 结果
-	 */
-	@GetMapping("/getReportNumberByContractId")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "获取当前合同段下所有的上报批次")
-	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId, String contractIdRelation){
-		//获取合同段信息
-		ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
-		return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), StringUtils.isNotEmpty(contractIdRelation) ? contractIdRelation : contractId));
-	}
-
-	/**
-	 * 根据合同段ID获取所有填报人
-	 * @param contractId 合同段ID
-	 * @return 填报人集合
-	 */
-	@GetMapping("/getFileUserByContractId")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "根据合同段ID获取所有填报人")
-	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	public R<List<FileUserVO>> getFileUserByContractId(@RequestParam String contractId){
-		//获取合同段信息
-		ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
-		return R.data(this.informationQueryService.queryFileUserByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
-	}
-
-	/**
-	 * 分页
-	 * @param vo 查询条件
-	 * @return 结果
-	 */
-	@PostMapping("/page")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "分页")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "size", value = "当前页条数", required = true),
-			@ApiImplicitParam(name = "current", value = "当前页", required = true),
-			@ApiImplicitParam(name = "wbsId", value = "节点ID", required = true),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<IPage<InformationQueryVO>> page(@RequestBody InformationQueryVO vo){
-		if("null".equals(String.valueOf(vo.getContractId())) || StringUtils.isEmpty(String.valueOf(vo.getContractId()))){
-			return R.data(-1, null, "数据查询失败");
-		}
-		//封装分页信息
-		Query query = new Query();
-		query.setSize(vo.getSize());
-		query.setCurrent(vo.getCurrent());
-		//获取合同段信息
-		ContractInfo contract = this.contractClient.getContractById(vo.getContractId());
-		vo.setClassify(StringUtils.isNotEmpty(vo.getClassifyType()) ? new Integer(vo.getClassifyType()) : contract.getContractType() == null ? 1 : new Integer("1").equals(contract.getContractType()) ? 1 : 2);
-
-		//获取所有
-		List<String> submitNodeKeyIds = new ArrayList<>();
-		//防止遗漏,将当前节点设置进集合中
-		submitNodeKeyIds.add(vo.getWbsId().toString());
-		//查询当前节点下的所有填报节点
-		WbsTreeContract node = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(vo.getWbsId());
-		if(node == null){
-			//这一步主要是为了兼容监理合同段
-			node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(vo.getWbsId(), Long.parseLong(vo.getContractIdRelation()));
-		}
-
-		if(!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
-			//不是工序,则查询当前节点下的所有填报节点
-			List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
-			if(StringUtils.isNotEmpty(vo.getIsFirst())){
-				//如果是首件列表请求,则删掉没有标记为首件的数据
-				queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
-			}
-			if(queryDataResult != null && queryDataResult.size() > 0){
-				submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
-			}
-		}
-		//设置进集合中
-		vo.setWbsIds(submitNodeKeyIds);
-		if(StringUtils.isNotEmpty(vo.getContractIdRelation())){
-			vo.setContractId(Long.valueOf(vo.getContractIdRelation()));
-		}
-
-		return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo));
-	}
-
-	/**
-	 * 获取当前合同段的划分树
-	 * @return 结果
-	 */
-	@GetMapping("/queryStandingBookContractWbsTree")
-	@ApiOperationSupport(order = 29)
-	@ApiOperation(value = "获取当前合同段的划分树")
-	@ApiImplicitParams(value = {
-			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryStandingBookContractWbsTree(@RequestParam String primaryKeyId,@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
-		if (StringUtils.isNotEmpty(primaryKeyId)){
-			parentId = primaryKeyId;
-		}
-		List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
-		rootTreeNode.removeIf(vos -> (vos.getNodeType() != null && vos.getNodeType() == 111));
-
-		return R.data(rootTreeNode);
-	}
-
-	/**
-	 * 获取当前合同段的划分树
-	 * @return 结果
-	 */
-	@GetMapping("/queryContractWbsTreeByContractIdAndType")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "获取当前合同段的划分树")
-	@ApiImplicitParams(value = {
-			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String primaryKeyId,@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
-		if (StringUtils.isNotEmpty(primaryKeyId)){
-			parentId = primaryKeyId;
-		}
-		return R.data(this.queryContractTree(parentId, contractId, contractIdRelation));
-	}
-
-	/**
-	 * 修改 
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "修改(只能修改编号和文件名)")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "name", value = "文件名称, 必须有值", required = true),
-			@ApiImplicitParam(name = "number", value = "文件编号,可以为空")
-	})
-	public R<Boolean> update(@Valid @RequestBody InformationQuery informationQuery) {
-		if("null".equals(String.valueOf(informationQuery.getId())) || StringUtils.isEmpty(String.valueOf(informationQuery.getId()))){
-			return R.data(-1, false, "数据操作失败");
-		}
-		return R.status(informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getName, informationQuery.getName()).set(InformationQuery::getNumber, informationQuery.getNumber()).eq(InformationQuery::getId, informationQuery.getId())));
-	}
-
-	
-	/**
-	 * 删除 
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(informationQueryService.deleteLogic(Func.toLongList(ids)));
-	}
-
-
-	/**
-	 * 首件wbs 树
-	 * @return 结果
-	 */
-	@GetMapping("/queryContractWbsTreeByFirstInfo")
-	@ApiOperationSupport(order = 28)
-	@ApiOperation(value = "首件wbs树")
-	@ApiImplicitParams(value = {
-			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
-			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	})
-	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByFirstInfo(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
-		List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
-		//查询被标记为首件的数据
-		rootTreeNode = rootTreeNode.stream().filter(WbsTreeContractTreeVOS::getIsFirst).collect(Collectors.toList());
-
-		return R.data(rootTreeNode);
-	}
-
-	/**
-	 * 查询合同段划分树公共代码
-	 */
-	private List<WbsTreeContractTreeVOS> queryContractTree(String parentId, String contractId, String contractIdRelation){
-		List<WbsTreeContractTreeVOS> rootTreeNode;
-
-		//获取合同段,检查是否是监理合同段
-		ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
-		if(new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())){
-			//监理/业主合同段,需要获取关联的施工方合同段根节点数据
-			List<String> contractIds = new ArrayList<>();
-			if(StringUtils.isEmpty(parentId)){
-				contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
-			} else {
-				contractIds.add(contractIdRelation);
-			}
-			if(contractIds.size() > 0){
-				rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, StringUtils.isNotEmpty(parentId) ? parentId : "0", 2);
-			} else {
-				rootTreeNode = new ArrayList<>();
-			}
-
-		} else {
-			//施工合同段
-			rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
-		}
-
-		return rootTreeNode;
-	}
+        //获取被删除节点名称
+        String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());
+
+        //获取当前节点下所有填报节点
+        List<QueryProcessDataVO> queryProcess = new ArrayList<>();
+        if (!Arrays.asList("1,2,3,4".split(",")).contains(removeNode.getMajorDataType().toString())) {
+            queryProcess = this.informationQueryService.queryProcessDataByParentIdAndContractId(removeNode.getId().toString(), 1, removeNode.getContractId());
+            if (queryProcess == null || queryProcess.size() == 0) {
+                //填报节点
+                queryProcess = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(removeNode.getPKeyId().toString(), 1);
+            }
+        }
+
+        if (queryProcess != null && queryProcess.size() > 0) {
+            //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
+            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
+            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
+            if (approvalList.size() > 0 || runTaskList.size() > 0) {
+                //说明存在已经审批或已经上报的节点,不允许删除
+                return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
+            }
+        }
+
+        //保存操作记录
+        List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
+
+        JSONObject json = new JSONObject();
+        json.put("operationObjIds", idArray);
+        json.put("operationObjName", nodeName);
+        this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", json);
+
+        //保存进回收站
+        this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
+
+        return R.data(this.wbsTreeContractClient.removeContractTreeNode(idArray));
+    }
+
+    /**
+     * 新增子节点
+     *
+     * @return 新增结果
+     */
+    @PostMapping("/saveContractTreeNode")
+    @ApiOperationSupport(order = 10)
+    @ApiOperation(value = "新增节点及其子节点")
+    public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
+        //先获取当前节点的信息
+        WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(vo.getCurrentNodePrimaryKeyId()));
+
+        //半选
+        List<AddContractTreeNodeVO.Node> halfSelectedNodeList = vo.getHalfSelectedList();
+        //全选
+        List<AddContractTreeNodeVO.Node> allSelectedNodeList = vo.getAllSelectedList();
+        //勾选的数据
+        List<AddContractTreeNodeVO.Node> selectList = new ArrayList<>();
+        selectList.addAll(halfSelectedNodeList);
+        selectList.addAll(allSelectedNodeList);
+
+        //所有相关节点集合
+        List<WbsTreePrivate> selectedNodeList = new ArrayList<>();
+
+        //检查新增类型
+        if ("1".equals(vo.getSaveType())) {
+            //todo 当前节点及其子节点
+            //当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
+            if (allSelectedNodeList.size() > 0) {
+                //查询数据
+                selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
+
+                //检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
+                List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
+
+                List<WbsTreePrivate> childList = new ArrayList<>();
+                if (submitNodeList.size() > 0) {
+                    this.foreachQueryChild(submitNodeList, childList);
+                    //将表格数据设置
+                    selectedNodeList.addAll(childList);
+                }
+
+                if (childList.size() > 0) {
+                    //处理重复的数据
+                    Iterator<WbsTreePrivate> iterator = childList.iterator();
+                    while (iterator.hasNext()) {
+                        WbsTreePrivate next = iterator.next();
+                        for (WbsTreePrivate treePrivate : selectedNodeList) {
+                            if (treePrivate.getPKeyId().equals(next.getPKeyId())) {
+                                //删掉重复数据
+                                iterator.remove();
+                                break;
+                            }
+                        }
+                    }
+                }
+                //处理完重复数据后,设置进集合中
+                selectedNodeList.addAll(childList);
+            }
+
+            //处理半选
+            this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
+
+        } else {
+            //todo 仅当前节点操作
+            if (allSelectedNodeList.size() > 0) {
+                //查询数据
+                selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
+
+                //检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
+                List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
+
+                List<WbsTreePrivate> childList = new ArrayList<>();
+                if (submitNodeList.size() > 0) {
+                    this.foreachQueryChild(submitNodeList, childList);
+                    //将表格数据设置
+                    selectedNodeList.addAll(childList);
+                }
+            }
+            //处理半选
+            this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
+
+        }
+
+        //保存集合
+        List<WbsTreeContract> saveList = new ArrayList<>();
+        List<ConstructionLedger> saveLedger = new ArrayList<>();
+        if (selectedNodeList.size() > 0) {
+            //重塑关键信息
+            Map<Long, Long> OldIdToNewIdMap = new HashMap<>();
+            Map<String, WbsTreePrivate> nodeMap = new HashMap<>();
+            selectedNodeList.forEach(half -> {
+                OldIdToNewIdMap.put(half.getId(), SnowFlakeUtil.getId());
+                nodeMap.put(half.getId().toString(), half);
+            });
+
+            //处理数据
+            selectedNodeList.forEach(half -> {
+                //处理合同段数据
+                WbsTreeContract newData = new WbsTreeContract();
+                BeanUtils.copyProperties(half, newData);
+
+                //重塑pKeyId、id和parentId
+                newData.setPKeyId(SnowFlakeUtil.getId());
+                if (new Integer("1").equals(half.getType())) {
+                    newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
+                }
+                newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
+                //记录旧ID
+                newData.setOldId(half.getId().toString());
+                //设置合同段等信息
+                newData.setWbsType(treeContract.getWbsType());
+                newData.setContractId(treeContract.getContractId());
+                newData.setContractIdRelation(treeContract.getContractIdRelation());
+                newData.setContractType(treeContract.getContractType());
+                newData.setCreateTime(new Date());
+                if (half.getType() != null && new Integer("2").equals(half.getType())) {
+                    newData.setIsTypePrivatePid(half.getPKeyId());
+                }
+
+                //设置节点名称
+                for (AddContractTreeNodeVO.Node addVO : selectList) {
+                    if (half.getPKeyId().toString().equals(addVO.getPrimaryKeyId())) {
+                        if (StringUtils.isNotEmpty(addVO.getNodeName())) {
+                            newData.setFullName(addVO.getNodeName());
+                        }
+                        break;
+                    }
+                }
+
+                //重塑父节点关联关系
+                String ancestors = newData.getAncestors();
+                if (StringUtils.isNotEmpty(ancestors)) {
+                    //重组后的链表
+                    StringBuilder stringBuilder = new StringBuilder();
+                    //拆分重组
+                    String[] ancestorsArray = ancestors.split(",");
+                    for (String oldParentId : ancestorsArray) {
+                        if (StringUtils.isNotEmpty(oldParentId)) {
+                            //获取新的
+                            Long newParentId = OldIdToNewIdMap.get(Long.parseLong(oldParentId));
+                            //如果新的id为空,说明不变
+                            stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
+                        }
+                    }
+                    //将新链表设置进对象中
+                    newData.setAncestors(stringBuilder.substring(1));
+                }
+
+                //设置名称
+                Iterator<AddContractTreeNodeVO.Node> iterator = selectList.iterator();
+                while (iterator.hasNext()) {
+                    AddContractTreeNodeVO.Node next = iterator.next();
+                    if (next.getPrimaryKeyId().equals(half.getPKeyId().toString())) {
+                        newData.setFullName(next.getNodeName());
+                        iterator.remove();
+                        break;
+                    }
+                }
+
+                //设置到保存集合中
+                saveList.add(newData);
+
+                if (new Integer("6").equals(newData.getNodeType())) {
+                    //生成施工日志
+                    this.createLedger(newData, saveLedger, null, nodeMap);
+                }
+
+            });
+        }
+
+        return this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
+    }
+
+    private List<WbsTreePrivate> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract) {
+        //获取主键
+        List<String> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
+        //查询数据
+        List<WbsTreePrivate> selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
+        //剔除与当前操作节点相同的ID
+        selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
+
+        return selectedNodeList;
+    }
+
+    @NotNull
+    private R<Boolean> saveOrCopyNodeTree(List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer operationType, WbsTreeContract currentNode) {
+        if (saveList.size() > 0) {
+            //保存施工日志
+            if (saveLedger.size() > 0) {
+                this.constructionLedgerService.saveBatch(saveLedger);
+            }
+
+            try {
+                //获取当前节点的所有父节点
+                List<WbsTreeContract> result = new ArrayList<>();
+                result.add(currentNode);
+                this.queryParentNode(currentNode, result);
+                StringBuilder pathName = new StringBuilder();
+                for (int i = 1, l = result.size(); i <= l; i++) {
+                    WbsTreeContract node = result.get(result.size() - i);
+                    pathName.append("-").append(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
+                }
+
+                JSONObject json = new JSONObject();
+                json.put("operationObjIds", JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class));
+                json.put("operationObjName", pathName.substring(1));
+                //保存操作记录
+                this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料", json);
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            //保存节点
+            return R.data(this.wbsTreeContractClient.saveBatch(saveList));
+        }
+
+        return R.data(false);
+    }
+
+    private void queryParentNode(WbsTreeContract currentNode, List<WbsTreeContract> result) {
+        WbsTreeContract parentNode = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(currentNode.getParentId(), Long.parseLong(currentNode.getContractId()));
+        if (parentNode != null) {
+            result.add(parentNode);
+            this.queryParentNode(parentNode, result);
+        }
+    }
+
+    /**
+     * 处理半选集合
+     */
+    private void disposeHalfSelectList(@RequestBody WbsTreeContract treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
+        if (allSelectedNodeList != null && allSelectedNodeList.size() > 0) {
+            //获取主键
+            List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
+            //查询对应数据
+            List<WbsTreePrivate> allSelectedNodeLists = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
+            //剔除与当前操作节点相同的ID
+            allSelectedNodeLists.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
+            //设置到集合中
+            selectedNodeList.addAll(allSelectedNodeLists);
+        }
+    }
+
+    /**
+     * 循环查询子节点
+     *
+     * @param parentList 父节点集合
+     * @param childList  保存集合
+     */
+    private void foreachQueryChild(List<WbsTreePrivate> parentList, List<WbsTreePrivate> childList) {
+        parentList.forEach(parent -> {
+            List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
+
+            if (childs != null && childs.size() > 0) {
+                //添加入结果集
+                childList.addAll(childs);
+                //继续向下检查子集
+                this.foreachQueryChild(childs, childList);
+            }
+        });
+    }
+
+    /**
+     * 懒加载项目级工程划分树
+     *
+     * @param projectId 项目ID
+     * @param id        节点ID
+     * @return 结果集
+     */
+    @PostMapping("/queryWbsTreePrivateByProjectIdAndId")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "懒加载项目级工程划分树")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectId", value = "项目ID"),
+            @ApiImplicitParam(name = "id", value = "点击节点ID")
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String projectId, @RequestParam String id) {
+        List<WbsTreeContractTreeVOS> result = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(id)) {
+            WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+            WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(projectId, Long.parseLong(id));
+            //设置参数
+            vos.setId(wbsTreePrivate.getId());
+            vos.setKey(wbsTreePrivate.getId().toString());
+            vos.setPrimaryKeyId(wbsTreePrivate.getPKeyId().toString());
+            vos.setParentId(wbsTreePrivate.getParentId());
+            vos.setTitle(wbsTreePrivate.getNodeName());
+            vos.setType(wbsTreePrivate.getType());
+            vos.setWbsType(Integer.parseInt(wbsTreePrivate.getWbsType()));
+            //设置子级
+            vos.setChildren(this.wbsTreePrivateClient.queryWbsTreePrivateByProjectIdAndId(projectId, Long.parseLong(id)));
+            //添加进结果集合中
+            result.add(vos);
+        }
+
+        return R.data(result);
+    }
+
+    /**
+     * 获取与当前节点平级的项目级节点
+     *
+     * @param primaryKeyId 主键
+     * @return 结果
+     */
+    @PostMapping("/queryPeersNode")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "获取与当前节点平级的项目级节点")
+    @ApiImplicitParam(name = "primaryKeyId", value = "需要新增子节点的节点ID,即当前点出菜单栏的节点ID")
+    public R<WbsTreePrivate> queryPeersNode(@RequestParam String primaryKeyId) {
+        if (StringUtils.isEmpty(primaryKeyId) || "null".equals(primaryKeyId)) {
+            return R.data(null);
+        }
+
+        //首先获取当前节点信息
+        WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(primaryKeyId));
+        //获取与其平级对应的项目级节点
+        WbsTreePrivate treePrivate = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
+
+        return R.data(treePrivate);
+    }
+
+
+    /**
+     * 获取流程状态分类和文件类型分类
+     */
+    @GetMapping("/getDictBizClassifyByCode")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "获取流程状态分类和文件类型分类")
+    @ApiImplicitParam(name = "code", value = "获取流程状态分类:flowTaskStatus;获取文件类型分类:fileType")
+    public R<List<DictBiz>> getDictBizClassifyByCode(@RequestParam String code) {
+        return this.dictBizClient.getList(code, "notRoot");
+    }
+
+    /**
+     * 获取当前合同段下所有的上报批次
+     *
+     * @param contractId 合同段ID
+     * @return 结果
+     */
+    @GetMapping("/getReportNumberByContractId")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "获取当前合同段下所有的上报批次")
+    @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId, String contractIdRelation) {
+        //获取合同段信息
+        ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
+        return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), StringUtils.isNotEmpty(contractIdRelation) ? contractIdRelation : contractId));
+    }
+
+    /**
+     * 根据合同段ID获取所有填报人
+     *
+     * @param contractId 合同段ID
+     * @return 填报人集合
+     */
+    @GetMapping("/getFileUserByContractId")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "根据合同段ID获取所有填报人")
+    @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    public R<List<FileUserVO>> getFileUserByContractId(@RequestParam String contractId) {
+        //获取合同段信息
+        ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
+        return R.data(this.informationQueryService.queryFileUserByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
+    }
+
+    /**
+     * 分页
+     *
+     * @param vo 查询条件
+     * @return 结果
+     */
+    @PostMapping("/page")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "分页")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "size", value = "当前页条数", required = true),
+            @ApiImplicitParam(name = "current", value = "当前页", required = true),
+            @ApiImplicitParam(name = "wbsId", value = "节点ID", required = true),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<IPage<InformationQueryVO>> page(@RequestBody InformationQueryVO vo) {
+        if ("null".equals(String.valueOf(vo.getContractId())) || StringUtils.isEmpty(String.valueOf(vo.getContractId()))) {
+            return R.data(-1, null, "数据查询失败");
+        }
+        //封装分页信息
+        Query query = new Query();
+        query.setSize(vo.getSize());
+        query.setCurrent(vo.getCurrent());
+        //获取合同段信息
+        ContractInfo contract = this.contractClient.getContractById(vo.getContractId());
+        vo.setClassify(StringUtils.isNotEmpty(vo.getClassifyType()) ? new Integer(vo.getClassifyType()) : contract.getContractType() == null ? 1 : new Integer("1").equals(contract.getContractType()) ? 1 : 2);
+
+        //获取所有
+        List<String> submitNodeKeyIds = new ArrayList<>();
+        //防止遗漏,将当前节点设置进集合中
+        submitNodeKeyIds.add(vo.getWbsId().toString());
+        //查询当前节点下的所有填报节点
+        WbsTreeContract node = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(vo.getWbsId());
+        if (node == null) {
+            //这一步主要是为了兼容监理合同段
+            node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(vo.getWbsId(), Long.parseLong(vo.getContractIdRelation()));
+        }
+
+        if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
+            //不是工序,则查询当前节点下的所有填报节点
+            List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
+            if (StringUtils.isNotEmpty(vo.getIsFirst())) {
+                //如果是首件列表请求,则删掉没有标记为首件的数据
+                queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
+            }
+            if (queryDataResult != null && queryDataResult.size() > 0) {
+                submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+            }
+        }
+        //设置进集合中
+        vo.setWbsIds(submitNodeKeyIds);
+        if (StringUtils.isNotEmpty(vo.getContractIdRelation())) {
+            vo.setContractId(Long.valueOf(vo.getContractIdRelation()));
+        }
+
+        return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo));
+    }
+
+    /**
+     * 获取当前合同段的划分树
+     *
+     * @return 结果
+     */
+    @GetMapping("/queryStandingBookContractWbsTree")
+    @ApiOperationSupport(order = 29)
+    @ApiOperation(value = "获取当前合同段的划分树")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryStandingBookContractWbsTree(@RequestParam String primaryKeyId, @RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+        if (StringUtils.isNotEmpty(primaryKeyId)) {
+            parentId = primaryKeyId;
+        }
+        List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
+        rootTreeNode.removeIf(vos -> (vos.getNodeType() != null && vos.getNodeType() == 111));
+
+        return R.data(rootTreeNode);
+    }
+
+    /**
+     * 获取当前合同段的划分树
+     *
+     * @return 结果
+     */
+    @GetMapping("/queryContractWbsTreeByContractIdAndType")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "获取当前合同段的划分树")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String primaryKeyId, @RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+        if (StringUtils.isNotEmpty(primaryKeyId)) {
+            parentId = primaryKeyId;
+        }
+        return R.data(this.queryContractTree(parentId, contractId, contractIdRelation));
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "修改(只能修改编号和文件名)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "文件名称, 必须有值", required = true),
+            @ApiImplicitParam(name = "number", value = "文件编号,可以为空")
+    })
+    public R<Boolean> update(@Valid @RequestBody InformationQuery informationQuery) {
+        if ("null".equals(String.valueOf(informationQuery.getId())) || StringUtils.isEmpty(String.valueOf(informationQuery.getId()))) {
+            return R.data(-1, false, "数据操作失败");
+        }
+        return R.status(informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getName, informationQuery.getName()).set(InformationQuery::getNumber, informationQuery.getNumber()).eq(InformationQuery::getId, informationQuery.getId())));
+    }
+
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+        return R.status(informationQueryService.deleteLogic(Func.toLongList(ids)));
+    }
+
+
+    /**
+     * 首件wbs 树
+     *
+     * @return 结果
+     */
+    @GetMapping("/queryContractWbsTreeByFirstInfo")
+    @ApiOperationSupport(order = 28)
+    @ApiOperation(value = "首件wbs树")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+    })
+    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByFirstInfo(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+        List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
+        //查询被标记为首件的数据
+        rootTreeNode = rootTreeNode.stream().filter(WbsTreeContractTreeVOS::getIsFirst).collect(Collectors.toList());
+
+        return R.data(rootTreeNode);
+    }
+
+    /**
+     * 查询合同段划分树公共代码
+     */
+    private List<WbsTreeContractTreeVOS> queryContractTree(String parentId, String contractId, String contractIdRelation) {
+        List<WbsTreeContractTreeVOS> rootTreeNode;
+
+        //获取合同段,检查是否是监理合同段
+        ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
+        if (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) {
+            //监理/业主合同段,需要获取关联的施工方合同段根节点数据
+            List<String> contractIds = new ArrayList<>();
+            if (StringUtils.isEmpty(parentId)) {
+                contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
+            } else {
+                contractIds.add(contractIdRelation);
+            }
+            if (contractIds.size() > 0) {
+                rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, StringUtils.isNotEmpty(parentId) ? parentId : "0", 2);
+            } else {
+                rootTreeNode = new ArrayList<>();
+            }
+
+        } else {
+            //施工合同段
+            rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
+        }
+
+        return rootTreeNode;
+    }
 
 }

+ 0 - 23
blade-service/blade-business/src/main/java/org/springblade/business/controller/UserViewProjectContractController.java

@@ -56,8 +56,6 @@ public class UserViewProjectContractController {
 
     private final SignPfxClient signPfxClient;
 
-    private final WbsInfoClient wbsInfoClient;
-
     /**
      * 获取用户信息
      */
@@ -132,20 +130,6 @@ public class UserViewProjectContractController {
             //获取当前所有合同段
             List<ContractInfo> contractInfos = this.contractClient.queryContractListByIds(longProjectIds);
 
-            //wbsType
-            List<ProjectInfoWbsTypeVO> wbsTypeVOList = new ArrayList<>();
-            for (ProjectInfo projectInfo : projectInfos) {
-                ProjectInfoWbsTypeVO projectInfoWbsTypeVO = new ProjectInfoWbsTypeVO();
-                Integer wbsType = wbsInfoClient.getWbsTypeByPrivateWbsId(projectInfo.getReferenceWbsTemplateId());
-                if (wbsType == null) {
-                    projectInfoWbsTypeVO.setWbsType(-1);
-                } else {
-                    projectInfoWbsTypeVO.setWbsType(wbsType);
-                }
-                projectInfoWbsTypeVO.setProjectId(projectInfo.getId());
-                wbsTypeVOList.add(projectInfoWbsTypeVO);
-            }
-
             //转换VO
             List<ProjectInfoVO> projectInfoVOS = JSONArray.parseArray(JSONObject.toJSONString(projectInfos), ProjectInfoVO.class);
             if (contractInfos != null && contractInfos.size() != 0) {
@@ -158,13 +142,6 @@ public class UserViewProjectContractController {
                 String finalDefaultContract = defaultContract;
 
                 projectInfoVOS.forEach(vo -> {
-                    //wbsType
-                    for (ProjectInfoWbsTypeVO projectInfoWbsTypeVO : wbsTypeVOList) {
-                        if (vo.getId().equals(projectInfoWbsTypeVO.getProjectId())) {
-                            vo.setWbsType(projectInfoWbsTypeVO.getWbsType());
-                        }
-                    }
-
                     //统一返回格式
                     vo.setName(vo.getProjectName());
                     vo.setIsDefault(StringUtils.isNotEmpty(finalDefaultProject) && vo.getId().toString().equals(finalDefaultProject) ? 1 : 0);

+ 1 - 4
blade-service/blade-business/src/main/java/org/springblade/business/service/IDefaultProjectService.java

@@ -17,16 +17,13 @@
 package org.springblade.business.service;
 
 import org.springblade.business.entity.DefaultProject;
-import org.springblade.business.vo.DefaultProjectVO;
 import org.springblade.core.mp.base.BaseService;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 
 /**
- *  服务类
+ * 服务类
  *
  * @author BladeX
  * @since 2022-07-06
  */
 public interface IDefaultProjectService extends BaseService<DefaultProject> {
-
 }

+ 0 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/DefaultProjectServiceImpl.java

@@ -17,12 +17,10 @@
 package org.springblade.business.service.impl;
 
 import org.springblade.business.entity.DefaultProject;
-import org.springblade.business.vo.DefaultProjectVO;
 import org.springblade.business.mapper.DefaultProjectMapper;
 import org.springblade.business.service.IDefaultProjectService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 
 /**
  *  服务实现类
@@ -32,5 +30,4 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
  */
 @Service
 public class DefaultProjectServiceImpl extends BaseServiceImpl<DefaultProjectMapper, DefaultProject> implements IDefaultProjectService {
-
 }

+ 10 - 7
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java

@@ -24,6 +24,7 @@ import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialDeviceInfoVO;
 import org.springblade.business.vo.TrialDeviceInfoVO3;
 import org.springblade.business.wrapper.TrialDeviceInfoWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
@@ -225,11 +226,10 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
 
             document.add(table);
             document.close();
-            BladeFile bladeFile;
+            fileOutputStream.close();
             try {
-                document.close();
-                fileOutputStream.close();
-
+                List<String> removeList = new ArrayList<>();
+                BladeFile bladeFile;
                 //存储OSS
                 File file = new File(pdfUrl + fileName);
                 String canonicalPath = file.getCanonicalPath();
@@ -242,9 +242,12 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
                 }
                 this.updateBatchById(pdfData);
 
-                //删除本地缓存
-                if (file.exists()) {
-                    file.delete();
+                //添加删除本地文件信息
+                removeList.add(pdfUrl + fileName);
+
+                //删除本地文件
+                if (removeList.size() > 0) {
+                    CommonUtil.removeFile(removeList);
                 }
 
                 return bladeFile.getLink();

+ 11 - 8
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java

@@ -28,6 +28,7 @@ import org.springblade.business.utils.PDFUtil;
 import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialDeviceOverhaulPageVO;
 import org.springblade.business.wrapper.TrialDeviceOverhaulWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
@@ -217,14 +218,13 @@ public class TrialDeviceOverhaulServiceImpl extends BaseServiceImpl<TrialDeviceO
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManagerName()) ? pdfDatum.getManagerName() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRemarks()) ? pdfDatum.getRemarks() : "", textFont, table, lineHeight, colSpan);
             }
-
             document.add(table);
             document.close();
-            BladeFile bladeFile;
-            try {
-                document.close();
-                fileOutputStream.close();
+            fileOutputStream.close();
 
+            try {
+                List<String> removeList = new ArrayList<>();
+                BladeFile bladeFile;
                 //存储OSS
                 File file = new File(pdfUrl + fileName);
                 String canonicalPath = file.getCanonicalPath();
@@ -237,9 +237,12 @@ public class TrialDeviceOverhaulServiceImpl extends BaseServiceImpl<TrialDeviceO
                 }
                 this.updateBatchById(pdfData);
 
-                //删除本地缓存
-                if (file.exists()) {
-                    file.delete();
+                //添加删除本地文件信息
+                removeList.add(pdfUrl + fileName);
+
+                //删除本地文件
+                if (removeList.size() > 0) {
+                    CommonUtil.removeFile(removeList);
                 }
 
                 return bladeFile.getLink();

+ 11 - 8
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java

@@ -26,6 +26,7 @@ import org.springblade.business.entity.TrialDeviceUse;
 import org.springblade.business.mapper.TrialDeviceUseMapper;
 import org.springblade.business.service.ITrialDeviceUseService;
 import org.springblade.business.wrapper.TrialDeviceUseWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
@@ -231,14 +232,13 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManagerName()) ? pdfDatum.getManagerName() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRemarks()) ? pdfDatum.getRemarks() : "", textFont, table, lineHeight, colSpan);
             }
-
             document.add(table);
             document.close();
-            BladeFile bladeFile;
-            try {
-                document.close();
-                fileOutputStream.close();
+            fileOutputStream.close();
 
+            try {
+                List<String> removeList = new ArrayList<>();
+                BladeFile bladeFile;
                 //存储OSS
                 File file = new File(pdfUrl + fileName);
                 String canonicalPath = file.getCanonicalPath();
@@ -251,9 +251,12 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
                 }
                 this.updateBatchById(pdfData);
 
-                //删除本地缓存
-                if (file.exists()) {
-                    file.delete();
+                //添加删除本地文件信息
+                removeList.add(pdfUrl + fileName);
+
+                //删除本地文件
+                if (removeList.size() > 0) {
+                    CommonUtil.removeFile(removeList);
                 }
 
                 return bladeFile.getLink();

+ 11 - 7
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -27,6 +27,7 @@ import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialMaterialMobilizationVO;
 import org.springblade.business.vo.TrialSamplingRecordVO;
 import org.springblade.business.wrapper.TrialMaterialMobilizationWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
@@ -289,12 +290,12 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getUserName()) ? pdfDatum.getUserName() : "", textFont, table, lineHeight, colSpan);
             }
             document.add(table);
+            document.close();
+            fileOutputStream.close();
 
-            BladeFile bladeFile;
             try {
-                document.close();
-                fileOutputStream.close();
-
+                List<String> removeList = new ArrayList<>();
+                BladeFile bladeFile;
                 //存储OSS
                 File file = new File(pdfUrl + fileName);
                 String canonicalPath = file.getCanonicalPath();
@@ -307,9 +308,12 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 }
                 this.updateBatchById(list);
 
-                //删除本地缓存
-                if (file.exists()) {
-                    file.delete();
+                //添加删除本地文件信息
+                removeList.add(pdfUrl + fileName);
+
+                //删除本地文件
+                if (removeList.size() > 0) {
+                    CommonUtil.removeFile(removeList);
                 }
 
                 return bladeFile.getLink();

+ 10 - 7
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java

@@ -25,6 +25,7 @@ import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialSampleInfoVO;
 import org.springblade.business.vo.TrialSampleInfoVO2;
 import org.springblade.business.wrapper.TrialSampleInfoWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
@@ -299,12 +300,11 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
             }
             document.add(table);
             document.close();
+            fileOutputStream.close();
 
-            BladeFile bladeFile;
             try {
-                document.close();
-                fileOutputStream.close();
-
+                List<String> removeList = new ArrayList<>();
+                BladeFile bladeFile;
                 //存储OSS
                 File file = new File(pdfUrl + fileName);
                 String canonicalPath = file.getCanonicalPath();
@@ -317,9 +317,12 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
                 }
                 this.updateBatchById(list);
 
-                //删除本地缓存
-                if (file.exists()) {
-                    file.delete();
+                //添加删除本地文件信息
+                removeList.add(pdfUrl + fileName);
+
+                //删除本地文件
+                if (removeList.size() > 0) {
+                    CommonUtil.removeFile(removeList);
                 }
 
                 return bladeFile.getLink();

+ 14 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -90,7 +90,7 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
         if ("queryTable".equals(queryTable)) {
             LambdaQueryWrapper<WbsTreeContract> wrapper = Wrappers.lambdaQuery();
             wrapper.eq(WbsTreeContract::getParentId, treeNode.getId()).eq(WbsTreeContract::getContractId, treeNode.getContractId()).eq(WbsTreeContract::getType, "2");
-            if(StringUtils.isNotEmpty(classify)){
+            if (StringUtils.isNotEmpty(classify)) {
                 wrapper.in(WbsTreeContract::getTableOwner, "1".equals(classify) ? Arrays.asList("1,2,3".split(",")) : Arrays.asList("4,5,6".split(",")));
             }
             //查询表格
@@ -190,6 +190,11 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
         return this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, contractId).like(WbsTreeContract::getAncestors, parentId).eq(WbsTreeContract::getIsDeleted, 0));
     }
 
+    @Override
+    public List<WbsTreeContract> selectAllByContractId(String contractId) {
+        return this.wbsTreeContractService.selectAllByContractId(Long.parseLong(contractId));
+    }
+
     @Override
     public List<WbsTreeContractTreeVOS> queryCurrentContractLogList(String contractId) {
         ContractInfo contract = this.contractInfoService.getById(contractId);
@@ -205,13 +210,13 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
             String jlTheLOg = StringUtils.isNotEmpty(jlLogConfig) ? jlLogConfig : "8,10,11,12";
 
             result.forEach(node -> {
-               if(new Integer("2").equals(contract.getContractType()) && Arrays.asList(jlTheLOg.split(",")).contains(node.getNodeType().toString())){
-                   //转换
-                   this.setWbsTreeContractTreeVOS(node, vosResult);
-               } else if(new Integer("1").equals(contract.getContractType()) && Arrays.asList(sgTheLog.split(",")).contains(node.getNodeType().toString())){
-                   //转换
-                   this.setWbsTreeContractTreeVOS(node, vosResult);
-               }
+                if (new Integer("2").equals(contract.getContractType()) && Arrays.asList(jlTheLOg.split(",")).contains(node.getNodeType().toString())) {
+                    //转换
+                    this.setWbsTreeContractTreeVOS(node, vosResult);
+                } else if (new Integer("1").equals(contract.getContractType()) && Arrays.asList(sgTheLog.split(",")).contains(node.getNodeType().toString())) {
+                    //转换
+                    this.setWbsTreeContractTreeVOS(node, vosResult);
+                }
             });
 
             List<WbsTreeContractTreeVOS> finalResult = new ArrayList<>();
@@ -273,7 +278,7 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
         return null;
     }
 
-    private void setWbsTreeContractTreeVOS(WbsTreeContract node, List<WbsTreeContractTreeVOS> vosResult){
+    private void setWbsTreeContractTreeVOS(WbsTreeContract node, List<WbsTreeContractTreeVOS> vosResult) {
         WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
         vos.setNodeType(node.getNodeType());
         vos.setPrimaryKeyId(String.valueOf(node.getPKeyId()));

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -46,4 +46,6 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     boolean concealedWorksNode(String pKeyId, Integer type);
 
+    List<WbsTreeContract> selectAllByContractId(Long contractId);
+
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -415,6 +415,11 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return false;
     }
 
+    @Override
+    public List<WbsTreeContract> selectAllByContractId(Long contractId) {
+        return baseMapper.selectList(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getContractId, contractId));
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public WbsTreeContractVO4 importWbsContract(MultipartFile excelFile, String primaryKeyId, Integer isSplicingNumber) throws IOException {

+ 1 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -51,10 +51,9 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
             WbsTreePrivate nodeRoot = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda().eq(WbsTreePrivate::getWbsId, wbsId).eq(WbsTreePrivate::getProjectId, projectId).eq(WbsTreePrivate::getParentId, 0L));
             if (nodeRoot != null) {
                 return ForestNodeMerger.merge(baseMapper.tree(wbsId, projectId, Integer.valueOf(nodeRoot.getWbsType())));
-            } else {
-                throw new ServiceException("未获取到当前wbs项目树的类型");
             }
         }
+        return null;
     }
 
     @Override