|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  package com.hwrj.cloud.admin.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dao.PmsProductExcelDao;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dto.param.ForestPath;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dto.param.PmsProductExcel;
 | 
	
	
		
			
				|  | @@ -13,7 +14,6 @@ import com.hwrj.cloud.admin.mapper.UmsCompanyFileMapper;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.mapper.UmsCompanyInfoMapper;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.mapper.UmsMemberOriginMapper;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.model.*;
 | 
	
		
			
				|  |  | -import com.hwrj.cloud.admin.service.PmsProductService;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.service.UmsCompanyService;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.service.UmsMemberOriginService;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.util.EasyExcelUtil;
 | 
	
	
		
			
				|  | @@ -61,6 +61,9 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |      @Value("${qiniu.path}")
 | 
	
		
			
				|  |  |      private String url;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    List<PmsProductParam> listAll = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("上传文件")
 | 
	
		
			
				|  |  |      @ApiImplicitParams({
 | 
	
		
			
				|  |  |              @ApiImplicitParam(name = "paths",value = "文件路径",required = true),
 | 
	
	
		
			
				|  | @@ -132,8 +135,6 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          for (ForestPath p:list) {
 | 
	
		
			
				|  |  |              if ("产品".equals(p.getCompanyName())){
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                  addProductImg(p,company,companyId);
 | 
	
		
			
				|  |  |              }else if ("供应商".equals(p.getCompanyName())){
 | 
	
		
			
				|  |  |                  addCompanyImg(p,company,companyId);
 | 
	
	
		
			
				|  | @@ -187,6 +188,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (i==0){
 | 
	
		
			
				|  |  | +                infoFile.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                  umsCompanyFileMapper.insertSelective(infoFile);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -308,19 +310,26 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public void addProductImg(ForestPath forestPath,String companyName,Long companyId){
 | 
	
		
			
				|  |  |          List<String> directory = getDirectory(forestPath.getPath());
 | 
	
		
			
				|  |  | -        Long aLong = companyId(companyName);
 | 
	
		
			
				|  |  | -        List<PmsProduct> products = selectProduct(companyName);
 | 
	
		
			
				|  |  | -        if (products != null&&directory != null&& products.size()>0&&directory.size()>0&&products.size()==directory.size()){
 | 
	
		
			
				|  |  | -            for (int i = 0;i<directory.size();i++){
 | 
	
		
			
				|  |  | -                updateFile(forestPath.getPath(),products.get(i).getId(),directory.get(i));
 | 
	
		
			
				|  |  | +        if (listAll != null || listAll.size()<1){
 | 
	
		
			
				|  |  | +            log.info("好像没有数据哦");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for (PmsProductParam  pms:listAll) {
 | 
	
		
			
				|  |  | +            if (directory.contains(pms.getProductNo())){
 | 
	
		
			
				|  |  | +                updateFile(forestPath.getPath(),pms.getId(),pms.getProductNo());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +//        List<PmsProduct> products = selectProduct(companyName);
 | 
	
		
			
				|  |  | +//        if (products != null&&directory != null&& products.size()>0&&directory.size()>0&&products.size()==directory.size()){
 | 
	
		
			
				|  |  | +//            for (int i = 0;i<directory.size();i++){
 | 
	
		
			
				|  |  | +//                updateFile(forestPath.getPath(),products.get(i).getId(),directory.get(i));
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      public void productImg(){
 | 
	
		
			
				|  |  |  //        List<String> directory = getDirectory(forestPath.getPath());
 | 
	
	
		
			
				|  | @@ -434,8 +443,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UmsMemberOriginService umsMemberOriginService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private PmsProductService pmsProductService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public String importExcel(MultipartFile file,String companyName)throws Exception{
 | 
	
	
		
			
				|  | @@ -460,7 +468,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |          //导入生产地
 | 
	
		
			
				|  |  |          importOriginExcel(file,companyId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //导入铲平
 | 
	
		
			
				|  |  | +        //导入商品
 | 
	
		
			
				|  |  |          importBasic(file);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return companyId;
 | 
	
	
		
			
				|  | @@ -529,7 +537,10 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |  //            }
 | 
	
		
			
				|  |  |  //        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<PmsProductParam> listAll = new ArrayList<>();
 | 
	
		
			
				|  |  | +//        List<PmsProductParam> listAll = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        listAll = new ArrayList<>();
 | 
	
		
			
				|  |  |          if(file != null){
 | 
	
		
			
				|  |  |              List<Object> list = null;
 | 
	
		
			
				|  |  |              try {
 | 
	
	
		
			
				|  | @@ -548,6 +559,8 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          log.info("sssss");
 | 
	
		
			
				|  |  |          productExcelDao.saveData(listAll);
 | 
	
		
			
				|  |  | +        log.info(JSONObject.toJSONString(listAll));
 | 
	
		
			
				|  |  | +        log.info(JSONObject.toJSONString(listAll));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |