Explorar o código

孙浩博,fixed:算法管理编辑算法模块

seamew hai 1 ano
pai
achega
45ba9c87db

+ 1 - 0
src/main/java/io/renren/RenrenApplication.java

@@ -8,6 +8,7 @@
 
 package io.renren;
 
+import lgh.springboot.starter.hbase.template.HBaseTemplate;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;

+ 24 - 0
src/main/java/io/renren/common/utils/MinIoUtils.java

@@ -281,6 +281,30 @@ public class MinIoUtils {
         minioClient.copyObject(bucketName,objectName,null,null,srcBucketName,srcObjectName,null,null);
     }
 
+
+    /**
+     * Description 复制文件夹
+     *
+     * @param bucketName 存放复制文件夹的存储桶
+     * @param folderName 复制文件夹名称
+     * @param srcBucketName 源文件夹所在桶
+     * @param srcFolderName 源文件夹名称
+     */
+    public static void copyFolder(String bucketName,String folderName,String srcBucketName,String srcFolderName) throws IOException, InvalidKeyException, InvalidResponseException, InsufficientDataException, NoSuchAlgorithmException, InternalException, XmlParserException, InvalidBucketNameException, ErrorResponseException {
+        if (StringUtils.isEmpty(folderName)) {
+            folderName = "";
+        }
+        Iterable<Result<Item>> results = minioClient.listObjects(srcBucketName, srcFolderName, false);
+        for (Result<Item> result : results) {
+            Item item = result.get();
+            if (item.isDir()) {
+                copyFolder(bucketName, folderName, srcBucketName, item.objectName());
+            } else {
+                copyFile(bucketName, folderName + item.objectName(), srcBucketName, item.objectName());
+            }
+        }
+    }
+
     /**
      * Description 删除指定文件
      * @param bucketName

+ 2 - 1
src/main/java/io/renren/modules/dataSet/enumeration/DataSetType.java

@@ -11,7 +11,8 @@ public enum DataSetType {
     STATIC_DATASET("dataset", ""),
     DYNAMIC_DATASET("dydataset", ""),
     FILE_DATASET("dataset", "单文件"),
-    DIR_DATASET("dataset", "文件夹");
+    DIR_DATASET("dataset", "文件夹"),
+    ALG_DATASET("algorithm", "");
 
     private final String bucketName;
 

+ 3 - 0
src/main/java/io/renren/modules/dataSet/service/impl/DynamicSystemServiceImpl.java

@@ -21,6 +21,8 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.*;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Conditional;
 import org.springframework.stereotype.Service;
 
 import java.io.*;
@@ -31,6 +33,7 @@ import java.util.*;
 @Service
 public class DynamicSystemServiceImpl implements DynamicSystemService {
 
+
     @Autowired
     HBaseTemplate hBaseTemplate;
 

+ 5 - 6
src/main/java/io/renren/modules/oss/controller/SysOssController.java

@@ -22,7 +22,6 @@ import io.renren.common.validator.group.AliyunGroup;
 import io.renren.common.validator.group.QcloudGroup;
 import io.renren.common.validator.group.QiniuGroup;
 import io.renren.modules.oss.cloud.CloudStorageConfig;
-import io.renren.modules.oss.cloud.OSSFactory;
 import io.renren.modules.oss.entity.SysOssEntity;
 import io.renren.modules.oss.service.SysOssService;
 import io.renren.modules.sys.service.SysConfigService;
@@ -55,7 +54,7 @@ public class SysOssController {
 	String secret_key;
 
 	@Value("${minio.bucket}")
-	String buctek;
+	String bucket;
 
 	@Autowired
 	private SysOssService sysOssService;
@@ -132,21 +131,21 @@ public class SysOssController {
 		// 使用MinIO服务的URL,端口,Access key和Secret key创建一个MinioClient对象
 		MinioClient minioClient = new MinioClient(endpoint, access_key, secret_key);
 		// 检查存储桶是否已经存在
-		boolean isExist = minioClient.bucketExists(buctek);
+		boolean isExist = minioClient.bucketExists(bucket);
 		if(isExist) {
 			System.out.println("Bucket already exists.");
 		}else {
-			minioClient.makeBucket(buctek);
+			minioClient.makeBucket(bucket);
 		}
 		// 使用putObject上传一个文件到存储桶中。
 		String a = file.getOriginalFilename() ;//.split("\\.")[1];
 		PutObjectOptions putObjectOptions = new PutObjectOptions(file.getSize(), PutObjectOptions.MIN_MULTIPART_SIZE);
 		putObjectOptions.setContentType(file.getContentType());
 		String objectName = UUID.randomUUID().toString()+"$"+a;
-		minioClient.putObject(buctek, "1/"+objectName,file.getInputStream(),putObjectOptions);
+		minioClient.putObject(bucket, "1/"+objectName,file.getInputStream(),putObjectOptions);
 		System.out.println("-----------------");
 
-		String url = minioClient.getPresignedObjectUrl(Method.GET, buctek, "1/"+objectName, 1000, null);
+		String url = minioClient.getPresignedObjectUrl(Method.GET, bucket, "1/"+objectName, 1000, null);
 
 		//保存文件信息
 		SysOssEntity ossEntity = new SysOssEntity();

+ 2 - 5
src/main/java/io/renren/modules/sys/controller/VisiAlgorithmnodeController.java

@@ -34,15 +34,12 @@ public class VisiAlgorithmnodeController {
 
     /**
      * 列表
-     * @param params 页面配置信息
      * @return 结果
      */
     @RequestMapping("/list")
 //    @RequiresPermissions("sys:visialgorithmnode:list")
