|
@@ -8,11 +8,13 @@ import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.util.FileMd5Util;
|
|
import com.fdkankan.common.util.FileMd5Util;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
|
+import com.fdkankan.manage.common.FilePath;
|
|
import com.fdkankan.manage.util.MangerUploadToOssUtil;
|
|
import com.fdkankan.manage.util.MangerUploadToOssUtil;
|
|
import com.fdkankan.manage.entity.AppFile;
|
|
import com.fdkankan.manage.entity.AppFile;
|
|
import com.fdkankan.manage.mapper.IAppFileMapper;
|
|
import com.fdkankan.manage.mapper.IAppFileMapper;
|
|
import com.fdkankan.manage.service.IAppFileService;
|
|
import com.fdkankan.manage.service.IAppFileService;
|
|
import com.fdkankan.manage.vo.request.AppFileParam;
|
|
import com.fdkankan.manage.vo.request.AppFileParam;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -37,6 +39,7 @@ import java.util.stream.Collectors;
|
|
* @since 2022-06-14
|
|
* @since 2022-06-14
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
|
|
+@Slf4j
|
|
public class AppFileServiceImpl extends ServiceImpl<IAppFileMapper, AppFile> implements IAppFileService {
|
|
public class AppFileServiceImpl extends ServiceImpl<IAppFileMapper, AppFile> implements IAppFileService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -54,9 +57,9 @@ public class AppFileServiceImpl extends ServiceImpl<IAppFileMapper, AppFile> imp
|
|
try {
|
|
try {
|
|
Map<String,String> result = new HashMap<>(2);
|
|
Map<String,String> result = new HashMap<>(2);
|
|
|
|
|
|
- String filePath = FileUtils.getResource().concat("uploadAppTmp");
|
|
|
|
|
|
+ String filePath = FilePath.appLocalPath;
|
|
FileUtils.createDir(filePath);
|
|
FileUtils.createDir(filePath);
|
|
- filePath = filePath.concat("/").concat(file.getOriginalFilename());
|
|
|
|
|
|
+ filePath = filePath.concat(file.getOriginalFilename());
|
|
// 删除旧文件
|
|
// 删除旧文件
|
|
FileUtils.deleteFile(filePath);
|
|
FileUtils.deleteFile(filePath);
|
|
File file1 = new File(filePath);
|
|
File file1 = new File(filePath);
|
|
@@ -67,6 +70,7 @@ public class AppFileServiceImpl extends ServiceImpl<IAppFileMapper, AppFile> imp
|
|
result.put("fileName",file.getOriginalFilename());
|
|
result.put("fileName",file.getOriginalFilename());
|
|
return result;
|
|
return result;
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
|
+ log.error("上传App出错{}",e);
|
|
throw new BusinessException(-1,"上传失败");
|
|
throw new BusinessException(-1,"上传失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -97,7 +101,7 @@ public class AppFileServiceImpl extends ServiceImpl<IAppFileMapper, AppFile> imp
|
|
}
|
|
}
|
|
AppFile managerAPPEntity = new AppFile();
|
|
AppFile managerAPPEntity = new AppFile();
|
|
BeanUtils.copyProperties(param, managerAPPEntity);
|
|
BeanUtils.copyProperties(param, managerAPPEntity);
|
|
- String basePath = FileUtils.getResource().concat("uploadAppTmp/");
|
|
|
|
|
|
+ String basePath = FilePath.appLocalPath ;
|
|
|
|
|
|
String filePath = basePath.concat(param.getName());
|
|
String filePath = basePath.concat(param.getName());
|
|
File file = new File(filePath);
|
|
File file = new File(filePath);
|