mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +08:00
新增添加余料板、提交保存优化结果文件、开始开料 接口
This commit is contained in:
+5
@@ -23,4 +23,9 @@ public class FileApiImpl implements FileApi {
|
||||
createReqDTO.getContent()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteFileByPath(String path) {
|
||||
return success(fileService.deleteFileByPath(path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -45,4 +45,10 @@ public interface FileService {
|
||||
*/
|
||||
byte[] getFileContent(Long configId, String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
* @param path 文件地址
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteFileByPath(String path);
|
||||
}
|
||||
|
||||
+25
@@ -6,6 +6,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.io.FileUtils;
|
||||
import com.cf.imes.framework.file.core.client.FileClient;
|
||||
import com.cf.imes.framework.file.core.utils.FileTypeUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
|
||||
import com.cf.imes.module.infra.dal.mysql.file.FileMapper;
|
||||
@@ -14,8 +15,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL;
|
||||
|
||||
/**
|
||||
* 文件 Service 实现类
|
||||
@@ -95,4 +99,25 @@ public class FileServiceImpl implements FileService {
|
||||
return client.getContent(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteFileByPath(String path) {
|
||||
// 校验存在
|
||||
FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX<FileDO>().eq(FileDO::getPath, path));
|
||||
if(Objects.isNull(fileDO)) {
|
||||
throw exception(FILE_NOT_EXISTS);
|
||||
}
|
||||
// 从文件存储器中删除
|
||||
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
|
||||
Assert.notNull(client, "客户端({}) 不能为空", fileDO.getConfigId());
|
||||
try {
|
||||
client.delete(path);
|
||||
} catch (Exception e) {
|
||||
throw exception(FILE_REMOVE_FAIL);
|
||||
}
|
||||
|
||||
// 删除记录
|
||||
fileMapper.deleteById(fileDO.getId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user