@ -762,6 +762,16 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
int unfininshNum = 0 ;
int unfininshNum = 0 ;
double progress = 0 . 00 ;
double progress = 0 . 00 ;
String formatted = "0.00" ;
String formatted = "0.00" ;
//测试
// List<String> test=new ArrayList<>();
// test.add("1787757791784607745");
// List<HuzhouPlaninfo> t = planinfoService.listByProjectIds(test);
// fininshNum = (int) t.stream().filter(x -> (x.getIsfinish().equals("2"))).count();
// unfininshNum = t.size() - fininshNum;
// progress = (double) fininshNum / t.size();
// formatted = String.format("%.2f", progress);
if ( Ids . size ( ) ! = 0 ) {
if ( Ids . size ( ) ! = 0 ) {
List < HuzhouPlaninfo > planInfoList = planinfoService . listByProjectIds ( Ids ) ;
List < HuzhouPlaninfo > planInfoList = planinfoService . listByProjectIds ( Ids ) ;
fininshNum = ( int ) planInfoList . stream ( ) . filter ( x - > ( x . getIsfinish ( ) . equals ( "2" ) ) ) . count ( ) ;
fininshNum = ( int ) planInfoList . stream ( ) . filter ( x - > ( x . getIsfinish ( ) . equals ( "2" ) ) ) . count ( ) ;
@ -900,27 +910,37 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
@Override
@Override
public IPage < DimensionPageResponse > getDimensionPage ( HuzhouProjectinfo projectInfo , Integer pageNo , Integer pageSize , String orderBy , String orderDir ) {
public IPage < DimensionPageResponse > getDimensionPage ( HuzhouProjectinfo projectInfo , Integer pageNo , Integer pageSize , String orderBy , String orderDir ) {
Page page = new Page ( pageNo , pageSize ) ;
// Page page1 = new Page(pageNo, pageSize);
//只要入库项目
//只要入库项目
projectInfo . setType ( "1" ) ;
projectInfo . setType ( "1" ) ;
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils . setGetProjectInfoAuth ( projectInfo ) ;
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils . setGetProjectInfoAuth ( projectInfo ) ;
//获取全部
//获取全部
Page page = new Page ( 1 , 1000 ) ;
IPage < DimensionPageOV > pageSorted = projectinfoMapper . getDimensionPageSorted ( page , projectInfoAuthSelect , orderBy , orderDir ) ;
IPage < DimensionPageOV > pageSorted ;
if ( ( Objects . equals ( orderBy , "paymentExecutionRate" ) ) | | ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) ) | | Objects . equals ( orderBy , "projectProgress" ) ) {
pageSorted = projectinfoMapper . getDimensionPageNoSorted ( page , projectInfoAuthSelect ) ;
} else {
pageSorted = projectinfoMapper . getDimensionPageSorted ( page , projectInfoAuthSelect , orderBy , orderDir ) ;
}
List < DimensionPageOV > records = pageSorted . getRecords ( ) ;
List < DimensionPageOV > records = pageSorted . getRecords ( ) ;
List < DimensionPageResponse > newRecords = new ArrayList < > ( ) ;
List < DimensionPageResponse > newRecords = new ArrayList < > ( ) ;
IPage < DimensionPageResponse > result = new Page < > ( ) ;
IPage < DimensionPageResponse > result = new Page < > ( ) ;
LambdaQueryWrapper < HuzhouProjectinfo > queryWrapper = new LambdaQueryWrapper < > ( ) ;
HuzhouProjectinfo info = new HuzhouProjectinfo ( ) ;
List < String > projectIds = new ArrayList < > ( ) ;
for ( DimensionPageOV r : records ) {
for ( DimensionPageOV r : records ) {
queryWrapper . eq ( HuzhouProjectinfo : : getDutyWorkplace , r . getDutyWorkplace ( ) ) . eq ( HuzhouProjectinfo : : getAdminDivision , r . getAdminDivision ( ) )
info . setAdminDivision ( r . getAdminDivision ( ) ) ;
. eq ( HuzhouProjectinfo : : getWorkplaceProperties , r . getWorkplaceProperties ( ) ) . eq ( HuzhouProjectinfo : : getSuperLeader , r . getSuperLeader ( ) ) ;
info . setDutyWorkplace ( r . getDutyWorkplace ( ) ) ;
projectIds . addAll ( projectinfoMapper . selectList ( queryWrapper ) . stream ( ) . map ( x - > x . getId ( ) ) . collect ( Collectors . toList ( ) ) ) ;
info . setWorkplaceProperties ( r . getWorkplaceProperties ( ) ) ;
NewFundOV fund = this . getFund ( projectIds ) ;
info . setSuperLeader ( r . getSuperLeader ( ) ) ;
info . setType ( "1" ) ;
ProjectInfoAuthSelect projectInfoAuthSelect1 = CommonUtils . setGetProjectInfoAuth ( info ) ;
List < HuzhouProjectinfoOV > listByConditions = projectinfoMapper . getListByConditions ( projectInfoAuthSelect1 ) ;
List < String > projectIds = listByConditions . stream ( ) . map ( x - > x . getId ( ) ) . collect ( Collectors . toList ( ) ) ;
//进度
ProjectProgressOV progress = this . getProgress ( projectIds ) ;
ProjectProgressOV progress = this . getProgress ( projectIds ) ;
//按单位划分的各类资金总额和执行率情况
NewFundOV fund = this . getFund ( projectIds ) ;
DimensionPageResponse build = new DimensionPageResponse ( ) ;
DimensionPageResponse build = new DimensionPageResponse ( ) ;
BeanUtils . copyProperties ( r , build ) ;
BeanUtils . copyProperties ( r , build ) ;
BigDecimal totalDecimal = BigDecimal . valueOf ( r . getTotalMoney ( ) ) ;
BigDecimal totalDecimal = BigDecimal . valueOf ( r . getTotalMoney ( ) ) ;
@ -938,17 +958,41 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
. setProjectProgress ( progress . getProjectProgress ( ) ) ;
. setProjectProgress ( progress . getProjectProgress ( ) ) ;
newRecords . add ( newRecord ) ;
newRecords . add ( newRecord ) ;
}
}
result . setSize ( pageSorted . getSize ( ) ) . setCurrent ( pageSorted . getCurrent ( ) ) . setRecords ( newRecords ) . setTotal ( pageSorted . getTotal ( ) ) ;
//资金执行率和上级资金执行率排序
List < DimensionPageResponse > sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getPaymentExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ; ;
if ( Objects . equals ( orderBy , "paymentExecutionRate" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getPaymentExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "paymentExecutionRate" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getPaymentExecutionRate ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getSuperiorFundExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getSuperiorFundExecutionRate ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "projectProgress" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getProjectProgress ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "projectProgress" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedDimensionPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( DimensionPageResponse : : getProjectProgress ) ) . collect ( Collectors . toList ( ) ) ;
}
//手动分页
int fromIndex = ( pageNo - 1 ) * pageSize ;
List < DimensionPageResponse > currentPageData = sortedDimensionPageResponse . subList ( fromIndex , Math . min ( fromIndex + pageSize , sortedDimensionPageResponse . size ( ) ) ) ;
result . setSize ( pageSize ) . setCurrent ( pageNo ) . setRecords ( currentPageData ) . setTotal ( pageSorted . getTotal ( ) ) ;
return result ;
return result ;
}
}
@Override
@Override
public IPage < ProjectPageResponse > getProjectPage ( HuzhouProjectinfo projectInfo , Integer pageNo , Integer pageSize , String orderBy , String orderDir ) {
public IPage < ProjectPageResponse > getProjectPage ( HuzhouProjectinfo projectInfo , Integer pageNo , Integer pageSize , String orderBy , String orderDir ) {
Page page = new Page ( pageNo , pageSize ) ;
//只要入库项目
//只要入库项目
projectInfo . setType ( "1" ) ;
projectInfo . setType ( "1" ) ;
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils . setGetProjectInfoAuth ( projectInfo ) ;
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils . setGetProjectInfoAuth ( projectInfo ) ;
IPage < ProjectPageOV > pageSorted = projectinfoMapper . getProjectPageSorted ( page , projectInfoAuthSelect , orderBy , orderDir ) ;
Page page = new Page ( 1 , 1000 ) ;
IPage < ProjectPageOV > pageSorted ;
if ( ( Objects . equals ( orderBy , "paymentExecutionRate" ) ) | | ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) ) | | Objects . equals ( orderBy , "projectProgress" ) ) {
pageSorted = projectinfoMapper . getProjectPageNoSorted ( page , projectInfoAuthSelect ) ;
} else {
pageSorted = projectinfoMapper . getProjectPageSorted ( page , projectInfoAuthSelect , orderBy , orderDir ) ;
}
List < ProjectPageOV > records = pageSorted . getRecords ( ) ;
List < ProjectPageOV > records = pageSorted . getRecords ( ) ;
List < ProjectPageResponse > newRecords = new ArrayList < > ( ) ;
List < ProjectPageResponse > newRecords = new ArrayList < > ( ) ;
IPage < ProjectPageResponse > result = new Page < > ( ) ;
IPage < ProjectPageResponse > result = new Page < > ( ) ;
@ -974,7 +1018,25 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
. setProjectProgress ( progress . getProjectProgress ( ) ) ;
. setProjectProgress ( progress . getProjectProgress ( ) ) ;
newRecords . add ( newRecord ) ;
newRecords . add ( newRecord ) ;
}
}
result . setSize ( pageSorted . getSize ( ) ) . setCurrent ( pageSorted . getCurrent ( ) ) . setRecords ( newRecords ) . setTotal ( pageSorted . getTotal ( ) ) ;
//资金执行率和上级资金执行率排序
List < ProjectPageResponse > sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getPaymentExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ; ;
if ( Objects . equals ( orderBy , "paymentExecutionRate" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getPaymentExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "paymentExecutionRate" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getPaymentExecutionRate ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getSuperiorFundExecutionRate ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "superiorFundExecutionRate" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getSuperiorFundExecutionRate ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "projectProgress" ) & & Objects . equals ( orderDir , "desc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getProjectProgress ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
} else if ( Objects . equals ( orderBy , "projectProgress" ) & & Objects . equals ( orderDir , "asc" ) ) {
sortedProjectPageResponse = newRecords . stream ( ) . sorted ( Comparator . comparing ( ProjectPageResponse : : getProjectProgress ) ) . collect ( Collectors . toList ( ) ) ;
}
//手动分页
int fromIndex = ( pageNo - 1 ) * pageSize ;
List < ProjectPageResponse > currentPageData = sortedProjectPageResponse . subList ( fromIndex , Math . min ( fromIndex + pageSize , sortedProjectPageResponse . size ( ) ) ) ;
result . setSize ( pageSorted . getSize ( ) ) . setCurrent ( pageSorted . getCurrent ( ) ) . setRecords ( currentPageData ) . setTotal ( pageSorted . getTotal ( ) ) ;
return result ;
return result ;
}
}