I have a requirement that if a record has two different fee cat types
1 and 2, then need to treat them as type 1 and sum the amounts
corresponding to the record and add it to map. The logic is not giving me correct results. I am not sure where it is incorrect. I have changed the
logic for other records when its not type 1 and 2, do some calculation and add it to map and when the record has type 1 and type 2, fetch the amounts and add it to map. Its not working for type 1 and type 2 logic. Can you please let me know where I am incorrect.
Java class
for(FeeTypeTo catType : (Collection<FeeTypeTo>) feeTypeList){
if(to.getFeeCatType().shortValue() == catType.getFeeCatType()){
if(catType.getRvrslSign() == -1){
BigDecimal amountFeeType1 =BigDecimal.ZERO;
BigDecimal amountFeeType1 =BigDecimal.ZERO;
BigDecimal newAmountFee =BigDecimal.ZERO;
if(to.getCdFeeCatType().shortValue() != 1 && to.getCdFeeCatType().shortValue() != 2 ) {
feeMap.put(to.getCdFeeCatType(), newbalValue.subtract(getBigDecimalValue(to.getAmtFee())));
break;
}else{
if(to.getCdFeeCatType().shortValue() == 1){
amountFeeType1 = to.getAmtFee(); continue;
}
if(to.getCdFeeCatType().shortValue() == 2){
amountFeeType2 = to.getAmtFee();
continue;
}
newAmountFee = amountFeeType1.add(amountFeeType2);
to.setAmtFee(newAmountFee);
to.setCdFeeCatType(Const.BD_ONE_AMT);
feeMap.put(to.getCdFeeCatType(), newbalValue.subtract(getBigDecimalValue(to.getAmtFee())));
break;
}
}
else {
feeMap.put(to.getCdFeeCatType(), balValue.subtract(getBigDecimalValue(to.getAmtFee())));
break;
}
}
}
Aucun commentaire:
Enregistrer un commentaire