http://jira.mfd.msk:8088/browse/BKI-3241 old destination for client's reports
This commit is contained in:
parent
6c99e6408e
commit
5fc51a58c8
3 changed files with 20 additions and 20 deletions
2
pom.xml
2
pom.xml
|
|
@ -10,7 +10,7 @@
|
|||
</parent>
|
||||
<groupId>ru.nbch</groupId>
|
||||
<artifactId>credit-tracker</artifactId>
|
||||
<version>2.21.1</version>
|
||||
<version>2.21.2</version>
|
||||
<name>credit_tracker</name>
|
||||
<description>Credit Tracker Application</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -303,8 +303,10 @@ public class SignalFacadeV3 {
|
|||
throw clientExcp(SignalError.ERROR_012, XmlErrorFormat.MonitoringReportListError, packageName);
|
||||
}
|
||||
|
||||
Path folderPath = Path.of(config.getLoadDir(),"tmp", userPackage.getUserId(), userPackage.getPackageName());
|
||||
File folder = folderPath.toFile();
|
||||
String memberCode = username.substring(0, 6);
|
||||
String filePrefix = (memberCode + "_" + packageName).toUpperCase();
|
||||
String dirPath = config.getLoadDir() + File.separator + memberCode;
|
||||
File folder = new File(dirPath);
|
||||
log.debug("searching for reports from: {}", folder.getAbsolutePath());
|
||||
|
||||
MonitoringReportListResponse.Reports reports = new MonitoringReportListResponse.Reports();
|
||||
|
|
@ -312,7 +314,7 @@ public class SignalFacadeV3 {
|
|||
File[] files = folder.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile() && file.getName().endsWith(".zip")) {
|
||||
if (file.isFile() && file.getName().startsWith(filePrefix)) {
|
||||
reports.getReports().add(file.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -333,27 +335,20 @@ public class SignalFacadeV3 {
|
|||
public ResponseEntity<Resource> downloadFile(String fileName) {
|
||||
try {
|
||||
Matcher matcher = DOWNLOAD_FILE_PATTERN.matcher(fileName);
|
||||
String packageName = null;
|
||||
String memberCode = null;
|
||||
if (matcher.matches()) {
|
||||
packageName = matcher.group("package");
|
||||
memberCode = matcher.group("member");
|
||||
}
|
||||
|
||||
if (packageName == null) {
|
||||
if (memberCode == null) {
|
||||
throw clientExcp(SignalError.ERROR_014, XmlErrorFormat.MonitoringDownloadError, fileName);
|
||||
}
|
||||
UserPackage userPackage = userPackageService.findByPackageName(packageName);
|
||||
|
||||
if (userPackage == null) {
|
||||
throw clientExcp(SignalError.ERROR_014, XmlErrorFormat.MonitoringDownloadError, fileName);
|
||||
}
|
||||
String dirPath = config.getLoadDir() +
|
||||
File.separator + "tmp" +
|
||||
File.separator + userPackage.getUserId() +
|
||||
File.separator + userPackage.getPackageName();
|
||||
File folder = new File(dirPath);
|
||||
Path reportRootPath = Path.of(config.getLoadDir(), memberCode);
|
||||
File folder = reportRootPath.toFile();
|
||||
|
||||
if (folder.exists() && folder.isDirectory()) {
|
||||
File file = new File(dirPath + File.separator + fileName);
|
||||
Path filePath = reportRootPath.resolve(fileName);
|
||||
File file = filePath.toFile();
|
||||
if (file.exists() && file.isFile()) {
|
||||
return ResponseEntity.ok().body(new FileUrlResource(file.getPath()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,10 +186,15 @@ public class MonitoringService {
|
|||
// Выставляется в true, если хотя бы один субъект с мониторинга подошел под условие срабатывания сигнала. В этом случае отчет сохраняется
|
||||
AtomicBoolean generateResponse = new AtomicBoolean(false);
|
||||
|
||||
String commonMembercode = userPackage.getUserId().substring(0, 6);
|
||||
Path rootReportPath = Path.of(config.getLoadDir(), commonMembercode);
|
||||
if (!Files.exists(rootReportPath)) {
|
||||
Files.createDirectories(rootReportPath);
|
||||
}
|
||||
AtomicReference<Path> responsePath = new AtomicReference<>(
|
||||
loadedReportPath.resolveSibling(
|
||||
rootReportPath.resolve(
|
||||
String.format("%s_%s_%s.xml",
|
||||
userPackage.getUserId().substring(0, 6),
|
||||
commonMembercode,
|
||||
userPackage.getPackageName(),
|
||||
CTUtil.getDateFromReportFileName(reportName))
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue