updated code

This commit is contained in:
Mohd-Arham
2025-12-19 12:15:32 +05:30
parent d3ae7decc8
commit 0197f6951f
5 changed files with 58 additions and 157 deletions
@@ -6,6 +6,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -528,6 +529,7 @@ public class BillerMapperHelper {
entity.setNpciTicketStatus(dto.getNpciTicketStatus());
entity.setCreatedTime(dto.getCreatedTime());
entity.setUserId(userId);
entity.setCreateDateTime(new Date());
try {
ComplainStatus saved = complaintStatusRepository.save(entity);
@@ -558,7 +560,7 @@ public class BillerMapperHelper {
entity.setReqId(reqId);
entity.setTxnId(txnId);
entity.setUserId(userId);
entity.setCreateDateTime(new Date());
complaintHistoryRepository.save(entity);
savedCount++;
}
@@ -673,6 +675,7 @@ public class BillerMapperHelper {
entity.setPage(String.valueOf(responseWrapper.getPage()));
entity.setPageSize(String.valueOf(responseWrapper.getPageSize()));
entity.setUserId(userId);
entity.setCreateDateTime(new Date());
}
@@ -852,6 +855,7 @@ public class BillerMapperHelper {
entity.setTotalPages(String.valueOf(responseWrapper.getTotalPages()));
entity.setTotalElements(String.valueOf(responseWrapper.getTotalElements()));
entity.setUserId(userId);
entity.setCreateDateTime(new Date());
}
@@ -962,9 +966,9 @@ public class BillerMapperHelper {
LocalDateTime bmCreatedOn = parseToLocalDateTime(responseWrapper.getCreationDate());
LocalDateTime bmUpdatedOn = parseToLocalDateTime(responseWrapper.getModifiedDate());
if (bmUpdatedOn != null) {
billMaster.setUpdatedDateTime(bmUpdatedOn);
}
// if (bmUpdatedOn != null) {
// billMaster.setUpdatedDateTime(bmUpdatedOn);
// }
billMaster.setCreatedEpochDate(responseWrapper.getCreatedEpochDate());
billMaster.setModifiedEpochDate(responseWrapper.getModifiedEpochDate());
@@ -1091,21 +1095,27 @@ public class BillerMapperHelper {
record.setClientUserId(request.getClientUserId());
record.setInternalTxnId(txnId);
if (apiResponse != null &&
apiResponse.getResponseData() != null) {
record.setAmount(Optional.ofNullable(apiResponse.getResponseData().getAmount(
)).orElse("0.00"));
record.setTxnId(Optional.ofNullable(apiResponse.getResponseData().getTxnId())
.orElse("DUMMY_TXN"));
record.setQrString(Optional.ofNullable(apiResponse.getResponseData().
getQrString()).orElse("NO_QR")); // parse createdOn string into LocalDateTime and set on Auditable
LocalDateTime createdOn =parseToLocalDateTime(apiResponse.getResponseData().getCreatedOn());
record.setTxnStatus("PENDING"); } else { record.setAmount("0.00");
record.setTxnStatus("PENDING"); }
if (apiResponse != null && apiResponse.getResponseData() != null) {
record.setAmount(Optional.ofNullable(apiResponse.getResponseData().getAmount()).orElse("0.00"));
record.setTxnId(Optional.ofNullable(apiResponse.getResponseData().getTxnId()).orElse("DUMMY_TXN"));
record.setQrString(Optional.ofNullable(apiResponse.getResponseData().getQrString()).orElse("NO_QR")); // parse
// createdOn
// string
// into
// LocalDateTime
// and
// set
// on
// Auditable
LocalDateTime createdOn = parseToLocalDateTime(apiResponse.getResponseData().getCreatedOn());
record.setTxnStatus("PENDING");
} else {
record.setAmount("0.00");
record.setTxnStatus("PENDING");
}
// store the original request body and raw response
record.setRequestBody(requestJson);
record.setResponseBody(rawResponse);
@@ -1151,7 +1161,7 @@ public class BillerMapperHelper {
// Persist complaint response entity
public String saveComplaintResponseEntity(ComplaintResponse responseWrapper, String requestId, String txnId,
String userId, String requestTxnId) {
String userId, String requestTxnId, String mid) {
if (responseWrapper == null || responseWrapper.getTicketDetails() == null) {
return "No data";
}
@@ -1164,6 +1174,8 @@ public class BillerMapperHelper {
complaintResponseEntity.setTicketDesp(responseWrapper.getTicketDetails().getTicketDesp());
complaintResponseEntity.setTicketDesr(responseWrapper.getTicketDetails().getTicketDesr());
complaintResponseEntity.setRequestTxnId(requestTxnId);
complaintResponseEntity.setMid(mid);
complaintResponseEntity.setCreateDateTime(new Date());
complaintResponseEntity.setMessage(responseWrapper.getMessage());
complaintResponseEntity.setRemarks(responseWrapper.getRemarks());
@@ -1273,7 +1285,7 @@ public class BillerMapperHelper {
}
}
public ComplaintResponseDto toDto(ComplaintResponseEntity e) {
public ComplaintResponseDto toDto(ComplaintResponseEntity e) {
ComplaintResponseDto dto = new ComplaintResponseDto();
dto.setTicketId(e.getTicketId());