-    public R list(@RequestParam Map<String, Object> params){
-        PageUtils page = visiAlgorithmnodeService.queryPage(params);
-
-        return R.ok().put("page", page);
+    public R list(){
+        return R.ok().put("list", visiAlgorithmnodeService.list());
     }
 
 

+ 1 - 1
src/main/java/io/renren/modules/sys/controller/VisiWorkflowController.java

@@ -90,7 +90,7 @@ public class VisiWorkflowController extends AbstractController {
     @RequestMapping("/save")
 //    @RequiresPermissions("sys:visiworkflow:save")
     public R save(@RequestBody VisiWorkflowEntity visiWorkflow) {
-        visiWorkflowService.save(visiWorkflow);
+        visiWorkflowService.saveOrUpdate(visiWorkflow);
 
         return R.ok();
     }

+ 39 - 7
src/main/java/io/renren/modules/sys/controller/algs/algsController.java

@@ -1,5 +1,8 @@
 package io.renren.modules.sys.controller.algs;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.google.gson.Gson;
 import io.minio.errors.*;
 import io.renren.common.annotation.SysLog;
 import io.renren.common.utils.Constant;
@@ -12,9 +15,11 @@ import io.renren.common.validator.group.UpdateGroup;
 import io.renren.modules.dataSet.enumeration.DataSetType;
 import io.renren.modules.sys.entity.algs.*;
 import io.renren.modules.sys.entity.dataset.DataSet;
+import io.renren.modules.sys.entity.dataset.DataSetDy;
 import io.renren.modules.sys.service.*;
 import io.renren.modules.sys.service.impl.AlgsModelsServiceImpl;
 import io.renren.modules.sys.service.impl.AlgsServiceImpl;
+import jdk.internal.org.objectweb.asm.TypeReference;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +30,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
 import java.io.IOException;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -50,6 +56,8 @@ public class algsController{
     AlgorithmParameterService algorithmParameterService;
     @Autowired
     AlgorithmResultService algorithmResultService;
+    @Autowired
+    CategoryService categoryService;
     /**
      * 所有列表
      */
@@ -131,12 +139,19 @@ public class algsController{
             String algTemplatesString=request.getParameter("algTemplates");//如果有选择模板,则将对应模板代码拷贝到相应位置
             saveIntelligentAlg(alg,dataSetsString,algModelsString,algTemplatesString,files);
         }else {
-            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 algResultNameString=request.getParameter("algResultNames");
             String algResultLocationString=request.getParameter("algResultLocations");
             String algParameterNameString=request.getParameter("algParameterName");
             String algParameterTypeString=request.getParameter("algParameterTypes");
-            saveTraditionalAlg(alg,files,algParameterNameString,algParameterTypeString,algResultNameString,algResultLocationString,dataSetsString);
+            saveTraditionalAlg(alg,files,algParameterNameString,algParameterTypeString,algResultNameString,algResultLocationString,dataSets, dataSetsDy);
 
         }
         return R.ok();
@@ -197,7 +212,7 @@ public class algsController{
      * @param alg 算法对象实体
      * @param files 算法文件
      */
-    public void saveTraditionalAlg(Algorithm alg,List<MultipartFile> files,String algParameterNameString,String algParameterTypeString,String algResultNameString,String algResultLocationString,String dataSetsString) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InternalException {
+    public void saveTraditionalAlg(Algorithm alg,List<MultipartFile> files,String algParameterNameString,String algParameterTypeString,String algResultNameString,String algResultLocationString,List<DataSet> dataSets, List<DataSetDy> dataSetsDy) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InternalException {
         Long algId = alg.getAlgorithmId();
 
         String[] algorithmParameterNames = new String[0];
@@ -261,12 +276,29 @@ public class algsController{
             MinIoUtils.uploadMultipartFile(file,"algorithm","alg"+algId+"/"+file.getOriginalFilename());
         }
         //将数据集上传
-        if (StringUtils.isNotEmpty(dataSetsString)){
-            String[] dataSets = dataSetsString.split(",");
-            for (String fileName : dataSets) {
-                MinIoUtils.copyFile("algorithm","alg"+algId+"/"+fileName, DataSetType.STATIC_DATASET.getBucketName(), 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+"/"+dataSet.getDatasetName(), DataSetType.STATIC_DATASET.getBucketName(), dataSet.getDatasetName());
+                }
             }
         }
+
+        if (!dataSetsDy.isEmpty()) {
+            for (DataSetDy dataSetDy : dataSetsDy) {
+                MinIoUtils.copyFile("algorithm", "alg"+algId+"/"+dataSetDy.getDatasetName(), DataSetType.DYNAMIC_DATASET.getBucketName(), dataSetDy.getDatasetName());
+            }
+        }
+
+        // if (StringUtils.isNotEmpty(dataSetsString)){
+        //     String[] dataSets = dataSetsString.split(",");
+        //     for (String fileName : dataSets) {
+        //         MinIoUtils.copyFile("algorithm","alg"+algId+"/"+fileName, DataSetType.STATIC_DATASET.getBucketName(), fileName);
+        //     }
+        // }
     }
 
 

+ 0 - 8
src/main/java/io/renren/modules/sys/controller/dataaccess/getTemplateController.java

@@ -26,14 +26,6 @@ import java.util.Map;
 @RequestMapping("/getTemplate")
 @DataSource("bigData")
 public class getTemplateController {
-    @Value("${realTimeKafka1}")
-    String realTimeKafka1;
-
-    @Value("${realTimeKafka2}")
-    String realTimeKafka2;
-
-    @Value("${realTimeKafka3}")
-    String realTimeKafka3;
 
     @Value("${resultToDB}")
     String resultToDB;

+ 2 - 2
src/main/java/io/renren/modules/sys/controller/dataset/DataSetController.java

@@ -148,8 +148,8 @@ public class DataSetController {
 
     @GetMapping("/listAll")
     public R listAll() throws Exception {
-        List<FileTest> list=MinIoUtils.listBucketFiles(DataSetType.STATIC_DATASET.getBucketName());
-
+        // List<FileTest> list=MinIoUtils.listBucketFiles(DataSetType.STATIC_DATASET.getBucketName());
+        List<DataSet> list = dataSetService.list();
         return R.ok().put("list",list);
     }
 

+ 9 - 0
src/main/java/io/renren/modules/sys/controller/dataset/DataSetDyController.java

@@ -6,6 +6,8 @@ import io.renren.common.utils.MinIoUtils;
 import io.renren.common.utils.PageUtils;
 import io.renren.common.utils.R;
 import io.renren.modules.sys.entity.algs.FileTest;
+import io.renren.modules.sys.entity.dataset.DataSet;
+import io.renren.modules.sys.entity.dataset.DataSetDy;
 import io.renren.modules.sys.service.DataSetDyService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +48,13 @@ public class DataSetDyController {
 
         return R.ok().put("page", page);
     }
+
+    @GetMapping("/listAll")
+    public R listAll() throws Exception {
+        // List<FileTest> list=MinIoUtils.listBucketFiles(DataSetType.STATIC_DATASET.getBucketName());
+        List<DataSetDy> list = dataSetDyService.list();
+        return R.ok().put("list", list);
+    }
     /**
      * Description 下载数据集
      * @param datasetName

+ 65 - 196
src/main/java/io/renren/modules/sys/controller/minIo/MinioController.java

@@ -1,19 +1,10 @@
 package io.renren.modules.sys.controller.minIo;
 
-import io.minio.MinioClient;
-import io.minio.PutObjectOptions;
 import io.minio.errors.*;
-import io.minio.http.Method;
 import io.renren.common.utils.MinIoUtils;
 import io.renren.common.utils.R;
-import io.renren.modules.sys.entity.algs.FileTest;
-import io.renren.modules.sys.service.FileTestService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
+import io.renren.modules.dataSet.enumeration.DataSetType;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import io.minio.messages.Item;
-import io.minio.Result;
 
 
 import java.io.*;
@@ -22,117 +13,16 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
+
 
 @RestController
 @RequestMapping("/minio")
 public class MinioController {
-    @Value("${minio.endpoint}")
-    String endpoint;
-
-    @Value("${minio.access-key}")
-    String access_key;
-
-    @Value("${minio.secret-key}")
-    String secret_key;
-
-    @Value("${minio.bucket}")
-    String buctek;
-
-    @Value("${tempFileLocation}")
-    String tempFileLocation;
-
-    @Autowired
-    FileTestService fileTestService;
-
-
-
-
-    @PostMapping("/upload")
-    public void upload(@RequestParam("file")MultipartFile file) throws Exception {
-
-        // 使用MinIO服务的URL,端口,Access key和Secret key创建一个MinioClient对象
-        MinioClient minioClient = new MinioClient(endpoint, access_key, secret_key);
-
-        // 检查存储桶是否已经存在
-        boolean isExist = minioClient.bucketExists(buctek);
-        if(isExist) {
-            System.out.println("Bucket already exists.");
-        }else {
-            // 创建一个名为asiatrip的存储桶,用于存储照片的zip文件。
-            minioClient.makeBucket(buctek);
-        }
-
-        // 使用putObject上传一个文件到存储桶中。
-        String a = file.getOriginalFilename() ;//.split("\\.")[1];
-        PutObjectOptions putObjectOptions = new PutObjectOptions(file.getSize(), PutObjectOptions.MIN_MULTIPART_SIZE);
-        putObjectOptions.setContentType(file.getContentType());
-        minioClient.putObject(buctek, UUID.randomUUID().toString()+"$"+a,file.getInputStream(),putObjectOptions);
-        System.out.println("-----------------");
-
-    }
-
-    @GetMapping("/download")
-    public String download() throws Exception{ //String buctek,String objectName        ResponseEntity
-        // 使用MinIO服务的URL,端口,Access key和Secret key创建一个MinioClient对象
-        MinioClient minioClient = new MinioClient(endpoint, access_key, secret_key);
-        String buctek="test";
-        String objectName="1C8EL8QQCUAUHKI31DPBTD7TJT.jpg";
-        System.out.println(buctek);
-        System.out.println(objectName);
-//        InputStream object = minioClient.getObject(buctek, objectName);
-
-        String objectUrl = minioClient.getObjectUrl(buctek, objectName);
-        //返回Minio提供的下载链接,第四个参数是second,要给很多秒
-        String presignedObjectUrl = minioClient.getPresignedObjectUrl(Method.GET, buctek, objectName, 1000, null);
-
-        System.out.println(objectUrl);
-
-        System.out.println(presignedObjectUrl);
-        System.out.println("********");
-
-        return presignedObjectUrl;
-    }
-
-    @GetMapping("listtest")
-    public R listtest() throws Exception{
-
-            /* play.min.io for test and development. */
-            MinioClient minioClient =
-                    new MinioClient(
-                            endpoint,
-                            access_key,
-                            secret_key);
-
-            /* Amazon S3: */
-            // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
-            //                                           "YOUR-SECRETACCESSKEY");
-
-            // Check whether 'my-bucketname' exist or not.
-            boolean found = minioClient.bucketExists(buctek);
-            if (found) {
-                List<Item> res = new ArrayList<>();
-                // List objects from 'my-bucketname'
-                Iterable<Result<Item>> myObjects = minioClient.listObjects(buctek,"");
-                for (Result<Item> result : myObjects) {
-                    Item item = result.get();
-                    if(!item.isDir())
-                    System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName());
-                    res.add(item);
-                }
-                return R.ok().put("res", res);
-            } else {
-                System.out.println("bucket does not exist");
-                return R.error("bucket does not exist");
-            }
-
-    }
 
     /**
      * Description 获取minio中指定代码文件的内容
+     *
      * @return
      */
     @GetMapping("/readUrlContent")
@@ -145,14 +35,14 @@ public class MinioController {
             return MinIoUtils.getFileContent("algorithm", fileName);
         }
 
-        String requestUrl= MinIoUtils.getFileUrl("algorithm","alg"+algorithmNameToVersion+"/version"+verisionToFile+"/"+fileName);
-        HttpURLConnection conn=null;
-        BufferedReader br=null;
-        StringBuffer sbf=new StringBuffer();
-        String content=null;
+        String requestUrl = MinIoUtils.getFileUrl("algorithm", "alg" + algorithmNameToVersion + "/version" + verisionToFile + "/" + fileName);
+        HttpURLConnection conn = null;
+        BufferedReader br = null;
+        StringBuffer sbf = new StringBuffer();
+        String content = null;
         try {
-            URL url=new URL(requestUrl);
-            conn=(HttpURLConnection) url.openConnection();
+            URL url = new URL(requestUrl);
+            conn = (HttpURLConnection) url.openConnection();
 
             //设置不使用缓存
             conn.setUseCaches(false);
@@ -168,20 +58,20 @@ public class MinioController {
             //开启链接
             conn.connect();
 
-            br=new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
-            String strContent=null;
-            while ((strContent=br.readLine())!=null){
+            br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
+            String strContent = null;
+            while ((strContent = br.readLine()) != null) {
                 sbf.append("\n");
                 sbf.append(strContent);
             }
-            sbf.delete(0,1);
-            content=sbf.toString();
+            sbf.delete(0, 1);
+            content = sbf.toString();
 
         } catch (MalformedURLException e) {
             e.printStackTrace();
-        }finally {
-            if(null!=br)    br.close();
-            if(null!=conn)  conn.disconnect();
+        } finally {
+            if (null != br) br.close();
+            if (null != conn) conn.disconnect();
         }
 
         return content;
@@ -189,22 +79,23 @@ public class MinioController {
 
     /**
      * Description 获取minio中指定传统算法代码文件的内容
+     *
      * @return
      */
     @GetMapping("/readTraUrlContent")
-    public String readTraUrlContent(String algorithmNameToVersion,String fileName) throws Exception {
+    public String readTraUrlContent(String algorithmNameToVersion, String fileName) throws Exception {
 
 
         //String requestUrl = minioClient.getPresignedObjectUrl(Method.GET, bucket, fileName, 1000, null);
         //使用minio工具类获取指定文件url
-        String requestUrl= MinIoUtils.getFileUrl("algorithm","alg"+algorithmNameToVersion+"/"+fileName);
-        HttpURLConnection conn=null;
-        BufferedReader br=null;
-        StringBuffer sbf=new StringBuffer();
-        String content=null;
+        String requestUrl = MinIoUtils.getFileUrl("algorithm", "alg" + algorithmNameToVersion + "/" + fileName);
+        HttpURLConnection conn = null;
+        BufferedReader br = null;
+        StringBuffer sbf = new StringBuffer();
+        String content = null;
         try {
-            URL url=new URL(requestUrl);
-            conn=(HttpURLConnection) url.openConnection();
+            URL url = new URL(requestUrl);
+            conn = (HttpURLConnection) url.openConnection();
 
             //设置不使用缓存
             conn.setUseCaches(false);
@@ -220,20 +111,20 @@ public class MinioController {
             //开启链接
             conn.connect();
 
-            br=new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
-            String strContent=null;
-            while ((strContent=br.readLine())!=null){
+            br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
+            String strContent = null;
+            while ((strContent = br.readLine()) != null) {
                 sbf.append("\n");
                 sbf.append(strContent);
             }
-            sbf.delete(0,1);
-            content=sbf.toString();
+            sbf.delete(0, 1);
+            content = sbf.toString();
 
         } catch (MalformedURLException e) {
             e.printStackTrace();
-        }finally {
-            if(null!=br)    br.close();
-            if(null!=conn)  conn.disconnect();
+        } finally {
+            if (null != br) br.close();
+            if (null != conn) conn.disconnect();
         }
 
         return content;
@@ -241,80 +132,58 @@ public class MinioController {
 
     /**
      * Description 将codemirror中的内容写入文件
+     *
      * @return
      * @throws IOException
      */
     @PostMapping("/writeFile")
-    public String writeFile(@RequestBody HashMap<String,String> map){
-        File file=new File(tempFileLocation);
+    public R writeFile(@RequestBody HashMap<String, String> map) {
         try {
-            //判断是否存在指定文件夹 不存在则创建
-            if (!file.getParentFile().exists()) {
-                file.getParentFile().mkdirs();
-            }
-            //判断是否存在指定文件 不存在则创建
-            if(!file.exists()){
-                file.createNewFile();
-            }
-            FileWriter fileWriter=new FileWriter(file.getAbsoluteFile());
-            BufferedWriter bufferWriter = new BufferedWriter(fileWriter);
-            bufferWriter.write(map.get("content"));
-            bufferWriter.close();
-            PutObjectOptions options=new PutObjectOptions(file.length(),PutObjectOptions.MIN_MULTIPART_SIZE);
-            //使用minio工具类上传本地文件到minio
-            String algorithmNameToVersion=map.get("algorithmNameToVersion");
-            String verisionToFile=map.get("verisionToFile");
-            String fileName=map.get("fileName");
-            MinIoUtils.uploadLocalFile("algorithm", "alg"+algorithmNameToVersion+"/version"+verisionToFile+"/"+fileName,tempFileLocation,options);
-        }catch (Exception e){
-            e.printStackTrace();
+            String algorithmNameToVersion = map.get("algorithmNameToVersion");
+            String verisionToFile = map.get("verisionToFile");
+            String fileName = map.get("fileName");
+            byte[] contentBytes = map.get("content").getBytes(); // 将字符串内容转换为字节数组
+            // 构造InputStream对象
+            InputStream inputStream = new ByteArrayInputStream(contentBytes);
+            // 获取字节数组长度作为文件大小
+            long fileSize = contentBytes.length;
+            MinIoUtils.uploadFileByInputStream(inputStream, fileSize, DataSetType.ALG_DATASET.getBucketName(), "alg" + algorithmNameToVersion + "/version" + verisionToFile + "/" + fileName);
+            return R.ok();
+        } catch (Exception e) {
+            return R.error(e.getMessage());
         }
-
-        return "success";
     }
 
     /**
-     * Description 将codemirror中的内容写入传统算法文件
+     * 将codemirror中的内容写入传统算法文件
+     *
+     * @param map
      * @return
-     * @throws IOException
      */
     @PostMapping("/writeTraFile")
-    public String writeTraFile(@RequestBody HashMap<String,String> map){
-        File file=new File(tempFileLocation);
+    public R writeTraFile(@RequestBody HashMap<String, String> map) {
         try {
-            //判断是否存在指定文件夹 不存在则创建
-            if (!file.getParentFile().exists()) {
-                file.getParentFile().mkdirs();
-            }
-            //判断是否存在指定文件 不存在则创建
-            if(!file.exists()){
-                file.createNewFile();
-            }
-            FileWriter fileWriter=new FileWriter(file.getAbsoluteFile());
-            BufferedWriter bufferWriter = new BufferedWriter(fileWriter);
-            bufferWriter.write(map.get("content"));
-            bufferWriter.close();
-            PutObjectOptions options=new PutObjectOptions(file.length(),PutObjectOptions.MIN_MULTIPART_SIZE);
-            //使用minio工具类上传本地文件到minio
-            String algorithmNameToVersion=map.get("algorithmNameToVersion");
-            String fileName=map.get("fileName");
-            MinIoUtils.uploadLocalFile("algorithm", "alg"+algorithmNameToVersion+"/"+fileName,tempFileLocation,options);
-        }catch (Exception e){
-            e.printStackTrace();
+            String algorithmNameToVersion = map.get("algorithmNameToVersion");
+            String fileName = map.get("fileName");
+            byte[] contentBytes = map.get("content").getBytes(); // 将字符串内容转换为字节数组
+            // 构造InputStream对象
+            InputStream inputStream = new ByteArrayInputStream(contentBytes);
+            MinIoUtils.uploadFileByInputStream(inputStream, (long) contentBytes.length, DataSetType.ALG_DATASET.getBucketName(), "alg" + algorithmNameToVersion + "/" + fileName);
+            return R.ok();
+        } catch (Exception e) {
+            return R.error(e.getMessage());
         }
-
-        return "success";
     }
 
     /**
      * 根据传入的algId与versionId以及fileName 删除文件
+     *
      * @param
      * @return
      */
     @GetMapping("/deleteFile")
-    public R deleteFile(String algorithmNameToVersion,String versionToFile,String fileName) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException {
-        System.out.println("alg"+algorithmNameToVersion+"/version"+versionToFile+"/"+fileName);
-        MinIoUtils.deleteFile("algorithm","alg"+algorithmNameToVersion+"/version"+versionToFile+"/"+fileName);
+    public R deleteFile(String algorithmNameToVersion, String versionToFile, String fileName) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException {
+        MinIoUtils.deleteFile("algorithm", "alg" + algorithmNameToVersion + "/version" + versionToFile + "/" + fileName);
         return R.ok();
     }
 }

+ 2 - 0
src/main/java/io/renren/modules/sys/entity/VisiWorkflowEntity.java

@@ -1,5 +1,6 @@
 package io.renren.modules.sys.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
@@ -47,6 +48,7 @@ public class VisiWorkflowEntity implements Serializable {
 	/**
 	 * 执行状态
 	 */
+	@TableField(exist = false)
 	private String status;
 
 

+ 7 - 7
src/main/resources/application-dev.yml

@@ -5,10 +5,10 @@ spring:
         druid:
             driver-class-name: com.mysql.cj.jdbc.Driver
             #43.143.221.128:6033/renren_fast
-            url: jdbc:mysql://82.156.153.135:6033/renren_fast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+#            url: jdbc:mysql://10.170.57.219:3306/renren_fast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+            url: jdbc:mysql://10.170.57.219:3306/renren_fast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
             username: root
-            password: XDUxdu2022
-            #            password: XDUxdu2022
+            password: XDUxdu2023
             initial-size: 10
             max-active: 100
             min-idle: 10
@@ -50,9 +50,10 @@ dynamic:
         #            #        password: 123456
         #            driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
         heBing:
-            url: jdbc:mysql://82.156.153.135:6033/hebing_menu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+#            url: jdbc:mysql://10.170.57.219:3306/hebing_menu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+            url: jdbc:mysql://10.170.57.219:3306/hebing_menu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
             username: root
-            password: XDUxdu2022
+            password: XDUxdu2023
             driver-class-name: com.mysql.cj.jdbc.Driver
 
 server:
@@ -62,8 +63,7 @@ server:
 
 hbase:
     config:
-        hbase.zookeeper.quorum: 43.143.226.39,43.143.224.212,43.143.230.108
-        #hbase.zookeeper.quorum: 182.92.79.148,112.126.68.148,123.56.99.12
+        hbase.zookeeper.quorum: 10.170.7.125
         hbase.zookeeper.property.clientPort: 2181
         zookeeper.znode.parent: /hbase
         hbase.client.keyvalue.maxsize: 1048576000

+ 27 - 38
src/main/resources/application.yml

@@ -5,51 +5,42 @@ server:
     max-threads: 1000
     min-spare-threads: 30
   port: 8082
-  connection-timeout: 5000ms
   servlet:
     context-path: /renren-fast
-#  minIO
+# minio
 minio:
-  endpoint: http://43.143.237.223:9000
+  endpoint: http://10.170.7.125:9000
   bucket: test0706
   access-key: minio
   secret-key: minio123
 
-#docker远程连接
+# docker远程连接
 docker:
-  #url: https://192.168.25.101:2376
-  url: https://43.143.237.223:2376
-remote-docker: 43.143.237.223
-#上传文件到远程服务器地址,用户名及密码,上传文件的基础路径
-host: 43.143.237.223
+  url: https://10.170.7.125:2376
+remote-docker: 10.170.7.125
+# 上传文件到远程服务器地址,用户名及密码,上传文件的基础路径
+host: 10.170.7.125
 host-username: root
-host-password: XDUxdu2022
-#host-basepath: D:/aiplat-mkcloud/aiplat/uploadFile
+host-password: kylin123
+# host-basepath: D:/aiplat-mkcloud/aiplat/uploadFile
 host-basepath: /opt/uploadFile
 host-port: 22
-#连接远程服务器是否需要秘钥
+# 连接远程服务器是否需要秘钥
 key-needed: false
-#如果需要秘钥,则将秘钥地址填写在此
+# 如果需要秘钥,则将秘钥地址填写在此,这是ftp服务器的密钥不是ca的密钥
 key-location: D:/aiplat-mkcloud/aiplat/docker_ca
 
-#docker证书存放路径
+# docker证书存放路径
 docker_ca: D:/aiplat-mkcloud/aiplat/docker_ca
 
-#minio暂存文件地址
-tempFileLocation: D:/aiplat-mkcloud/test0708/testPython.py
 
-#获取kafka实时数据ip与端口
-realTimeKafka1: 43.143.230.108:9092
-realTimeKafka2: 43.143.224.212:9092
-realTimeKafka3: 43.143.226.39:9092
+# 算法结果入库模板ip
+resultToDB: 10.170.7.125
 
-#算法结果入库模板ip
-resultToDB: 43.143.226.39
-
-#数据预处理数据集存放文件夹
+# 数据预处理数据集存放文件夹
 datasetLocation: D:/aiplat-mkcloud/aiplat/demoCSV
 
-#数据预处理python文件存放文件夹
+# 数据预处理python文件存放文件夹
 dataPreProcessLocation: D:/aiplat-mkcloud/aiplat/dataPreProcess
 
 spring:
@@ -83,24 +74,24 @@ spring:
   resources:
     add-mappings: true
 
-#层级相关数据库
+# 层级相关数据库
 cengji: hebing_menu
 
 
-#mybatis
+# mybatis
 mybatis-plus:
   mapper-locations: classpath*:/mapper/**/*.xml
-  #实体扫描,多个package用逗号或者分号分隔
+  # 实体扫描,多个package用逗号或者分号分隔
   typeAliasesPackage: io.renren.modules.*.entity
   global-config:
-    #数据库相关配置
+    # 数据库相关配置
     db-config:
-      #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
+      # 主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
       id-type: AUTO
       logic-delete-value: -1
       logic-not-delete-value: 0
     banner: false
-  #原生配置
+  # 原生配置
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
@@ -121,25 +112,23 @@ renren:
     expire: 604800
     header: token
 
-#Argo
+# Argo
 argo:
-  basepath: https://43.143.237.223:31691
-  minioendpoint: http://43.143.237.223:31352
+  basepath: https://10.170.7.125:32742
+  minioendpoint: http://10.170.7.125:32626
   minioAccess-key: admin
-  #  minioAccess-key: vzZBapBXei60zI1t6oPl
   minioSecret-key: password
-  #  minioSecret-key: nkjkRpJLkpb2THUpGKtdMBPPEi3XdmllnOctF8yS
   sparkMasterRest: spark://150.158.138.99:16066
   sparkMaster: spark://150.158.138.99:7077
   sparkHdfsurl: hdfs://150.158.138.99:8020
   sparkYarnAddress: spark://150.158.138.99:8088
   sparkYarnJARS: hdfs://150.158.138.99:8020
-#kubenetes  Argo部分获取pod日志
+# kubenetes  Argo部分获取pod日志
 Akubenetes:
   basepath: https://43.143.237.223:30880
   kubeconfig-path: D:/aiplat-mkcloud/aiplat/akubenetes/config
 
-#griffin数据探查服务
+# griffin数据探查服务
 griffin: http://43.143.224.212:8091
 
 

+ 3 - 4
src/test/java/io/renren/JwtTest.java

@@ -1,5 +1,6 @@
 package io.renren;
 
+import io.renren.common.utils.MinIoUtils;
 import io.renren.modules.app.utils.JwtUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -15,10 +16,8 @@ public class JwtTest {
     private JwtUtils jwtUtils;
 
     @Test
-    public void test() {
-        String token = jwtUtils.generateToken(1);
-
-        System.out.println(token);
+    public void test() throws Exception {
+        MinIoUtils.copyFolder("ce111", null, "stan", null);
     }
 
 }