@Test public void test_getCalculationCurrentvalue() { when(assetConfigurationService.getAssetConfigValueByKeyAndTenantId(any(AssetConfigurationKeys.class), any(String.class))).thenReturn("9/30/23/59/59"); final List<CalculationCurrentValue> actualCalculationCurrentValues = depreciationRepository .getCalculationCurrentvalue(getDepreciationCriteria()); assertEquals(new ArrayList<>().toString(), actualCalculationCurrentValues.toString()); }
public List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria) { final String tenantId = depreciationCriteria.getTenantId(); final Integer year = Integer.parseInt(depreciationCriteria.getFinancialYear().substring(0, 4)); final String[] sepDate = assetConfigurationService .getAssetConfigValueByKeyAndTenantId(AssetConfigurationKeys.DEPRECIATIONSEPARATIONDATE, tenantId) .split("/"); final Long seprationDate = Date .from(LocalDateTime.of(year, Integer.parseInt(sepDate[0]), Integer.parseInt(sepDate[1]), Integer.parseInt(sepDate[2]), Integer.parseInt(sepDate[3]), Integer.parseInt(sepDate[4])) .toInstant(ZoneOffset.UTC)) .getTime(); final String sql = depreciationQueryBuilder.getCalculationCurrentvalueQuery(depreciationCriteria.getAssetIds()); final List<Object> pSValues = new ArrayList<>(); pSValues.add(seprationDate); pSValues.add(tenantId); pSValues.add(seprationDate); pSValues.add(tenantId); log.debug("the calculation currentvalue query --" + sql + "\n --preparedstatementvalues---" + pSValues); return jdbcTemplate.query(sql, pSValues.toArray(), calculationCurrentValueRowMapper); }
DepreciationRepository { public List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria) { final String tenantId = depreciationCriteria.getTenantId(); final Integer year = Integer.parseInt(depreciationCriteria.getFinancialYear().substring(0, 4)); final String[] sepDate = assetConfigurationService .getAssetConfigValueByKeyAndTenantId(AssetConfigurationKeys.DEPRECIATIONSEPARATIONDATE, tenantId) .split("/"); final Long seprationDate = Date .from(LocalDateTime.of(year, Integer.parseInt(sepDate[0]), Integer.parseInt(sepDate[1]), Integer.parseInt(sepDate[2]), Integer.parseInt(sepDate[3]), Integer.parseInt(sepDate[4])) .toInstant(ZoneOffset.UTC)) .getTime(); final String sql = depreciationQueryBuilder.getCalculationCurrentvalueQuery(depreciationCriteria.getAssetIds()); final List<Object> pSValues = new ArrayList<>(); pSValues.add(seprationDate); pSValues.add(tenantId); pSValues.add(seprationDate); pSValues.add(tenantId); log.debug("the calculation currentvalue query --" + sql + "\n --preparedstatementvalues---" + pSValues); return jdbcTemplate.query(sql, pSValues.toArray(), calculationCurrentValueRowMapper); } }
DepreciationRepository { public List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria) { final String tenantId = depreciationCriteria.getTenantId(); final Integer year = Integer.parseInt(depreciationCriteria.getFinancialYear().substring(0, 4)); final String[] sepDate = assetConfigurationService .getAssetConfigValueByKeyAndTenantId(AssetConfigurationKeys.DEPRECIATIONSEPARATIONDATE, tenantId) .split("/"); final Long seprationDate = Date .from(LocalDateTime.of(year, Integer.parseInt(sepDate[0]), Integer.parseInt(sepDate[1]), Integer.parseInt(sepDate[2]), Integer.parseInt(sepDate[3]), Integer.parseInt(sepDate[4])) .toInstant(ZoneOffset.UTC)) .getTime(); final String sql = depreciationQueryBuilder.getCalculationCurrentvalueQuery(depreciationCriteria.getAssetIds()); final List<Object> pSValues = new ArrayList<>(); pSValues.add(seprationDate); pSValues.add(tenantId); pSValues.add(seprationDate); pSValues.add(tenantId); log.debug("the calculation currentvalue query --" + sql + "\n --preparedstatementvalues---" + pSValues); return jdbcTemplate.query(sql, pSValues.toArray(), calculationCurrentValueRowMapper); }  }
DepreciationRepository { public List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria) { final String tenantId = depreciationCriteria.getTenantId(); final Integer year = Integer.parseInt(depreciationCriteria.getFinancialYear().substring(0, 4)); final String[] sepDate = assetConfigurationService .getAssetConfigValueByKeyAndTenantId(AssetConfigurationKeys.DEPRECIATIONSEPARATIONDATE, tenantId) .split("/"); final Long seprationDate = Date .from(LocalDateTime.of(year, Integer.parseInt(sepDate[0]), Integer.parseInt(sepDate[1]), Integer.parseInt(sepDate[2]), Integer.parseInt(sepDate[3]), Integer.parseInt(sepDate[4])) .toInstant(ZoneOffset.UTC)) .getTime(); final String sql = depreciationQueryBuilder.getCalculationCurrentvalueQuery(depreciationCriteria.getAssetIds()); final List<Object> pSValues = new ArrayList<>(); pSValues.add(seprationDate); pSValues.add(tenantId); pSValues.add(seprationDate); pSValues.add(tenantId); log.debug("the calculation currentvalue query --" + sql + "\n --preparedstatementvalues---" + pSValues); return jdbcTemplate.query(sql, pSValues.toArray(), calculationCurrentValueRowMapper); }  List<DepreciationDetail> getDepreciationdetails(final DepreciationCriteria depreciationCriteria); void persistDepreciation(final Depreciation depreciation); Map<Long, BigDecimal> getdepreciationSum(final String tenantId); List<CalculationAssetDetails> getCalculationAssetDetails(final DepreciationCriteria depreciationCriteria); List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria); List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria); List<DepreciationInputs> getDepreciationInputs(final DepreciationCriteria depreciationCriteria); }
DepreciationRepository { public List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria) { final String tenantId = depreciationCriteria.getTenantId(); final Integer year = Integer.parseInt(depreciationCriteria.getFinancialYear().substring(0, 4)); final String[] sepDate = assetConfigurationService .getAssetConfigValueByKeyAndTenantId(AssetConfigurationKeys.DEPRECIATIONSEPARATIONDATE, tenantId) .split("/"); final Long seprationDate = Date .from(LocalDateTime.of(year, Integer.parseInt(sepDate[0]), Integer.parseInt(sepDate[1]), Integer.parseInt(sepDate[2]), Integer.parseInt(sepDate[3]), Integer.parseInt(sepDate[4])) .toInstant(ZoneOffset.UTC)) .getTime(); final String sql = depreciationQueryBuilder.getCalculationCurrentvalueQuery(depreciationCriteria.getAssetIds()); final List<Object> pSValues = new ArrayList<>(); pSValues.add(seprationDate); pSValues.add(tenantId); pSValues.add(seprationDate); pSValues.add(tenantId); log.debug("the calculation currentvalue query --" + sql + "\n --preparedstatementvalues---" + pSValues); return jdbcTemplate.query(sql, pSValues.toArray(), calculationCurrentValueRowMapper); }  List<DepreciationDetail> getDepreciationdetails(final DepreciationCriteria depreciationCriteria); void persistDepreciation(final Depreciation depreciation); Map<Long, BigDecimal> getdepreciationSum(final String tenantId); List<CalculationAssetDetails> getCalculationAssetDetails(final DepreciationCriteria depreciationCriteria); List<CalculationCurrentValue> getCalculationCurrentvalue(final DepreciationCriteria depreciationCriteria); List<DepreciationReportCriteria> getDepreciatedAsset(final DepreciationReportCriteria depreciationReportCriteria); List<DepreciationInputs> getDepreciationInputs(final DepreciationCriteria depreciationCriteria);  }