فهرست منبع

Merge branch 'refs/heads/feature-image-lihb-20250821' into dev

LHB 1 ماه پیش
والد
کامیت
674c9efe0e

+ 12 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java

@@ -304,6 +304,11 @@ public class ArchiveFile extends BaseEntity {
      */
     @ApiModelProperty("u_image_classification_file_id表中的主键id")
     private Long uImageClassificationFileId;
+    /**
+     * m_album表中的主键id
+     */
+    @ApiModelProperty("u_image_classification_file_id表中的主键id")
+    private Long mAlbumId;
 
     /**
      * 归档文件储存类型,可看代码枚举
@@ -331,6 +336,8 @@ public class ArchiveFile extends BaseEntity {
     private String outId;
 
     private String sortNum;
+
+    private String remark;
     @ApiModelProperty("是否锁定 1已锁定")
     private Integer isLock;
 
@@ -448,6 +455,10 @@ public class ArchiveFile extends BaseEntity {
             this.fileTime = "";
             return;
         }
-        this.fileTime = fileTime.replaceAll("[^0-9]", "");
+        if (fileTime.contains("~")) {
+            this.fileTime = fileTime;
+        } else {
+            this.fileTime = fileTime.replaceAll("[^0-9]", "");
+        }
     }
 }

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/Album.java

@@ -61,6 +61,10 @@ public class Album extends BaseEntity {
 	*/
 		private String groupNumber;
 	/**
+	* 起止编号
+	*/
+		private String codes;
+	/**
 	* 开始日期
 	*/
 		private String startDate;

+ 36 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/AlbumImages.java

@@ -0,0 +1,36 @@
+package org.springblade.manager.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 相册与照片关联关系表
+ * @TableName m_album_images
+ */
+@TableName(value ="m_album_images")
+@Data
+public class AlbumImages {
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 相册表id
+     */
+    private Long albumId;
+
+    /**
+     * 照片表id
+     */
+    private Long imageId;
+    /**
+     * 照片表id
+     */
+    @TableField(exist = false)
+    private String imagesUrl;
+
+}

+ 434 - 219
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/AlbumController.java

@@ -26,6 +26,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
+
 import javax.validation.Valid;
 
 import org.apache.poi.ss.usermodel.*;
@@ -42,15 +43,14 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.IoUtil;
-import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.dto.AlbumDTO;
 import org.springblade.manager.dto.AlbumDTO1;
+import org.springblade.manager.entity.AlbumImages;
 import org.springblade.manager.entity.ExcelTab;
 import org.springblade.manager.feign.ExcelTabClient;
 import org.springblade.manager.feign.ImageClassificationConfigClient;
+import org.springblade.manager.service.AlbumImagesService;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewIOSSClient;
@@ -77,7 +77,7 @@ import java.util.HashMap;
 import java.util.List;
 
 /**
- *  控制器
+ * 控制器
  *
  * @author BladeX
  * @since 2025-07-15
@@ -88,37 +88,39 @@ import java.util.List;
 @Api(value = "", tags = "接口")
 public class AlbumController extends BladeController {
 
-	private final IAlbumService albumService;
+    private final IAlbumService albumService;
+
+    private final NewIOSSClient newIOSSClient;
 
-	private final NewIOSSClient newIOSSClient;
+    private final ExcelTabClient excelTabClient;
 
-	private final ExcelTabClient excelTabClient;
+    private final ImageClassificationFileClient imageClassificationFileClient;
 
-	private final ImageClassificationFileClient imageClassificationFileClient;
+    private final CommonFileClient commonFileClient;
 
-	private final CommonFileClient commonFileClient;
+    private final AlbumImagesService albumImagesService;
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入album")
-	public R<AlbumVO> detail(Album album) {
-		Album detail = albumService.getOne(Condition.getQueryWrapper(album));
-		return R.data(AlbumWrapper.build().entityVO(detail));
-	}
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入album")
+    public R<AlbumVO> detail(Album album) {
+        Album detail = albumService.getOne(Condition.getQueryWrapper(album));
+        return R.data(AlbumWrapper.build().entityVO(detail));
+    }
 
-	/**
-	 * 分页 
-	 */
-	@PostMapping("/page")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页", notes = "传入album")
-	public R<IPage<AlbumVO>> page(Long projectId,Long contractId,Query query) {
-		IPage<AlbumVO> pages = albumService.selectPage1(projectId,contractId,Condition.getPage(query));
-		return R.data(pages);
-	}
+    /**
+     * 分页
+     */
+    @PostMapping("/page")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页", notes = "传入album")
+    public R<IPage<AlbumVO>> page(Long projectId, Long contractId, Query query) {
+        IPage<AlbumVO> pages = albumService.selectPage1(projectId, contractId, Condition.getPage(query));
+        return R.data(pages);
+    }
 
 
 //	/**
@@ -132,54 +134,55 @@ public class AlbumController extends BladeController {
 //		return R.data(pages);
 //	}
 
-	/**
-	 * 新增 
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入album")
-	public R save(@Valid @RequestBody AlbumDTO albumDTO) {
-		if(albumDTO.getMargePdfUrls().isEmpty()){
-			throw new ServiceException("相册不能为空");
-		}
-		List<String>uris=new ArrayList<>();
-		HashMap<String, Long> map = new HashMap<>();
-		for (AlbumDTO1 margePdfUrl : albumDTO.getMargePdfUrls()) {
-			String imageUrl = margePdfUrl.getImageUrl();
-			String[] urlss = imageUrl.split(",");
-			for (String string : urlss) {
-				map.put(string,margePdfUrl.getId());
-				uris.add(string);
-			}
-		}
-		if(uris.isEmpty()){
-			throw new ServiceException("相册不能为空");
-		}
-		Album album=new Album();
-		BeanUtil.copy(albumDTO,album);
-		String dateValue = albumDTO.getDateValue();
-		String[] strings = dateValue.split("~");
-		album.setStartDate(strings[0]);
-		album.setEndDate(strings[1]);
-		//获取固定表格
-		ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498"); //影像资料模板
-		String file_path = null;
-		if (SystemUtils.isWindows()) {
-			file_path = "C:\\pdfFiles\\";
-			File file = new File(file_path);
-			if (!file.exists()) {
-				file.mkdirs();
-			}
-		}
-		if (SystemUtils.isLinux()) {
-			file_path = "/home/pdfFiles";
-			File file = new File(file_path);
-			if (!file.exists()) {
-				file.mkdirs();
-			}
-		}
-		if (excelTab != null) {
-			//获取数据
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入album")
+    public R save(@Valid @RequestBody AlbumDTO albumDTO) {
+        if (albumDTO.getMargePdfUrls().isEmpty()) {
+            throw new ServiceException("相册不能为空");
+        }
+        List<String> uris = new ArrayList<>();
+        HashMap<String, Long> map = new HashMap<>();
+        for (AlbumDTO1 margePdfUrl : albumDTO.getMargePdfUrls()) {
+            String imageUrl = margePdfUrl.getImageUrl();
+            String[] urlss = imageUrl.split(",");
+            for (String string : urlss) {
+                map.put(string, margePdfUrl.getId());
+                uris.add(string);
+            }
+        }
+        if (uris.isEmpty()) {
+            throw new ServiceException("相册不能为空");
+        }
+        Album album = new Album();
+        BeanUtil.copy(albumDTO, album);
+        album.setId(SnowFlakeUtil.getId());
+        String dateValue = albumDTO.getDateValue();
+        String[] strings = dateValue.split("~");
+        album.setStartDate(strings[0]);
+        album.setEndDate(strings[1]);
+        //获取固定表格
+        ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498"); //影像资料模板
+        String file_path = null;
+        if (SystemUtils.isWindows()) {
+            file_path = "C:\\pdfFiles\\";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+        if (SystemUtils.isLinux()) {
+            file_path = "/home/pdfFiles";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+        if (excelTab != null) {
+            //获取数据
 //			try {
 //					//需要删除的本地文件集合
 //					List<String> removeList = new ArrayList<>();
@@ -294,139 +297,349 @@ public class AlbumController extends BladeController {
 //			} catch (Exception e) {
 //				e.printStackTrace();
 //			}
-			try {
-				//需要删除的本地文件集合
-				List<String> removeList = new ArrayList<>();
-				//获取模板文件流
-				InputStream modInput = null;
-				FileInputStream excelFileInput = null;
-				FileOutputStream outputStream = null;
-				Workbook workbook = null;
-
-				List<String> pdfFileList = new ArrayList<>();
-				//两个图片一组
-				List<List<String>> groupUrls = CommonUtil.getBatchSize(uris, 2);
-				for (List<String> urls : groupUrls) {
-					try {
-						//创建模板Workbook
-						modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
-						if (modInput != null) {
-							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();
-									Long id = map.get(urls.get(i));
-									ImageClassificationFile file = imageClassificationFileClient.getImageClassificationFileById(id);
-
-									//获取文件流
-									byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i)));
-									if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
-										bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(urls.get(i)));
-									}
-									//压缩文件大小
-									byte[] byteNew = FileUtils.compressImage(bytes);
-									//创建图片
-									Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
-									picture.resize();
-
-									//图片定位
-									FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
-
-									//定位其它信息
-									int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
-
-									// 分组号 (C列,索引2)
-									sheet.getRow(baseRow ).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
-									// 照片编号 (C列,索引2)
-									sheet.getRow(baseRow + 1).getCell(3).setCellValue(file.getPhotoCode() != null ? file.getPhotoCode() : "");
-									// 摄影者 (C列,索引2)
-									sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
-									// 拍摄时间 (C列,索引2)
-									sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
-											DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
-									// 照片说明 (A列,索引0)
-									String a=albumDTO.getImagesName()!=null?albumDTO.getImagesName():"";
-									String b=file.getTextContent() != null ? file.getTextContent() : "";
-									sheet.getRow(baseRow+4).getCell(1).setCellValue(a+b);
-
-								} 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";
-				String mergeUrl = file_path + mergeName;
-				FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
-				//记录文件删除
-				removeList.add(mergeUrl);
-				//上传
-				BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
-				if (bladeFile != null) {
-					album.setImagesPdf(bladeFile.getLink());
-				}
-
-				if (removeList.size() > 0) {
-					//删除本地文件
-					CommonUtil.removeFile(removeList);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-		return R.status(albumService.save(album));
-	}
-
-	/**
-	 * 修改 
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入album")
-	public R update(@Valid @RequestBody AlbumDTO albumDTO) {
-		Album album=new Album();
-		BeanUtil.copy(albumDTO,album);
-		String dateValue = albumDTO.getDateValue();
-		String[] strings = dateValue.split("~");
-		album.setStartDate(strings[0]);
-		album.setEndDate(strings[1]);
-		return R.status(albumService.updateById(album));
-	}
+            try {
+                //需要删除的本地文件集合
+                List<String> removeList = new ArrayList<>();
+                //获取模板文件流
+                InputStream modInput = null;
+                FileInputStream excelFileInput = null;
+                FileOutputStream outputStream = null;
+                Workbook workbook = null;
+
+                List<String> pdfFileList = new ArrayList<>();
+                //两个图片一组
+                List<List<String>> groupUrls = CommonUtil.getBatchSize(uris, 2);
+                for (List<String> urls : groupUrls) {
+                    try {
+                        //创建模板Workbook
+                        modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+                        if (modInput != null) {
+                            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();
+                                    Long id = map.get(urls.get(i));
+                                    ImageClassificationFile file = imageClassificationFileClient.getImageClassificationFileById(id);
+
+                                    //获取文件流
+                                    byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i)));
+                                    if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
+                                        bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(urls.get(i)));
+                                    }
+                                    //压缩文件大小
+                                    byte[] byteNew = FileUtils.compressImage(bytes);
+                                    //创建图片
+                                    Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
+                                    picture.resize();
+
+                                    //图片定位
+                                    FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
+
+                                    //定位其它信息
+                                    int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
+
+                                    // 分组号 (C列,索引2)
+                                    sheet.getRow(baseRow).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
+                                    // 照片编号 (C列,索引2)
+                                    sheet.getRow(baseRow + 1).getCell(3).setCellValue(file.getPhotoCode() != null ? file.getPhotoCode() : "");
+                                    // 摄影者 (C列,索引2)
+                                    sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
+                                    // 拍摄时间 (C列,索引2)
+                                    sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
+                                            DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
+                                    // 照片说明 (A列,索引0)
+                                    String a = albumDTO.getImagesName() != null ? albumDTO.getImagesName() : "";
+                                    String b = file.getTextContent() != null ? file.getTextContent() : "";
+                                    sheet.getRow(baseRow + 4).getCell(1).setCellValue(a + b);
+
+                                } 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";
+                String mergeUrl = file_path + mergeName;
+                FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
+                //记录文件删除
+                removeList.add(mergeUrl);
+                //上传
+                BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+                if (bladeFile != null) {
+                    album.setImagesPdf(bladeFile.getLink());
+                }
+
+                if (removeList.size() > 0) {
+                    //删除本地文件
+                    CommonUtil.removeFile(removeList);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        //添加相册与照片的关联关系 用于编辑时重新生成pdf
+        List<AlbumImages> albumImages = new ArrayList<>();
+        albumDTO.getMargePdfUrls().forEach(f -> {
+            AlbumImages albumImage = new AlbumImages();
+            albumImage.setId(SnowFlakeUtil.getId());
+            albumImage.setAlbumId(album.getId());
+            albumImage.setImageId(f.getId());
+            albumImages.add(albumImage);
+        });
+        albumImagesService.saveBatch(albumImages);
+
+        return R.status(albumService.save(album));
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入album")
+    public R update(@Valid @RequestBody AlbumDTO albumDTO) {
+
+        //查询关联关系
+        List<ImageClassificationFile> list = albumImagesService.selectImageUrlByAlbumId(albumDTO.getId());
+        if (CollectionUtil.isNotEmpty(list)) {
+            //可能存在一条数据多张照片的情况
+            List<ImageClassificationFile> images = new ArrayList<>();
+            list.forEach(f -> {
+                //多个照片
+                if (f.getImageUrl().contains(",")) {
+                    String[] split = f.getImageUrl().split(",");
+                    for (String imageUrl : split) {
+                        ImageClassificationFile file = BeanUtil.copyProperties(f, ImageClassificationFile.class);
+                        file.setImageUrl(imageUrl);
+                        images.add(file);
+                    }
+                } else {
+                    images.add(f);
+                }
+            });
+
+            //旧pdf地址
+            String imagesPdf = albumDTO.getImagesPdf();
+
+            //获取起止编码
+            String codes = albumDTO.getCodes();
+            //初始值
+            Integer startInt = null, endInt = null, middleInt = null;
+            //图片计算值 最终值
+
+            if (StringUtils.isBlank(codes)) {
+                startInt = 1;
+            } else if (codes.contains("~")) {
+                String[] split = codes.split("~");
+                try {
+                    startInt = Integer.valueOf(split[0]);
+                    endInt = Integer.valueOf(split[1]);
+                } catch (NumberFormatException e) {
+                    throw new ServiceException("无法识别的数字");
+                }
+            } else {
+                try {
+                    startInt = Integer.valueOf(codes);
+                } catch (NumberFormatException e) {
+                    throw new ServiceException("无法识别的数字");
+                }
+            }
+            int count = startInt;
+
+            //重新生成pdf 并设置起止编号
+            //获取固定表格
+            //影像资料模板
+            ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498");
+            String file_path = null;
+            if (SystemUtils.isWindows()) {
+                file_path = "C:\\pdfFiles\\";
+                File file = new File(file_path);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+            }
+            Album album = new Album();
+            BeanUtil.copy(albumDTO, album);
+            String dateValue = albumDTO.getDateValue();
+            String[] strings = dateValue.split("~");
+            album.setStartDate(strings[0]);
+            album.setEndDate(strings[1]);
+            if (SystemUtils.isLinux()) {
+                file_path = "/home/pdfFiles";
+                File file = new File(file_path);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+            }
+            if (excelTab != null) {
+                try {
+                    //需要删除的本地文件集合
+                    List<String> removeList = new ArrayList<>();
+                    //获取模板文件流
+                    InputStream modInput = null;
+                    FileInputStream excelFileInput = null;
+                    FileOutputStream outputStream = null;
+                    Workbook workbook = null;
+
+                    List<String> pdfFileList = new ArrayList<>();
+                    List<List<ImageClassificationFile>> batchSize = CommonUtil.getBatchSize(images, 2);
+
+
+                    for (List<ImageClassificationFile> imageClassificationFiles : batchSize) {
+                        try {
+                            //创建模板Workbook
+                            modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+                            if (modInput != null) {
+                                workbook = WorkbookFactory.create(modInput);
+
+                                //一个pdf 两个图片
+                                int i = 0;
+                                for (ImageClassificationFile file : imageClassificationFiles) {
+                                    try {
+                                        CreationHelper helper = workbook.getCreationHelper();
+                                        Sheet sheet = workbook.getSheetAt(0);
+                                        Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                        ClientAnchor anchor = helper.createClientAnchor();
+                                        //获取文件流
+                                        byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(file.getImageUrl()));
+                                        if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
+                                            bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(file.getImageUrl()));
+                                        }
+                                        //压缩文件大小
+                                        byte[] byteNew = FileUtils.compressImage(bytes);
+                                        //创建图片
+                                        Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
+                                        picture.resize();
+
+                                        //图片定位
+                                        FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
+                                        //定位其它信息
+                                        int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
+                                        // 分组号 (C列,索引2)
+                                        sheet.getRow(baseRow).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
+                                        // 照片编号 (C列,索引2)
+                                        sheet.getRow(baseRow + 1).getCell(3).setCellValue(endInt != null && count > endInt ? "" : count + "");
+                                        // 摄影者 (C列,索引2)
+                                        sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
+                                        // 拍摄时间 (C列,索引2)
+                                        sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
+                                                DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
+                                        // 照片说明 (A列,索引0)
+                                        String a = albumDTO.getImagesName() != null ? albumDTO.getImagesName() : "";
+                                        String b = file.getTextContent() != null ? file.getTextContent() : "";
+                                        sheet.getRow(baseRow + 4).getCell(1).setCellValue(a + b);
+                                        i++;
+
+                                        if (endInt != null && count > endInt) {
+                                            middleInt = count - 1;
+                                        } else {
+                                            count++;
+                                        }
+                                    } 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";
+                    String mergeUrl = file_path + mergeName;
+                    FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
+                    //记录文件删除
+                    removeList.add(mergeUrl);
+                    //上传
+                    BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+                    if (bladeFile != null) {
+                        album.setImagesPdf(bladeFile.getLink());
+                        //删除旧pdf
+                        if (StringUtils.isNotBlank(imagesPdf)) {
+                            String pdfName = imagesPdf.split("upload")[1];
+                            this.newIOSSClient.removeFile("upload" + pdfName);
+                        }
+                    }
+                    if (removeList.size() > 0) {
+                        //删除本地文件
+                        CommonUtil.removeFile(removeList);
+                    }
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            if (middleInt != null) {
+                album.setCodes(startInt + "~" + middleInt);
+            } else {
+                album.setCodes(startInt + "~" + (count - 1));
+            }
+            return R.status(albumService.updateById(album));
+        }
+        throw new ServiceException("相册不能为空");
+    }
 
 //	/**
 //	 * 新增或修改
@@ -438,7 +651,7 @@ public class AlbumController extends BladeController {
 //		return R.status(albumService.saveOrUpdate(album));
 //	}
 
-	
+
 //	/**
 //	 * 删除
 //	 */
@@ -450,13 +663,15 @@ public class AlbumController extends BladeController {
 //	}
 
 
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
+        //同时删除关联关系
+        albumImagesService.remove(Wrappers.<AlbumImages>lambdaQuery()
+                .eq(AlbumImages::getAlbumId, id));
+        return R.status(albumService.removeById(id));
+    }
 
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
-		return R.status(albumService.removeById(id));
-	}
 
-	
 }

