|  | @@ -34,6 +34,7 @@ import org.junit.Test;
 | 
	
		
			
				|  |  |  import org.junit.runner.RunWith;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.boot.test.context.SpringBootTest;
 | 
	
		
			
				|  |  |  import org.springframework.mock.web.MockMultipartFile;
 | 
	
		
			
				|  |  |  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 | 
	
	
		
			
				|  | @@ -67,6 +68,9 @@ public class FirstUploadForestData {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  private int i = 1;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Value("${qiniu.path}")
 | 
	
		
			
				|  |  | +    private String url;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      public void readFile(){
 | 
	
	
		
			
				|  | @@ -75,7 +79,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |          if (i>2){
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String filepath = "D:\\developerUtil\\code\\hwrj\\forest\\到数据";//D盘下的file文件夹的目录
 | 
	
		
			
				|  |  | +        String filepath = "G:\\待上传\\sd";//D盘下的file文件夹的目录
 | 
	
		
			
				|  |  |          List<String> file = getDirectory(filepath);
 | 
	
		
			
				|  |  |          List<ForestPath> list = new ArrayList<>();
 | 
	
		
			
				|  |  |          file.stream().forEach(item->{
 | 
	
	
		
			
				|  | @@ -100,16 +104,19 @@ private int i = 1;
 | 
	
		
			
				|  |  |      public void excelPut(ForestPath forestPath){
 | 
	
		
			
				|  |  |          String company = forestPath.getCompanyName();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Long companyId = companyId(company);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          List<String> strings = getDirectory(forestPath.getPath());
 | 
	
		
			
				|  |  |          List<String> excel = getFile(forestPath.getPath());
 | 
	
		
			
				|  |  |          for (String path:excel) {
 | 
	
		
			
				|  |  |              if (path.endsWith(".xlsx")){
 | 
	
		
			
				|  |  | -                addCompanyInfo(new File(forestPath.getPath()+"\\"+path),company);
 | 
	
		
			
				|  |  | +                company = addCompanyInfo(new File(forestPath.getPath()+"\\"+path),company);
 | 
	
		
			
				|  |  |                  System.out.println("供应商导入表格--"+path);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(company)){
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        Long companyId = companyId(company);
 | 
	
		
			
				|  |  |          List<ForestPath> list = new ArrayList<>();
 | 
	
		
			
				|  |  |          for (String str:strings) {
 | 
	
		
			
				|  |  |              ForestPath forestPath1 = new ForestPath();
 | 
	
	
		
			
				|  | @@ -151,7 +158,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |              infoFile.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |              infoFile.setCompId(companyId(companyName));
 | 
	
		
			
				|  |  |              infoFile.setFileStatus(0);
 | 
	
		
			
				|  |  | -            infoFile.setFileUrl(br+s);
 | 
	
		
			
				|  |  | +            infoFile.setFileUrl(url+br+s);
 | 
	
		
			
				|  |  |              if (str.contains("公众号二维码")){
 | 
	
		
			
				|  |  |                  infoFile.setFileType("qrl");
 | 
	
		
			
				|  |  |                  uploadFileUtil.uploadLocalFile(path+"\\"+str,br+s);
 | 
	
	
		
			
				|  | @@ -244,9 +251,9 @@ private int i = 1;
 | 
	
		
			
				|  |  |              String s = OrderNo.NextOrderNo();
 | 
	
		
			
				|  |  |              uploadFileUtil.uploadLocalFile(path+"\\"+file.get(i),br+s);
 | 
	
		
			
				|  |  |              if (i>0){
 | 
	
		
			
				|  |  | -                bu.append(","+br+s);
 | 
	
		
			
				|  |  | +                bu.append(","+url+br+s);
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  | -                bu.append(br+s);
 | 
	
		
			
				|  |  | +                bu.append(url+br+s);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          u.setImgUrl(bu.toString());
 | 
	
	
		
			
				|  | @@ -303,7 +310,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |                  String fs = br+OrderNo.NextOrderNo();
 | 
	
		
			
				|  |  |                  uploadFileUtil.uploadLocalFile(upPath+"\\"+s,fs);
 | 
	
		
			
				|  |  |                  if (s.contains("首图")){
 | 
	
		
			
				|  |  | -                    p.setPic(fs);
 | 
	
		
			
				|  |  | +                    p.setPic(url+fs);
 | 
	
		
			
				|  |  |                  }else {
 | 
	
		
			
				|  |  |                      builder.append(br+",");
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -357,7 +364,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |          return paths;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public void addCompanyInfo(File pdf,String companyName){
 | 
	
		
			
				|  |  | +    public String addCompanyInfo(File pdf,String companyName){
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |  //                    File pdf = fileList[i];
 | 
	
		
			
				|  |  |              System.out.println(pdf.getPath());
 | 
	
	
		
			
				|  | @@ -366,11 +373,13 @@ private int i = 1;
 | 
	
		
			
				|  |  |              MultipartFile multipartFile = new MockMultipartFile(pdf.getName(), pdf.getName(),
 | 
	
		
			
				|  |  |                      ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
 | 
	
		
			
				|  |  |  //                        String url = ossFileUtils.upload(multipartFile.getOriginalFilename(), multipartFile);
 | 
	
		
			
				|  |  | -            importExcel(multipartFile,companyName);
 | 
	
		
			
				|  |  | +            String name = importExcel(multipartFile,companyName);
 | 
	
		
			
				|  |  | +            return name;
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
		
			
				|  |  |              System.out.println(e.getMessage());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        return  null;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -384,7 +393,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |      private PmsProductService pmsProductService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public void importExcel(MultipartFile file,String companyName)throws Exception{
 | 
	
		
			
				|  |  | +    public String importExcel(MultipartFile file,String companyName)throws Exception{
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //导入公司
 | 
	
		
			
				|  |  |          String companyId = null;
 | 
	
	
		
			
				|  | @@ -394,6 +403,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |              for(Object o : list){
 | 
	
		
			
				|  |  |                  UmsCompanyInfoExcel umsCompanyInfoExcel = (UmsCompanyInfoExcel) o;
 | 
	
		
			
				|  |  |                  umsCompanyInfoExcel.setCreateId(0l);
 | 
	
		
			
				|  |  | +                companyId = umsCompanyInfoExcel.getCompName();
 | 
	
		
			
				|  |  |                  listAll.add(umsCompanyInfoExcel);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -405,7 +415,7 @@ private int i = 1;
 | 
	
		
			
				|  |  |          //导入铲平
 | 
	
		
			
				|  |  |          importBasic(file);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        return companyId;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 |