Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.APSJ
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
佟礼
HYH.APSJ
Commits
ded51bc0
Commit
ded51bc0
authored
Sep 21, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://39.100.78.207:1213/tongli/hyh.apsj
parents
a0aa0811
29be9769
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
55 deletions
+56
-55
ResultWriter.java
src/main/java/com/aps/macroplanner/output/ResultWriter.java
+56
-55
No files found.
src/main/java/com/aps/macroplanner/output/ResultWriter.java
View file @
ded51bc0
...
...
@@ -191,16 +191,16 @@ public class ResultWriter {
}
FlatParquetUtil
parquetUtil
=
new
FlatParquetUtil
();
String
periodTaskPath
=
getOptimizationPeriodTask
(
sceneId
);
writeLog
(
"writePeriodTasks"
+
result
.
getPeriodTasks
().
size
());
writeLog
(
"writePeriodTasks"
+
result
.
getPeriodTasks
().
size
());
parquetUtil
.
write
(
result
.
getPeriodTasks
(),
periodTaskPath
,
PeriodTaskResult
.
class
);
writeLog
(
"writePeriodTasks"
);
writeLog
(
"writePeriodOutputTasks"
+
result
.
getPeriodTaskOutputs
().
size
());
writeLog
(
"writePeriodOutputTasks"
+
result
.
getPeriodTaskOutputs
().
size
());
String
periodTaskOutputPath
=
getOptimizationPeriodTaskOutput
(
sceneId
);
parquetUtil
.
write
(
result
.
getPeriodTaskOutputs
(),
periodTaskOutputPath
,
PeriodTaskResult
.
OutputInfo
.
class
);
writeLog
(
"writePeriodOutputTasks"
);
writeLog
(
"writePispips:"
+
result
.
getPispips
().
size
());
writeLog
(
"writePispips:"
+
result
.
getPispips
().
size
());
String
pispiPath
=
getOptimizationPispip
(
sceneId
);
parquetUtil
.
write
(
result
.
getPispips
(),
pispiPath
,
PispipResult
.
class
);
...
...
@@ -212,7 +212,7 @@ public class ResultWriter {
writeLog
(
"writesalesDemand"
);
String
salesDemandPath
=
getOptimizationSalesDemand
(
sceneId
);
parquetUtil
.
write
(
result
.
getSalesDemands
(),
salesDemandPath
,
SalesDemandResult
.
class
);
// List<PispipResult> pispips = parquetUtil.readAll(pispiPath, PispipResult.class);
// List<PispipResult> pispips = parquetUtil.readAll(pispiPath, PispipResult.class);
String
salesDemandSummariePath
=
getOptimizationSalesDemandSummarie
(
sceneId
);
parquetUtil
.
write
(
result
.
getSaleSummarieDemands
(),
salesDemandSummariePath
,
SalesDemandResult
.
class
);
...
...
@@ -235,58 +235,59 @@ public class ResultWriter {
List
<
OperationDemandResult
>
opDemands
=
buildOperationDemandResults
();
parquetUtil
.
write
(
opDemands
,
getOptimizationOperationDemand
(
sceneId
),
OperationDemandResult
.
class
);
try
{
File
file
=
getOptimizationFile
(
sceneId
);
File
tempFile
=
new
File
(
file
.
getParentFile
(),
file
.
getName
()
+
".tmp"
);
if
(
useCompression
)
{
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
tempFile
);
GZIPOutputStream
gzos
=
new
GZIPOutputStream
(
fos
))
{
objectMapper
.
writeValue
(
gzos
,
result
);
}
}
else
{
objectMapper
.
writeValue
(
tempFile
,
result
);
}
if
(
tempFile
.
length
()
==
0
)
{
logger
.
error
(
"写入的临时文件为空: {}"
,
tempFile
.
getAbsolutePath
());
Files
.
deleteIfExists
(
tempFile
.
toPath
());
return
false
;
}
if
(
useCompression
)
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
tempFile
);
GZIPInputStream
gzis
=
new
GZIPInputStream
(
fis
))
{
OptimizationResult
verifyChromosome
=
objectMapper
.
readValue
(
gzis
,
OptimizationResult
.
class
);
if
(
verifyChromosome
==
null
)
{
throw
new
IOException
(
"验证读取失败"
);
}
}
}
else
{
try
{
OptimizationResult
verifyChromosome
=
objectMapper
.
readValue
(
tempFile
,
OptimizationResult
.
class
);
if
(
verifyChromosome
==
null
)
{
throw
new
IOException
(
"验证读取失败"
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"验证染色体文件内容失败,文件: {}"
,
tempFile
.
getAbsolutePath
(),
e
);
Files
.
deleteIfExists
(
tempFile
.
toPath
());
return
false
;
}
}
if
(
file
.
exists
())
{
Files
.
deleteIfExists
(
file
.
toPath
());
}
Files
.
move
(
tempFile
.
toPath
(),
file
.
toPath
());
logger
.
info
(
"保存成功,场景ID: {}, 文件: {}"
,
sceneId
,
file
.
getAbsolutePath
());
return
true
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存文件失败,场景ID: "
+
sceneId
,
e
);
return
false
;
}
// try {
//
// File file = getOptimizationFile(sceneId);
// File tempFile = new File(file.getParentFile(), file.getName() + ".tmp");
//
// if (useCompression) {
// try (FileOutputStream fos = new FileOutputStream(tempFile);
// GZIPOutputStream gzos = new GZIPOutputStream(fos)) {
// objectMapper.writeValue(gzos, result);
// }
// } else {
// objectMapper.writeValue(tempFile, result);
// }
//
// if (tempFile.length() == 0) {
// logger.error("写入的临时文件为空: {}", tempFile.getAbsolutePath());
// Files.deleteIfExists(tempFile.toPath());
// return false;
// }
//
// if (useCompression) {
// try (FileInputStream fis = new FileInputStream(tempFile);
// GZIPInputStream gzis = new GZIPInputStream(fis)) {
// OptimizationResult verifyChromosome = objectMapper.readValue(gzis, OptimizationResult.class);
// if (verifyChromosome == null) {
// throw new IOException("验证读取失败");
// }
// }
// } else {
// try {
// OptimizationResult verifyChromosome = objectMapper.readValue(tempFile, OptimizationResult.class);
// if (verifyChromosome == null) {
// throw new IOException("验证读取失败");
// }
// } catch (Exception e) {
// logger.error("验证染色体文件内容失败,文件: {}", tempFile.getAbsolutePath(), e);
// Files.deleteIfExists(tempFile.toPath());
// return false;
// }
// }
//
// if (file.exists()) {
// Files.deleteIfExists(file.toPath());
// }
// Files.move(tempFile.toPath(), file.toPath());
//
// logger.info("保存成功,场景ID: {}, 文件: {}", sceneId, file.getAbsolutePath());
// return true;
// } catch (Exception e) {
// logger.error("保存文件失败,场景ID: " + sceneId, e);
// return false;
// }
}
catch
(
IOException
ex
)
{
logger
.
error
(
"保存文件失败,场景ID: "
+
sceneId
,
ex
);
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment