add business events logger

This commit is contained in:
RM
2026-10-01 21:45:00 +03:00
parent c6183a88ef
commit f94cb5460d

View File

@@ -29,6 +29,7 @@ import static com.pledge.torgi.utils.AppUtils.EXCEL_LINK;
public class DownloadHeadlessController {
private final Logger logger = LoggerFactory.getLogger(DownloadHeadlessController.class);
private static final Logger businessLogger = LoggerFactory.getLogger("BUSINESS");
private final Set<String> content = new HashSet<>();
private final TorgiEventRepository eventRepository;
private final MissedDataRepository missedDataRepository;
@@ -44,7 +45,7 @@ public class DownloadHeadlessController {
}
private void addNewToDiff() {
logger.error("startProcessing");
businessLogger.info("startProcessing");
DownloadHeadlessService downloadHeadlessService = new DownloadHeadlessService();
Map<String, Lot> currentContent = downloadHeadlessService.downloadExcel(0, EXCEL_LINK);
List<TorgiEvent> newEvents = new ArrayList<>();
@@ -53,11 +54,11 @@ public class DownloadHeadlessController {
if (!content.contains(key)) {
newEvents.add(new TorgiEvent(key, currentContent.get(key)));
content.add(key);
logger.error("added new diff content");
businessLogger.info("added new diff content");
}
}
eventRepository.saveAll(newEvents);
logger.error("completeProcessing");
businessLogger.info("completeProcessing");
}
public void sendNewContent(StartParams params, List<String> cadastral, String email) {
@@ -67,7 +68,7 @@ public class DownloadHeadlessController {
createArchive(now);
sendArchive(params, now, email);
removeArchiveAndSource(now);
logger.error("sended archive");
businessLogger.info("sended archive");
}
private void removeArchiveAndSource(LocalDate now) {
@@ -144,7 +145,7 @@ public class DownloadHeadlessController {
DownloadHeadlessService downloadHeadlessService = new DownloadHeadlessService();
for (MissedData missedCadastral : all) {
Map<String, Lot> currentContent = downloadHeadlessService.downloadExcel(0, String.format(CUSTOM_EXCEL_LINK, missedCadastral.getCadastral()));
logger.error("get content by cadastral {} {}", missedCadastral.getCadastral(), currentContent.size());
businessLogger.info("get content by cadastral {} {}", missedCadastral.getCadastral(), currentContent.size());
if (!currentContent.isEmpty()) {
List<TorgiEvent> newEvents = new ArrayList<>();
Set<String> contentByCadastral = new HashSet<>();
@@ -154,7 +155,7 @@ public class DownloadHeadlessController {
if (!contentByCadastral.contains(key)) {
newEvents.add(new TorgiEvent(key, currentContent.get(key)));
content.add(key);
logger.error("added new missed content");
businessLogger.info("added new missed content");
}
}
eventRepository.saveAll(newEvents);