@ -1,5 +1,6 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl ;
package com.epmet.service.evaluationindex.extract.toscreen.impl ;
import com.alibaba.fastjson.JSON ;
import com.epmet.commons.tools.constant.NumConstant ;
import com.epmet.commons.tools.constant.NumConstant ;
import com.epmet.commons.tools.constant.StrConstant ;
import com.epmet.commons.tools.constant.StrConstant ;
import com.epmet.commons.tools.utils.DateUtils ;
import com.epmet.commons.tools.utils.DateUtils ;
@ -21,16 +22,13 @@ import com.epmet.service.project.ProjectService;
import com.epmet.service.topic.TopicService ;
import com.epmet.service.topic.TopicService ;
import com.epmet.service.user.UserService ;
import com.epmet.service.user.UserService ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.lang3.StringUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.StringUtils ;
import java.math.BigDecimal ;
import java.math.BigDecimal ;
import java.util.HashMap ;
import java.util.* ;
import java.util.LinkedList ;
import java.util.List ;
import java.util.Map ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
@ -91,10 +89,10 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
dateId = DateUtils . getBeforeNMonth ( NumConstant . ONE ) ;
dateId = DateUtils . getBeforeNMonth ( NumConstant . ONE ) ;
} else {
} else {
String dateType = DateUtils . identifyTimeDimension ( dateId ) ;
String dateType = DateUtils . identifyTimeDimension ( dateId ) ;
if ( StringUtils . isEmpty ( dateType ) | | ! org . apache . commons . lang3 . StringUtils . equalsAny ( dateType , "date" , "month" ) ) {
if ( StringUtils . isEmpty ( dateType ) | | ! StringUtils . equalsAny ( dateType , "date" , "month" ) ) {
dateId = DateUtils . getBeforeNMonth ( NumConstant . ONE ) ;
dateId = DateUtils . getBeforeNMonth ( NumConstant . ONE ) ;
} else if ( org . apache . commons . lang3 . StringUtils . equals ( dateType , "date" ) ) {
} else if ( StringUtils . equals ( dateType , "date" ) ) {
dateId = dateId . substring ( NumConstant . ZERO , dateId . length ( ) - NumConstant . TWO ) ;
dateId = dateId . substring ( NumConstant . ZERO , dateId . length ( ) - NumConstant . TWO ) ;
}
}
}
}
final String finalDateId = dateId ;
final String finalDateId = dateId ;
@ -125,7 +123,19 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
//6.存入数据库
//6.存入数据库
//不按照时间删除,每次插入之前将该客户下的所有历史数据清空
//不按照时间删除,每次插入之前将该客户下的所有历史数据清空
screenPartyUserRankDataService . dataClean ( registeredUsers , param . getCustomerId ( ) ) ;
//过滤 统计维度中没有的数据
Set < String > gridIdSet = new HashSet < > ( ) ;
List < ScreenPartyUserRankDataEntity > newInsertList = registeredUsers . stream ( )
. filter ( o - > {
if ( StringUtils . isBlank ( o . getGridName ( ) ) ) {
gridIdSet . add ( o . getGridId ( ) ) ;
return false ;
} else {
return true ;
}
} ) . collect ( Collectors . toList ( ) ) ;
log . warn ( "userScoreDataHub grids:{} not in DimGrid" , JSON . toJSONString ( gridIdSet ) ) ;
screenPartyUserRankDataService . dataClean ( newInsertList , param . getCustomerId ( ) ) ;
}
}
/ * *
/ * *