BLasan commented on a change in pull request #1770:
URL: https://github.com/apache/fineract/pull/1770#discussion_r698605447



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java
##########
@@ -313,12 +322,28 @@ public ClientData retrieveOne(final Long clientId) {
             final ClientData clientData = 
this.jdbcTemplate.queryForObject(sql, this.clientMapper,
                     new Object[] { hierarchySearchString, 
hierarchySearchString, clientId });
 
+            // Get client collaterals
+            final Collection<ClientCollateralManagement> 
clientCollateralManagements = this.clientCollateralManagementRepositoryWrapper
+                    .getCollateralsPerClient(clientId);
+            final Set<ClientCollateralManagementData> 
clientCollateralManagementDataSet = new HashSet<>();
+
+            // Map to client collateral data class
+            for (ClientCollateralManagement clientCollateralManagement : 
clientCollateralManagements) {
+                BigDecimal pctToBase = 
clientCollateralManagement.getCollaterals().getPctToBase().divide(BigDecimal.valueOf(100));
+                BigDecimal basePrice = 
clientCollateralManagement.getCollaterals().getBasePrice();
+                BigDecimal quantity = clientCollateralManagement.getQuantity();
+                BigDecimal total = basePrice.multiply(quantity);
+                BigDecimal totalCollateral = total.multiply(pctToBase);
+                clientCollateralManagementDataSet

Review comment:
       By adding a new util function?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to