Conversation
…) 오버로드만 사용하는 걸 권장함에 따라 파라미터 추가
There was a problem hiding this comment.
Pull Request Overview
This PR implements a new daily settlement batch job that generates purchase CSV files and sends them via SFTP.
- Adds new repository methods to query payment and merchant data.
- Introduces separate database configurations along with Quartz scheduling, retry, and batch job components.
- Implements CSV generation and SFTP file upload utilities to support the job workflow.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/fisa/pg/repository/PaymentRepository.java | Adds method to retrieve payments by merchant, payment status, and approval date range. |
| src/main/java/com/fisa/pg/repository/MerchantRepository.java | Introduces query for active merchants. |
| src/main/java/com/fisa/pg/config/db/MetaDBConfig.java | Configures primary datasource for the Meta DB. |
| src/main/java/com/fisa/pg/config/db/DataDBConfig.java | Sets up the Data DB with JPA properties and entity management. |
| src/main/java/com/fisa/pg/batch/utils/SftpUploader.java | Implements SFTP file upload with retry logic. |
| src/main/java/com/fisa/pg/batch/utils/CsvGenerator.java | Creates CSV files from merchant summary data. |
| src/main/java/com/fisa/pg/batch/quartz/QuartzJobLauncher.java | Launches Spring Batch Jobs via a Quartz trigger. |
| src/main/java/com/fisa/pg/batch/quartz/QuartzConfig.java | Defines Quartz job and trigger configurations. |
| src/main/java/com/fisa/pg/batch/job_config/RetryTemplateConfig.java | Configures a RetryTemplate with fixed backoff policy. |
| src/main/java/com/fisa/pg/batch/job_config/GenerateAndSendPurchaseCsvJob.java | Implements the batch job that ties together data retrieval, CSV generation, and SFTP upload. |
| src/main/java/com/fisa/pg/batch/dto/MerchantSummary.java | Defines an immutable DTO for merchant settlement summaries. |
Comments suppressed due to low confidence (1)
src/main/java/com/fisa/pg/batch/job_config/GenerateAndSendPurchaseCsvJob.java:74
- [nitpick] Consider capturing a consistent job start timestamp and reusing it for both the date calculations and settlementTime to avoid potential discrepancies if the job runs around midnight.
LocalDateTime settlementTime = LocalDateTime.now().withHour(2).withMinute(0).withSecond(0).withNano(0);
| em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); | ||
|
|
||
| HashMap<String, Object> properties = new HashMap<>(); | ||
| properties.put("hibernate.hbm2ddl.auto", "update"); |
There was a problem hiding this comment.
Consider using a managed schema migration tool (e.g., Flyway or Liquibase) instead of relying on 'update' in hibernate.hbm2ddl.auto to prevent unintended schema changes in production.
Comment on lines
+41
to
+43
| if (file == null || !file.exists()) { | ||
| throw new IllegalArgumentException(">>>>>>>>>>>>>[Error]: 전송할 파일이 존재하지 않습니다: " + file); | ||
| } |
There was a problem hiding this comment.
[nitpick] Consider separating the null check from the exists() check to provide a clearer error message when file is null.
Suggested change
| if (file == null || !file.exists()) { | |
| throw new IllegalArgumentException(">>>>>>>>>>>>>[Error]: 전송할 파일이 존재하지 않습니다: " + file); | |
| } | |
| if (file == null) { | |
| throw new IllegalArgumentException(">>>>>>>>>>>>>[Error]: 전송할 파일이 null입니다."); | |
| } | |
| if (!file.exists()) { | |
| throw new IllegalArgumentException(">>>>>>>>>>>>>[Error]: 전송할 파일이 존재하지 않습니다: " + file.getAbsolutePath()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[PG서버 Batch Job] 매입 파일 생성 및 SFTP 전송 Job
GenerateAndSendPurchaseCsvJob참고 사항