@ -8,13 +8,17 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSON ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import jnpf.base.DictionaryDataApi ;
import jnpf.base.DictionaryDataApi ;
import jnpf.base.UserInfo ;
import jnpf.base.entity.DictionaryDataEntity ;
import jnpf.base.entity.DictionaryDataEntity ;
import jnpf.entity.BiddingProjectSubscribeChild ;
import jnpf.entity.Bidding_project_statisticsEntity ;
import jnpf.entity.Bidding_project_statisticsEntity ;
import jnpf.enump.BiddingProjectEnum ;
import jnpf.exception.DataException ;
import jnpf.exception.DataException ;
import jnpf.model.dto.IndicatorStatisticsDto ;
import jnpf.model.dto.IndicatorStatisticsDto ;
import jnpf.permission.model.authorize.AuthorizeConditionModel ;
import jnpf.permission.model.authorize.AuthorizeConditionModel ;
import jnpf.service.BiddingProjectSubscribeService ;
import jnpf.service.BiddingProjectSubscribeService ;
import jnpf.service.CustomAuthService ;
import jnpf.service.CustomAuthService ;
import jnpf.service.IBiddingProjectSubscribeChildService ;
import jnpf.service.IndicatorStatisticsService ;
import jnpf.service.IndicatorStatisticsService ;
import jnpf.util.ServletUtil ;
import jnpf.util.ServletUtil ;
import jnpf.util.UserProvider ;
import jnpf.util.UserProvider ;
@ -27,6 +31,7 @@ import java.time.LocalDateTime;
import java.time.YearMonth ;
import java.time.YearMonth ;
import java.time.format.DateTimeFormatter ;
import java.time.format.DateTimeFormatter ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.List ;
import java.util.List ;
import java.util.Optional ;
import java.util.Optional ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
@ -36,6 +41,7 @@ import java.util.stream.Collectors;
public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsService {
public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsService {
private final BiddingProjectSubscribeService biddingProjectSubscribeService ;
private final BiddingProjectSubscribeService biddingProjectSubscribeService ;
private final IBiddingProjectSubscribeChildService iBiddingProjectSubscribeChildService ;
private final CustomAuthService customAuthService ;
private final CustomAuthService customAuthService ;
private final UserProvider userProvider ;
private final UserProvider userProvider ;
private final DictionaryDataApi dictionaryDataApi ;
private final DictionaryDataApi dictionaryDataApi ;
@ -105,8 +111,8 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
LocalDateTime month = LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy-MM" ) ;
LocalDateTime month = LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy-MM" ) ;
YearMonth yearMonth = YearMonth . from ( month ) ;
YearMonth yearMonth = YearMonth . from ( month ) ;
int i = yearMonth . lengthOfMonth ( ) ;
int i = yearMonth . lengthOfMonth ( ) ;
if ( LocalDateTimeUtil . parse ( LocalDateTimeUtil . format ( LocalDateTime . now ( ) , "yyyy-MM" ) , "yyyy-MM" ) . isEqual ( LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy-MM" ) ) ) {
if ( LocalDateTimeUtil . parse ( LocalDateTimeUtil . format ( LocalDateTime . now ( ) , "yyyy-MM" ) , "yyyy-MM" ) . isEqual ( LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy-MM" ) ) ) {
i = LocalDateTime . now ( ) . getDayOfMonth ( ) ;
i = LocalDateTime . now ( ) . getDayOfMonth ( ) ;
}
}
for ( int day = 1 ; day < = i ; day + + ) {
for ( int day = 1 ; day < = i ; day + + ) {
IndicatorStatisticsDto . Indicator indicator = new IndicatorStatisticsDto . Indicator ( ) ;
IndicatorStatisticsDto . Indicator indicator = new IndicatorStatisticsDto . Indicator ( ) ;
@ -129,7 +135,7 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
//校验时间格式
//校验时间格式
try {
try {
response . setCorresponding ( LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy" ) ) ;
response . setCorresponding ( LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy" ) ) ;
if ( LocalDateTime . now ( ) . getYear ( ) > LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy" ) . getYear ( ) ) {
if ( LocalDateTime . now ( ) . getYear ( ) > LocalDateTimeUtil . parse ( param . getCorresponding ( ) , "yyyy" ) . getYear ( ) ) {
value = 12 ;
value = 12 ;
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -161,7 +167,7 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
}
}
assert queryWhere ! = null ;
assert queryWhere ! = null ;
List < IndicatorStatisticsDto . MoneyAndProjectsNumberChild > dataList = biddingProjectSubscribeService . moneyAndProjectsNumber ( param , queryWhere . getParamNameValuePairs ( ) , queryWhere . getSqlSegment ( ) . replace ( "paramNameValuePairs." , "" ) ) ;
List < IndicatorStatisticsDto . MoneyAndProjectsNumberChild > dataList = biddingProjectSubscribeService . moneyAndProjectsNumber ( param , queryWhere . getParamNameValuePairs ( ) , queryWhere . getSqlSegment ( ) . replace ( "paramNameValuePairs." , "" ) ) ;
checkMoneyAndProjectsNumberResult ( param , dataList ) ;
checkMoneyAndProjectsNumberResult ( param , dataList ) ;
response . setDataList ( dataList ) ;
response . setDataList ( dataList ) ;
return response ;
return response ;
}
}
@ -181,8 +187,8 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
// </if>
// </if>
String classificationType = param . getClassificationType ( ) ;
String classificationType = param . getClassificationType ( ) ;
List < String > oldNameList = dataList . stream ( ) . map ( IndicatorStatisticsDto . MoneyAndProjectsNumberChild : : getYName ) . collect ( Collectors . toList ( ) ) ;
List < String > oldNameList = dataList . stream ( ) . map ( IndicatorStatisticsDto . MoneyAndProjectsNumberChild : : getYName ) . collect ( Collectors . toList ( ) ) ;
List < String > newNameList = new ArrayList < > ( ) ;
List < String > newNameList = new ArrayList < > ( ) ;
switch ( classificationType ) {
switch ( classificationType ) {
case "1" :
case "1" :
break ;
break ;
@ -207,9 +213,16 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
. filter ( fullName - > ! oldNameList . contains ( fullName ) )
. filter ( fullName - > ! oldNameList . contains ( fullName ) )
. collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
break ;
break ;
case "5" :
newNameList = dictionaryDataApi . getList ( "dc6b2542d94b5434fc61ec1d59592901" )
. stream ( )
. map ( DictionaryDataEntity : : getFullName )
. filter ( fullName - > ! oldNameList . contains ( fullName ) )
. collect ( Collectors . toList ( ) ) ;
break ;
}
}
if ( CollectionUtil . isEmpty ( newNameList ) ) {
if ( CollectionUtil . isEmpty ( newNameList ) ) {
return ;
return ;
}
}
for ( String name : newNameList ) {
for ( String name : newNameList ) {
@ -236,6 +249,17 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
param . setCorresponding ( yyyy ) ;
param . setCorresponding ( yyyy ) ;
case "3" :
case "3" :
break ;
break ;
case "4" :
if ( StrUtil . isBlank ( param . getStartTime ( ) ) | | StrUtil . isBlank ( param . getEndTime ( ) ) ) {
throw new DataException ( "请传入开始及结束时间" ) ;
}
try {
LocalDateTimeUtil . parse ( param . getStartTime ( ) , "yyyy-MM-dd HH:mm:ss" ) ;
LocalDateTimeUtil . parse ( param . getEndTime ( ) , "yyyy-MM-dd HH:mm:ss" ) ;
} catch ( Exception e ) {
throw new DataException ( "时间格式错误,应为yyyy-MM-dd HH:mm:ss" ) ;
}
break ;
default :
default :
throw new DataException ( "查询类型错误: " + param . getQueryDateType ( ) ) ;
throw new DataException ( "查询类型错误: " + param . getQueryDateType ( ) ) ;
}
}
@ -243,4 +267,22 @@ public class IndicatorStatisticsServiceImpl implements IndicatorStatisticsServic
return response ;
return response ;
}
}
@Override
public IndicatorStatisticsDto . MyToDoListResponse myToDoList ( ) {
IndicatorStatisticsDto . MyToDoListResponse response = new IndicatorStatisticsDto . MyToDoListResponse ( ) ;
//查询用户信息
UserInfo userInfo = userProvider . get ( ) ;
//待办数量
response . setTodoCount ( iBiddingProjectSubscribeChildService . lambdaQuery ( )
. eq ( BiddingProjectSubscribeChild : : getUserId , userInfo . getUserId ( ) )
. in ( BiddingProjectSubscribeChild : : getChildStatus , Arrays . asList ( BiddingProjectEnum . ChildStatusEnum . PENDING_REVIEW . getCode ( ) , BiddingProjectEnum . ChildStatusEnum . TO_BE_ARCHIVED . getCode ( ) , BiddingProjectEnum . ChildStatusEnum . TO_BE_SUBMITTED . getCode ( ) , BiddingProjectEnum . ChildStatusEnum . TO_BE_EDIT . getCode ( ) ) )
. count ( ) + "" ) ;
//已办数量
response . setAlreadyCount ( iBiddingProjectSubscribeChildService . lambdaQuery ( )
. eq ( BiddingProjectSubscribeChild : : getUserId , userInfo . getUserId ( ) )
. in ( BiddingProjectSubscribeChild : : getChildStatus , Arrays . asList ( BiddingProjectEnum . ChildStatusEnum . RETURNED . getCode ( ) , BiddingProjectEnum . ChildStatusEnum . ARCHIVED . getCode ( ) , BiddingProjectEnum . ChildStatusEnum . PASS . getCode ( ) ) )
. count ( ) + "" ) ;
return response ;
}
}
}