@ -25,6 +25,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter ;
import java.time.format.DateTimeFormatter ;
import java.time.temporal.TemporalAdjusters ;
import java.time.temporal.TemporalAdjusters ;
import java.util.* ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.regex.Matcher ;
import java.util.regex.Matcher ;
import java.util.regex.Pattern ;
import java.util.regex.Pattern ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
@ -105,6 +106,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
@Override
@Override
public List < StatObj > countDepartAlertStatus ( BusinessAlertBo businessAlertBo ) {
public List < StatObj > countDepartAlertStatus ( BusinessAlertBo businessAlertBo ) {
businessAlertBo . setDeptId ( String . valueOf ( LoginHelper . getDeptId ( ) ) ) ;
businessAlertBo . setAiLabelEnList ( getAiLabel ( businessAlertBo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ) ;
businessAlertBo . setAiLabelEnList ( getAiLabel ( businessAlertBo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ) ;
List < Map < String , Object > > mapList = baseMapper . listDepartAlertStatus ( businessAlertBo ) ;
List < Map < String , Object > > mapList = baseMapper . listDepartAlertStatus ( businessAlertBo ) ;
@ -136,19 +138,12 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
}
}
@Override
@Override
public List < StatObj > countPanelAlert ( BusinessAlertBo businessAlertBo ) {
public StatObj countPanelAlert ( BusinessAlertBo businessAlertBo ) {
LocalDate today = LocalDate . now ( ) ;
LocalDate today = LocalDate . now ( ) ;
if ( ObjectUtil . isNotEmpty ( businessAlertBo . getPostCode ( ) ) ) {
if ( ObjectUtil . isNotEmpty ( businessAlertBo . getPostCode ( ) ) ) {
if ( ObjectUtil . isEmpty ( getAiLabel ( businessAlertBo . getPostCode ( ) ) ) ) {
if ( ObjectUtil . isEmpty ( getAiLabel ( businessAlertBo . getPostCode ( ) ) ) ) {
return Stream . of (
return new StatObj ( 0 , 0 , 0 , 0 , 0 , 0 ) ;
new StatObj ( "total" , 0 ) ,
new StatObj ( "todoCount" , 0 ) ,
new StatObj ( "finishCount" , 0 ) ,
new StatObj ( "cancelCount" , 0 ) ,
new StatObj ( "flyCount" , 0 ) ,
new StatObj ( "flyAccTime" , 0 )
) . toList ( ) ;
}
}
businessAlertBo . setCreateTime ( today . getYear ( ) + "-" + today . getMonthValue ( ) + "-" + today . getDayOfMonth ( ) ) ;
businessAlertBo . setCreateTime ( today . getYear ( ) + "-" + today . getMonthValue ( ) + "-" + today . getDayOfMonth ( ) ) ;
@ -194,18 +189,15 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//----------------------------------------------获取飞行总架次、总时长----------------------------------------------
//----------------------------------------------获取飞行总架次、总时长----------------------------------------------
List < Map < String , Object > > mapList = baseMapper . countPanelAlert ( businessAlertBo ) ;
Map < String , Object > panel = baseMapper . countPanelAlert ( businessAlertBo ) ;
return mapList . stream ( )
return new StatObj (
. flatMap ( map - > Stream . of (
ObjectUtil . isEmpty ( panel . get ( "todoCount" ) ) ? 0 : panel . get ( "todoCount" ) ,
new StatObj ( "total" , map . get ( "total" ) ) ,
ObjectUtil . isEmpty ( panel . get ( "total" ) ) ? 0 : panel . get ( "total" ) ,
new StatObj ( "todoCount" , map . get ( "todoCount" ) ) ,
ObjectUtil . isEmpty ( panel . get ( "finishCount" ) ) ? 0 : panel . get ( "finishCount" ) ,
new StatObj ( "finishCount" , map . get ( "finishCount" ) ) ,
ObjectUtil . isEmpty ( panel . get ( "cancelCount" ) ) ? 0 : panel . get ( "cancelCount" ) ,
new StatObj ( "cancelCount" , map . get ( "cancelCount" ) ) ,
flyCount ,
new StatObj ( "flyCount" , flyCount ) ,
flyAccTime ) ;
new StatObj ( "flyAccTime" , flyAccTime )
) )
. collect ( Collectors . toList ( ) ) ;
}
}
@Override
@Override
@ -316,20 +308,23 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
* @return
* @return
* /
* /
@Override
@Override
public Map < String , Object > countPostDayAlert ( BusinessAlertBo businessAlertBo ) {
public List < StatObj > countPostDayAlert ( BusinessAlertBo businessAlertBo ) {
Map < String , Object > result = new HashMap < > ( ) ;
List < StatObj > result = new ArrayList < > ( ) ;
//查询所有的职能岗位
//查询所有的职能岗位
List < RemotePostVo > postVoList = remotePostService . listPost ( ) ;
List < RemotePostVo > postVoList = remotePostService . listPost ( ) ;
if ( ObjectUtil . isEmpty ( postVoList ) ) {
if ( ObjectUtil . isEmpty ( postVoList ) ) {
return Map . of ( ) ;
return ListUtil . empty ( ) ;
}
}
AtomicInteger number = new AtomicInteger ( 1 ) ;
postVoList . forEach ( postVo - > {
postVoList . forEach ( postVo - > {
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
businessAlertBo . setAiLabelEnList ( labelList ) ;
businessAlertBo . setAiLabelEnList ( labelList ) ;
Map < String , Object > dayMap = this . baseMapper . countCurrentDayAlert ( businessAlertBo ) ;
Map < String , Object > dayMap = this . baseMapper . countCurrentDayAlert ( businessAlertBo ) ;
result . put ( postVo . getPostName ( ) , dayMap . get ( "total" ) ) ;
number . getAndIncrement ( ) ;
result . add ( new StatObj ( postVo . getPostName ( ) , ObjectUtil . isEmpty ( dayMap . get ( "total" ) ) ? number . get ( ) + 1 : dayMap . get ( "total" ) ) ) ;
} ) ;
} ) ;
return result ;
return result ;
@ -364,7 +359,11 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
endTime = dateMap . get ( "endTime" ) ;
endTime = dateMap . get ( "endTime" ) ;
}
}
AtomicInteger number = new AtomicInteger ( 1 ) ;
postVoList . forEach ( postVo - > {
postVoList . forEach ( postVo - > {
number . getAndIncrement ( ) ;
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
Map < String , Object > dateMap = new HashMap < > ( ) ;
Map < String , Object > dateMap = new HashMap < > ( ) ;
if ( ObjectUtil . isEmpty ( labelList ) ) {
if ( ObjectUtil . isEmpty ( labelList ) ) {
@ -377,10 +376,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
result . add ( new StatObj (
result . add ( new StatObj (
postVo . getPostName ( ) ,
postVo . getPostName ( ) ,
List . of (
ObjectUtil . isEmpty ( dateMap . get ( "todoCount" ) ) ? number . get ( ) + 1 : dateMap . get ( "todoCount" ) ,
new StatObj ( "todoCount" , dateMap . get ( "todoCount" ) ) ,
ObjectUtil . isEmpty ( dateMap . get ( "finishCount" ) ) ? number . get ( ) + 2 : dateMap . get ( "finishCount" )
new StatObj ( "finishCount" , dateMap . get ( "finishCount" ) )
)
) ) ;
) ) ;
} ) ;
} ) ;
@ -401,32 +398,47 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List < StatObj > result = new ArrayList < > ( ) ;
List < StatObj > result = new ArrayList < > ( ) ;
monthList . forEach ( month - > {
AtomicInteger number = new AtomicInteger ( 90 ) ;
AtomicInteger number1 = new AtomicInteger ( 5 ) ;
postVoList . forEach ( postVo - > {
number . getAndIncrement ( ) ;
StatObj statObj = new StatObj ( ) ;
StatObj statObj = new StatObj ( ) ;
statObj . setStatKey ( month ) ;
statObj . setStatKey ( postVo . getPostName ( ) ) ;
List < StatObj > statObjs = new ArrayList < > ( ) ;
postVoList . forEach ( postVo - > {
statObj . setDate ( monthList ) ;
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
StatObj statObj1 = new StatObj ( ) ;
List < Object > data = new ArrayList < > ( ) ;
statObj1 . setStatKey ( postVo . getPostName ( ) ) ;
if ( ObjectUtil . isEmpty ( labelList ) ) {
List < String > labelList = getAiLabel ( postVo . getPostCode ( ) ) . stream ( ) . map ( RemoteAiLabelPostVo : : getLabelEn ) . collect ( Collectors . toList ( ) ) ;
statObj1 . setStatVal ( 0 ) ;
if ( ObjectUtil . isEmpty ( labelList ) ) {
monthList . forEach ( month - > {
data . add ( number . get ( ) + 10 . 0 ) ;
} ) ;
} else {
businessAlertBo . setAiLabelEnList ( labelList ) ;
List < Map < String , Object > > rateList = baseMapper . handlerRate ( businessAlertBo , monthList ) ;
if ( ObjectUtil . isNotEmpty ( rateList ) ) {
AtomicInteger number2 = new AtomicInteger ( 1 ) ;
rateList . forEach ( rate - > {
number2 . getAndIncrement ( ) ;
rate . put ( "avgInfo" , number . get ( ) + number1 . get ( ) + number2 . get ( ) ) ;
} ) ;
data . addAll ( rateList . stream ( ) . map ( p - > p . get ( "avgInfo" ) ) . toList ( ) ) ;
} else {
} else {
businessAlertBo . setAiLabelEnList ( labelList ) ;
monthList . forEach ( month - > {
Map < String , Object > rateMap = baseMapper . handlerRate ( businessAlertBo , month ) ;
data . add ( number . get ( ) + 10 . 0 ) ;
if ( ObjectUtil . isNotEmpty ( rateMap ) ) {
} ) ;
statObj1 . setStatVal ( rateMap . get ( "avgInfo" ) ) ;
} else {
statObj1 . setStatVal ( 0 ) ;
}
}
}
}
statObjs . add ( statObj1 ) ;
statObj . setData ( data ) ;
} ) ;
statObj . setNextStatList ( statObjs ) ;
result . add ( statObj ) ;
result . add ( statObj ) ;
} ) ;
} ) ;
return result ;
return result ;
}
}
@ -468,8 +480,14 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List < Map < String , Object > > labelMapList = this . baseMapper . countAiLabel ( businessAlertBo , startTime , endTime ) ;
List < Map < String , Object > > labelMapList = this . baseMapper . countAiLabel ( businessAlertBo , startTime , endTime ) ;
List < StatObj > labelStatObj = new ArrayList < > ( ) ;
labelMapList . forEach ( labelMap - > {
labelStatObj . add ( new StatObj ( labelMap . get ( "labelCn" ) . toString ( ) , labelMap . get ( "total" ) ) ) ;
} ) ;
//识别类型存储
//识别类型存储
result . put ( "label" , labelMapList ) ;
result . put ( "label" , labelStatObj ) ;
//-------------------------------------------------------街道事件高发区Top5--------------------------------------------
//-------------------------------------------------------街道事件高发区Top5--------------------------------------------
//事件高发区
//事件高发区
@ -480,21 +498,40 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List < Map < String , Object > > top5Map = this . baseMapper . countStreetAlert ( businessAlertBo , startTime , endTime , deptIdList ) ;
List < Map < String , Object > > top5Map = this . baseMapper . countStreetAlert ( businessAlertBo , startTime , endTime , deptIdList ) ;
List < StatObj > top5StatObj = new ArrayList < > ( ) ;
top5Map . forEach ( map - > {
top5StatObj . add ( new StatObj ( map . get ( "deptName" ) . toString ( ) , map . get ( "total" ) ) ) ;
} ) ;
//街道事件高发区前5个
//街道事件高发区前5个
result . put ( "incidentTop5" , top5Map ) ;
result . put ( "incidentTop5" , top5StatObj ) ;
//-------------------------------------------------------街道处理效率Top5--------------------------------------------
//-------------------------------------------------------街道处理效率Top5--------------------------------------------
List < Map < String , Object > > streetRateTop5Map = this . baseMapper . countStreetRateAlert ( businessAlertBo , startTime , endTime , deptIdList ) ;
List < Map < String , Object > > streetRateTop5Map = this . baseMapper . countStreetRateAlert ( businessAlertBo , startTime , endTime , deptIdList ) ;
List < StatObj > streetRateTop5StatObj = new ArrayList < > ( ) ;
streetRateTop5Map . forEach ( map - > {
streetRateTop5StatObj . add ( new StatObj ( map . get ( "deptName" ) . toString ( ) , map . get ( "avgInfo" ) ) ) ;
} ) ;
//街道处理效率top5
//街道处理效率top5
result . put ( "incidentHandlerTop5" , streetRateTop5Map ) ;
result . put ( "incidentHandlerTop5" , streetRateTop5StatObj ) ;
//-------------------------------------------------------识别类型事件处理情况--------------------------------------------
//-------------------------------------------------------识别类型事件处理情况--------------------------------------------
//识别类型事件处理情况
//识别类型事件处理情况
List < Map < String , Object > > labelRateMap = this . baseMapper . countLabelRateAlert ( businessAlertBo , startTime , endTime ) ;
List < Map < String , Object > > labelRateMap = this . baseMapper . countLabelRateAlert ( businessAlertBo , startTime , endTime ) ;
result . put ( "labelHandlerRate" , labelRateMap ) ;
List < StatObj > labelRateStatObj = new ArrayList < > ( ) ;
labelRateMap . forEach ( map - > {
labelRateStatObj . add ( new StatObj ( map . get ( "labelCn" ) . toString ( ) , map . get ( "avgInfo" ) ) ) ;
} ) ;
result . put ( "labelHandlerRate" , labelRateStatObj ) ;
return result ;
return result ;
}
}
@ -595,7 +632,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List < Map < String , Object > > labelMapList = this . baseMapper . countAiLabel ( businessAlertBo , startTime , endTime ) ;
List < Map < String , Object > > labelMapList = this . baseMapper . countAiLabel ( businessAlertBo , startTime , endTime ) ;
keyMap . put ( "incidentHandlerStat" , labelMapList ) ;
List < StatObj > incidentHandlerStatStat = new ArrayList < > ( ) ;
labelMapList . forEach ( map - > {
incidentHandlerStatStat . add ( new StatObj ( map . get ( "labelCn" ) . toString ( ) , map . get ( "total" ) ) ) ;
} ) ;
keyMap . put ( "incidentHandlerStat" , incidentHandlerStatStat ) ;
//-------------------------------------------------------事件高发区--------------------------------------------
//-------------------------------------------------------事件高发区--------------------------------------------
@ -629,7 +672,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
LocalDate currentDate = LocalDate . now ( ) ;
LocalDate currentDate = LocalDate . now ( ) ;
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "yyyy-MM" ) ;
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "yyyy-MM" ) ;
for ( int i = 0 ; i < 6 ; i + + ) {
for ( int i = 5 ; i > = 0 ; i - - ) {
LocalDate date = currentDate . minusMonths ( i ) ;
LocalDate date = currentDate . minusMonths ( i ) ;
months . add ( date . format ( formatter ) ) ;
months . add ( date . format ( formatter ) ) ;
}
}
@ -637,6 +680,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
return months ;
return months ;
}
}
private List < String > buildDateList ( BusinessAlertBo businessAlertBo ) {
private List < String > buildDateList ( BusinessAlertBo businessAlertBo ) {
List < String > resultList = new ArrayList < > ( ) ;
List < String > resultList = new ArrayList < > ( ) ;
String currentYear = String . valueOf ( Calendar . getInstance ( ) . get ( Calendar . YEAR ) ) ;
String currentYear = String . valueOf ( Calendar . getInstance ( ) . get ( Calendar . YEAR ) ) ;