|
@@ -43,6 +43,7 @@ import java.io.BufferedReader;
|
|
|
import java.io.File;
|
|
|
import java.io.FileReader;
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.text.DecimalFormat;
|
|
@@ -135,7 +136,6 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
@Override
|
|
|
public List<ToInfraredVo> selectList(ToInfraredBo toInfraredBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(toInfraredBo);
|
|
|
- queryWrapper.orderBy(TO_INFRARED.CREATE_TIME,Boolean.FALSE);
|
|
|
return this.listAs(queryWrapper, ToInfraredVo.class);
|
|
|
}
|
|
|
|
|
@@ -148,7 +148,6 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
@Override
|
|
|
public PageResult<ToInfraredVo> selectPage(ToInfraredBo toInfraredBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(toInfraredBo);
|
|
|
- queryWrapper.orderBy(TO_INFRARED.CREATE_TIME,Boolean.FALSE);
|
|
|
Page<ToInfraredVo> page = this.pageAs(PageQuery.build(), queryWrapper, ToInfraredVo.class);
|
|
|
page.getRecords().forEach(entity -> {
|
|
|
Long modelId = entity.getAlgorithmModelId();
|
|
@@ -469,14 +468,48 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
Path inputPath = path.resolveSibling(fileName_without_suffix + BizConstant.UNZIP_SUFFIX + File.separator + BizConstant.PREDICT_PATH);
|
|
|
Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TO_INFRARED_SUFFIX + File.separator + BizConstant.PREDICT_PATH);
|
|
|
|
|
|
- String urlPrefix = inputOssEntity.getUrl().substring(0, inputOssEntity.getUrl().indexOf(Constants.RESOURCE_PREFIX) + Constants.RESOURCE_PREFIX.length());
|
|
|
-
|
|
|
+// String urlPrefix = inputOssEntity.getUrl().substring(0, inputOssEntity.getUrl().indexOf(Constants.RESOURCE_PREFIX) + Constants.RESOURCE_PREFIX.length());
|
|
|
+ String urlPrefix = Constants.RESOURCE_PREFIX;
|
|
|
return getCompareImage(urlPrefix, inputPath.toString(), outputPath.toString());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public CommonResult getStatisticsResult(Long id) {
|
|
|
+ ToInfrared entity = getById(id);
|
|
|
+ SysOssVo inputOssEntity = ossService.getById(entity.getInputOssId());
|
|
|
+
|
|
|
+ String filePath = inputOssEntity.getFileName();
|
|
|
+ String localPath = TaaisConfig.getProfile();
|
|
|
+ String resourcePath = localPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX);
|
|
|
+
|
|
|
+ Path path = Paths.get(resourcePath);
|
|
|
+ Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TO_INFRARED_SUFFIX + File.separator + BizConstant.PREDICT_PATH);
|
|
|
+
|
|
|
+ Path statisticsResultPath = outputPath.resolve(BizConstant.RESULT_JSON_NAME);
|
|
|
+
|
|
|
+ List<Dict> resultMap = parseJsonMapList(statisticsResultPath);
|
|
|
+ if(ObjectUtil.isEmpty(resultMap)) {
|
|
|
+ return CommonResult.fail("获取结果文件失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ return CommonResult.success(resultMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Dict> parseJsonMapList(Path path) {
|
|
|
+ try {
|
|
|
+ String jsonString = new String(Files.readAllBytes(path));
|
|
|
+ List<Dict> dicts = JsonUtils.parseArrayMap(jsonString);
|
|
|
+ return dicts;
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static CommonResult getCompareImage(String urlPrefix, String inputPath, String outputPath) {
|
|
|
try {
|
|
|
- List<String> inputImageList = calculateImagePath(urlPrefix, inputPath);
|
|
|
+ List<String> inputImageList = calculateImagePath(urlPrefix, inputPath);
|
|
|
List<String> outputImageList = calculateImagePath(urlPrefix, outputPath);
|
|
|
|
|
|
HashMap<String,String> nameToUrl1 = new HashMap<>();
|