From 0a796981b8d2c5ff463ebc6d779af61d446b27b1 Mon Sep 17 00:00:00 2001 From: Jinyuanyuan <1197651512@qq.com> Date: Mon, 30 Sep 2024 16:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HuzhouProjectController.java | 13 +- .../service/IHuzhouProjectinfoService.java | 4 +- .../impl/HuzhouProjectinfoServiceImpl.java | 150 ++++++++++++++---- 3 files changed, 134 insertions(+), 33 deletions(-) diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java index 5d409cb..12dc3dc 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java @@ -334,8 +334,17 @@ public class HuzhouProjectController { @GetMapping("/getStagePage") public Result getStagePage(HuzhouProjectinfoOV projectinfo, @RequestParam(name="current", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){ - IPage result = projectinfoService.showStagePage(projectinfo, pageNo, pageSize); + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + @RequestParam(name="declareStage", defaultValue="") String declareStage, + @RequestParam(name="reviewStage", defaultValue="") String reviewStage, + @RequestParam(name="verifyStage", defaultValue="") String verifyStage, + @RequestParam(name="approvalStage", defaultValue="") String approvalStage, + @RequestParam(name="purchaseStage", defaultValue="") String purchaseStage, + @RequestParam(name="buildStage", defaultValue="") String buildStage, + @RequestParam(name="acceptanceStage", defaultValue="") String acceptanceStage){ + IPage result = projectinfoService.showStagePage(projectinfo, pageNo, pageSize, + declareStage,reviewStage,verifyStage,approvalStage, + purchaseStage,buildStage,acceptanceStage); return Result.ok(result); } @GetMapping("/countStageByRefrom") diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java index f1f3d44..ede1215 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java @@ -196,7 +196,9 @@ public interface IHuzhouProjectinfoService extends IService { IPage getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir, String projectStage,String stepName,String isUpload,String isOffline); - IPage showStagePage(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize); + IPage showStagePage(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize, + String declareStage,String reviewStage,String verifyStage, String approvalStage, + String purchaseStage,String buildStage,String acceptanceStage); IPage countStageByRefrom(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize); diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java index 0d07e72..fbb6142 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java @@ -1890,7 +1890,9 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl showStagePage(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize){ + public IPage showStagePage(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize, + String declareStage,String reviewStage,String verifyStage, String approvalStage, + String purchaseStage,String buildStage,String acceptanceStage){ IPage result = new Page<>(); List records=new ArrayList<>(); HashMap stageMap=new HashMap<>(); @@ -1915,23 +1917,19 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl0){ String review =reviewList.get(0).getIsfinish(); if(review.equals("2")){ - reviewStage="已完成"; + reviewStageName="已完成"; } else if (review.equals("1")) { - reviewStage="进行中"; + reviewStageName="进行中"; }else { - reviewStage="未完成"; + reviewStageName="未完成"; } }else { - reviewStage="未完成"; + reviewStageName="未完成"; } if(verifyList.size()>0){ String verify =verifyList.get(0).getIsfinish(); if(verify.equals("2")){ - verifyStage="已完成"; + verifyStageName="已完成"; } else if (verify.equals("1")) { - verifyStage="进行中"; + verifyStageName="进行中"; }else { - verifyStage="未完成"; + verifyStageName="未完成"; } }else { - verifyStage="未完成"; + verifyStageName="未完成"; } if(approvalList.size()>0){ String approval =approvalList.get(0).getIsfinish(); if(approval.equals("2")){ - approvalStage="已完成"; + approvalStageName="已完成"; } else if (approval.equals("1")) { - approvalStage="进行中"; + approvalStageName="进行中"; }else { - approvalStage="未完成"; + approvalStageName="未完成"; } }else { - approvalStage="未完成"; + approvalStageName="未完成"; } - showStage.setReviewStage(reviewStage); - showStage.setVerifyStage(verifyStage); - showStage.setApprovalStage(approvalStage); + showStage.setReviewStage(reviewStageName); + showStage.setVerifyStage(verifyStageName); + showStage.setApprovalStage(approvalStageName); records.add(showStage); } + //先筛选再排序 + List detailSortedList=new ArrayList<>(); + List conditionList=new ArrayList<>(); + //筛选条件集合 + HashMap filterMap= new HashMap<>(); + filterMap.put("declareStage",declareStage); + filterMap.put("reviewStage",reviewStage); + filterMap.put("verifyStage",verifyStage); + filterMap.put("approvalStage",approvalStage); + filterMap.put("purchaseStage",purchaseStage); + filterMap.put("buildStage",buildStage); + filterMap.put("acceptanceStage",acceptanceStage); + for (Map.Entry entry : filterMap.entrySet()){ + if (!entry.getValue().equals("")){ + conditionList.add(entry.getKey()); + } + } + //筛选 + if(!conditionList.isEmpty()){ + List tempList=new ArrayList<>(); + tempList.addAll(records); + List filteredList=new ArrayList<>(); + for(String condition:conditionList){ + if(condition.equals("declareStage")){ + String[] splitArray = declareStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getDeclareStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getDeclareStage().equals(declareStage)).collect(Collectors.toList()); + } + }else if (condition.equals("reviewStage")){ + String[] splitArray = reviewStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getReviewStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getReviewStage().equals(reviewStage)).collect(Collectors.toList()); + } + + } else if (condition.equals("verifyStage")) { + String[] splitArray = verifyStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getVerifyStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getVerifyStage().equals(verifyStage)).collect(Collectors.toList()); + } + + }else if (condition.equals("approvalStage")){ + String[] splitArray = approvalStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getApprovalStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getApprovalStage().equals(approvalStage)).collect(Collectors.toList()); + } + + } else if (condition.equals("purchaseStage")) { + String[] splitArray = purchaseStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getPurchaseStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getPurchaseStage().equals(purchaseStage)).collect(Collectors.toList()); + } + + }else if (condition.equals("buildStage")){ + String[] splitArray = buildStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getBuildStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getBuildStage().equals(buildStage)).collect(Collectors.toList()); + } + + } else if (condition.equals("acceptanceStage")) { + String[] splitArray = acceptanceStage.split(","); + if(splitArray.length>1){ + List paramsList = new ArrayList<>(Arrays.asList(splitArray)); + filteredList = tempList.stream().filter(x -> paramsList.contains(x.getAcceptanceStage())).collect(Collectors.toList()); + }else { + filteredList = tempList.stream().filter(x -> x.getAcceptanceStage().equals(acceptanceStage)).collect(Collectors.toList()); + } + + } + tempList.clear(); + tempList.addAll(filteredList); + } + records=filteredList; + } List sortedRecord = records.stream().filter(x -> x.getSort() != null).sorted(Comparator.comparingInt(ShowStageOV::getSort)).collect(Collectors.toList()); List commonRecord = records.stream().filter(x -> x.getSort() == null).collect(Collectors.toList()); sortedRecord.addAll(commonRecord); + //手动分页 int fromIndex = (pageNo - 1) * pageSize; List currentPageData = sortedRecord.subList(fromIndex, Math.min(fromIndex + pageSize, records.size())); - result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectAndChildInfoList.size()); + result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(records.size()); return result; } public IPage countStageByRefrom(HuzhouProjectinfo projectInfo,Integer pageNo, Integer pageSize){ IPage result = new Page<>(); List re=new ArrayList<>(); - List records = showStagePage(projectInfo, 1, 10000).getRecords(); + List records = showStagePage(projectInfo, 1, 10000,"","","","","","","").getRecords(); Map> reformMap = records.stream().collect(Collectors.groupingBy(x -> x.getReformName())); for(Map.Entry> entry : reformMap.entrySet()){ CountStageByRefromOV countStageByRefromOV=new CountStageByRefromOV();