@ -21,17 +21,6 @@ import com.zc.business.utils.PoiUtil;
import org.apache.poi.ss.usermodel.Cell ;
import org.apache.poi.ss.usermodel.CellType ;
import org.apache.poi.ss.usermodel.Row ;
import org.apache.poi.xssf.usermodel.XSSFSheet ;
import org.apache.poi.xssf.usermodel.XSSFWorkbook ;
import org.apache.poi.xwpf.usermodel.XWPFChart ;
import org.apache.poi.xwpf.usermodel.XWPFDocument ;
import org.apache.poi.xwpf.usermodel.XWPFTable ;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth ;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth ;
import com.zc.business.utils.PoiUtil ;
import org.apache.poi.ss.usermodel.Cell ;
import org.apache.poi.ss.usermodel.CellType ;
import org.apache.poi.ss.usermodel.Row ;
import org.apache.poi.xssf.usermodel.XSSFCell ;
import org.apache.poi.xssf.usermodel.XSSFRow ;
import org.apache.poi.xssf.usermodel.XSSFSheet ;
@ -47,19 +36,9 @@ import java.io.IOException;
import java.io.InputStream ;
import java.math.BigInteger ;
import java.text.DecimalFormat ;
import java.util.ArrayList ;
import java.util.Comparator ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
import java.io.InputStream ;
import java.math.BigInteger ;
import java.text.SimpleDateFormat ;
import java.time.LocalDate ;
import java.time.LocalDateTime ;
import java.time.LocalTime ;
import java.time.ZoneId ;
import java.time.format.DateTimeFormatter ;
import java.time.temporal.TemporalAdjusters ;
@ -70,9 +49,6 @@ import java.util.stream.Collectors;
import static com.zc.business.utils.PoiUtil.* ;
import static com.zc.business.utils.PoiUtil.mergeChart ;
import static com.zc.business.utils.PoiUtil.setTableFonts ;
/ * *
* 高速云事件分析Service业务层处理
*
@ -154,7 +130,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String stakeMark = dcSdhsEvent . getStakeMark ( ) ;
if ( StringUtils . isNotEmpty ( stakeMark ) & & ! "无" . equals ( stakeMark ) & & ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
if ( StringUtils . isNotEmpty ( stakeMark ) & & ! "无" . equals ( stakeMark ) ) {
if ( ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
//尝试桩号补零
List < String > numbers = new ArrayList < > ( ) ;
@ -178,7 +156,11 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
if ( ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
continue ;
}
}
dcSdhsEvent . setStakeMark ( stakeMark ) ;
dcSdhsEvent . setMileage ( StakeMarkUtils . formatMetreLong ( stakeMark ) ) ;
}
eventList . add ( dcSdhsEvent ) ;
@ -1310,46 +1292,10 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public AjaxResult selectRegionAnalysis ( DcSdhsEventQuery dcSdhsEventQuery ) {
List < DcSdhsEvent > eventList = redisCache . getCacheList ( RedisKeyConstants . SDHS_EVENT ) ;
if ( eventList = = null | | eventList . size ( ) = = 0 ) {
return AjaxResult . error ( "请先导入数据" ) ;
}
List < Map < String , Object > > thisTimeData = dcSdhsEventMapper . selectRegionAnalysis ( dcSdhsEventQuery . getType ( ) , dcSdhsEventQuery . getThisTime ( ) , dcSdhsEventQuery . getLastTime ( ) ) ;
//先筛选时间范围
eventList = eventList . stream ( )
. filter ( item - > item . getStartTime ( ) ! = null
& & item . getStartTime ( ) . getTime ( ) > = dcSdhsEventQuery . getStartTime ( ) . getTime ( )
& & item . getStartTime ( ) . getTime ( ) < = dcSdhsEventQuery . getEndTime ( ) . getTime ( )
& & item . getEventType ( ) . equals ( "交通事故" ) )
. collect ( Collectors . toList ( ) ) ;
//筛选方向
/ * if ( StringUtils . isNotEmpty ( dcSdhsEventQuery . getDirection ( ) ) ) {
if ( dcSdhsEventQuery . getDirection ( ) . equals ( "1" ) ) {
//菏泽方向
eventList = eventList . stream ( )
. filter ( item - > item . getDirection ( ) . equals ( "广州方向" ) | | item . getDirection ( ) . equals ( "双向" ) )
. collect ( Collectors . toList ( ) ) ;
} else if ( dcSdhsEventQuery . getDirection ( ) . equals ( "3" ) ) {
//济南方向
eventList = eventList . stream ( )
. filter ( item - > item . getDirection ( ) . equals ( "济南方向" ) | | item . getDirection ( ) . equals ( "双向" ) )
. collect ( Collectors . toList ( ) ) ;
}
} * /
//地市统计
Map < String , Long > region = eventList . stream ( )
. collect ( Collectors . groupingBy ( item - > getRange ( item . getStakeMark ( ) ) , Collectors . counting ( ) ) ) ;
List < Map < String , Object > > list = new ArrayList < > ( ) ;
for ( String key : region . keySet ( ) ) {
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "regionName" , key ) ;
map . put ( "num" , region . get ( key ) ) ;
list . add ( map ) ;
}
list = list . stream ( ) . sorted ( Comparator . comparing ( item - > getCitySorted ( item . get ( "regionName" ) . toString ( ) ) ) ) . collect ( Collectors . toList ( ) ) ;
return AjaxResult . success ( list ) ;
return AjaxResult . success ( thisTimeData ) ;
}
private int getCitySorted ( String city ) {