added logs in masterdataserviceimpl

This commit is contained in:
himanshu
2025-11-04 02:59:38 +05:30
parent f7c2669d11
commit 7d6db124e7
10 changed files with 282 additions and 110 deletions
@@ -9,10 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.BillerDetailRequest;
import com.billpaymentservice.bbps.dto.request.MerchantRequestModel;
import com.billpaymentservice.bbps.entites.BBPSMerchantValidation;
import com.billpaymentservice.bbps.exception.CustomException;
import com.billpaymentservice.bbps.repository.MerchantRepository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
@@ -23,6 +26,8 @@ public class Helper {
private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private static final SecureRandom secureRandom = new SecureRandom();
private final ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private MerchantRepository merchantRegisterRepo;
@@ -125,4 +130,15 @@ public class Helper {
}
return sb.toString(); // Prefix
}
}
public String convertObjectToJson(Object obj) {
if (obj == null) return "null";
try {
return new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(obj);
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
// log appropriately (use your existing logger)
System.err.println("JSON conversion failed: " + e.getMessage());
return "{}"; // or "N/A" depending on your needs
}
}
}