|
@@ -1,7 +1,11 @@
|
|
|
package io.renren.modules.job.task;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import io.minio.PutObjectOptions;
|
|
|
+import io.minio.errors.*;
|
|
|
+import io.renren.common.utils.MinIoUtils;
|
|
|
import io.renren.modules.dataSet.entity.DataSetDychoosedata;
|
|
|
import io.renren.modules.dataSet.mapper.DataSetDychoosedataMapper;
|
|
|
import io.renren.modules.dataSet.service.DynamicSystemService;
|
|
@@ -12,6 +16,10 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.security.InvalidKeyException;
|
|
|
+import java.security.NoSuchAlgorithmException;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Component("demo1")
|
|
@@ -27,8 +35,8 @@ public class demo1 implements ITask{
|
|
|
private DynamicSystemService dynamicSystemService;
|
|
|
@Override
|
|
|
public void run(String params) {
|
|
|
- System.out.println("demo1 执行了 时间------" + new Date());
|
|
|
- System.out.println(params);
|
|
|
+// System.out.println("demo1 执行了 时间------" + new Date());
|
|
|
+// System.out.println(params);
|
|
|
logger.debug("TestTask定时任务正在执行,参数为:{}", params);
|
|
|
Integer parms = Integer.parseInt(params);
|
|
|
|
|
@@ -89,6 +97,21 @@ public class demo1 implements ITask{
|
|
|
|
|
|
}
|
|
|
// 最后 更新数据集中 文件路径
|
|
|
+
|
|
|
+ String path = System.getProperty("user.dir")+ File.separator+"csv" + File.separator + map.get("userID");
|
|
|
+ File newFileName = new File(path,map.get("newFileName")+ ".csv");
|
|
|
+ File lastFileName = new File(path,dataSetDy.getDatasetName()+".csv");
|
|
|
+ FileUtil.rename(newFileName,lastFileName.getName(),false,true);
|
|
|
+ PutObjectOptions putObjectOptions = new PutObjectOptions(lastFileName.length(), PutObjectOptions.MIN_MULTIPART_SIZE);
|
|
|
+ try {
|
|
|
+ MinIoUtils.uploadLocalFile("dydataset",lastFileName.getName(),lastFileName.getAbsolutePath(),putObjectOptions);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ // 删除本地数据文件
|
|
|
+ FileUtil.del(lastFileName);
|
|
|
+
|
|
|
+
|
|
|
dataSetDy.setDfsUrl(map.get("newFileName").toString());
|
|
|
dataSetDyMapper.updateById(dataSetDy);
|
|
|
}
|