From 40db67c817529e047314e9b8f5a2b0e5f69c58f4 Mon Sep 17 00:00:00 2001 From: Jinyuanyuan <1197651512@qq.com> Date: Thu, 19 Sep 2024 17:29:17 +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 --- .../huzhou/dao/HuzhouPlaninfoMapper.java | 2 +- .../huzhou/dao/HuzhouProjectinfoMapper.java | 6 +++ .../dao/mapping/HuzhouPlaninfoMapper.xml | 2 +- .../dao/mapping/HuzhouProjectinfoMapper.xml | 11 ++++ .../impl/HuzhouProjectinfoServiceImpl.java | 53 +++++++++++++------ 5 files changed, 56 insertions(+), 18 deletions(-) diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java index 87ba3bd..54d9c7d 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java @@ -17,5 +17,5 @@ public interface HuzhouPlaninfoMapper extends BaseMapper { String getTaskName(@Param("projectId") String projectId,@Param("taskLevel") String taskLevel); - String getIsOffline(@Param("projectId") String projectId,@Param("taskLevel") String taskLevel); + List getIsOffline(@Param("projectId") String projectId); } diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java index f6f974a..d6ea4aa 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java @@ -91,4 +91,10 @@ public interface HuzhouProjectinfoMapper extends BaseMapper { List getIds(@Param("reformName") String reformName,@Param("superLeader") String superLeader); + List getTaskIds(@Param("planId") String planId); + + List getTaskNames(@Param("taskIds") List taskIds); + + + } diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml index a4187df..2e5642c 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml @@ -15,7 +15,7 @@ select task_name from huzhou_planinfo where project_id=#{projectId} and task_level=#{taskLevel} \ No newline at end of file diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml index 0b5fade..376c6d9 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml @@ -547,4 +547,15 @@ order by create_date desc + + + \ No newline at end of file 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 97c3df7..57f49dc 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 @@ -1556,33 +1556,56 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl query1=new LambdaQueryWrapper<>(); query1.eq(HuzhouPlaninfo::getProjectId,p.getId()); query1.eq(HuzhouPlaninfo::getIsfinish,"1"); - List onGoingLevelList = planinfoService.list(query1).stream().map(x -> x.getTaskLevel().split("\\.")).collect(Collectors.toList()); + List onGoingList = planinfoService.list(query1); + List onGoingLevelList = onGoingList.stream().map(x -> x.getTaskLevel().split("\\.")).collect(Collectors.toList()); String defaultStepName=""; - String defaultIsUpload=""; - String defaultIsOffline="0"; + String currentIsUpload="";//当前审批节点 + String currentStepName=""; if(!onGoingLevelList.isEmpty()){//有1取1,多1取最大 List onGoingKeyList = onGoingLevelList.stream().filter(x -> x.length == 2).collect(Collectors.toList()); int firstMax = onGoingKeyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax(); List onGoingKeyFilterList = onGoingKeyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList()); int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax(); String level=firstMax+"."+secondMax; - defaultStepName=planinfoMapper.getTaskName(p.getId(),level); - defaultIsUpload = planinfoMapper.getIsOffline(p.getId(), level); - defaultIsOffline="1"; + currentStepName=planinfoMapper.getTaskName(p.getId(),level); + //当前审批节点 + String planId = onGoingList.stream().filter(x -> x.getTaskLevel().equals(level)).collect(Collectors.toList()).get(0).getId(); + List taskIds = projectinfoMapper.getTaskIds(planId); + List taskNames = projectinfoMapper.getTaskNames(taskIds); + currentIsUpload= String.join(",", taskNames); } - else if(onGoingLevelList.isEmpty() && !levelList.isEmpty()){//没有1,有2 + else if(onGoingLevelList.isEmpty() && !levelList.isEmpty()){//没有1,有2,取2的下一个(planList,找到最大2的位置,取该位置+1的值) List keyList = levelList.stream().filter(x -> x.length == 2).collect(Collectors.toList()); int firstMax = keyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax(); - List onGoingKeyFilterList = keyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList()); - int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax(); + List finsishKeyFilterList = keyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList()); + int secondMax = finsishKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax(); String level=firstMax+"."+secondMax; defaultStepName=planinfoMapper.getTaskName(p.getId(),level); - defaultIsUpload = planinfoMapper.getIsOffline(p.getId(), level); - defaultIsOffline="1"; + LambdaQueryWrapper query2=new LambdaQueryWrapper<>(); + query2.eq(HuzhouPlaninfo::getProjectId,p.getId()); + List allPlanList = planinfoService.list(query2); + List taskList = allPlanList.stream().map(x -> x.getTaskName()).collect(Collectors.toList()); + int index = taskList.indexOf(defaultStepName); + currentStepName=taskList.get(index+1); + String planId = allPlanList.stream().filter(x -> x.getTaskLevel().equals(level)).collect(Collectors.toList()).get(0).getId(); + List executionIds = projectinfoMapper.getTaskIds(planId); + List taskNames = projectinfoMapper.getTaskNames(executionIds); + currentIsUpload= String.join(",", taskNames); + } + projectDetail.setStepName(currentStepName); + projectDetail.setIsUpload(currentIsUpload); + //线下完成情况 + String isOfflineStepName=""; + List isOfflineList = planinfoMapper.getIsOffline(p.getId()).stream().map(x->x.split("\\.")).collect(Collectors.toList()); + if(isOfflineList.size()>0){ + List isOfflinekeyList = isOfflineList.stream().filter(x -> x.length == 2).collect(Collectors.toList()); + int firstMax1 = isOfflinekeyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax(); + List isOfflineKeyFilterList = isOfflinekeyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax1))).collect(Collectors.toList()); + int secondMax1 = isOfflineKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax(); + String isOfflineLevel=firstMax1+"."+secondMax1; + isOfflineStepName=planinfoMapper.getTaskName(p.getId(),isOfflineLevel); } - projectDetail.setStepName(defaultStepName); - projectDetail.setIsUpload(defaultIsUpload); - projectDetail.setIsOffline(defaultIsOffline); + projectDetail.setIsOffline(isOfflineStepName); // 进度 List projectIds=new ArrayList<>(); projectIds.add(p.getId()); @@ -1860,8 +1883,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl updateWrapper=new LambdaUpdateWrapper<>(); updateWrapper.set(null,projectInfo); projectinfoMapper.updateById(projectInfo);