| | |
| | | private void setDircode(List<MetaFileEntity> list, DirEntity dir) { |
| | | List<DirEntity> dirs = dirService.selectRecursiveById(dir.getId()); |
| | | for (MetaFileEntity mfe : list) { |
| | | String code= dir.getCode(); |
| | | String fileName = mfe.getName().toLowerCase(); |
| | | String filePath = mfe.getPath().toLowerCase().replace("/", "\\"); |
| | | for(DirEntity de : dirs){ |
| | | if (filePath.contains(de.getFullName().toLowerCase() + "\\" + fileName)) { |
| | | code=de.getCode(); |
| | | break; |
| | | String fileName = mfe.getName().toLowerCase(); |
| | | |
| | | String code = findDirByPath(dirs, filePath, fileName); |
| | | if (StringHelper.isEmpty(code)) { |
| | | DirEntity baseDir = findBaseDirByPath(dirs, filePath); |
| | | if (null != baseDir) { |
| | | createDirByPath(baseDir, mfe.getPath()); |
| | | dirs = dirService.selectRecursiveById(dir.getId()); |
| | | code = findDirByPath(dirs, filePath, fileName); |
| | | } |
| | | } |
| | | code = StringHelper.isEmpty(code) ? dir.getCode() : code; |
| | | mfe.setDircode(code); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据路径查找目录 |
| | | */ |
| | | private String findDirByPath(List<DirEntity> dirs, String filePath,String fileName) { |
| | | for (DirEntity de : dirs) { |
| | | if (filePath.contains(de.getFullName().toLowerCase() + "\\" + fileName)) { |
| | | return de.getCode(); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据路径查找父目录 |
| | | */ |
| | | private DirEntity findBaseDirByPath(List<DirEntity> dirs, String filePath) { |
| | | for (DirEntity de : dirs) { |
| | | if (StringHelper.isEmpty(de.getCode()) || de.getCode().length() != StaticData.FOUR) { |
| | | continue; |
| | | } |
| | | if (filePath.contains(de.getFullName().toLowerCase() + "\\")) { |
| | | return de; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据路径创建目录 |
| | | */ |
| | | private void createDirByPath(DirEntity baseDir, String filePath) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取参数 * |
| | | * Enumeration<String> headers = req.getHeaderNames(); |
| | | * Enumeration<String> attributes = req.getAttributeNames(); |