|
@@ -18,6 +18,8 @@ import com.taais.biz.domain.vo.AlgorithmTaskVo;
|
|
|
import com.taais.biz.domain.vo.DataVo;
|
|
|
import com.taais.biz.mapper.AlgorithmTaskMapper;
|
|
|
import com.taais.biz.service.*;
|
|
|
+import com.taais.common.core.config.TaaisConfig;
|
|
|
+import com.taais.common.core.constant.Constants;
|
|
|
import com.taais.common.core.core.page.PageResult;
|
|
|
import com.taais.common.core.utils.MapstructUtils;
|
|
|
import com.taais.common.core.utils.StringUtils;
|
|
@@ -36,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.lang.reflect.Type;
|
|
|
+import java.nio.file.Path;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
@@ -660,19 +663,30 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
|
|
|
}
|
|
|
|
|
|
private void copyToDestinationFolder(List<DataVo> trainDataList, String destinationPath) {
|
|
|
- SysDictDataVo sysDictDataVo = dictDataService.selectDictDataByTypeAndLabel("biz_algorithm_config", "path");
|
|
|
- String destinationBase = "d:\\taais\\common\\";
|
|
|
- if (sysDictDataVo!= null && StringUtils.isNotEmpty(sysDictDataVo.getDictValue())) {
|
|
|
- destinationBase = sysDictDataVo.getDictValue();
|
|
|
- }
|
|
|
+// SysDictDataVo sysDictDataVo = dictDataService.selectDictDataByTypeAndLabel("biz_algorithm_config", "path");
|
|
|
+// if (sysDictDataVo!= null && StringUtils.isNotEmpty(sysDictDataVo.getDictValue())) {
|
|
|
+// destinationBase = sysDictDataVo.getDictValue();
|
|
|
+// }
|
|
|
int errorCount = 0;
|
|
|
for (DataVo dataVo : trainDataList) {
|
|
|
+ // 复制图片
|
|
|
+ String imagePath = StringUtils.substringAfter(dataVo.getUrl(), Constants.RESOURCE_PREFIX);
|
|
|
try {
|
|
|
- FileUtils.copyFile(dataVo.getDataSource(),destinationBase + destinationPath);
|
|
|
+ FileUtils.copyFile(TaaisConfig.getProfile() + imagePath, TaaisConfig.getProfile() + destinationPath+BizConstant.IMAGE);
|
|
|
} catch (IOException e) {
|
|
|
errorCount++;
|
|
|
- log.error("复制文件出错source:{},target:{}", dataVo.getDataSource(), destinationBase + destinationPath);
|
|
|
+ log.error("复制图片文件出错source:{},target:{}", dataVo.getDataSource(), TaaisConfig.getProfile() + destinationPath);
|
|
|
+ }
|
|
|
+ if(dataVo.getLabeled()){
|
|
|
+ try {
|
|
|
+ String txtPathStr = FileUtils.getTxtPathStr(imagePath);
|
|
|
+ FileUtils.copyFile(txtPathStr, TaaisConfig.getProfile() + destinationPath+BizConstant.LABEL);
|
|
|
+ } catch (IOException e) {
|
|
|
+ errorCount++;
|
|
|
+ log.error("复制标注文件出错source:{},target:{}", dataVo.getDataSource(), TaaisConfig.getProfile() + destinationPath);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if(errorCount != 0){
|
|
|
log.warn("复制文件失败了{}个!!",errorCount);
|
|
@@ -690,4 +704,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
|
|
|
return MapstructUtils.convert(data, DataVo. class);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
+ String profile = "D:/taais/uploadPath";
|
|
|
+ FileUtils.copyFile(profile + StringUtils.substringAfter("/profile/upload\\2024\\07\\13\\101953322/3.jpg", Constants.RESOURCE_PREFIX), profile + "/task/169578890091683840/train/original/0/"+BizConstant.IMAGE);
|
|
|
+ }
|
|
|
}
|