user id addded in this code

This commit is contained in:
Mohd-Arham
2025-12-03 17:40:04 +05:30
parent d521459227
commit 003dd9325c
33 changed files with 723 additions and 568 deletions
@@ -8,6 +8,9 @@ import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;
@@ -216,8 +219,8 @@ public class ComplainServiceImpl implements ComplainService {
String complaintId = request.getTicketId();
String mid = request.getMid();
String ticketId = request.getTicketId();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId);
String userId = request.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={} | userId={}", apiName, reqId, mid, ticketId, userId);
String fullUrl = agentDtaUrl + BBPSConstant.COMPALINT_STATUS;
String txnId = helper.generateTxnId(15);
@@ -277,7 +280,7 @@ public class ComplainServiceImpl implements ComplainService {
TicketCheckStatusResponse responseWrapper = objectMapper.convertValue(dataMap,
TicketCheckStatusResponse.class);
String saveComplaintStatus = mapperHelper.saveComplaintStatus(responseWrapper, reqId, txnId);
String saveComplaintStatus = mapperHelper.saveComplaintStatus(responseWrapper, reqId, txnId, userId);
LOGGER.info("[{}] Save Status | ticketId={} | status={}", apiName, ticketId, saveComplaintStatus);
helper.updateInboundLogSuccess(inboundLog, responseData, responseWrapper.getStatus());
@@ -298,8 +301,8 @@ public class ComplainServiceImpl implements ComplainService {
String reqId = request.getReqId();
String ticketId = request.getTicketId();
String mid = request.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId);
String userId = request.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={} | userId={}", apiName, reqId, mid, ticketId, userId);
String fullUrl = agentDtaUrl + BBPSConstant.COMPLAINT_HISTORY + request.getTicketId();
String txnId = helper.generateTxnId(15);
@@ -345,7 +348,7 @@ public class ComplainServiceImpl implements ComplainService {
LOGGER.info("Current Complaint ReOpen Status: {}", status);
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
String saveComplaintHistory = mapperHelper.saveComplaintHistory(responseWrapper, reqId, txnId);
String saveComplaintHistory = mapperHelper.saveComplaintHistory(responseWrapper, reqId, txnId, userId);
LOGGER.info("[{}] Complaint history saved | ticketId={} | entryId={}", apiName, ticketId,
saveComplaintHistory);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -364,7 +367,8 @@ public class ComplainServiceImpl implements ComplainService {
String reqId = request.getReqId();
String ticketId = request.getTicketId();
String mid = request.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId);
String userId = request.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={} | userId={}", apiName, reqId, mid, ticketId, userId);
String txnId = helper.generateTxnId(15);
String fullUrl = agentDtaUrl + BBPSConstant.VIEW_COMPLAINT_BY_ID + request.getTicketId();
@@ -408,7 +412,7 @@ public class ComplainServiceImpl implements ComplainService {
LOGGER.info("Current Complaint ReOpen Status: {}", status);
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
String saveComplaint = mapperHelper.saveComplainStatusDetail(responseWrapper, reqId, txnId);
String saveComplaint = mapperHelper.saveComplainStatusDetail(responseWrapper, reqId, txnId, userId);
LOGGER.info("[{}] Complaint details saved | ticketId={} | id={}", apiName, ticketId, saveComplaint);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -540,8 +544,9 @@ public class ComplainServiceImpl implements ComplainService {
String reqId = request.getReqId();
String mid = request.getMid();
String statusType = request.getStatusType();
LOGGER.info("[{}] START | reqId={} | mid={} | statusType={}", apiName, reqId, mid, statusType);
String userId = request.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | statusType={} | userId={}", apiName, reqId, mid, statusType,
userId);
String txnId = helper.generateTxnId(15);
String fullUrl = complainDataUrl + BBPSConstant.VIEW_ALL_COMPLAINTS_BASE + "?pageNo=" + request.getPageNo()
+ "&pageSize=" + request.getPageSize() + "&statusType=" + request.getStatusType() + "&ticketType="
@@ -586,7 +591,7 @@ public class ComplainServiceImpl implements ComplainService {
String status = generalResp.getStatus();
LOGGER.info("Current Complaint ReOpen Status: {}", status);
String saveComplaint = mapperHelper.saveAllComplaints(responseWrapper, reqId, txnId);
String saveComplaint = mapperHelper.saveAllComplaints(responseWrapper, reqId, txnId, userId);
LOGGER.info("[{}] Complaint records saved into DB | count={}", apiName, saveComplaint);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -632,7 +637,12 @@ public class ComplainServiceImpl implements ComplainService {
// Log the call to external API
LOGGER.info("[{}] Calling external API | URL={}", apiName, apiName);
List<ComplaintResponseEntity> complaintUserData = complaintResponseRepository.findByUserIdCustom(userId);
// List<ComplaintResponseEntity> complaintUserData =
// complaintResponseRepository.findByUserIdCustom(userId);
Pageable pageable = PageRequest.of(request.getPageNo(), request.getPageSize());
Page<ComplaintResponseEntity> complaintUserData = complaintResponseRepository.findByUserIdCustom(userId,
pageable);
// Check if complaints were found
if (complaintUserData == null || complaintUserData.isEmpty()) {
@@ -642,15 +652,17 @@ public class ComplainServiceImpl implements ComplainService {
}
// Log the number of complaints fetched
LOGGER.info("[{}] Complaints found for userId={} | count={}", apiName, userId, complaintUserData.size());
LOGGER.info("[{}] Complaints found for userId={} | count={}", apiName, userId,
complaintUserData.getContent().size());
// Update outbound log with the count
String count = String.valueOf(complaintUserData.size());
String count = String.valueOf(complaintUserData.getContent().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, complaintUserData.size());
BBPSConstant.HTTP_OK_INT, complaintUserData.getContent(), // Only the list of complaints (data)
complaintUserData.getContent().size());
} catch (CustomException e) {
// Rethrow custom exception for handling at the controller level