This commit is contained in:
Mohd-Arham
2025-12-04 18:37:44 +05:30
parent 812aa3c2ff
commit f15e967e58
17 changed files with 177 additions and 100 deletions
@@ -164,6 +164,7 @@ public class AgentServiceImpl implements AgentService {
String txnId = helper.generateTxnId(15);
String reqId = billFetchByBillIdRequest.getReqId();
String billId = billFetchByBillIdRequest.getBillId();
String userId = billFetchByBillIdRequest.getClientUserId();
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
null);
@@ -197,7 +198,7 @@ public class AgentServiceImpl implements AgentService {
LOGGER.info("Current Bill Status: {}", status);
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
LOGGER.info("Bill data saved successfully for billId: {}", billId);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -216,8 +217,9 @@ public class AgentServiceImpl implements AgentService {
String reqId = billFetchByBillIdRequest.getReqId();
String billId = billFetchByBillIdRequest.getBillId();
String mid = billFetchByBillIdRequest.getMid();
String userId = billFetchByBillIdRequest.getClientUserId();
String requestJson = helper.convertObjectToJson(billFetchByBillIdRequest);
LOGGER.info("[{}] START | reqId={} | mid={} | billId={}", apiName, reqId, mid, billId);
LOGGER.info("[{}] START | reqId={} | mid={} | billId={} | userId={}", apiName, reqId, mid, billId, userId);
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
String txnId = helper.generateTxnId(15);
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billFetchByBillIdRequest.getMid(),
@@ -253,7 +255,7 @@ public class AgentServiceImpl implements AgentService {
// update inbound log success and persist bill data
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
return responseModel;
@@ -396,7 +398,7 @@ public class AgentServiceImpl implements AgentService {
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
System.out.println("responseWrapper:" + responseWrapper);
mapperHelper.saveBillValidation(responseWrapper, billRequest,txnId);
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
} catch (JsonProcessingException e) {
@@ -454,7 +456,7 @@ public class AgentServiceImpl implements AgentService {
GeneralResp generalResp = responseWrapper.getGenericResponse();
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveBillValidation(responseWrapper, billRequest,txnId);
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId);
LOGGER.info("Bill validation saved successfully for billId: {}", billId);
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -239,9 +239,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_GET_CUSTOMER_PARAM_BY_BILLER_ID;
String requestId = customerParamRequest.getReqId();
String mid = customerParamRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid,
customerParamRequest.getBillerId());
String userId = customerParamRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={} | userId={}", apiName, requestId, mid,
customerParamRequest.getBillerId(), userId);
String txnID = helper.generateTxnId(15);
String billerId = customerParamRequest.getBillerId();
String fullUrl = masterRegisterUrl + BBPSConstant.CUSTOMPARAM_URL + billerId;
@@ -282,8 +282,13 @@ public class MasterDataServiceImpl implements MasterDataService {
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
// Map DTOs to entities
List<CustomParam> entities = customParams.stream().map(dto -> mapper.map(dto, CustomParam.class))
.collect(Collectors.toList());
List<CustomParam> entities = customParams.stream().map(dto -> {
CustomParam mappedParam = mapper.map(dto, CustomParam.class);
mappedParam.setReqId(requestId);
mappedParam.setTxnId(txnID);
mappedParam.setUserId(userId);
return mappedParam;
}).collect(Collectors.toList());
// Save all to DB
customParamReposiotory.saveAll(entities);
LOGGER.info("[{}] Saved {} custom param records to DB", apiName, entities.size());
@@ -306,8 +311,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_FETCH_CATEGORY_MASTER_DATA;
String requestId = contactMasterRequest.getReqId();
String mid = contactMasterRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | category={}", apiName, requestId, contactMasterRequest.getMid(),
contactMasterRequest.getCategory());
String userId = contactMasterRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | category={} | userId={}", apiName, requestId,
contactMasterRequest.getMid(), contactMasterRequest.getCategory(), userId);
String txnID = helper.generateTxnId(15);
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID);
@@ -345,8 +351,8 @@ public class MasterDataServiceImpl implements MasterDataService {
}
ContactMasterResponse responseWrapper = objectMapper.convertValue(dataMap, ContactMasterResponse.class);
String result = mapperHelper.saveContactMasterData(responseWrapper.getContactMasterList(), requestId,
txnID);
String result = mapperHelper.saveContactMasterData(responseWrapper.getContactMasterList(), requestId, txnID,
userId);
LOGGER.info("[{}] DB Save Result | reqId={} | result={}", apiName, requestId, result);
GeneralResp generalResp = responseWrapper.getGeneralResp();
@@ -371,9 +377,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_FETCH_MASTER_DATA_CATEGORY_WISE;
String requestId = masterRequest.getReqId();
String mid = masterRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | billerName={} | category={}", apiName, requestId, mid,
masterRequest.getBillerName(), masterRequest.getCategory());
String userId = masterRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | billerName={} | category={} | userId={}", apiName, requestId, mid,
masterRequest.getBillerName(), masterRequest.getCategory(), userId);
String txnID = helper.generateTxnId(15);
String fullUrl = String.format("%s%s?billerName=%s&category=%s&page=%d&pagesize=%d", masterRegisterUrl,
@@ -414,7 +420,7 @@ public class MasterDataServiceImpl implements MasterDataService {
BillerResponse responseWrapper = objectMapper.convertValue(dataMap, BillerResponse.class);
List<BillerCategoryWise> savedEntities = mapperHelper.mapAndSaveAll(responseWrapper.getBillerResp(),
requestId, txnID);
requestId, txnID, userId);
LOGGER.info("[{}] Saved {} records to DB | reqId={}", apiName, savedEntities.size(), requestId);
GeneralResp generalResp = responseWrapper.getGeneralResp();