Commit 05ea5991 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 81e29bde
...@@ -97,6 +97,8 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -97,6 +97,8 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
zipFile.transferTo(file); zipFile.transferTo(file);
// 获取解压出来的文件名 不带后缀 // 获取解压出来的文件名 不带后缀
unZip(file, dec); unZip(file, dec);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFile(dec);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -121,16 +123,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -121,16 +123,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
private R unZip(File srcFile, String destDirPath) throws RuntimeException { private R unZip(File srcFile, String destDirPath) throws RuntimeException {
// 调用字典服务,渲染字典值 // 调用字典服务,渲染字典值
R<Map<String, Map<String, String>>> dictR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId() R<Map<String, Map<String, Map<String, String>>>> dictR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictToLable", null, Map.class, SecurityConstants.FROM_IN); , "/dict/inner/getDictToLable", null, Map.class, SecurityConstants.FROM_IN);
Map<String, Map<String, String>> dictMap; Map<String, Map<String, Map<String, String>>> dictMap;
// 电子档案类型 // 电子档案类型
Map<String, Map<String, String>> elecTypeMapData;
Map<String, String> elecTypeMap; Map<String, String> elecTypeMap;
if (dictR == null) { if (dictR == null) {
return R.failed("获取字典失败!"); return R.failed("获取字典失败!");
}else { }else {
dictMap = dictR.getData(); dictMap = dictR.getData();
elecTypeMap = dictMap.get("elec_archives_type"); elecTypeMapData = dictMap.get("data");
elecTypeMap = elecTypeMapData.get("elec_archives_type");
} }
//记录解压出来的所有文件名 //记录解压出来的所有文件名
List<String> filesName = new ArrayList<>(); List<String> filesName = new ArrayList<>();
...@@ -239,4 +243,41 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -239,4 +243,41 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
MultipartFile multipartFile = new CommonsMultipartFile(item); MultipartFile multipartFile = new CommonsMultipartFile(item);
return multipartFile; return multipartFile;
} }
/**
* 删除文件
*
* @param filePath
* @return
*/
public static boolean deleteFile(String filePath) {
boolean flag = false;
File file = new File(filePath);
if (!file.exists()) {
return flag;
}
if (!file.isDirectory()) {
return flag;
}
String[] tempList = file.list();
File temp;
for (int i = 0; i < tempList.length; i++) {
if (filePath.endsWith(File.separator)) {
temp = new File(filePath + tempList[i]);
} else {
temp = new File(filePath + File.separator + tempList[i]);
}
if (temp.isFile()) {
temp.delete();
}
if (temp.isDirectory()) {
// 先删除文件夹里面的文件
deleteFile(filePath + "/" + tempList[i]);
// 再删除空文件夹
deleteFile(filePath + "/" + tempList[i]);
flag = true;
}
}
return flag;
}
} }
...@@ -311,7 +311,7 @@ public class DictController { ...@@ -311,7 +311,7 @@ public class DictController {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/ **/
@Inner @Inner
@GetMapping("/inner/getDictToLable") @PostMapping("/inner/getDictToLable")
public R<Map<String, Map<String, String>>> getDictToLable() { public R<Map<String, Map<String, String>>> getDictToLable() {
return sysDictItemService.getDictToLable(); return sysDictItemService.getDictToLable();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment