|
|
|
@ -54,11 +54,13 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
@Resource
|
|
|
|
|
private IdcService idcService;
|
|
|
|
|
private String imagePath = "register/file/image2/";
|
|
|
|
|
String pdfPath = "pdf/template/";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse upload(List<String> list) {
|
|
|
|
|
return fileToUpload(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse download(List<String> list) {
|
|
|
|
|
return fileToDownload(list);
|
|
|
|
@ -95,21 +97,15 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
if (StringUtils.isEmpty(host))
|
|
|
|
|
return ResultVOUtils.error(9999, "上传地址未配置,请至同步设置中进行设置");
|
|
|
|
|
if (list != null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
|
|
|
|
|
ArrayList<String> files = new ArrayList<>();
|
|
|
|
|
boolean isExists = true;
|
|
|
|
|
List<String> noExitsList = new ArrayList<>();
|
|
|
|
|
for (String strs : list) {
|
|
|
|
|
String[] str = strs.split(",");
|
|
|
|
|
for(String s:str) {
|
|
|
|
|
if (!StringUtils.isEmpty(s) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + s)) {
|
|
|
|
|
files.add(filePath + filePathSlash + imagePath + s);
|
|
|
|
|
if (!StringUtils.isEmpty(strs) && FileUtils.isFileExist(strs)) {
|
|
|
|
|
files.add(strs);
|
|
|
|
|
} else {
|
|
|
|
|
isExists = false;
|
|
|
|
|
noExitsList.add(s);
|
|
|
|
|
}
|
|
|
|
|
noExitsList.add(strs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!isExists)
|
|
|
|
@ -124,7 +120,6 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse fileDownload(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
@ -173,6 +168,8 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
boolean isRelay = false;
|
|
|
|
|
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
|
|
|
|
|
String host = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
Map<String, Object> config = dbDao.get("select paramValue from system_param_config where paramKey='upper_server_ip'");
|
|
|
|
|
if (config != null && config.get("paramValue") != null) {
|
|
|
|
@ -190,9 +187,15 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
IDCUtils.createDirectory(filePath + filePathSlash + imagePath);
|
|
|
|
|
try {
|
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
|
String imageName = filePath + filePathSlash + imagePath + file.getOriginalFilename();
|
|
|
|
|
String flodPath;
|
|
|
|
|
if (file.getName().contains(".jrxml") || file.getName().contains(".jasper")) {
|
|
|
|
|
flodPath = pdfPath;
|
|
|
|
|
} else {
|
|
|
|
|
flodPath = imagePath;
|
|
|
|
|
}
|
|
|
|
|
String imageName = filePath + filePathSlash + flodPath + file.getOriginalFilename();
|
|
|
|
|
saveFiles.add(imageName);
|
|
|
|
|
IDCUtils.writeFile(file.getBytes(), filePath + filePathSlash + imagePath, file.getOriginalFilename());
|
|
|
|
|
IDCUtils.writeFile(file.getBytes(), filePath + filePathSlash + flodPath, file.getOriginalFilename());
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|