From a41dca5693397aa0ad5cf422911c47f6a2688887 Mon Sep 17 00:00:00 2001 From: Mohd-Arham Date: Wed, 17 Dec 2025 10:56:34 +0530 Subject: [PATCH] code added on updated --- .../bbps/dto/ComplaintResponseDto.java | 24 ++++++ .../bbps/dto/ComplaintStatusDetailsDto.java | 18 +++++ .../bbps/dto/ComplaintStatusDto.java | 17 +++++ .../bbps/dto/ViewAllComplaintDto.java | 20 +++++ .../bbps/entites/ComplainStatus.java | 6 +- .../bbps/entites/ComplaintHistory.java | 4 +- .../bbps/entites/ComplaintResponseEntity.java | 25 ++++--- .../bbps/entites/ComplaintStatusDetails.java | 5 +- .../ViewAllComplaintTicketStatusDetails.java | 4 +- .../ComplaintResponseRepository.java | 12 ++- .../bbps/serviceImpl/ComplainServiceImpl.java | 30 +++++--- .../bbps/util/BillerMapperHelper.java | 75 +++++++++++++++++-- 12 files changed, 197 insertions(+), 43 deletions(-) create mode 100644 src/main/java/com/billpaymentservice/bbps/dto/ComplaintResponseDto.java create mode 100644 src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDetailsDto.java create mode 100644 src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDto.java create mode 100644 src/main/java/com/billpaymentservice/bbps/dto/ViewAllComplaintDto.java diff --git a/src/main/java/com/billpaymentservice/bbps/dto/ComplaintResponseDto.java b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintResponseDto.java new file mode 100644 index 0000000..3bc9ab6 --- /dev/null +++ b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintResponseDto.java @@ -0,0 +1,24 @@ +package com.billpaymentservice.bbps.dto; + +import java.util.List; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ComplaintResponseDto { + + private String ticketId; + private String ticketType; + private String txnNpciId; + private String status; + private String userId; + private String ticketDesp; + private String ticketDesr; + + private List complaintStatusList; + private List historyList; + private List statusDetailsList; + private List viewAllList; +} diff --git a/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDetailsDto.java b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDetailsDto.java new file mode 100644 index 0000000..c44e15a --- /dev/null +++ b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDetailsDto.java @@ -0,0 +1,18 @@ +package com.billpaymentservice.bbps.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ComplaintStatusDetailsDto { + + private String ticketStatus; + private String ticketType; + private String txnAmount; + private String billerName; + private String ticketId; + private String totalTxnAmount; + private String billCategory; + +} diff --git a/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDto.java b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDto.java new file mode 100644 index 0000000..301f451 --- /dev/null +++ b/src/main/java/com/billpaymentservice/bbps/dto/ComplaintStatusDto.java @@ -0,0 +1,17 @@ +package com.billpaymentservice.bbps.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ComplaintStatusDto { + + private String ticketId; + private String npciTicketStatus; + private String ticketDespo; + private String createdTime; + private String npciTicketType; + + +} diff --git a/src/main/java/com/billpaymentservice/bbps/dto/ViewAllComplaintDto.java b/src/main/java/com/billpaymentservice/bbps/dto/ViewAllComplaintDto.java new file mode 100644 index 0000000..fee00eb --- /dev/null +++ b/src/main/java/com/billpaymentservice/bbps/dto/ViewAllComplaintDto.java @@ -0,0 +1,20 @@ +package com.billpaymentservice.bbps.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ViewAllComplaintDto { + + private String ticketStatus; + private String txnAmount; + private String billerName; + private String ticketId; + private String txnNpciId; + private String ticketType; + private String createdTime; + private String billCategory; + private String totalTxnAmount; + +} diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ComplainStatus.java b/src/main/java/com/billpaymentservice/bbps/entites/ComplainStatus.java index 076cecc..827a6c2 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ComplainStatus.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ComplainStatus.java @@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.entites; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -71,9 +72,4 @@ public class ComplainStatus extends Auditable { @Column(name = "user_id") private String userId; - - @ManyToOne - @JoinColumn(name = "complaint_response_id") - private ComplaintResponseEntity complaintResponse; } - diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintHistory.java b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintHistory.java index 7d95581..6ad3bca 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintHistory.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintHistory.java @@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.entites; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -46,8 +47,5 @@ public class ComplaintHistory extends Auditable { @Column(name = "user_id") private String userId; - @ManyToOne - @JoinColumn(name = "complaint_response_id") - private ComplaintResponseEntity complaintResponse; } diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintResponseEntity.java b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintResponseEntity.java index d82d3a7..88bdb17 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintResponseEntity.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintResponseEntity.java @@ -1,13 +1,16 @@ package com.billpaymentservice.bbps.entites; +import java.util.HashSet; import java.util.List; +import java.util.Set; -import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.Getter; @@ -74,16 +77,20 @@ public class ComplaintResponseEntity extends Auditable { @Column(name = "user_id") private String userId; - @OneToMany(mappedBy = "complaintResponse", cascade = CascadeType.ALL, orphanRemoval = false) - private List complaintStatusList; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "ticket_id", referencedColumnName = "ticket_id", insertable = false, updatable = false) + private Set complaintStatusList = new HashSet<>(); - @OneToMany(mappedBy = "complaintResponse", cascade = CascadeType.ALL, orphanRemoval = false) - private List historyList; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "ticket_id", referencedColumnName = "ticket_id", insertable = false, updatable = false) + private Set historyList = new HashSet<>(); - @OneToMany(mappedBy = "complaintResponse", cascade = CascadeType.ALL, orphanRemoval = false) - private List statusDetailsList; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "ticket_id", referencedColumnName = "ticket_id", insertable = false, updatable = false) + private Set statusDetailsList = new HashSet<>(); - @OneToMany(mappedBy = "complaintResponse", cascade = CascadeType.ALL, orphanRemoval = false) - private List viewAllList; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "ticket_id", referencedColumnName = "ticket_id", insertable = false, updatable = false) + private Set viewAllList = new HashSet<>(); } diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintStatusDetails.java b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintStatusDetails.java index 038e57f..08d3c3a 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ComplaintStatusDetails.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ComplaintStatusDetails.java @@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.entites; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -88,8 +89,6 @@ public class ComplaintStatusDetails extends Auditable { @Column(name = "biller_name") private String billerName; - @ManyToOne - @JoinColumn(name = "complaint_response_id") - private ComplaintResponseEntity complaintResponse; + } diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ViewAllComplaintTicketStatusDetails.java b/src/main/java/com/billpaymentservice/bbps/entites/ViewAllComplaintTicketStatusDetails.java index efb0e59..7e1ab86 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ViewAllComplaintTicketStatusDetails.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ViewAllComplaintTicketStatusDetails.java @@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.entites; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -88,7 +89,4 @@ public class ViewAllComplaintTicketStatusDetails extends Auditable { @Column(name = "biller_name") private String billerName; - @ManyToOne - @JoinColumn(name = "complaint_response_id") - private ComplaintResponseEntity complaintResponse; } diff --git a/src/main/java/com/billpaymentservice/bbps/repository/ComplaintResponseRepository.java b/src/main/java/com/billpaymentservice/bbps/repository/ComplaintResponseRepository.java index a018e30..e6b9b18 100644 --- a/src/main/java/com/billpaymentservice/bbps/repository/ComplaintResponseRepository.java +++ b/src/main/java/com/billpaymentservice/bbps/repository/ComplaintResponseRepository.java @@ -15,7 +15,17 @@ public interface ComplaintResponseRepository extends JpaRepository findByUserIdCustom(@Param("userId") String userId); - @Query("SELECT c FROM ComplaintResponseEntity c WHERE c.userId = :userId") +// @Query("SELECT c FROM ComplaintResponseEntity c WHERE c.userId = :userId") +// Page findByUserIdCustom(@Param("userId") String userId, Pageable pageable); + + @Query(""" + SELECT DISTINCT c FROM ComplaintResponseEntity c + LEFT JOIN FETCH c.complaintStatusList cs + LEFT JOIN FETCH c.historyList ch + LEFT JOIN FETCH c.statusDetailsList sd + LEFT JOIN FETCH c.viewAllList va + WHERE c.userId = :userId + """) Page findByUserIdCustom(@Param("userId") String userId, Pageable pageable); @Query(value = "SELECT * FROM bbps_complaint_responses WHERE user_id = :userId", nativeQuery = true) diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java index 16b78fc..254ca4b 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; import org.springframework.web.client.RestClient; +import com.billpaymentservice.bbps.dto.ComplaintResponseDto; import com.billpaymentservice.bbps.dto.GeneralResp; import com.billpaymentservice.bbps.dto.ResponseModel; import com.billpaymentservice.bbps.dto.request.AllMasterOptionsRequest; @@ -103,7 +104,7 @@ public class ComplainServiceImpl implements ComplainService { String requestId = complainRequestDTO.getReqId(); String mid = complainRequestDTO.getMid(); String userId = complainRequestDTO.getClientUserId(); - String requestTxnId=complainRequestDTO.getTxnId(); + String requestTxnId = complainRequestDTO.getTxnId(); LOGGER.info("[{}] START | reqId={} | mid={} | clientUserId={}", apiName, requestId, mid, userId); String txnId = helper.generateTxnId(15); @@ -196,7 +197,7 @@ public class ComplainServiceImpl implements ComplainService { ComplaintResponse responseWrapper = objectMapper.convertValue(dataMap, ComplaintResponse.class); String saveComplaintResponseEntity = mapperHelper.saveComplaintResponseEntity(responseWrapper, requestId, - txnId, userId,requestTxnId); + txnId, userId, requestTxnId); LOGGER.info("Save Complaint Response Count" + saveComplaintResponseEntity); ResponseModel responseModel = new ResponseModel(responseWrapper.getMessage(), responseWrapper.getStatus(), Integer.parseInt(responseWrapper.getStatusCode()), responseWrapper); @@ -208,7 +209,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("JSON Parsing Error: {}", e.getMessage()); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -291,7 +293,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("Error parsing JSON in complaint status API: {}", e.getMessage(), e); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -357,7 +360,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -421,7 +425,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -533,7 +538,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -600,7 +606,8 @@ public class ComplainServiceImpl implements ComplainService { } catch (JsonProcessingException e) { LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e); helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR); - throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); + throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", + BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage()); } } @@ -656,14 +663,15 @@ public class ComplainServiceImpl implements ComplainService { LOGGER.info("[{}] Complaints found for userId={} | count={}", apiName, userId, complaintUserData.getContent().size()); + List dtoList = complaintUserData.getContent().stream().map(mapperHelper::toDto) + .toList(); // Update outbound log with the count - String count = String.valueOf(complaintUserData.getContent().size()); + String count = String.valueOf(dtoList.size()); helper.updateOutboundLogResponse(outboundLog, count); // Return successful response with complaints data return new ResponseModel(BBPSConstant.ALL_COMPLAINT_FIELDS_FETCH, BBPSConstant.SUCCESS_RESPONSE, - BBPSConstant.HTTP_OK_INT, complaintUserData.getContent(), // Only the list of complaints (data) - complaintUserData.getContent().size()); + BBPSConstant.HTTP_OK_INT, dtoList, dtoList.size()); } catch (CustomException e) { // Rethrow custom exception for handling at the controller level diff --git a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java index c889a2a..e8e2a52 100644 --- a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java +++ b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java @@ -6,7 +6,6 @@ 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; @@ -27,6 +26,9 @@ import com.billpaymentservice.bbps.dto.BillCustomerParamsDTO; import com.billpaymentservice.bbps.dto.BillerIconDTO; import com.billpaymentservice.bbps.dto.CheckClientBillerResponseDTO; import com.billpaymentservice.bbps.dto.ComplaintHistoryDTO; +import com.billpaymentservice.bbps.dto.ComplaintResponseDto; +import com.billpaymentservice.bbps.dto.ComplaintStatusDetailsDto; +import com.billpaymentservice.bbps.dto.ComplaintStatusDto; import com.billpaymentservice.bbps.dto.ContactMaster; import com.billpaymentservice.bbps.dto.CustomerParamDAO; import com.billpaymentservice.bbps.dto.CustomerParamGroupsDTO; @@ -38,11 +40,10 @@ import com.billpaymentservice.bbps.dto.TicketDetailsDTO; import com.billpaymentservice.bbps.dto.TicketDispositionsDTO; import com.billpaymentservice.bbps.dto.TransactionHistoryMasterDTO; import com.billpaymentservice.bbps.dto.TransactionHistoryParticularDetailsDTO; +import com.billpaymentservice.bbps.dto.ViewAllComplaintDto; import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest; import com.billpaymentservice.bbps.dto.request.BillPaymentRequest; import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO; -import com.billpaymentservice.bbps.dto.request.FetchBillRequest; -import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest; import com.billpaymentservice.bbps.dto.request.GetTicketLatestStausRequest; import com.billpaymentservice.bbps.dto.request.PaymentStartUserRequest; import com.billpaymentservice.bbps.dto.response.AmountOptionsResponse; @@ -50,7 +51,6 @@ import com.billpaymentservice.bbps.dto.response.BillDataResponse; import com.billpaymentservice.bbps.dto.response.ClientReqIdResponse; import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse; import com.billpaymentservice.bbps.dto.response.ComplaintResponse; -import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse; import com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse; import com.billpaymentservice.bbps.dto.response.PlanResponse; import com.billpaymentservice.bbps.dto.response.TicketCheckStatusResponse; @@ -58,8 +58,6 @@ import com.billpaymentservice.bbps.dto.response.ViewAllComplaintsResponse; import com.billpaymentservice.bbps.dto.response.ViewAllComplaintsTicketsResponse; import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse; import com.billpaymentservice.bbps.dto.sentRequest.BillPaymentForwardRequest; -import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest; -import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest; import com.billpaymentservice.bbps.dto.sentRequest.FetchComplaintForwardRequest; import com.billpaymentservice.bbps.dto.sentRequest.FetchTicketLatestStatusRequest; import com.billpaymentservice.bbps.entites.AdditionalInfoBill; @@ -119,8 +117,6 @@ import com.billpaymentservice.bbps.repository.ReOpenComplaintRepository; import com.billpaymentservice.bbps.repository.TicketDispositionRepository; import com.billpaymentservice.bbps.repository.ViewAllComplainTicketDetailRepository; -import jakarta.persistence.Column; - @Component public class BillerMapperHelper { @@ -1276,4 +1272,67 @@ public class BillerMapperHelper { LOGGER.error("Error saving BillValidation: {}", e.getMessage(), e); } } + + public ComplaintResponseDto toDto(ComplaintResponseEntity e) { + + ComplaintResponseDto dto = new ComplaintResponseDto(); + dto.setTicketId(e.getTicketId()); + dto.setTicketType(e.getTicketType()); + dto.setStatus(e.getStatus()); + dto.setUserId(e.getUserId()); + dto.setTxnNpciId(e.getTxnNpciId()); + dto.setTicketDesr(e.getTicketDesr()); + dto.setTicketDesp(e.getTicketDesp()); + + dto.setComplaintStatusList(e.getComplaintStatusList().stream().map(cs -> { + ComplaintStatusDto d = new ComplaintStatusDto(); + d.setNpciTicketStatus(cs.getNpciTicketStatus()); + d.setTicketDespo(cs.getTicketDespo()); + d.setCreatedTime(cs.getCreatedTime()); + d.setTicketId(cs.getTicketId()); + d.setNpciTicketStatus(cs.getNpciTicketStatus()); + d.setTicketDespo(cs.getTicketDespo()); + d.setNpciTicketType(cs.getNpciTicketType()); + return d; + }).collect(Collectors.toList())); + + dto.setHistoryList(e.getHistoryList().stream().map(h -> { + ComplaintHistoryDTO d = new ComplaintHistoryDTO(); + d.setHistoryStatus(h.getHistoryStatus()); + d.setTime(h.getTime()); + d.setHistoryId(h.getHistoryId()); + d.setTicketId(h.getTicketId()); + return d; + }).collect(Collectors.toList())); + + dto.setStatusDetailsList(e.getStatusDetailsList().stream().map(sd -> { + ComplaintStatusDetailsDto d = new ComplaintStatusDetailsDto(); + d.setTicketStatus(sd.getTicketStatus()); + d.setTicketType(sd.getTicketType()); + d.setTxnAmount(sd.getTxnAmount()); + d.setBillerName(sd.getBillerName()); + d.setTicketId(sd.getTicketId()); + d.setTotalTxnAmount(sd.getTotalTxnAmount()); + d.setBillCategory(sd.getBillCategory()); + + return d; + }).collect(Collectors.toList())); + + dto.setViewAllList(e.getViewAllList().stream().map(v -> { + ViewAllComplaintDto d = new ViewAllComplaintDto(); + d.setTicketStatus(v.getTicketStatus()); + d.setTxnAmount(v.getTxnAmount()); + d.setBillerName(v.getBillerName()); + d.setTicketId(v.getTicketId()); + d.setTxnNpciId(v.getTxnNpciId()); + d.setTicketType(v.getTicketType()); + d.setBillCategory(v.getBillCategory()); + d.setCreatedTime(v.getCreatedTime()); + d.setTotalTxnAmount(v.getTotalTxnAmount()); + + return d; + }).collect(Collectors.toList())); + + return dto; + } }