FINERACT-2415: Refactor InlineLoanCOBExecutorServiceImpl to reduce duplication
This commit is contained in:
committed by
Arnold Gálovics
parent
36d779eabf
commit
d043f4cb61
+8
-7
@@ -200,16 +200,17 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
return loanAccountLocks;
|
return loanAccountLocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Long saveCustomJobParameter(String paramName, String paramValue) {
|
||||||
|
JobParameterDTO paramDTO = new JobParameterDTO(paramName, paramValue);
|
||||||
|
Set<JobParameterDTO> paramSet = Collections.singleton(paramDTO);
|
||||||
|
return customJobParameterRepository.save(paramSet);
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, JobParameter<?>> getJobParametersMap(List<Long> loanIds, LocalDate businessDate) {
|
private Map<String, JobParameter<?>> getJobParametersMap(List<Long> loanIds, LocalDate businessDate) {
|
||||||
// TODO: refactor for a more generic solution
|
|
||||||
String parameterJson = gson.toJson(loanIds);
|
String parameterJson = gson.toJson(loanIds);
|
||||||
JobParameterDTO loanIdsParameterDTO = new JobParameterDTO(LoanCOBConstant.LOAN_IDS_PARAMETER_NAME, parameterJson);
|
Long loanIdsJobParameterId = saveCustomJobParameter(LoanCOBConstant.LOAN_IDS_PARAMETER_NAME, parameterJson);
|
||||||
Set<JobParameterDTO> loanIdJobParameter = Collections.singleton(loanIdsParameterDTO);
|
Long businessDateJobParameterId = saveCustomJobParameter(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME,
|
||||||
Long loanIdsJobParameterId = customJobParameterRepository.save(loanIdJobParameter);
|
|
||||||
JobParameterDTO businessDateParameterDTO = new JobParameterDTO(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME,
|
|
||||||
businessDate.format(DateTimeFormatter.ISO_DATE));
|
businessDate.format(DateTimeFormatter.ISO_DATE));
|
||||||
Set<JobParameterDTO> businessDateJobParameter = Collections.singleton(businessDateParameterDTO);
|
|
||||||
Long businessDateJobParameterId = customJobParameterRepository.save(businessDateJobParameter);
|
|
||||||
Map<String, JobParameter<?>> jobParameterMap = new HashMap<>();
|
Map<String, JobParameter<?>> jobParameterMap = new HashMap<>();
|
||||||
jobParameterMap.put(SpringBatchJobConstants.CUSTOM_JOB_PARAMETER_ID_KEY, new JobParameter<>(loanIdsJobParameterId, Long.class));
|
jobParameterMap.put(SpringBatchJobConstants.CUSTOM_JOB_PARAMETER_ID_KEY, new JobParameter<>(loanIdsJobParameterId, Long.class));
|
||||||
jobParameterMap.put(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME, new JobParameter<>(businessDateJobParameterId, Long.class));
|
jobParameterMap.put(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME, new JobParameter<>(businessDateJobParameterId, Long.class));
|
||||||
|
|||||||
Reference in New Issue
Block a user