|
@@ -19,7 +19,6 @@ import io.renren.modules.sys.entity.dataset.DataSetDy;
|
|
import io.renren.modules.sys.service.*;
|
|
import io.renren.modules.sys.service.*;
|
|
import io.renren.modules.sys.service.impl.AlgsModelsServiceImpl;
|
|
import io.renren.modules.sys.service.impl.AlgsModelsServiceImpl;
|
|
import io.renren.modules.sys.service.impl.AlgsServiceImpl;
|
|
import io.renren.modules.sys.service.impl.AlgsServiceImpl;
|
|
-import jdk.internal.org.objectweb.asm.TypeReference;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -134,10 +133,18 @@ public class algsController{
|
|
List<MultipartFile> files=request.getFiles("file");
|
|
List<MultipartFile> files=request.getFiles("file");
|
|
//若是智能算法,则调用上传智能算法方法,-1为传统算法,其他为智能算法
|
|
//若是智能算法,则调用上传智能算法方法,-1为传统算法,其他为智能算法
|
|
if(alg.getFrameId()!=-1){
|
|
if(alg.getFrameId()!=-1){
|
|
- String dataSetsString= request.getParameter("dataSets");//如果有选择数据集,则将数据集从minio中拷贝到相应位置
|
|
|
|
|
|
+ List<DataSet> dataSets = new ArrayList<>();
|
|
|
|
+ List<DataSetDy> dataSetsDy = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isNotEmpty(request.getParameter("dataSets"))) {
|
|
|
|
+ dataSets = JSON.parseArray(request.getParameter("dataSets"), DataSet.class);//如果有选择数据集,则将数据集从minio中拷贝到相应位置
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(request.getParameter("dataSetsDy"))) {
|
|
|
|
+ dataSetsDy = JSON.parseArray(request.getParameter("dataSetsDy"), DataSetDy.class);
|
|
|
|
+ }
|
|
|
|
+ // String dataSetsString= request.getParameter("dataSets");//如果有选择数据集,则将数据集从minio中拷贝到相应位置
|
|
String algModelsString=request.getParameter("algModels");//如果有选择算法,则将对应算法代码拷贝到相应位置
|
|
String algModelsString=request.getParameter("algModels");//如果有选择算法,则将对应算法代码拷贝到相应位置
|
|
String algTemplatesString=request.getParameter("algTemplates");//如果有选择模板,则将对应模板代码拷贝到相应位置
|
|
String algTemplatesString=request.getParameter("algTemplates");//如果有选择模板,则将对应模板代码拷贝到相应位置
|
|
- saveIntelligentAlg(alg,dataSetsString,algModelsString,algTemplatesString,files);
|
|
|
|
|
|
+ saveIntelligentAlg(alg,dataSets,dataSetsDy,algModelsString,algTemplatesString,files);
|
|
}else {
|
|
}else {
|
|
List<DataSet> dataSets = new ArrayList<>();
|
|
List<DataSet> dataSets = new ArrayList<>();
|
|
List<DataSetDy> dataSetsDy = new ArrayList<>();
|
|
List<DataSetDy> dataSetsDy = new ArrayList<>();
|
|
@@ -160,12 +167,13 @@ public class algsController{
|
|
/**
|
|
/**
|
|
* 保存智能算法
|
|
* 保存智能算法
|
|
* @param alg 算法对象实体
|
|
* @param alg 算法对象实体
|
|
- * @param dataSetsString 算法引入的数据集id,以逗号分隔
|
|
|
|
|
|
+ * @param dataSets 算法引入的静态数据集
|
|
|
|
+ * @param dataSets 算法引入的动态数据集
|
|
* @param algModelsString 算法引入的算法库算法id,以逗号分隔
|
|
* @param algModelsString 算法引入的算法库算法id,以逗号分隔
|
|
* @param algTemplatesString 算法引入的算法模板id,以逗号分隔
|
|
* @param algTemplatesString 算法引入的算法模板id,以逗号分隔
|
|
* @param files 算法文件
|
|
* @param files 算法文件
|
|
*/
|
|
*/
|
|
- public void saveIntelligentAlg(Algorithm alg,String dataSetsString,String algModelsString,String algTemplatesString,List<MultipartFile> files) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InternalException {
|
|
|
|
|
|
+ public void saveIntelligentAlg(Algorithm alg,List<DataSet> dataSets, List<DataSetDy> dataSetsDy,String algModelsString,String algTemplatesString,List<MultipartFile> files) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InternalException {
|
|
Long algId=alg.getAlgorithmId();
|
|
Long algId=alg.getAlgorithmId();
|
|
Version version=new Version();
|
|
Version version=new Version();
|
|
version.setAlgorithmId(algId);
|
|
version.setAlgorithmId(algId);
|
|
@@ -178,12 +186,35 @@ public class algsController{
|
|
if(file.isEmpty()) break;
|
|
if(file.isEmpty()) break;
|
|
MinIoUtils.uploadMultipartFile(file,"algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/"+file.getOriginalFilename());
|
|
MinIoUtils.uploadMultipartFile(file,"algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/"+file.getOriginalFilename());
|
|
}
|
|
}
|
|
- if(dataSetsString.length()!=0){
|
|
|
|
- String[] dataSets=dataSetsString.split(",");
|
|
|
|
- for(String fileName:dataSets){
|
|
|
|
- MinIoUtils.copyFile("algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/"+fileName,"dataset",fileName);
|
|
|
|
|
|
+ //将数据集上传
|
|
|
|
+ if (!dataSets.isEmpty()) {
|
|
|
|
+ for (DataSet dataSet : dataSets) {
|
|
|
|
+ CategoryEntity category = categoryService.getById(dataSet.getCategoryId());
|
|
|
|
+ if (DataSetType.DIR_DATASET.getClassificationName().equals(category.getCategoryName())) {
|
|
|
|
+ MinIoUtils.copyFolder("algorithm", "alg"+algId+"/", DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName() + "/");
|
|
|
|
+ } else {
|
|
|
|
+ MinIoUtils.copyFile("algorithm",
|
|
|
|
+ "alg"+algId+"/version"+versionService.getMaxId()+"/"+ dataSet.getDatasetName()+".csv",
|
|
|
|
+ DataSetType.STATIC_DATASET.getBucketName(),
|
|
|
|
+ dataSet.getDatasetName()+".csv");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!dataSetsDy.isEmpty()) {
|
|
|
|
+ for (DataSetDy dataSetDy : dataSetsDy) {
|
|
|
|
+ MinIoUtils.copyFile("algorithm",
|
|
|
|
+ "alg"+algId+"/version"+versionService.getMaxId()+"/"+ dataSetDy.getDatasetName()+".csv",
|
|
|
|
+ DataSetType.DYNAMIC_DATASET.getBucketName(),
|
|
|
|
+ dataSetDy.getDatasetName()+".csv");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+// if(dataSetsString.length()!=0){
|
|
|
|
+// String[] dataSets=dataSetsString.split(",");
|
|
|
|
+// for(String fileName:dataSets){
|
|
|
|
+// MinIoUtils.copyFile("algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/"+fileName+".csv",DataSetType.DYNAMIC_DATASET.getBucketName(),fileName+".csv");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
//MinIoUtils.copyFile("algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/fea_data.csv","dataset","fea_data.csv");
|
|
//MinIoUtils.copyFile("algorithm","alg"+algId+"/version"+versionService.getMaxId()+"/fea_data.csv","dataset","fea_data.csv");
|
|
if(algModelsString.length()!=0){
|
|
if(algModelsString.length()!=0){
|
|
String[] algModels=algModelsString.split(",");
|
|
String[] algModels=algModelsString.split(",");
|
|
@@ -282,14 +313,14 @@ public class algsController{
|
|
if (DataSetType.DIR_DATASET.getClassificationName().equals(category.getCategoryName())) {
|
|
if (DataSetType.DIR_DATASET.getClassificationName().equals(category.getCategoryName())) {
|
|
MinIoUtils.copyFolder("algorithm", "alg"+algId+"/", DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName() + "/");
|
|
MinIoUtils.copyFolder("algorithm", "alg"+algId+"/", DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName() + "/");
|
|
} else {
|
|
} else {
|
|
- MinIoUtils.copyFile("algorithm","alg"+algId+"/"+dataSet.getDatasetName(), DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName());
|
|
|
|
|
|
+ MinIoUtils.copyFile("algorithm","alg"+algId+"/"+dataSet.getDatasetName()+".csv", DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName()+".csv");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (!dataSetsDy.isEmpty()) {
|
|
if (!dataSetsDy.isEmpty()) {
|
|
for (DataSetDy dataSetDy : dataSetsDy) {
|
|
for (DataSetDy dataSetDy : dataSetsDy) {
|
|
- MinIoUtils.copyFile("algorithm", "alg"+algId+"/"+dataSetDy.getDatasetName(), DataSetType.DYNAMIC_DATASET.getBucketName(), dataSetDy.getDatasetName());
|
|
|
|
|
|
+ MinIoUtils.copyFile("algorithm", "alg"+algId+"/"+dataSetDy.getDatasetName()+".csv", DataSetType.DYNAMIC_DATASET.getBucketName(), dataSetDy.getDatasetName()+".csv");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|