@ -1536,14 +1536,26 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
}
projectDetail . setContractMoney ( contractMoney ) ;
projectDetail . setContractCentralMoney ( contractCentralMoney ) ;
//当前阶段
//当前阶段,当前所处节点,当前审批节点,线下完成情况
String taskName ; //当前阶段
String defaultStepName = "" ;
String currentStepName = "" ; //当前所处节点
String currentIsUpload = "" ; //当前审批节点
String currentLevel ;
String isOfflineStepName = "" ; //线下完成情况
LambdaQueryWrapper < HuzhouPlaninfo > query = new LambdaQueryWrapper < > ( ) ;
query . eq ( HuzhouPlaninfo : : getProjectId , p . getId ( ) ) ;
query . eq ( HuzhouPlaninfo : : getIsfinish , "2" ) ;
List < String [ ] > levelList = planinfoService . list ( query ) . stream ( ) . map ( x - > x . getTaskLevel ( ) . split ( "\\." ) ) . collect ( Collectors . toList ( ) ) ;
String taskName ;
if ( ! levelList . isEmpty ( ) ) {
List < String [ ] > keyList = levelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
List < HuzhouPlaninfo > allPlanList = planinfoService . list ( query ) ;
List < String > allLevelList = allPlanList . stream ( ) . map ( x - > x . getTaskLevel ( ) ) . collect ( Collectors . toList ( ) ) ;
List < String [ ] > allLevelSplitList = allPlanList . stream ( ) . map ( x - > x . getTaskLevel ( ) . split ( "\\." ) ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int globlFirstMax = allLevelSplitList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
int globlSecondMax = allLevelSplitList . stream ( ) . filter ( x - > Integer . parseInt ( x [ 0 ] ) = = globlFirstMax ) . mapToInt ( x - > Integer . parseInt ( x [ 1 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
List < HuzhouPlaninfo > onGoingList = allPlanList . stream ( ) . filter ( x - > x . getIsfinish ( ) . equals ( "1" ) ) . collect ( Collectors . toList ( ) ) ;
List < HuzhouPlaninfo > isFinishList = allPlanList . stream ( ) . filter ( x - > x . getIsfinish ( ) . equals ( "2" ) ) . collect ( Collectors . toList ( ) ) ;
List < String [ ] > onGoingLevelList = onGoingList . stream ( ) . map ( x - > x . getTaskLevel ( ) . split ( "\\." ) ) . collect ( Collectors . toList ( ) ) ;
List < String [ ] > isFinishlevelList = isFinishList . stream ( ) . map ( x - > x . getTaskLevel ( ) . split ( "\\." ) ) . collect ( Collectors . toList ( ) ) ;
if ( ! isFinishlevelList . isEmpty ( ) ) {
List < String [ ] > keyList = isFinishlevelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int max = keyList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
String key = String . valueOf ( max ) ;
taskName = stageMap . get ( key ) ;
@ -1551,50 +1563,62 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
taskName = "项目申报阶段" ;
}
projectDetail . setProjectStage ( taskName ) ;
//当前节点
LambdaQueryWrapper < HuzhouPlaninfo > query1 = new LambdaQueryWrapper < > ( ) ;
query1 . eq ( HuzhouPlaninfo : : getProjectId , p . getId ( ) ) ;
query1 . eq ( HuzhouPlaninfo : : getIsfinish , "1" ) ;
List < HuzhouPlaninfo > onGoingList = planinfoService . list ( query1 ) ;
List < String [ ] > onGoingLevelList = onGoingList . stream ( ) . map ( x - > x . getTaskLevel ( ) . split ( "\\." ) ) . collect ( Collectors . toList ( ) ) ;
String defaultStepName = "" ;
String currentIsUpload = "" ; //当前审批节点
String currentStepName = "" ;
if ( ! onGoingLevelList . isEmpty ( ) ) { //有1取1,多1取最大
List < String [ ] > onGoingKeyList = onGoingLevelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int firstMax = onGoingKeyList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
List < String [ ] > 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 ;
currentStepName = planinfoMapper . getTaskName ( p . getId ( ) , level ) ;
//当前审批节点
String planId = onGoingList . stream ( ) . filter ( x - > x . getTaskLevel ( ) . equals ( level ) ) . collect ( Collectors . toList ( ) ) . get ( 0 ) . getId ( ) ;
List < String > taskIds = projectinfoMapper . getTaskIds ( planId ) ;
List < String > taskNames = projectinfoMapper . getTaskNames ( taskIds ) ;
currentIsUpload = String . join ( "," , taskNames ) ;
}
else if ( onGoingLevelList . isEmpty ( ) & & ! levelList . isEmpty ( ) ) { //没有1,有2,取2的下一个(planList,找到最大2的位置,取该位置+1的值)
List < String [ ] > keyList = levelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int firstMax = keyList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
List < String [ ] > 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 ) ;
LambdaQueryWrapper < HuzhouPlaninfo > query2 = new LambdaQueryWrapper < > ( ) ;
query2 . eq ( HuzhouPlaninfo : : getProjectId , p . getId ( ) ) ;
List < HuzhouPlaninfo > allPlanList = planinfoService . list ( query2 ) ;
List < String > 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 < String > executionIds = projectinfoMapper . getTaskIds ( planId ) ;
List < String > taskNames = projectinfoMapper . getTaskNames ( executionIds ) ;
currentIsUpload = String . join ( "," , taskNames ) ;
//如果当前阶段为项目申报阶段,当前所处节点、当前审批节点和线下完成情况都不显示
if ( ! taskName . equals ( "项目申报阶段" ) ) {
if ( ! onGoingLevelList . isEmpty ( ) ) {
currentLevel = "" ; //有1取1,多1取最大
List < String [ ] > onGoingKeyList = onGoingLevelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int firstMax = onGoingKeyList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
List < String [ ] > 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 ;
currentStepName = planinfoMapper . getTaskName ( p . getId ( ) , level ) ;
//当前审批节点
String planId = onGoingList . stream ( ) . filter ( x - > x . getTaskLevel ( ) . equals ( level ) ) . collect ( Collectors . toList ( ) ) . get ( 0 ) . getId ( ) ;
List < String > taskNames = projectinfoMapper . getTaskNames ( planId ) ;
if ( taskNames . size ( ) > 0 ) {
currentIsUpload = String . join ( "," , taskNames ) ;
}
} else { //没有1,有2,取2的下一个(planList,找到最大2的位置,取该位置+1的值)
List < String [ ] > isFinishkeyList = isFinishlevelList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
int firstMax = isFinishkeyList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 0 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
List < String [ ] > isFinsishKeyFilterList = isFinishkeyList . stream ( ) . filter ( x - > x [ 0 ] . equals ( String . valueOf ( firstMax ) ) ) . collect ( Collectors . toList ( ) ) ;
int secondMax = isFinsishKeyFilterList . stream ( ) . mapToInt ( x - > Integer . parseInt ( x [ 1 ] ) ) . summaryStatistics ( ) . getMax ( ) ;
String level = firstMax + "." + secondMax ;
int newSecondMax = secondMax + 1 ;
String tempLevel = firstMax + "." + newSecondMax ;
//如果包含,则说明有这个level,不包含则有两种情况,1是level的fistMax+1,还有一种情况是当前的level已经是最后一个level了
//怎么判断是不是最后一个level?全局最大
if ( ! allLevelList . contains ( tempLevel ) ) {
if ( firstMax = = globlFirstMax & & secondMax = = globlSecondMax ) { //当前level最后一个level
currentLevel = level ;
} else {
int firstIndex = Integer . parseInt ( tempLevel . split ( "\\." ) [ 0 ] ) + 1 ;
currentLevel = firstIndex + "." + 1 ;
}
}
else { //包含,则第二位+1
currentLevel = tempLevel ;
}
currentStepName = planinfoMapper . getTaskName ( p . getId ( ) , currentLevel ) ;
String planId = allPlanList . stream ( ) . filter ( x - > x . getTaskLevel ( ) . equals ( currentLevel ) ) . collect ( Collectors . toList ( ) ) . get ( 0 ) . getId ( ) ;
List < String > taskNames = projectinfoMapper . getTaskNames ( planId ) ;
if ( taskNames . size ( ) > 0 ) {
currentIsUpload = String . join ( "," , taskNames ) ;
}
}
List < String > stepNameList = List . of ( "可研报告初稿编制" , "可研技术审查报告确认" , "造价评估报告确认" ) ;
if ( currentIsUpload . equals ( "" ) ) {
if ( stepNameList . contains ( currentStepName ) ) {
currentIsUpload = "总咨询单位" ;
} else {
currentIsUpload = "发起人" ;
}
}
} else {
currentLevel = "" ;
}
projectDetail . setStepName ( currentStepName ) ;
projectDetail . setIsUpload ( currentIsUpload ) ;
//线下完成情况
String isOfflineStepName = "" ;
List < String [ ] > isOfflineList = planinfoMapper . getIsOffline ( p . getId ( ) ) . stream ( ) . map ( x - > x . split ( "\\." ) ) . collect ( Collectors . toList ( ) ) ;
if ( isOfflineList . size ( ) > 0 ) {
List < String [ ] > isOfflinekeyList = isOfflineList . stream ( ) . filter ( x - > x . length = = 2 ) . collect ( Collectors . toList ( ) ) ;
@ -1604,6 +1628,10 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
String isOfflineLevel = firstMax1 + "." + secondMax1 ;
isOfflineStepName = planinfoMapper . getTaskName ( p . getId ( ) , isOfflineLevel ) ;
}
projectDetail . setStepName ( currentStepName ) ;
projectDetail . setIsUpload ( currentIsUpload ) ;
projectDetail . setIsOffline ( isOfflineStepName ) ;
// 进度
List < String > projectIds = new ArrayList < > ( ) ;