Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
79bab51c
Commit
79bab51c
authored
Apr 10, 2024
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 修改 local 环境配置
parent
42d834df
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
219 deletions
+90
-219
MainlineEvaluateServiceImpl.java
...t/wanji/opt/service/impl/MainlineEvaluateServiceImpl.java
+1
-1
application-local.yaml
...ptimize-service/src/main/resources/application-local.yaml
+5
-5
make-cross-dir-hist-data.sql
...rvice/src/main/resources/sql/make-cross-dir-hist-data.sql
+39
-0
make-cross-hist-data.sql
...e-service/src/main/resources/sql/make-cross-hist-data.sql
+45
-0
GeoWebCacheUtils.java
...ain/java/net/wanji/common/utils/geo/GeoWebCacheUtils.java
+0
-213
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/MainlineEvaluateServiceImpl.java
View file @
79bab51c
...
...
@@ -791,7 +791,7 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
List
<
String
>
weekDays
=
new
ArrayList
<>(
Arrays
.
asList
(
split
));
fillRes
(
weekDays
,
res
);
}
else
{
String
weekendMerge
=
greenwaveMergePO
.
getWeekendMerge
();
String
weekendMerge
=
greenwaveMergePO
.
getWeekendMerge
();
// 13:30,20:00|21:30,23:59
String
[]
split
=
weekendMerge
.
split
(
"\\|"
);
List
<
String
>
weekEnds
=
new
ArrayList
<>(
Arrays
.
asList
(
split
));
...
...
signal-optimize-service/src/main/resources/application-local.yaml
View file @
79bab51c
...
...
@@ -11,25 +11,25 @@ spring:
datasource
:
master
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://
10.102.1.182
:3306/t_signal_control_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url
:
jdbc:mysql://
37.12.182.29
:3306/t_signal_control_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
slave
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://
10.102.1.182
:3306/t_signal_control_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url
:
jdbc:mysql://
37.12.182.29
:3306/t_signal_control_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
holo
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://
10.102.1.182
:3306/holo_roadnet?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url
:
jdbc:mysql://
37.12.182.29
:3306/holo_roadnet?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
redis
:
host
:
10.102.1.182
port
:
14728
host
:
37.12.182.29
port
:
6379
password
:
Wanji300552
jedis
:
pool
:
...
...
signal-optimize-service/src/main/resources/sql/make-cross-dir-hist-data.sql
0 → 100644
View file @
79bab51c
DELETE
FROM
t_cross_dir_data_hist
WHERE
start_time
>=
'2024-04-02 00:00:00'
AND
start_time
<=
'2024-04-03 00:00:00'
;
DELIMITER
$$
CREATE
PROCEDURE
InsertRandomData
()
BEGIN
DECLARE
startDateTime
DATETIME
;
DECLARE
endDateTime
DATETIME
;
DECLARE
currentDateTime
DATETIME
;
DECLARE
randomChar1
CHAR
(
1
);
DECLARE
randomChar2
CHAR
(
1
);
DECLARE
allChars
VARCHAR
(
36
);
SET
startDateTime
=
'2024-04-02 00:00:00'
;
SET
endDateTime
=
'2024-04-03 00:00:00'
;
SET
currentDateTime
=
startDateTime
;
SET
allChars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
;
WHILE
currentDateTime
<
endDateTime
DO
SET
randomChar1
=
SUBSTRING
(
allChars
,
FLOOR
(
RAND
()
*
36
)
+
1
,
1
);
SET
randomChar2
=
SUBSTRING
(
allChars
,
FLOOR
(
RAND
()
*
36
)
+
1
,
1
);
INSERT
INTO
t_cross_dir_data_hist
(
id
,
dir_type
,
in_out_type
,
cross_id
,
length
,
status
,
traffic_index
,
start_time
,
capacity
,
duration
,
flow
,
speed
,
queue_length
,
stop_times
,
delay_time
,
sturation
,
no_stop_rate
,
one_stop_rate
,
two_stop_rate
,
three_stop_rate
,
batch_time
,
effusion_rate
,
green_light_efficiency
)
VALUES
(
CONCAT
(
'0VHGU0745B0_1_'
,
randomChar1
,
'_'
,
randomChar2
),
1
,
1
,
'0VHGU0745B0'
,
RAND
()
*
1000
,
FLOOR
(
RAND
()
*
5
)
+
1
,
0
.
4
+
(
RAND
()
*
0
.
2
),
currentDateTime
,
FLOOR
(
5
+
(
RAND
()
*
16
)),
FLOOR
(
RAND
()
*
60
)
+
10
,
FLOOR
(
5
+
(
RAND
()
*
11
)),
RAND
()
*
120
,
FLOOR
(
10
+
(
RAND
()
*
21
)),
RAND
()
*
10
,
FLOOR
(
RAND
()
*
300
)
+
10
,
RAND
(),
RAND
(),
RAND
(),
RAND
(),
RAND
(),
UNIX_TIMESTAMP
(
currentDateTime
),
RAND
(),
RAND
()),
(
CONCAT
(
'0VHGU0745B0_3_'
,
randomChar1
,
'_'
,
randomChar2
),
3
,
1
,
'0VHGU0745B0'
,
RAND
()
*
1000
,
FLOOR
(
RAND
()
*
5
)
+
1
,
0
.
4
+
(
RAND
()
*
0
.
2
),
currentDateTime
,
FLOOR
(
5
+
(
RAND
()
*
16
)),
FLOOR
(
RAND
()
*
60
)
+
10
,
FLOOR
(
5
+
(
RAND
()
*
11
)),
RAND
()
*
120
,
FLOOR
(
10
+
(
RAND
()
*
21
)),
RAND
()
*
10
,
FLOOR
(
RAND
()
*
300
)
+
10
,
RAND
(),
RAND
(),
RAND
(),
RAND
(),
RAND
(),
UNIX_TIMESTAMP
(
currentDateTime
),
RAND
(),
RAND
()),
(
CONCAT
(
'0VHGU0745B0_5_'
,
randomChar1
,
'_'
,
randomChar2
),
5
,
1
,
'0VHGU0745B0'
,
RAND
()
*
1000
,
FLOOR
(
RAND
()
*
5
)
+
1
,
0
.
4
+
(
RAND
()
*
0
.
2
),
currentDateTime
,
FLOOR
(
5
+
(
RAND
()
*
16
)),
FLOOR
(
RAND
()
*
60
)
+
10
,
FLOOR
(
5
+
(
RAND
()
*
11
)),
RAND
()
*
120
,
FLOOR
(
10
+
(
RAND
()
*
21
)),
RAND
()
*
10
,
FLOOR
(
RAND
()
*
300
)
+
10
,
RAND
(),
RAND
(),
RAND
(),
RAND
(),
RAND
(),
UNIX_TIMESTAMP
(
currentDateTime
),
RAND
(),
RAND
());
SET
currentDateTime
=
ADDTIME
(
currentDateTime
,
'0:5:0'
);
END
WHILE
;
END
$$
DELIMITER
;
CALL
InsertRandomData
();
DROP
PROCEDURE
IF
EXISTS
InsertRandomData
;
signal-optimize-service/src/main/resources/sql/make-cross-hist-data.sql
0 → 100644
View file @
79bab51c
DELETE
FROM
t_cross_data_hist
WHERE
start_time
>=
'2024-04-02 00:00:00'
AND
start_time
<=
'2024-04-03 00:00:00'
;
DELIMITER
$$
CREATE
PROCEDURE
InsertRandomData
()
BEGIN
DECLARE
startTime
TIMESTAMP
;
DECLARE
endTime
TIMESTAMP
;
DECLARE
currentTime
TIMESTAMP
;
SET
startTime
=
'2024-04-02 00:00:00'
;
SET
endTime
=
'2024-04-03 00:00:00'
;
SET
currentTime
=
startTime
;
WHILE
currentTime
<=
endTime
DO
INSERT
INTO
t_cross_data_hist
(
cross_id
,
status
,
type
,
traffic_index
,
start_time
,
duration
,
is_unbalance
,
is_spillover
,
is_congestion
,
unbalance_index
,
spillover_index
,
congestion_index
,
unbalance_dirs
,
spillover_dirs
,
congestion_dirs
,
flow
,
flow_rate
,
speed
,
queue_length
,
stop_times
,
delay_time
,
sturation
,
batch_time
,
gmt_create
,
gmt_modified
,
clear_rate
,
not_clear_car_nums
,
load_balance
,
green_light_efficiency
,
effusion_rate
,
no_stop_rate
,
one_stop_rate
,
two_stop_rate
,
three_stop_rate
,
end_time
)
VALUES
(
'0VHGU0745B0'
,
FLOOR
(
RAND
()
*
5
),
FLOOR
(
RAND
()
*
3
),
RAND
()
*
10
,
currentTime
,
FLOOR
(
RAND
()
*
121
),
FLOOR
(
RAND
()
*
2
),
FLOOR
(
RAND
()
*
2
),
FLOOR
(
RAND
()
*
2
),
RAND
()
*
100
,
RAND
()
*
100
,
RAND
()
*
100
,
LPAD
(
FLOOR
(
RAND
()
*
10000
),
4
,
'0'
),
LPAD
(
FLOOR
(
RAND
()
*
10000
),
4
,
'0'
),
LPAD
(
FLOOR
(
RAND
()
*
10000
),
4
,
'0'
),
FLOOR
(
80
+
RAND
()
*
31
),
RAND
()
*
100
,
FLOOR
(
40
+
RAND
()
*
21
),
FLOOR
(
90
+
RAND
()
*
61
),
RAND
()
*
10
,
FLOOR
(
4
+
RAND
()
*
7
),
RAND
()
*
100
,
UNIX_TIMESTAMP
(
currentTime
),
NOW
(),
NOW
(),
RAND
(),
FLOOR
(
RAND
()
*
501
),
RAND
()
*
100
,
RAND
(),
RAND
(),
RAND
(),
RAND
(),
RAND
(),
RAND
(),
DATE_ADD
(
currentTime
,
INTERVAL
FLOOR
(
RAND
()
*
121
)
MINUTE
)
);
SET
currentTime
=
ADDTIME
(
currentTime
,
'0:05:00'
);
END
WHILE
;
END
$$
DELIMITER
;
CALL
InsertRandomData
();
DROP
PROCEDURE
IF
EXISTS
InsertRandomData
;
wj-common/src/main/java/net/wanji/common/utils/geo/GeoWebCacheUtils.java
deleted
100644 → 0
View file @
42d834df
package
net
.
wanji
.
common
.
utils
.
geo
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.StatusLine
;
import
org.apache.http.util.EntityUtils
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
toilelibre
.
libe
.
curl
.
Curl
.
curl
;
import
static
org
.
toilelibre
.
libe
.
curl
.
Curl
.
$
;
/**
* GeoWebCache帮助类
* @author guoliang.dong@wanji.com
*/
@Slf4j
public
class
GeoWebCacheUtils
{
private
String
geoUrl
;
private
String
geoUsername
;
private
String
geoPassword
;
private
static
GeoWebCacheUtils
geoWebCacheUtils
=
null
;
public
static
GeoWebCacheUtils
getGeoServerRESTManager
(
String
url
,
String
username
,
String
password
)
{
if
(
geoWebCacheUtils
==
null
)
{
geoWebCacheUtils
=
new
GeoWebCacheUtils
(
url
,
username
,
password
);
}
return
geoWebCacheUtils
;
}
public
GeoWebCacheUtils
(
String
url
,
String
username
,
String
password
){
geoUrl
=
url
;
geoUsername
=
username
;
geoPassword
=
password
;
}
/**
* 新增工作空间
*
* @param workspace 工作空间名
* @return boolean
*/
public
boolean
addWorkspace
(
String
workspace
)
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XPOST -H \"Content-type: text/xml\"\n"
+
" -d \"<workspace><name>"
+
workspace
+
"</name></workspace>\"\n"
+
" "
+
geoUrl
+
"/rest/workspaces"
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
201
;
}
/**
* 创建外存储geotiff
*
* @param workspace
* @param store
* @return
*/
public
boolean
addExternalGeotiffStore
(
String
workspace
,
String
store
,
String
fileurl
){
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XPUT -H \"Content-type: text/plain\"\n"
+
" -d \"file://"
+
fileurl
+
"\"\n"
+
" "
+
geoUrl
+
"/rest/workspaces/"
+
workspace
+
"/coveragestores/"
+
store
+
"/external.geotiff?configure=first&coverageName="
+
store
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
201
;
}
/**
* 获取geoWebCache中的图层
*
* @return Map
*/
public
Map
<
String
,
Object
>
getLayers
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
();
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" \""
+
geoUrl
+
"/gwc/rest/layers\""
;
List
<
String
>
shp
=
new
ArrayList
<>();
List
<
String
>
image
=
new
ArrayList
<>();
HttpResponse
curl
=
curl
(
cmd
);
HttpEntity
entity
=
curl
.
getEntity
();
if
(
entity
!=
null
)
{
String
result
=
null
;
try
{
result
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
result
);
for
(
Object
o
:
jsonArray
)
{
String
str
=
o
.
toString
();
map
.
put
(
str
,
o
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
/**
*
*
* @param layer
* @param zoomStart
* @param zoomStop
* @return boolean
*/
/**
* 指定图层进行切片操作
* @param layer 指定图层 shp:test
* @param type * seed (add tiles) * reseed (replace tiles) * truncate (remove tiles)
* @param srs 坐标系srid
* @param zoomStart 1 切片开始层级
* @param zoomStop 15 切片结束层级
* @return
*/
public
boolean
slice
(
String
layer
,
String
type
,
int
srs
,
int
zoomStart
,
int
zoomStop
,
String
gridSetId
)
{
int
threadCount
=
2
;
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".xml\""
+
" -XPOST -H \"Content-type: text/xml\" -d '<seedRequest><name>"
+
layer
+
"</name><srs><number>"
+
srs
+
"</number></srs><zoomStart>"
+
zoomStart
+
"</zoomStart><zoomStop>"
+
zoomStop
+
"</zoomStop><format>image/png</format><type>"
+
type
+
"</type><threadCount>"
+
threadCount
+
"</threadCount><gridSetId>"
+
gridSetId
+
"</gridSetId></seedRequest>' \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".xml\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
/**
* 获取切片的情况
*
* @param layer 指定图层
* @return Map
*/
public
Map
getSliceType
(
String
layer
)
{
Map
map
=
new
HashMap
();
//返回所有图层切片情况 curl -u <user>:<password> -XGET http://localhost:8080/geoserver/gwc/rest/seed.json
//返回指定图层的切片情况
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XGET "
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".json"
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
if
(
statusLine
.
getStatusCode
()==
200
)
{
HttpEntity
entity
=
curl
.
getEntity
();
try
{
String
result
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
JSONObject
jsonArray
=
JSONObject
.
parseObject
(
result
);
map
.
put
(
"res"
,
jsonArray
.
getJSONArray
(
"long-array-array"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
/**
* 停止所有正在进行的切片任务
*
* @return boolean
*/
public
boolean
stopAllSlice
()
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -d \"kill_all=all\" \""
+
geoUrl
+
"/gwc/rest/seed\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
/**
* 停止指定图层的切片任务
*
* @return boolean
*/
public
boolean
stopSliceByLayer
(
String
layer
)
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -d \"kill_all=all\" \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
"\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
public
static
void
main
(
String
[]
args
){
GeoWebCacheUtils
geoServerRESTManager
=
GeoWebCacheUtils
.
getGeoServerRESTManager
(
"http://127.0.0.1:8080/geoserver"
,
"admin"
,
"geoserver"
);
//System.out.println(geoServerRESTManager.addWorkspace("zhangwei"));
//Map<String, Object> layers=geoServerRESTManager.getLayers();
//System.out.println("图层数:"+layers.size());
//System.out.println(layers);
System
.
out
.
println
(
geoServerRESTManager
.
slice
(
"sf:result8"
,
"seed"
,
4326
,
14
,
14
,
"My_EPSG:4326"
));
//System.out.println(geoServerRESTManager.stopSliceByLayer("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.getSliceType("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.getSliceType("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.stopAllSlice());
//System.out.println(geoServerRESTManager.addExternalGeotiffStore("sf","result8","D:/ProgramData/GeoServer/data/sf/result8/result.tif"));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment