|  | @@ -6,6 +6,7 @@ import com.hwrj.cloud.admin.dao.PmsProductExcelDao;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dto.param.ForestPath;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dto.param.PmsProductExcel;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.dto.param.PmsProductParam;
 | 
	
		
			
				|  |  | +import com.hwrj.cloud.admin.dto.utilEntity.LagLatEntity;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.excelEntity.UmsCompanyInfoExcel;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.excelEntity.UmsMemberOriginExcel;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.listener.ImportExcelEventListener;
 | 
	
	
		
			
				|  | @@ -16,10 +17,7 @@ import com.hwrj.cloud.admin.mapper.UmsMemberOriginMapper;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.model.*;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.service.UmsCompanyService;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.admin.service.UmsMemberOriginService;
 | 
	
		
			
				|  |  | -import com.hwrj.cloud.admin.util.ChineseCharToEn;
 | 
	
		
			
				|  |  | -import com.hwrj.cloud.admin.util.EasyExcelUtil;
 | 
	
		
			
				|  |  | -import com.hwrj.cloud.admin.util.OrderNo;
 | 
	
		
			
				|  |  | -import com.hwrj.cloud.admin.util.UploadFileUtil;
 | 
	
		
			
				|  |  | +import com.hwrj.cloud.admin.util.*;
 | 
	
		
			
				|  |  |  import com.hwrj.cloud.common.api.CommonResult;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParam;
 | 
	
	
		
			
				|  | @@ -63,6 +61,8 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value("${qiniu.path}")
 | 
	
		
			
				|  |  |      private String url;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private CompanyLatLagGet companyLatLagGet;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      List<PmsProductParam> listAll = new ArrayList<>();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -78,7 +78,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |      public CommonResult readFile(@RequestParam(value = "paths") String paths, @RequestParam(value = "type") String type, @RequestParam(value = "compName", required = false) String compName) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if ("1".equals(type)) {
 | 
	
		
			
				|  |  | -            String filepath = paths;//D盘下的file文件夹的目录
 | 
	
		
			
				|  |  | +            String filepath = paths;
 | 
	
		
			
				|  |  |              List<String> file = getDirectory(filepath);
 | 
	
		
			
				|  |  |              List<ForestPath> list = new ArrayList<>();
 | 
	
		
			
				|  |  |              file.stream().forEach(item -> {
 | 
	
	
		
			
				|  | @@ -157,7 +157,6 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UmsCompanyFileMapper umsCompanyFileMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    //供应商
 | 
	
		
			
				|  |  |      public void addCompanyImg(ForestPath forestPath, String companyName, Long companyId) {
 | 
	
		
			
				|  |  |          String path = forestPath.getPath();
 | 
	
		
			
				|  |  |          List<String> file = getFile(path);
 | 
	
	
		
			
				|  | @@ -178,7 +177,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  |                  throw new RuntimeException("获取文件后缀出错!=======>" + split);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            imgName = imgName + "." + split[split.length-1];
 | 
	
		
			
				|  |  | +            imgName = imgName + "." + split[1];
 | 
	
		
			
				|  |  |              String filePath = path + "\\" + str;
 | 
	
		
			
				|  |  |              infoFile.setFileUrl(url + imgName);
 | 
	
		
			
				|  |  |              if (str.contains("公众号二维码")) {
 | 
	
	
		
			
				|  | @@ -285,7 +284,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  |                  throw new RuntimeException("获取文件后缀出错!=======>" + split);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            String fileName = br + s + "." + split[split.length-1];
 | 
	
		
			
				|  |  | +            String fileName = br + s + "." + split[1];
 | 
	
		
			
				|  |  |              uploadFileUtil.uploadLocalFile(path + "\\" + oldFileName, fileName);
 | 
	
		
			
				|  |  |              if (i > 0) {
 | 
	
		
			
				|  |  |                  bu.append("," + url + fileName);
 | 
	
	
		
			
				|  | @@ -344,20 +343,12 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |                  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());
 | 
	
		
			
				|  |  | -//        Long aLong = companyId(companyName);
 | 
	
		
			
				|  |  |          List<String> directory = getDirectory("D:\\developerUtil\\code\\hwrj\\forest\\到数据\\上传\\石阡县猫寨农林专业合作社\\产品");
 | 
	
		
			
				|  |  |          List<PmsProduct> products = selectProduct("石阡县猫寨农林专业合作");
 | 
	
		
			
				|  |  |          if (products != null && directory != null && products.size() > 0 && directory.size() > 0 && products.size() == directory.size()) {
 | 
	
	
		
			
				|  | @@ -369,7 +360,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    //首图
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      public void updateFile(String path, Long along, String str) {
 | 
	
		
			
				|  |  |          String upPath = path + "\\" + str;
 | 
	
		
			
				|  |  |          String br = "0/2/" + along + "/";
 | 
	
	
		
			
				|  | @@ -386,7 +377,7 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |                  } catch (Exception e) {
 | 
	
		
			
				|  |  |                      throw new RuntimeException("获取文件后缀出错!=======>" + split);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                fs = fs + "." + split[split.length-1];
 | 
	
		
			
				|  |  | +                fs = fs + "." + split[1];
 | 
	
		
			
				|  |  |                  uploadFileUtil.uploadLocalFile(upPath + "\\" + s, fs);
 | 
	
		
			
				|  |  |                  if (s.contains("首图")) {
 | 
	
		
			
				|  |  |                      p.setPic(url + fs);
 | 
	
	
		
			
				|  | @@ -486,6 +477,11 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |                  UmsCompanyInfoExcel umsCompanyInfoExcel = (UmsCompanyInfoExcel) o;
 | 
	
		
			
				|  |  |                  umsCompanyInfoExcel.setCreateId(0l);
 | 
	
		
			
				|  |  |                  companyId = umsCompanyInfoExcel.getCompName();
 | 
	
		
			
				|  |  | +                LagLatEntity lagLat = companyLatLagGet.getLagLat(umsCompanyInfoExcel.getCityId(), umsCompanyInfoExcel.getCountyId(), umsCompanyInfoExcel.getDetailAddress());
 | 
	
		
			
				|  |  | +                if (lagLat != null ){
 | 
	
		
			
				|  |  | +                    umsCompanyInfoExcel.setLatitude(new BigDecimal(lagLat.getLat()));
 | 
	
		
			
				|  |  | +                    umsCompanyInfoExcel.setLongitude(new BigDecimal(lagLat.getLag()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  listAll.add(umsCompanyInfoExcel);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -522,6 +518,11 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |                      UmsMemberOriginExcel excel = (UmsMemberOriginExcel) obj;
 | 
	
		
			
				|  |  |                      excel.setCreateId(1);
 | 
	
		
			
				|  |  |                      excel.setState(0);
 | 
	
		
			
				|  |  | +                    LagLatEntity lagLat = companyLatLagGet.getLagLat(excel.getCityName(), excel.getCountyName(), excel.getDetailAddress());
 | 
	
		
			
				|  |  | +                    if (lagLat != null ){
 | 
	
		
			
				|  |  | +                        excel.setLatitude(lagLat.getLat());
 | 
	
		
			
				|  |  | +                        excel.setLongitude(lagLat.getLag());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      excel.setCompName(companyName);
 | 
	
		
			
				|  |  |                      listAll.add(excel);
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -552,22 +553,6 @@ public class UploadCompanyInfoAndProductController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public void importBasic(MultipartFile file) throws IOException {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//        PmsProductExcelListener basicExcelListener = new PmsProductExcelListener(productExcelDao,null);
 | 
	
		
			
				|  |  | -//        ExcelReader excelReader = null;
 | 
	
		
			
				|  |  | -//        try {
 | 
	
		
			
				|  |  | -//            excelReader = EasyExcel.read(file.getInputStream()).build();
 | 
	
		
			
				|  |  | -//            ReadSheet readSheet3 =
 | 
	
		
			
				|  |  | -//                    EasyExcel.readSheet(2).head(PmsProductExcel.class).registerReadListener(basicExcelListener).headRowNumber(2).build();
 | 
	
		
			
				|  |  | -//            // 这里注意 一定要把sheet1 sheet2 一起传进去,不然有个问题就是03版的excel 会读取多次,浪费性能
 | 
	
		
			
				|  |  | -//            excelReader.read(readSheet3);
 | 
	
		
			
				|  |  | -//        } finally {
 | 
	
		
			
				|  |  | -//            if (excelReader != null) {
 | 
	
		
			
				|  |  | -//                // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
 | 
	
		
			
				|  |  | -//                excelReader.finish();
 | 
	
		
			
				|  |  | -//            }
 | 
	
		
			
				|  |  | -//        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -//        List<PmsProductParam> listAll = new ArrayList<>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          listAll = new ArrayList<>();
 |