+ 23 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.java

@@ -0,0 +1,23 @@
+package org.springblade.manager.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Mapper
+* @createDate 2025-08-21 14:28:24
+* @Entity generator.domain.UAlbumImages
+*/
+public interface AlbumImagesMapper extends BaseMapper<AlbumImages> {
+
+    List<ImageClassificationFile> selectImageUrlByAlbumId(@Param("id") Long id);
+}
+
+
+
+

+ 21 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.manager.mapper.AlbumImagesMapper">
+
+    <resultMap id="BaseResultMap" type="org.springblade.manager.entity.AlbumImages">
+            <id property="id" column="id" />
+            <result property="albumId" column="album_id" />
+            <result property="imageId" column="image_id" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,album_id,image_id
+    </sql>
+    <select id="selectImageUrlByAlbumId" resultType="org.springblade.business.entity.ImageClassificationFile">
+        select b.* from m_album_images a
+        left join u_image_classification_file b on a.image_id = b.id
+        where a.album_id = #{id} and b.image_url is not null and b.is_deleted = 0
+    </select>
+</mapper>

+ 17 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/AlbumImagesService.java

@@ -0,0 +1,17 @@
+package org.springblade.manager.service;
+
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Service
+* @createDate 2025-08-21 14:28:24
+*/
+public interface AlbumImagesService extends IService<AlbumImages> {
+
+    List<ImageClassificationFile> selectImageUrlByAlbumId(Long id);
+}

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

