• java将文件夹md5为名的图片与数据库查询对应md5后导入相应图片到某分类下


       public class FolderUtil {
      /** * @param path * @return * 得到目录下的文件 */ public List<String> getDirectoryFile(String path){ List<String> retList=new ArrayList<String>(); File dir = new File(path); File[] files = dir.listFiles(); if (files == null) return null; for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) { retList.add(files[i].getName()); } } return retList; }
    }
        public void import3(){
            
            String path="D:/tt/yangtry";        
            FolderUtil fu=new FolderUtil();
            List<String> imgList=fu.getDirectoryFile(path);
                        
            System.out.println("jpg总数量:"+imgList.size());
            
            int i=0;
            for(String imgName:imgList){
                i++;
                System.out.println(i);            
                String imgMD5 = imgName.split("\.")[0];            
                //System.out.println(imgMD5);            
                
                ImgCenterFilter filterImc = new ImgCenterFilter();
                filterImc.setEq_imgMd5(imgMD5);
                ImgCenter imgCenter = imgCenterService.selectAll(filterImc).get(0);
                String caseId= imgCenter.getCaseId();
                ImgCase imgCase = imgCaseService.getById(caseId);
                            
                TagImg  newImg=new TagImg();
                  
                  newImg.setSetId("d0d86b8b52aa4df9a06bc3db57ed19d3");
                  newImg.setTypeId("56240f330eff4c049b19d0c7ce156647");
                  newImg.setOrgId("81dae004980145ffbd261717b49f35b6");
                //imc.id,imc.img_md5,imc.img_url,imc.img_url_thumb,imc.thumb_width,imc.thumb_height,c.img_info,c.img_result                         
                 
                  newImg.setImportId(imgCenter.getId());
                  newImg.setImgMd5(imgMD5);
                  newImg.setImgUrl(imgCenter.getImgUrl());
                  newImg.setImgUrlThumb(imgCenter.getImgUrlThumb());
                  newImg.setThumbw(imgCenter.getThumbWidth());
                  newImg.setThumbh(imgCenter.getThumbHeight());
                  newImg.setRemark(imgCase.getImgInfo());//影响描述              
                  newImg.setCreateUser("2018-06-22");                
                  newImg.setDiagnosis(imgCase.getImgResult());//诊断意见
            
                  tagImgService.save(newImg);
                  
            }        
        }
  • 相关阅读:
    linux文件操作.md
    MinIO
    快速幂和快速乘
    LCP 03.机器人大冒险
    java 实现 js 方法调用
    UNITY STANDARD ASSETS源码学习笔记(二)Sun Shafts
    下雨Shader,触摸擦除雨点,声控闪电
    Unity Standard Assets源码学习笔记(一)SSAO
    【转发】vueSSR剖析
    locust中的监听器
  • 原文地址:https://www.cnblogs.com/lely/p/10364555.html
Copyright © 2020-2023  润新知