List链式编程

                // チケット5649 START
                // 画面項目.アカウント種別が0、1以外の場合のみ
                if(!CommonConstants.ACCOUNT_TYPE_SYSTEM_NEXT.equals(form.getAccountType())
                        && !CommonConstants.ACCOUNT_TYPE_SYSTEM_G5.equals(form.getAccountType())) {
                    // ソートキー:予約日時 (昇順)
                    // お客様番号 (昇順)
                    // 地区 (昇順)
                    
                    beanList = beanList.parallelStream().sorted((added1, added2) -> {
                        if (StringUtils.compare(added1.getResvTm(),added2.getResvTm()) == CommonConstants.INT_0) {
                            if(StringUtils.compare(added1.getCustomerNum(),added2.getCustomerNum()) == CommonConstants.INT_0) {
                                // 第三ソートキー:地区
                                return StringUtils.compare(added1.getChiku(), added2.getChiku());
                            }
                            else{
                                // 第二ソートキー:お客様番号
                                return StringUtils.compare(added1.getCustomerNum(), added2.getCustomerNum());
                            }
                        } 
                        else {
                            // 第一ソートキー:予約日時
                            return StringUtils.compare(added1.getResvTm(), added2.getResvTm());
                        }
                    }).collect(Collectors.toList());
                }
                
                // 上位1,000件は検索データとして出力する
                if(beanList.size() > CommonConstants.INT_1000) {
                    beanList = beanList.subList(CommonConstants.INT_0, CommonConstants.INT_1000);
                }

猜你喜欢

转载自www.cnblogs.com/ltfxy/p/11201742.html
今日推荐