@@ -16,6 +16,7 @@
  */
 package org.springblade.manager.service;
 
+import org.springblade.manager.dto.AlbumDTO;
 import org.springblade.manager.entity.Album;
 import org.springblade.manager.vo.AlbumVO;
 import org.springblade.core.mp.base.BaseService;
@@ -40,4 +41,5 @@ public interface IAlbumService extends BaseService<Album> {
 
 
 	IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page);
+
 }

+ 30 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumImagesServiceImpl.java

@@ -0,0 +1,30 @@
+package org.springblade.manager.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import org.springblade.manager.service.AlbumImagesService;
+import org.springblade.manager.mapper.AlbumImagesMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Service实现
+* @createDate 2025-08-21 14:28:24
+*/
+@Service
+public class AlbumImagesServiceImpl extends ServiceImpl<AlbumImagesMapper, AlbumImages>
+    implements AlbumImagesService {
+
+    @Override
+    public List<ImageClassificationFile> selectImageUrlByAlbumId(Long id) {
+        return baseMapper.selectImageUrlByAlbumId(id);
+    }
+}
+
+
+
+

+ 9 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumServiceImpl.java

@@ -28,7 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.util.List;
 
 /**
- *  服务实现类
+ * 服务实现类
  *
  * @author BladeX
  * @since 2025-07-15
@@ -41,14 +41,13 @@ public class AlbumServiceImpl extends BaseServiceImpl<AlbumMapper, Album> implem
 //		return page.setRecords(baseMapper.selectAlbumPage(page, album));
 //	}
 
-	@Override
-	public IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page) {
-		Long count = baseMapper.selectCount(new LambdaQueryWrapper<>(Album.class).eq(Album::getProjectId, projectId).eq(Album::getContractId, contractId));
-		page.setTotal(count);
-		List<AlbumVO> albumVOS = baseMapper.selectAlbumPages(projectId, contractId, (page.getCurrent()-1)*page.getSize(),page.getSize());
-		page.setRecords(albumVOS);
-		return page;
-	}
-
+    @Override
+    public IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page) {
+        Long count = baseMapper.selectCount(new LambdaQueryWrapper<>(Album.class).eq(Album::getProjectId, projectId).eq(Album::getContractId, contractId));
+        page.setTotal(count);
+        List<AlbumVO> albumVOS = baseMapper.selectAlbumPages(projectId, contractId, (page.getCurrent() - 1) * page.getSize(), page.getSize());
+        page.setRecords(albumVOS);
+        return page;
+    }
 
 }

+ 148 - 69
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -28,6 +28,7 @@ import org.springblade.manager.entity.*;
 import org.springblade.manager.enums.AssociationTypeEnum;
 import org.springblade.manager.enums.StorageTypeEnum;
 import org.springblade.manager.enums.TreeStructureEnum;
+import org.springblade.manager.mapper.AlbumMapper;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.ForestNodeMerger;
@@ -84,6 +85,8 @@ public class ArchiveTreeContractSyncImpl {
 
     private final CommonFileClient commonFileClient;
 
+    private final AlbumMapper albumMapper;
+    private final AlbumImagesService albumImagesService;
 
 
     /**
@@ -1238,12 +1241,24 @@ public class ArchiveTreeContractSyncImpl {
             keyMap.put(vo.getPKeyId(),vo);
         }
 
-        //获取合同下声像资料所有文件
-        List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
-        if (CollectionUtil.isEmpty(imageClassificationFileList)){
+
+        //调整为查询相册
+        List<Album> albumsList = albumMapper.selectList(Wrappers.<Album>lambdaQuery()
+                .eq(Album::getContractId, contractId)
+                .isNotNull(Album::getImagesPdf));
+        if (CollectionUtil.isEmpty(albumsList)){
             throw new ServiceException("当前合同段下没有声像资料");
         }
-        Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
+        Map<Long, List<Album>> albumMap = albumsList.stream().collect(Collectors.groupingBy(Album::getClassifyId));
+
+
+        //获取合同下声像资料所有文件
+//        List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
+//        if (CollectionUtil.isEmpty(imageClassificationFileList)){
+//            throw new ServiceException("当前合同段下没有声像资料");
+//        }
+//        Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
+
 
         //获取声像资料分类,生成声像资料下级节点
         List<ImageClassificationConfig> imageTypes = imageClassificationConfigService.selectByContractType(contractId,contractInfo.getContractType());
@@ -1256,75 +1271,86 @@ public class ArchiveTreeContractSyncImpl {
             ArchiveTreeContract imageNode = createTypeNode(imageType.getClassfName(),archiveTreeContract);
             addNode.add(imageNode);
             //如果当前分类下存在文件,则根据类型生成树,还是日期
-            List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
-            if (CollectionUtil.isEmpty(files)){
-                continue;
-            }
-            if (imageType.getStorageDirectoryFormat() == 1){
-                /**部位存储,获取分类下面的文件,只生成必要的树,没有则跳过 */
-                //获取出文件对应的WBS节点,查询出所有节点
-                List<Long> wbsPIds = files.stream().filter(l-> l.getWbsId() != null).map(l -> l.getWbsId()).distinct().collect(Collectors.toList());
-                Set<Long> wbsIds = new HashSet<>();
-                for (Long wbsId : wbsPIds) {
-                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
-                    if (vo != null){
-                        wbsIds.add(vo.getId());
-                        String[] ids = vo.getAncestors().split(",");
-                        for (String id : ids) {
-                            wbsIds.add(Long.valueOf(id));
-                        }
-                    }
-                }
-                List<ArchiveSyncWbsVO> currentNodes = new ArrayList<>();
-                for (Long wbsId : wbsIds) {
-                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
-                    if (vo != null) {
-                        vo.setChildren(null);
-                        currentNodes.add(vo);
-                    }
-                }
-                ArchiveSyncWbsVO root = ForestNodeMerger.merge(currentNodes).stream()
-                        .filter(f -> f.getParentId() == 0L).collect(Collectors.toList()).get(0);
-                //从根节点递归,递归过程中,同步生成档案树, 并且生成档案树id和wbsPid的映射,后面单独为文件设置
-                List<ArchiveTreeContract> currentTypeAdd = new ArrayList<>();
-                recursionCreateArchiveTree(root,currentTypeAdd,imageNode);
-                //转换影像文件为档案文件,并挂到档案树下面
-                Map<Long, Long> wbsPidMapArchiveId = currentTypeAdd.stream().collect(Collectors.toMap(l -> l.getExtKeyId(), l -> l.getId()));
-                addNode.addAll(currentTypeAdd);
-                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
-                    ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
-                    return archiveFile;
-                }).collect(Collectors.toList());
-                addFile.addAll(newArchiveFileList);
-                log.info("同步声像文件树-"+imageType.getClassfName()+": 节点"+currentNodes.size()+"个,节点下文件"+files.size()+"个");
-
-            }else if (imageType.getStorageDirectoryFormat() == 2){
-                /**日期存储,获取分类下面的文件,获取出所有的年,生成年节点,文件归到年节点下 */
-                //文件按照年份分组
-                Map<Integer, List<ImageClassificationFileDTO>> yearMap = files.stream().collect(Collectors.groupingBy(l -> l.getShootingTime().getYear()));
-                List<Integer> years = yearMap.keySet().stream().sorted().collect(Collectors.toList());
-                for (Integer year : years) {
-                    //生成年份节点,并添加进集合
-                    ArchiveTreeContract dateNode = createImageDateNode(imageNode, year);
-                    addNode.add(dateNode);
-                    //把文件设置进指定年份下
-                    List<ImageClassificationFileDTO> fileDTOS = yearMap.get(year);
-                    Map<Long, Long> wbsPidMapArchiveId = new HashMap<>();
-                    for (ImageClassificationFileDTO fileDTO : fileDTOS) {
-                        wbsPidMapArchiveId.put(fileDTO.getWbsId(),dateNode.getId());
-                    }
-                    List<ArchiveFile> newArchiveFileList = fileDTOS.stream().map(file -> {
-                        ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
-                        return archiveFile;
-                    }).collect(Collectors.toList());
-                    addFile.addAll(newArchiveFileList);
+//            List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
 
-                }
-            }else {
-                log.error("同步声像文件:影像资料存储类型不在范围中");
+            List<Album> albums = albumMap.get(imageType.getId());
+
+            if (CollectionUtil.isEmpty(albums)){
                 continue;
             }
 
+            //直接点转文件
+
+            List<ArchiveFile> newArchiveFileList = albums.stream().map(album -> {
+                ArchiveFile archiveFile = albumCovertArchiveFile(album, imageNode.getId());
+                return archiveFile;
+            }).collect(Collectors.toList());
+
+            addFile.addAll(newArchiveFileList);
+//            if (imageType.getStorageDirectoryFormat() == 1){
+//                /**部位存储,获取分类下面的文件,只生成必要的树,没有则跳过 */
+//                //获取出文件对应的WBS节点,查询出所有节点
+//                List<Long> wbsPIds = files.stream().filter(l-> l.getWbsId() != null).map(l -> l.getWbsId()).distinct().collect(Collectors.toList());
+//                Set<Long> wbsIds = new HashSet<>();
+//                for (Long wbsId : wbsPIds) {
+//                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
+//                    if (vo != null){
+//                        wbsIds.add(vo.getId());
+//                        String[] ids = vo.getAncestors().split(",");
+//                        for (String id : ids) {
+//                            wbsIds.add(Long.valueOf(id));
+//                        }
+//                    }
+//                }
+//                List<ArchiveSyncWbsVO> currentNodes = new ArrayList<>();
+//                for (Long wbsId : wbsIds) {
+//                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
+//                    if (vo != null) {
+//                        vo.setChildren(null);
+//                        currentNodes.add(vo);
+//                    }
+//                }
+//                ArchiveSyncWbsVO root = ForestNodeMerger.merge(currentNodes).stream()
+//                        .filter(f -> f.getParentId() == 0L).collect(Collectors.toList()).get(0);
+//                //从根节点递归,递归过程中,同步生成档案树, 并且生成档案树id和wbsPid的映射,后面单独为文件设置
+//                List<ArchiveTreeContract> currentTypeAdd = new ArrayList<>();
+//                recursionCreateArchiveTree(root,currentTypeAdd,imageNode);
+//                //转换影像文件为档案文件,并挂到档案树下面
+//                Map<Long, Long> wbsPidMapArchiveId = currentTypeAdd.stream().collect(Collectors.toMap(l -> l.getExtKeyId(), l -> l.getId()));
+//                addNode.addAll(currentTypeAdd);
+//                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+//                    ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
+//                    return archiveFile;
+//                }).collect(Collectors.toList());
+//                addFile.addAll(newArchiveFileList);
+//                log.info("同步声像文件树-"+imageType.getClassfName()+": 节点"+currentNodes.size()+"个,节点下文件"+files.size()+"个");
+//
+//            }else if (imageType.getStorageDirectoryFormat() == 2){
+//                /**日期存储,获取分类下面的文件,获取出所有的年,生成年节点,文件归到年节点下 */
+//                //文件按照年份分组
+//                Map<Integer, List<ImageClassificationFileDTO>> yearMap = files.stream().collect(Collectors.groupingBy(l -> l.getShootingTime().getYear()));
+//                List<Integer> years = yearMap.keySet().stream().sorted().collect(Collectors.toList());
+//                for (Integer year : years) {
+//                    //生成年份节点,并添加进集合
+//                    ArchiveTreeContract dateNode = createImageDateNode(imageNode, year);
+//                    addNode.add(dateNode);
+//                    //把文件设置进指定年份下
+//                    List<ImageClassificationFileDTO> fileDTOS = yearMap.get(year);
+//                    Map<Long, Long> wbsPidMapArchiveId = new HashMap<>();
+//                    for (ImageClassificationFileDTO fileDTO : fileDTOS) {
+//                        wbsPidMapArchiveId.put(fileDTO.getWbsId(),dateNode.getId());
+//                    }
+//                    List<ArchiveFile> newArchiveFileList = fileDTOS.stream().map(file -> {
+//                        ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
+//                        return archiveFile;
+//                    }).collect(Collectors.toList());
+//                    addFile.addAll(newArchiveFileList);
+//
+//                }
+//            }else {
+//                log.error("同步声像文件:影像资料存储类型不在范围中");
+//                continue;
+//            }
         }
         if (addNode.size() > 0){
             addNode.stream().forEach(l->l.setTenantId(tenantId));
@@ -1336,6 +1362,59 @@ public class ArchiveTreeContractSyncImpl {
 
     }
 
+    private ArchiveFile albumCovertArchiveFile(Album file, Long id) {
+        ArchiveFile archiveFile = new ArchiveFile();
+        archiveFile.setId(SnowFlakeUtil.getId());
+        archiveFile.setProjectId(String.valueOf(file.getProjectId()));
+        archiveFile.setContractId(String.valueOf(file.getContractId()));
+        archiveFile.setNodeId(String.valueOf(id));
+        //标题
+        archiveFile.setFileName(file.getImagesName());
+        //时间
+        archiveFile.setFileTime(file.getStartDate().replaceAll("-","") + "~" + file.getEndDate().replaceAll("-",""));
+        archiveFile.setFileUrl(file.getImagesPdf());
+        archiveFile.setPdfFileUrl(file.getImagesPdf());
+        //文件页数  根据关联照片判断
+        long count = albumImagesService.count(Wrappers.<AlbumImages>lambdaQuery().eq(AlbumImages::getAlbumId, file.getId()));
+        //2张照片为一页
+        archiveFile.setFilePage((int) Math.ceil((double) count / 2));
+        archiveFile.setIsApproval(0);
+        archiveFile.setIsCertification(1);
+        archiveFile.setIsNeedCertification(0);
+        //责任者-主要拍摄者
+        archiveFile.setDutyUser(file.getPhotographer());
+        archiveFile.setCreateUser(file.getCreateUser());
+        archiveFile.setCreateDept(file.getCreateDept());
+        archiveFile.setCreateTime(file.getCreateTime());
+        archiveFile.setUpdateUser(file.getUpdateUser());
+        archiveFile.setUpdateTime(file.getUpdateTime());
+        archiveFile.setStatus(0);
+        archiveFile.setIsDeleted(0);
+        //文件类型 1 视频 2 照片
+        archiveFile.setFileType(2L);
+        //文件编号-分组号
+        archiveFile.setFileNumber(file.getGroupNumber());
+        //备注-起止编号
+        archiveFile.setRemark(file.getCodes());
+
+        // 创建 LocalDateTime 时间爱你
+        LocalDateTime localDateTime = new Date().toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDateTime();
+        archiveFile.setFtime(localDateTime);
+        archiveFile.setUtime(localDateTime);
+        archiveFile.setSort(0);
+
+        archiveFile.setSourceType(1);
+        archiveFile.setIsElement(0);
+        archiveFile.setRectification(0);
+        //关联id
+        archiveFile.setMAlbumId(file.getId());
+        archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
+        archiveFile.setDateName(DateFormatUtils.format(file.getCreateTime(), "yyyyMMdd"));
+        return archiveFile;
+    }
+
 
     /**
      * 质检影像资料 转换为 档案文件