1.修改文件信息接口的异常反馈。
This commit is contained in:
parent
b7ade7d149
commit
9580e204a7
|
|
@ -4,6 +4,7 @@ import com.electromagnetic.industry.software.data.manage.domain.boardservice.ind
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -54,7 +55,7 @@ public interface EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateFileInfo(EDDataParams parames);
|
Boolean updateFileInfo(EDDataParams parames) throws FileNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子文件数量
|
* 获取子文件数量
|
||||||
|
|
|
||||||
|
|
@ -212,19 +212,19 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean updateFileInfo(EDDataParams parames)
|
public Boolean updateFileInfo(EDDataParams parames) throws FileNotFoundException
|
||||||
{
|
{
|
||||||
|
|
||||||
String dataStoragePath = getDataStoragePath();
|
String dataStoragePath = getDataStoragePath();
|
||||||
if (!FileUtil.exist(dataStoragePath)){
|
if (!FileUtil.exist(dataStoragePath)){
|
||||||
return Boolean.FALSE;
|
throw new FileNotFoundException("数据存储文件夹不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
EDDataParams paramesFind = new EDDataParams();
|
EDDataParams paramesFind = new EDDataParams();
|
||||||
paramesFind.setDataId(parames.getDataId());
|
paramesFind.setDataId(parames.getDataId());
|
||||||
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(paramesFind);
|
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(paramesFind);
|
||||||
if(edDataInfoList.size() < 1) {
|
if(edDataInfoList.size() < 1) {
|
||||||
return Boolean.FALSE;
|
throw new FileNotFoundException("文件信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
EDDataInfo edDataInfo = edDataInfoList.get(0);
|
EDDataInfo edDataInfo = edDataInfoList.get(0);
|
||||||
|
|
@ -232,7 +232,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName();
|
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName();
|
||||||
|
|
||||||
if (!FileUtil.exist(fileStorageFullPath)){
|
if (!FileUtil.exist(fileStorageFullPath)){
|
||||||
return Boolean.FALSE;
|
throw new FileNotFoundException("文件不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileNameNew = parames.getName();
|
String fileNameNew = parames.getName();
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,12 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
public ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request)
|
public ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request)
|
||||||
{
|
{
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
edDataService.updateFileInfo(parames);
|
try {
|
||||||
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
return ElectromagneticResultUtil.success(edDataService.updateFileInfo(parames));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
log.error("文件信息更新失败。。。", e);
|
||||||
|
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue