@ -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,31 +130,37 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String stakeMark = dcSdhsEvent . getStakeMark ( ) ;
if ( StringUtils . isNotEmpty ( stakeMark ) & & ! "无" . equals ( stakeMark ) & & ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
//尝试桩号补零
List < String > numbers = new ArrayList < > ( ) ;
if ( StringUtils . isNotEmpty ( stakeMark ) & & ! "无" . equals ( stakeMark ) ) {
if ( ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
// 匹配大小桩号数字
Pattern pattern = Pattern . compile ( "\\d+" ) ;
Matcher matcher = pattern . matcher ( stakeMark ) ;
while ( matcher . find ( ) ) {
numbers . add ( matcher . group ( ) ) ; // 将匹配到的数字字符串添加到列表中
}
List < String > formattedNumbers = new ArrayList < > ( ) ;
for ( String number : numbers ) {
while ( number . length ( ) < 3 ) {
number = "0" + number ;
//尝试桩号补零
List < String > numbers = new ArrayList < > ( ) ;
// 匹配大小桩号数字
Pattern pattern = Pattern . compile ( "\\d+" ) ;
Matcher matcher = pattern . matcher ( stakeMark ) ;
while ( matcher . find ( ) ) {
numbers . add ( matcher . group ( ) ) ; // 将匹配到的数字字符串添加到列表中
}
formattedNumbers . add ( number ) ;
}
stakeMark = "K" + String . join ( "+" , formattedNumbers ) ;
List < String > formattedNumbers = new ArrayList < > ( ) ;
for ( String number : numbers ) {
while ( number . length ( ) < 3 ) {
number = "0" + number ;
}
formattedNumbers . add ( number ) ;
}
stakeMark = "K" + String . join ( "+" , formattedNumbers ) ;
//如果还验证不通过 则此条信息作废
if ( ! StakeMarkUtils . checkStakeMark ( stakeMark ) ) {
continue ;
//如果还验证不通过 则此条信息作废
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 ) {