首页 > 代码库 > Lambda表达式实用

Lambda表达式实用

public List<SettlementExportView> querySettlementExport(SettlementDemandQueryReq req) {    JdbcQuery.Builder queryBuilder = JdbcQuery.from(SettlementExportView.class);    SettlementExportViewMetaData md = SettlementExportViewMetaData.instance;    DateFormat format = new SimpleDateFormat("yyyy-MM-dd");    //开始结束日期    querySettleCondition(req, DemandViewEntityMetaData.instance, queryBuilder);    List<SettlementExportView> list = InstanceFactory.getInstance(SettlementExportViewDao.class).query(queryBuilder.build());    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");    return list.stream()        .filter(input -> input.getScore()!=null && input.getScore() > 0)        .map(view -> {          if (view.getUploadQuantity() == null) {            view.setUploadQuantity(0d);          }          if (view.getFinishQuantity() == null) {            view.setFinishQuantity(0d);          }          switch (view.getStatus()) {            case SETTLEMENT:              view.setStatusName("已结算");              view.setSettlePeriod(dateFormat.format(view.getSettlementDate()));              break;            case FINISH:              if (view.isNeedCheck()) {                view.setNeedCheckStr("Y");              }else{                view.setNeedCheckStr("N");              }              if (view.getSettlementDate() != null) {                view.setStatusName("已结算");                view.setSettlePeriod(dateFormat.format(view.getSettlementDate()));              }              break;            default:              view.setStatusName("未结算");              view.setFinishDate(null);          }          return view;        })        .collect(Collectors.toList());  }

 

Lambda表达式实用