lxw
2022-11-17 97b46c01f1d142780c2fc455bdb2b003f8141e93
//根据产品母料型号,定制单号,版本下载原始压缩包文件
2个文件已修改
31 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/ProductController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomHistoryService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProductController.java
@@ -80,6 +80,12 @@
        return bomHistoryService.getBomHistoryAndMaterial(productId,version);
    }
    @ApiOperation(value = "根据产品母料型号,定制单号,版本下载原始压缩包文件",notes = "11.17修改后使用")
    @GetMapping("getOriginalZip")
    public Response getOriginalZip( @RequestParam String parentModel,@RequestParam(required = false) String customCode,@RequestParam int version){
        return bomHistoryService.getOriginalZip(parentModel,customCode,version);
    }
    @ApiOperation(value = "历史产品下载(产品id和版本<下载的版本>)",notes = "8.17修改后使用")
    @GetMapping("downloadProductHistory")
src/main/java/com/whyc/service/ProductBomHistoryService.java
@@ -610,4 +610,29 @@
        mapper.updateMaterialField2BomHistoryBatch(bomHistoryList);
    }
    //根据产品母料型号,定制单号,版本下载原始压缩包文件
    public Response getOriginalZip(String parentModel, String customCode, int version) {
        String fileDirName = FileDirPath.getFileDirName();
        String withOutDwg=fileDirName+File.separator+"doc_file"+File.separator+"product"+File.separator+parentModel;
        if(customCode!=null&&!customCode.isEmpty()){
            withOutDwg+=File.separator+customCode+File.separator+version;
        }else{
            withOutDwg+=File.separator+"standard"+File.separator+version;
        }
        boolean bl=false;
        File file = new File(withOutDwg);
        if(!file.exists()) {
            return new Response().setII(1,bl,withOutDwg.replace(fileDirName,""),"原始文件相对路径");
        }
        String[] filePath = file.list();//获取该文件夹下的所有文件以及目录的名字
        if(filePath!=null&&filePath.length>0){
            for (String tmp:filePath) {
                if(tmp.contains(".zip")){
                    bl=true;
                    withOutDwg=withOutDwg+File.separator+tmp;
                }
            }
        }
        return new Response().setII(1,bl,withOutDwg.replace(fileDirName,""),"原始文件相对路径");
    }
}