java1.8特性lambel表达式
编辑器自动能识别lambel表达式表达一个Runnable的子类
dueEntry.stream().map(f -> f.getKey()).forEach(index -> { // 每一期的还款金额信息 String body = repayMessage.getRepayDetails().get(index); JSONObject repayObj = JSON.parseObject(body); // 本金 BigDecimal principal = new BigDecimal(repayObj.getDoubleValue("principal")); // 利息 BigDecimal interest = new BigDecimal(repayObj.getDoubleValue("interest")); // 应发放积分 Integer point = countUserPoint(principal, interest); // 是否有发放记录查询 UserPointHistory history = new UserPointHistory(); history.setIncomeType(IncomeType.REPAY.getName()); history.setType(PointType.INCOME.getValue()); history.setUserId(loan.getBorrowerId()); history.setApplicationId(repayMessage.getApplication_id()); history.setIndex(Integer.valueOf(index)); if (userPointHistoryMapper.countByHistory(history) > 0) { logger.warn("UserPoint warn:repay重复的积分插入,applicationId:{}", repayMessage.getApplication_id()); return; } // 发放积分 providePoints(loan.getBorrowerId(), IncomeType.REPAY, repayMessage.getApplication_id(), Integer.valueOf(index), point); });