报告模板路径调整
This commit is contained in:
@@ -120,7 +120,7 @@ public class SocketContrastResponseService {
|
|||||||
// private SysRegRes contrastRegRes = null;
|
// private SysRegRes contrastRegRes = null;
|
||||||
|
|
||||||
|
|
||||||
@Value("${log.homeDir}")
|
@Value("${report.reportDir}")
|
||||||
private String alignDataFilePath;
|
private String alignDataFilePath;
|
||||||
|
|
||||||
public static final Map<String, List<String>> testItemCodeMap = new HashMap() {{
|
public static final Map<String, List<String>> testItemCodeMap = new HashMap() {{
|
||||||
@@ -182,8 +182,8 @@ public class SocketContrastResponseService {
|
|||||||
FormalTestManager.pstDataType = null;
|
FormalTestManager.pstDataType = null;
|
||||||
FormalTestManager.isPstData = false;
|
FormalTestManager.isPstData = false;
|
||||||
FormalTestManager.isWaveCheck = false;
|
FormalTestManager.isWaveCheck = false;
|
||||||
// FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
||||||
FormalTestManager.isXu = true;
|
// FormalTestManager.isXu = true;
|
||||||
FormalTestManager.nonWaveDataSourceEnum = null;
|
FormalTestManager.nonWaveDataSourceEnum = null;
|
||||||
|
|
||||||
String[] datasourceIds = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
String[] datasourceIds = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
||||||
@@ -1230,39 +1230,6 @@ public class SocketContrastResponseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setScheduler(targetCount, param.getUserPageId(), requestOperateCode, quitOperateCode);
|
this.setScheduler(targetCount, param.getUserPageId(), requestOperateCode, quitOperateCode);
|
||||||
// if (Objects.isNull(FormalTestManager.scheduler)) {
|
|
||||||
// FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
|
||||||
// long delay = this.getDelay(targetCount);
|
|
||||||
// FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
|
||||||
// if (!checkResult) {
|
|
||||||
// System.out.println("正式检测-" + delay + "s内收集数据不完整!");
|
|
||||||
// // 断开与设备的连接,但是不要将Socket移除
|
|
||||||
// if (FormalTestManager.statisticsProtocol && quitOperateCode == SourceOperateCodeEnum.QUIT_INIT_02) {
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
|
||||||
// }
|
|
||||||
// if (FormalTestManager.voltageProtocol) {
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
|
||||||
// }
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), quitOperateCode, false);
|
|
||||||
// FormalTestManager.isTesting = false;
|
|
||||||
//
|
|
||||||
// this.clearData();
|
|
||||||
//
|
|
||||||
// Collection<String> disjunction = CollectionUtil.disjunction(FormalTestManager.pairsIpMap.keySet(), successPair.keySet());
|
|
||||||
// // 向前端推送收集数据不完整的配对项
|
|
||||||
// for (String key : disjunction) {
|
|
||||||
// webSend.setCode(SourceResponseCodeEnum.FAIL.getCode());
|
|
||||||
// webSend.setData(MsgUtil.getPairStr(key, FormalTestManager.pairsIpMap.inverse().get(key), FormalTestManager.devNameMapComm) + " 数据收集不完整!");
|
|
||||||
// WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
|
||||||
// }
|
|
||||||
// // 推送最终失败结果
|
|
||||||
// webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());//最终错误推送
|
|
||||||
// WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
|
||||||
// }
|
|
||||||
// FormalTestManager.scheduler.shutdown();
|
|
||||||
// FormalTestManager.scheduler = null;
|
|
||||||
// }, delay, TimeUnit.SECONDS);
|
|
||||||
// }
|
|
||||||
|
|
||||||
String monitorId1 = devData.getId();
|
String monitorId1 = devData.getId();
|
||||||
String devMonitorId = monitorId1;
|
String devMonitorId = monitorId1;
|
||||||
@@ -2149,7 +2116,7 @@ public class SocketContrastResponseService {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ExcelUtil.saveExcel(alignDataFilePath, "实时数据.xlsx", sheetsList);
|
ExcelUtil.saveExcel(alignDataFilePath, "对齐数据.xlsx", sheetsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
private final SocketManager socketManager;
|
private final SocketManager socketManager;
|
||||||
|
|
||||||
@Value("${log.homeDir}")
|
@Value("${report.reportDir}")
|
||||||
private String alignDataFilePath;
|
private String alignDataFilePath;
|
||||||
|
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportAlignData() {
|
public void exportAlignData() {
|
||||||
String fileName = "实时数据.xlsx";
|
String fileName = "对齐数据.xlsx";
|
||||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||||
response.reset();
|
response.reset();
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||||
|
|||||||
@@ -310,7 +310,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
||||||
MultipartFile baseFile = reportParam.getBaseFile();
|
MultipartFile baseFile = reportParam.getBaseFile();
|
||||||
MultipartFile detailFile = reportParam.getDetailFile();
|
MultipartFile detailFile = reportParam.getDetailFile();
|
||||||
String newDir = templatePath + File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
String relativePath = File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
||||||
|
String newDir = templatePath + relativePath;
|
||||||
|
|
||||||
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
||||||
if (isAdd) {
|
if (isAdd) {
|
||||||
@@ -329,13 +330,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
pqReport.setBasePath(newDir + baseOriginalFilename);
|
pqReport.setBasePath(relativePath + baseOriginalFilename);
|
||||||
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailOriginalFilename);
|
||||||
|
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseOriginalFilename);
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailOriginalFilename);
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
||||||
}
|
}
|
||||||
@@ -383,34 +384,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
//若修改了文件名称、版本号,则需要重命名文件
|
//若修改了文件名称、版本号,则需要重命名文件
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
if (!oldDir.equals(newDir)) {
|
if (!oldDir.equals(relativePath)) {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
String oldBasePathStr = oldPqReport.getBasePath();
|
String oldBasePathStr = oldPqReport.getBasePath();
|
||||||
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldBasePath = Paths.get(oldBasePathStr);
|
Path oldBasePath = Paths.get(templatePath + oldBasePathStr);
|
||||||
Path newBasePath = Paths.get(newDir + baseName);
|
Path newBasePath = Paths.get(newDir + baseName);
|
||||||
pqReport.setBasePath(newDir + baseName);
|
pqReport.setBasePath(relativePath + baseName);
|
||||||
|
|
||||||
String oldDetailPathStr = oldPqReport.getDetailPath();
|
String oldDetailPathStr = oldPqReport.getDetailPath();
|
||||||
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldDetailPath = Paths.get(oldDetailPathStr);
|
Path oldDetailPath = Paths.get(templatePath + oldDetailPathStr);
|
||||||
Path newDetailPath = Paths.get(newDir + detailName);
|
Path newDetailPath = Paths.get(newDir + detailName);
|
||||||
pqReport.setDetailPath(newDir + detailName);
|
pqReport.setDetailPath(relativePath + detailName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// windows下文件夹名称不区分大小写
|
// windows下文件夹名称不区分大小写
|
||||||
if (!oldDir.equalsIgnoreCase(newDir)) {
|
if (!oldDir.equalsIgnoreCase(relativePath)) {
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
Files.move(oldBasePath, newBasePath);
|
Files.move(oldBasePath, newBasePath);
|
||||||
Files.move(oldDetailPath, newDetailPath);
|
Files.move(oldDetailPath, newDetailPath);
|
||||||
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
||||||
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
||||||
} else {
|
} else {
|
||||||
Paths.get(oldDir).toFile().delete();
|
Paths.get(templatePath + oldDir).toFile().delete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
Paths.get(oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
Paths.get(templatePath + oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
||||||
@@ -418,16 +419,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!baseFileOriginalFilename.isEmpty()) {
|
if (!baseFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setBasePath(newDir + baseFileOriginalFilename);
|
pqReport.setBasePath(relativePath + baseFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getBasePath()).toFile().delete();
|
Paths.get(templatePath + oldPqReport.getBasePath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseFileOriginalFilename);
|
||||||
}
|
}
|
||||||
if (!detailFileOriginalFilename.isEmpty()) {
|
if (!detailFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setDetailPath(newDir + detailFileOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getDetailPath()).toFile().delete();
|
Paths.get(templatePath + oldPqReport.getDetailPath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailFileOriginalFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -800,8 +801,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
Path basePath = Paths.get(templatePath + report.getBasePath());
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path detailPath = Paths.get(templatePath + report.getDetailPath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
@@ -877,8 +878,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
Path basePath = Paths.get(templatePath + report.getBasePath());
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path detailPath = Paths.get(templatePath + report.getDetailPath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
|
|||||||
Reference in New Issue
Block a user