lyh
8 小时以前 6d3c8e9c8800becec33e714c2ec42703bb1cef50
两网交互添加图片
已修改1个文件
29 ■■■■■ 文件已修改
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
@@ -48,6 +48,9 @@
    @Value("${fileHomePath}")
    private String fileHomePath;
    @Value("${jeecg.path.upload}")
    private String upLoadPath;
    @Autowired
    private MdcEquipmentMapper mdcEquipmentMapper;
@@ -201,10 +204,34 @@
                throw new RuntimeException("文件传输路径获取失败");
            }
            // 10.删除临时NC文件与json文件
            // 计算后一个文件名
            long nextNumber = Long.parseLong(numericPart);
            nextNumber++;
            //获取序列化的程序确认表数据
            GuideCardBatch guideCardBatch=pkg.getTraceChain().getGuideCardBatch();
            //获取文件路径
            String pictureUrl=guideCardBatch.getPicture();
            // 保持相同位数格式
            String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber);
            String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1];
            String nextFilePath = path.getParent().resolve(nextFileName).toString();
            //拼接现有路径
            String picturePtah=upLoadPath+"/"+pictureUrl;
            // 9. 复制文件并重命名
            logger.info("复制文件: {} → {}", nextFilePath,picturePtah);
            Path PicSource= Paths.get(nextFilePath);
            Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING);
            // 删除文件
            logger.info("删除临时文件: {}", ncFilePath);
            Files.delete(source);
            Files.delete(path);
            Files.delete(PicSource);
            return JsonUtils.fromJson(json, TransferPackage.class);