Updated code

This commit is contained in:
nisha
2025-01-13 13:00:04 +05:30
parent 3b8246987e
commit b4877b588c
16 changed files with 110 additions and 55 deletions

View File

@@ -424,6 +424,10 @@ public class ApplicationDao {
if(applicationEntity.getProtocol() != null) {
responseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
}
responseBean.setAmountAccepted(applicationEntity.getAmountAccepted());
responseBean.setAmountRequested(applicationEntity.getAmountRequested());
responseBean.setDateAccepted(applicationEntity.getDateAccepted());
responseBean.setDateRejected(applicationEntity.getDateRejected());
return responseBean;
}
@@ -443,6 +447,10 @@ public class ApplicationDao {
response.setCallId(entity.getCall().getId());
response.setCreatedDate(entity.getCreatedDate());
response.setUpdatedDate(entity.getUpdatedDate());
response.setAmountAccepted(entity.getAmountAccepted());
response.setAmountRequested(entity.getAmountRequested());
response.setDateAccepted(entity.getDateAccepted());
response.setDateRejected(entity.getDateRejected());
if(entity.getProtocol() != null) {
response.setProtocolNumber(entity.getProtocol().getProtocolNumber());
}
@@ -481,22 +489,31 @@ public class ApplicationDao {
List<Long> newDocumentIds = validateFileUploadDocuments(applicationFormFieldRequestBean, formEntity);
validateFileUploadDocuments(applicationFormFieldRequestBean, formEntity);
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
List<ContentResponseBean> contentResponseBeans=formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
for (ContentResponseBean contentResponseBean:contentResponseBeans){
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("numberinput"))) {
List<SettingResponseBean> settingResponseBeans=contentResponseBean.getSettings();
for(SettingResponseBean settingResponseBean:settingResponseBeans){
if(settingResponseBean.getName().equals("isRequestedAmount")){
Object value=settingResponseBean.getValue();
if (value instanceof Boolean) {
if(Boolean.TRUE.equals(value))
{
applicationFormEntity.getApplication().setAmountRequested((BigDecimal) applicationFormFieldRequestBean.getFieldValue());
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
contentResponseBeans.stream()
.filter(content -> "numberinput".equals(content.getName()))
.map(ContentResponseBean::getSettings)
.flatMap(List::stream)
.filter(setting -> "isRequestedAmount".equals(setting.getName()) && Boolean.TRUE.equals(setting.getValue()))
.findFirst()
.ifPresent(setting -> {
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
if(fieldValue!=null) {
if (fieldValue instanceof String) {
try {
BigDecimal amountRequested = new BigDecimal((String) fieldValue);
applicationFormEntity.getApplication().setAmountRequested(amountRequested);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Field value is not a valid number: " + fieldValue, e);
}
} else {
throw new IllegalArgumentException("Field value is not a String: " + fieldValue);
}
}
}
}
}}
});
ApplicationFormFieldEntity oldApplicationFormFieldData = null;
if (applicationFormFieldEntities == null || applicationFormFieldEntities.isEmpty()) {
@@ -827,6 +844,10 @@ public class ApplicationDao {
applicationGetResponseBean.setCallId(applicationEntity.getCall().getId());
applicationGetResponseBean.setCallTitle(applicationEntity.getCall().getName());
applicationGetResponseBean.setCompanyId(applicationEntity.getCompanyId());
applicationGetResponseBean.setAmountAccepted(applicationEntity.getAmountAccepted());
applicationGetResponseBean.setAmountRequested(applicationEntity.getAmountRequested());
applicationGetResponseBean.setDateAccepted(applicationEntity.getDateAccepted());
applicationGetResponseBean.setDateRejected(applicationEntity.getDateRejected());
if(applicationEntity.getProtocol() != null) {
applicationGetResponseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
}