saving for laptop restart
This commit is contained in:
@@ -19,6 +19,7 @@ import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
|||||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ViewAllComplaintsRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||||
import com.billpaymentservice.bbps.service.ComplainService;
|
import com.billpaymentservice.bbps.service.ComplainService;
|
||||||
|
|
||||||
@@ -79,5 +80,12 @@ public class ComplainController {
|
|||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/viewAllComplaints")
|
||||||
|
public ResponseEntity<ResponseModel> viewAllComplaints(@RequestBody ViewAllComplaintsRequest request) {
|
||||||
|
log.info("Received request complaint View All Complaints for Status Type={}", request.getStatusType());
|
||||||
|
ResponseModel response = complainService.ViewAllComplaints(request);
|
||||||
|
return ResponseEntity.ok(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.billpaymentservice.bbps.dto;
|
package com.billpaymentservice.bbps.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class ComplainDetailsDto {
|
public class ComplainDetailsDto {
|
||||||
|
|
||||||
private String complaintId;
|
private String complaintId;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto.request;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ViewAllComplaintsRequest extends BaseClass{
|
||||||
|
|
||||||
|
private String statusType; // e.g. COMPLAINT_OPEN_SUCCESS
|
||||||
|
private Integer pageNo; // default 0
|
||||||
|
private Integer pageSize; // default 10
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto.response;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.billpaymentservice.bbps.dto.ComplainDetailsDto;
|
||||||
|
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ViewAllComplaintsResponse {
|
||||||
|
private List<ComplainDetailsDto> complaintsList;
|
||||||
|
private GeneralResp generalResp;
|
||||||
|
private Integer pageNo;
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer totalPages;
|
||||||
|
private Long totalElements;
|
||||||
|
}
|
||||||
@@ -4,12 +4,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||||
import com.billpaymentservice.bbps.dto.ViewComplaintDTO;
|
import com.billpaymentservice.bbps.dto.ViewComplaintDTO;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class ViewComplainByIdResponse {
|
public class ViewComplainByIdResponse {
|
||||||
private List<ViewComplaintDTO> complaintsList;
|
private List<ViewComplaintDTO> complaintsList;
|
||||||
private GeneralResp generalResp;
|
private GeneralResp generalResp;
|
||||||
|
|||||||
@@ -20,7 +20,18 @@ import lombok.ToString;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@ToString
|
@ToString(exclude = {
|
||||||
|
"billerPaymentModes",
|
||||||
|
"billerPaymentChannels",
|
||||||
|
"billerCustomerParams",
|
||||||
|
"customerParamGroups",
|
||||||
|
"billerResponseParams",
|
||||||
|
"billerAdditionalInfos",
|
||||||
|
"interchangeFeeConves",
|
||||||
|
"interchangeFees",
|
||||||
|
"billerPlanResponseParams"
|
||||||
|
})
|
||||||
|
|
||||||
@Table(name = "biller_details")
|
@Table(name = "biller_details")
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class BillerDetails {
|
public class BillerDetails {
|
||||||
|
|||||||
@@ -11,16 +11,17 @@ import lombok.Setter;
|
|||||||
@Setter
|
@Setter
|
||||||
@Table(name = "complaint_status_details")
|
@Table(name = "complaint_status_details")
|
||||||
public class ComplaintStatusDetails {
|
public class ComplaintStatusDetails {
|
||||||
|
|
||||||
|
@Id
|
||||||
@Id
|
@Column(name = "complaint_id")
|
||||||
|
private String complaintId;
|
||||||
|
|
||||||
@Column(name = "req_id")
|
@Column(name = "req_id")
|
||||||
private String reqId;
|
private String reqId;
|
||||||
|
|
||||||
@Column(name = "txn_id")
|
@Column(name = "txn_id")
|
||||||
private String txnId;
|
private String txnId;
|
||||||
|
|
||||||
private String complaintId;
|
|
||||||
|
|
||||||
@Column(name = "assigned_to")
|
@Column(name = "assigned_to")
|
||||||
private String assignedTo;
|
private String assignedTo;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
|||||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||||
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ViewAllComplaintsRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||||
|
|
||||||
@@ -23,5 +24,7 @@ public interface ComplainService {
|
|||||||
ResponseModel viewComplaintById(ViewComplainByIdRequest request);
|
ResponseModel viewComplaintById(ViewComplainByIdRequest request);
|
||||||
|
|
||||||
ResponseModel checkTxnStatus(TxnStatusRequest request);
|
ResponseModel checkTxnStatus(TxnStatusRequest request);
|
||||||
|
|
||||||
|
ResponseModel ViewAllComplaints(ViewAllComplaintsRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
|||||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||||
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ViewAllComplaintsRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||||
import com.billpaymentservice.bbps.dto.response.CloseComplaintStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.CloseComplaintStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.TxnStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.TxnStatusResponse;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.ViewAllComplaintsResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ComplainServiceImpl implements ComplainService {
|
public class ComplainServiceImpl implements ComplainService {
|
||||||
|
|
||||||
@Value("${agent.data.url}")
|
@Value("${agent.data.url}")
|
||||||
private String agentDtaUrl;
|
private String agentDtaUrl;
|
||||||
@@ -543,4 +545,76 @@ public class ComplainServiceImpl implements ComplainService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseModel ViewAllComplaints(ViewAllComplaintsRequest request) {
|
||||||
|
|
||||||
|
LOGGER.info("Fetching All Complaint for status Type={} and reqId={} ", request.getStatusType(),
|
||||||
|
request.getReqId());
|
||||||
|
String apiName = "View All Complaint By Status Type";
|
||||||
|
String txnId = helper.generateTxnId(15);
|
||||||
|
String reqId = request.getReqId();
|
||||||
|
String fullUrl = complainDataUrl+ BBPSConstant.VIEW_ALL_COMPLAINTS_BASE
|
||||||
|
+ "?pageNo=" + request.getPageNo()
|
||||||
|
+ "&pageSize=" + request.getPageSize()
|
||||||
|
+ "&statusType=" + request.getStatusType();
|
||||||
|
|
||||||
|
helper.validateMerchant(request.getMid());
|
||||||
|
|
||||||
|
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.set("x-digiledge-key", headersData.getXDigiledgeKey());
|
||||||
|
headers.set("agentId", headersData.getAgentId());
|
||||||
|
headers.set("tenantId", headersData.getTenantId());
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
String requestJson = helper.convertObjectToJson(request);
|
||||||
|
|
||||||
|
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), "POST",
|
||||||
|
requestJson);
|
||||||
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "GET", request.getStatusType());
|
||||||
|
LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
LOGGER.info("Calling external API: {}", fullUrl);
|
||||||
|
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||||
|
String responseData = responseMap.get("data");
|
||||||
|
LOGGER.info("Response: {}", responseData);
|
||||||
|
|
||||||
|
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||||
|
|
||||||
|
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||||
|
new TypeReference<Map<String, Object>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!dataMap.containsKey("generalResp")) {
|
||||||
|
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||||
|
LOGGER.warn("Invalid response structure for txnId: {}", txnId);
|
||||||
|
throw new CustomException(String.valueOf(dataMap.get("message")), String.valueOf(dataMap.get("status")),
|
||||||
|
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), String.valueOf(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewAllComplaintsResponse responseWrapper = objectMapper.convertValue(dataMap,
|
||||||
|
ViewAllComplaintsResponse.class);
|
||||||
|
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||||
|
|
||||||
|
String status = generalResp.getStatus();
|
||||||
|
LOGGER.info("Current Complaint ReOpen Status: {}", status);
|
||||||
|
|
||||||
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
|
String saveComplaint = mapperHelper.saveAllComplaints(responseWrapper, reqId, txnId);
|
||||||
|
//LOGGER.info("Complaint ReOpen data saved successfully for Count History: {}", saveComplaintHistory);
|
||||||
|
|
||||||
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e);
|
||||||
|
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||||
|
throw new CustomException("Invalid JSON received from API");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ public class MasterDataServiceImpl implements MasterDataService {
|
|||||||
String requestJson = helper.convertObjectToJson(billerDetailRequest);
|
String requestJson = helper.convertObjectToJson(billerDetailRequest);
|
||||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, billerDetailRequest.getMid(),
|
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, billerDetailRequest.getMid(),
|
||||||
"POST", requestJson);
|
"POST", requestJson);
|
||||||
|
|
||||||
|
System.out.println( billerDataRespository.findByBillerId(billerId));
|
||||||
|
|
||||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, "GET", null);
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, "GET", null);
|
||||||
LOGGER.info("Calling external API: {}", fullUrl);
|
LOGGER.info("Calling external API: {}", fullUrl);
|
||||||
|
|||||||
@@ -50,5 +50,7 @@ public class BBPSConstant {
|
|||||||
|
|
||||||
public static final String PLANS_URL = "/plans";
|
public static final String PLANS_URL = "/plans";
|
||||||
public static final String ADD_COMPLAIN_ENDPOINT = "/couapp/complaints";
|
public static final String ADD_COMPLAIN_ENDPOINT = "/couapp/complaints";
|
||||||
|
public static final String VIEW_ALL_COMPLAINTS_BASE = "/couapp/complaints/all";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.billpaymentservice.bbps.dto.response.AmountOptionsResponse;
|
|||||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.PlanResponse;
|
import com.billpaymentservice.bbps.dto.response.PlanResponse;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.ViewAllComplaintsResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||||
import com.billpaymentservice.bbps.entites.AdditionalInfoPlans;
|
import com.billpaymentservice.bbps.entites.AdditionalInfoPlans;
|
||||||
import com.billpaymentservice.bbps.entites.AmountOptionByBillerId;
|
import com.billpaymentservice.bbps.entites.AmountOptionByBillerId;
|
||||||
@@ -567,6 +568,29 @@ public class BillerMapperHelper {
|
|||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String saveAllComplaints(ViewAllComplaintsResponse responseWrapper, String reqId, String txnId) {
|
||||||
|
|
||||||
|
ModelMapper mapper = new ModelMapper();
|
||||||
|
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||||
|
|
||||||
|
// Map list → ComplaintStatusDetails list
|
||||||
|
List<ComplaintStatusDetails> entityList = responseWrapper.getComplaintsList()
|
||||||
|
.stream()
|
||||||
|
.map(c -> mapper.map(c, ComplaintStatusDetails.class))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// Set extra fields
|
||||||
|
for (ComplaintStatusDetails entity : entityList) {
|
||||||
|
entity.setReqId(reqId);
|
||||||
|
entity.setTxnId(txnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save to repository
|
||||||
|
complainDetailRepository.saveAll(entityList);
|
||||||
|
|
||||||
|
return "SUCCESS";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user