|
|
|
@ -51,6 +51,33 @@ public class ResourceController extends Controller {
|
|
|
|
|
renderJson(RetKit.renderSuccess(record));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取Minio的上传签名
|
|
|
|
|
*
|
|
|
|
|
* @param extension 上传的扩展名
|
|
|
|
|
* @param file_md5 文件md5值
|
|
|
|
|
*/
|
|
|
|
|
@Before(GET.class)
|
|
|
|
|
@JwtCheckInterface({})
|
|
|
|
|
@EmptyInterface({"extension"})
|
|
|
|
|
public void getSignatureByMd5(String extension, String file_md5) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
|
|
|
|
if (!extension.equals(extension.toLowerCase())) {
|
|
|
|
|
renderJson(RetKit.renderFail("扩展名必须为小写"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Record rResource = rm.getResourceByFileMd5(file_md5);
|
|
|
|
|
if (rResource == null) {
|
|
|
|
|
//生成一个guid+扩展名的key
|
|
|
|
|
String objectName = java.util.UUID.randomUUID() + "." + extension;
|
|
|
|
|
String signature = MinioUtils.getSignature("resources/" + objectName);
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("object_name", objectName);
|
|
|
|
|
record.set("signature", signature);
|
|
|
|
|
renderJson(RetKit.renderSuccess(record));
|
|
|
|
|
} else {
|
|
|
|
|
renderJson(RetKit.renderSuccess(rResource));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增加
|
|
|
|
@ -136,19 +163,20 @@ public class ResourceController extends Controller {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
* @param stage_id 学段
|
|
|
|
|
* @param scheme_id 版本
|
|
|
|
|
* @param subject_id 学科
|
|
|
|
|
*
|
|
|
|
|
* @param stage_id 学段
|
|
|
|
|
* @param scheme_id 版本
|
|
|
|
|
* @param subject_id 学科
|
|
|
|
|
* @param structure_id 结构ID
|
|
|
|
|
* @param keyword 搜索关键词
|
|
|
|
|
* @param pageNum 页码
|
|
|
|
|
* @param pageSize 每页数量
|
|
|
|
|
* @param keyword 搜索关键词
|
|
|
|
|
* @param pageNum 页码
|
|
|
|
|
* @param pageSize 每页数量
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
//@JwtCheckInterface({})
|
|
|
|
|
@IsNumericInterface({"pageNum", "pageSize","structure_id"})
|
|
|
|
|
@IsNumericInterface({"pageNum", "pageSize", "structure_id"})
|
|
|
|
|
public void getResourceBaseList(int stage_id, int scheme_id, int subject_id, int structure_id, String keyword, int pageNum, int pageSize) {
|
|
|
|
|
Page<Record> listPage = rm.getResourceBaseList(stage_id,scheme_id,subject_id,structure_id,keyword,pageNum, pageSize);
|
|
|
|
|
Page<Record> listPage = rm.getResourceBaseList(stage_id, scheme_id, subject_id, structure_id, keyword, pageNum, pageSize);
|
|
|
|
|
renderJson(RetKit.renderSuccess(listPage));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|