Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
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
李远洪
new-socketemulator
Commits
5f953db0
Commit
5f953db0
authored
Sep 16, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
M300,M500,车安优模拟器增加删除轨迹的功能
parent
283ac935
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
182 additions
and
10 deletions
+182
-10
data/messageTools/GPSLines/6_先涛的车轨迹(短).txt
data/messageTools/GPSLines/6_先涛的车轨迹(短).txt
+0
-2
lib/util/fileUtil.py
lib/util/fileUtil.py
+26
-7
templates/m300Tools/report/M_m300Simulater_page.html
templates/m300Tools/report/M_m300Simulater_page.html
+29
-0
templates/messageTools/message/M_simulater_page.html
templates/messageTools/message/M_simulater_page.html
+29
-0
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+28
-0
views/m300Tools/M_m300Simulater_process.py
views/m300Tools/M_m300Simulater_process.py
+23
-0
views/m300Tools/M_m300Simulater_view.py
views/m300Tools/M_m300Simulater_view.py
+1
-1
views/messageTools/M_simulater_process.py
views/messageTools/M_simulater_process.py
+22
-0
views/protocolTools/M_carSimulater_process.py
views/protocolTools/M_carSimulater_process.py
+24
-0
No files found.
data/messageTools/GPSLines/6_先涛的车轨迹(短).txt
deleted
100644 → 0
View file @
283ac935
{"name": "gpsLine", "GPSLine": [{"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.279711", "lat": "29.585448\n"}, {"lng": "106.287903", "lat": "29.586623\n"}, {"lng": "106.289041", "lat": "29.586608\n"}, {"lng": "106.293958", "lat": "29.586631\n"}, {"lng": "106.296643", "lat": "29.586603\n"}, {"lng": "106.29702", "lat": "29.586588\n"}, {"lng": "106.297076", "lat": "29.586625\n"}, {"lng": "106.297116", "lat": "29.586675\n"}, {"lng": "106.297148", "lat": "29.58674\n"}, {"lng": "106.297161", "lat": "29.586818\n"}, {"lng": "106.297168", "lat": "29.586906\n"}, {"lng": "106.297275", "lat": "29.58793\n"}, {"lng": "106.297461", "lat": "29.588408\n"}, {"lng": "106.297783", "lat": "29.588835\n"}, {"lng": "106.298863", "lat": "29.589848\n"}, {"lng": "106.299571", "lat": "29.59043\n"}, {"lng": "106.30007", "lat": "29.590666\n"}, {"lng": "106.300655", "lat": "29.59083\n"}, {"lng": "106.301408", "lat": "29.59091\n"}, {"lng": "106.301695", "lat": "29.590925\n"}, {"lng": "106.303111", "lat": "29.590928\n"}, {"lng": "106.30319", "lat": "29.590958\n"}, {"lng": "106.30325", "lat": "29.591001\n"}, {"lng": "106.303288", "lat": "29.59106\n"}, {"lng": "106.303306", "lat": "29.591125\n"}, {"lng": "106.303311", "lat": "29.591196\n"}, {"lng": "106.303321", "lat": "29.59202\n"}, {"lng": "106.303418", "lat": "29.594665\n"}, {"lng": "106.303493", "lat": "29.596323\n"}, {"lng": "106.30351", "lat": "29.597693\n"}]}
\ No newline at end of file
lib/util/fileUtil.py
View file @
5f953db0
...
@@ -47,8 +47,12 @@ def getMaxPrefixFile(filePath):
...
@@ -47,8 +47,12 @@ def getMaxPrefixFile(filePath):
# 获取当前目录前缀最大的文件的前缀
# 获取当前目录前缀最大的文件的前缀
###############################################
###############################################
def
getMaxPrefixFilePre
(
filePath
):
def
getMaxPrefixFilePre
(
filePath
):
theFileName
=
getDirFiles
(
filePath
)[
-
1
]
fileList
=
getDirFiles
(
filePath
)
thePrefix
=
theFileName
.
split
(
"_"
)[
0
]
thePrefix
=
0
for
temp
in
fileList
:
curPrefix
=
int
(
temp
.
split
(
"_"
)[
0
])
if
thePrefix
<
curPrefix
:
thePrefix
=
curPrefix
return
thePrefix
return
thePrefix
###############################################
###############################################
...
@@ -58,11 +62,26 @@ def removeSuffix(fileName):
...
@@ -58,11 +62,26 @@ def removeSuffix(fileName):
theFileName
=
fileName
.
split
(
"."
)[
0
]
theFileName
=
fileName
.
split
(
"."
)[
0
]
return
theFileName
return
theFileName
###############################################
# 删除文件
###############################################
def
delFile
(
path
,
fileName
):
# fi = fileName + ".txt"
fi
=
fileName
theFile
=
path
+
fi
if
os
.
path
.
exists
(
theFile
):
os
.
remove
(
theFile
)
# fi = fileName + ".json"
# theFile = path + fi
# if os.path.exists(theFile):
# os.remove(theFile)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
print
(
getDirFiles
(
"../../data/protocolTools/GPSLines"
))
# print(getDirFiles("../../data/protocolTools/GPSLines"))
print
(
getMaxPrefixFile
(
"../../data/protocolTools/GPSLines"
))
# print(getMaxPrefixFile("../../data/protocolTools/GPSLines"))
print
(
getMaxPrefixFilePre
(
"../../data/protocolTools/GPSLines"
))
# print(getMaxPrefixFilePre("../../data/protocolTools/GPSLines"))
print
(
getDirFilesNoPrefix
(
"../../data/protocolTools/GPSLines"
))
# print(getDirFilesNoPrefix("../../data/protocolTools/GPSLines"))
print
(
getDirFilesListMap
(
"../../data/protocolTools/GPSLines"
))
# print(getDirFilesListMap("../../data/protocolTools/GPSLines"))
delFile
(
"../../data/protocolTools/GPSLines/"
,
"11_testLine"
)
templates/m300Tools/report/M_m300Simulater_page.html
View file @
5f953db0
...
@@ -84,6 +84,7 @@
...
@@ -84,6 +84,7 @@
{% endfor %}
{% endfor %}
</select></span>
</select></span>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<button
id=
"del_gps_but"
type=
"button"
class=
"btn btn-primary"
onclick=
"del_gpsLine()"
style=
"margin-left:10px;"
>
删除选中轨迹
</button>
</div>
</div>
<div
style=
"display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<div
style=
"display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<h5><b>
行驶参数设置:
</b></h5>
<h5><b>
行驶参数设置:
</b></h5>
...
@@ -489,6 +490,34 @@ function uploadFile(){
...
@@ -489,6 +490,34 @@ function uploadFile(){
});
});
}
}
//删除选中的轨迹
function
del_gpsLine
(){
var
res
;
var
gpsLineTxt
=
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
text
();
var
gpsLine
=
$
(
"
#selectGPSLine
"
).
val
()
res
=
confirm
(
"
是否删除当前轨迹:
"
+
gpsLineTxt
+
"
?
"
);
data
=
{};
data
[
"
fileName
"
]
=
gpsLine
;
if
(
res
==
true
){
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/m300Tools/M_m300Simulater_process/delGpsLine
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
alert
(
data
.
message
);
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
remove
();
}
else
{
alert
(
data
.
message
);
}
}
});
}
}
function
download_sample
(){
function
download_sample
(){
var
host
=
window
.
location
.
host
;
var
host
=
window
.
location
.
host
;
window
.
location
.
href
=
"
http://
"
+
host
+
"
/m300Tools/M_m300Simulater_process/sampleDowload
"
;
window
.
location
.
href
=
"
http://
"
+
host
+
"
/m300Tools/M_m300Simulater_process/sampleDowload
"
;
...
...
templates/messageTools/message/M_simulater_page.html
View file @
5f953db0
...
@@ -104,6 +104,7 @@
...
@@ -104,6 +104,7 @@
{% endfor %}
{% endfor %}
</select></span>
</select></span>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<button
id=
"del_gps_but"
type=
"button"
class=
"btn btn-primary"
onclick=
"del_gpsLine()"
style=
"margin-left:10px;"
>
删除选中轨迹
</button>
</div>
</div>
<div
style=
"display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<div
style=
"display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<h5><b>
行驶参数设置:
</b></h5>
<h5><b>
行驶参数设置:
</b></h5>
...
@@ -563,6 +564,34 @@ function uploadFile(){
...
@@ -563,6 +564,34 @@ function uploadFile(){
});
});
}
}
//删除选中的轨迹
function
del_gpsLine
(){
var
res
;
var
gpsLineTxt
=
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
text
();
var
gpsLine
=
$
(
"
#selectGPSLine
"
).
val
()
res
=
confirm
(
"
是否删除当前轨迹:
"
+
gpsLineTxt
+
"
?
"
);
data
=
{};
data
[
"
fileName
"
]
=
gpsLine
;
if
(
res
==
true
){
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/delGpsLine
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
alert
(
data
.
message
);
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
remove
();
}
else
{
alert
(
data
.
message
);
}
}
});
}
}
function
download_sample
(){
function
download_sample
(){
var
host
=
window
.
location
.
host
;
var
host
=
window
.
location
.
host
;
window
.
location
.
href
=
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/sampleDowload
"
window
.
location
.
href
=
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/sampleDowload
"
...
...
templates/protocolTools/report/M_carSimulater_page.html
View file @
5f953db0
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
{% endfor %}
{% endfor %}
</select></span>
</select></span>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<a
style=
"margin-left:10px;font-weight:bold;"
onclick=
"download_sample()"
>
下载示例轨迹
</a>
<button
id=
"del_gps_but"
type=
"button"
class=
"btn btn-primary"
onclick=
"del_gpsLine()"
style=
"margin-left:10px;"
>
删除选中轨迹
</button>
<!-- <label><input style="margin-left:30px;" type="checkbox" id="ignition" />轨迹管理</label>-->
<!-- <label><input style="margin-left:30px;" type="checkbox" id="ignition" />轨迹管理</label>-->
<!-- <div style="display: block;margin:10px; width: 95%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">-->
<!-- <div style="display: block;margin:10px; width: 95%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">-->
<!-- </div>-->
<!-- </div>-->
...
@@ -592,6 +593,33 @@ function download_sample(){
...
@@ -592,6 +593,33 @@ function download_sample(){
var
host
=
window
.
location
.
host
;
var
host
=
window
.
location
.
host
;
window
.
location
.
href
=
"
http://
"
+
host
+
"
/protocolTools/M_carSimulater_process/sampleDowload
"
window
.
location
.
href
=
"
http://
"
+
host
+
"
/protocolTools/M_carSimulater_process/sampleDowload
"
}
}
//删除选中的轨迹
function
del_gpsLine
(){
var
res
;
var
gpsLineTxt
=
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
text
();
var
gpsLine
=
$
(
"
#selectGPSLine
"
).
val
()
res
=
confirm
(
"
是否删除当前轨迹:
"
+
gpsLineTxt
+
"
?
"
);
data
=
{};
data
[
"
fileName
"
]
=
gpsLine
;
if
(
res
==
true
){
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/protocolTools/M_carSimulater_process/delGpsLine
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
alert
(
data
.
message
);
$
(
"
#selectGPSLine
"
).
find
(
"
option:selected
"
).
remove
();
}
else
{
alert
(
data
.
message
);
}
}
});
}
}
//----------------------------------------数据查询代码块------------------------------------------
//----------------------------------------数据查询代码块------------------------------------------
//查询车机今日行驶数据
//查询车机今日行驶数据
...
...
views/m300Tools/M_m300Simulater_process.py
View file @
5f953db0
...
@@ -12,6 +12,7 @@ from lib.protocol.m300.TravelAct_protocol_m300 import TravelAct_protocol_m300
...
@@ -12,6 +12,7 @@ from lib.protocol.m300.TravelAct_protocol_m300 import TravelAct_protocol_m300
from
lib.socket.ClientSocket
import
ClientSocket
from
lib.socket.ClientSocket
import
ClientSocket
from
lib.socket.service.M300SimulaterService
import
M300SimulaterService
from
lib.socket.service.M300SimulaterService
import
M300SimulaterService
from
lib.util
import
fileUtil
from
lib.util
import
fileUtil
from
lib.util.fileUtil
import
delFile
M_m300Simulater_process
=
Blueprint
(
'M_m300Simulater_process'
,
__name__
)
M_m300Simulater_process
=
Blueprint
(
'M_m300Simulater_process'
,
__name__
)
...
@@ -312,6 +313,28 @@ def fileUplad():
...
@@ -312,6 +313,28 @@ def fileUplad():
def
sampleDowload
():
def
sampleDowload
():
return
send_from_directory
(
r"data/m300Tools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
return
send_from_directory
(
r"data/m300Tools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
@
M_m300Simulater_process
.
route
(
"/delGpsLine"
,
methods
=
[
'POST'
])
def
delGpsLine
():
fileName
=
request
.
form
.
get
(
"fileName"
)
data
=
{}
if
fileName
==
"1_sample.json"
:
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error:示例轨迹不可删除!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
delFile
(
"data/m300Tools/GPSLines/"
,
fileName
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"删除轨迹成功"
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 删除轨迹失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
##########################################
# 【接口类型】查询车机行驶数据
# 【接口类型】查询车机行驶数据
##########################################
##########################################
...
...
views/m300Tools/M_m300Simulater_view.py
View file @
5f953db0
...
@@ -19,7 +19,7 @@ def M_m300Simulater_page():
...
@@ -19,7 +19,7 @@ def M_m300Simulater_page():
arg
=
{}
arg
=
{}
path
=
"m300Tools/report/M_m300Simulater_page.html"
path
=
"m300Tools/report/M_m300Simulater_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
arg
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/
protocol
Tools/GPSLines"
)
arg
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/
m300
Tools/GPSLines"
)
return
render_template
(
path
,
arg
=
arg
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
##########################################
...
...
views/messageTools/M_simulater_process.py
View file @
5f953db0
...
@@ -12,6 +12,7 @@ from lib.protocol.message.Location_msg import Location_msg
...
@@ -12,6 +12,7 @@ from lib.protocol.message.Location_msg import Location_msg
from
lib.socket.ClientSocket
import
ClientSocket
from
lib.socket.ClientSocket
import
ClientSocket
from
lib.socket.service.MessageSimulaterService
import
MessageSimulaterService
from
lib.socket.service.MessageSimulaterService
import
MessageSimulaterService
from
lib.util
import
fileUtil
from
lib.util
import
fileUtil
from
lib.util.fileUtil
import
delFile
M_simulater_process
=
Blueprint
(
'M_simulater_process'
,
__name__
)
M_simulater_process
=
Blueprint
(
'M_simulater_process'
,
__name__
)
...
@@ -313,6 +314,27 @@ def fileUplad():
...
@@ -313,6 +314,27 @@ def fileUplad():
def
sampleDowload
():
def
sampleDowload
():
return
send_from_directory
(
r"data/messageTools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
return
send_from_directory
(
r"data/messageTools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
@
M_simulater_process
.
route
(
"/delGpsLine"
,
methods
=
[
'POST'
])
def
delGpsLine
():
fileName
=
request
.
form
.
get
(
"fileName"
)
data
=
{}
if
fileName
==
"1_sample.json"
:
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error:示例轨迹不可删除!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
delFile
(
"data/messageTools/GPSLines/"
,
fileName
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"删除轨迹成功"
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 删除轨迹失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
##########################################
# 【接口类型】查询车机行驶数据
# 【接口类型】查询车机行驶数据
##########################################
##########################################
...
...
views/protocolTools/M_carSimulater_process.py
View file @
5f953db0
...
@@ -17,6 +17,7 @@ import traceback
...
@@ -17,6 +17,7 @@ import traceback
from
lib.socket.service.ProtocolSimulaterService
import
ProtocolSimulaterService
from
lib.socket.service.ProtocolSimulaterService
import
ProtocolSimulaterService
from
lib.util
import
fileUtil
from
lib.util
import
fileUtil
from
lib.util.DelaySend
import
DelaySend
from
lib.util.DelaySend
import
DelaySend
from
lib.util.fileUtil
import
delFile
from
lib.util.util
import
strAddSpace
from
lib.util.util
import
strAddSpace
M_carSimulater_process
=
Blueprint
(
'M_carSimulater_process'
,
__name__
)
M_carSimulater_process
=
Blueprint
(
'M_carSimulater_process'
,
__name__
)
...
@@ -362,6 +363,29 @@ def fileUplad():
...
@@ -362,6 +363,29 @@ def fileUplad():
def
sampleDowload
():
def
sampleDowload
():
return
send_from_directory
(
r"data/protocolTools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
return
send_from_directory
(
r"data/protocolTools/GPSLines"
,
filename
=
"1_sample.json"
,
as_attachment
=
True
)
@
M_carSimulater_process
.
route
(
"/delGpsLine"
,
methods
=
[
'POST'
])
def
delGpsLine
():
fileName
=
request
.
form
.
get
(
"fileName"
)
data
=
{}
if
fileName
==
"1_sample.json"
:
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error:示例轨迹不可删除!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
delFile
(
"data/protocolTools/GPSLines/"
,
fileName
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"删除轨迹成功"
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 删除轨迹失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
##########################################
# 【接口类型】查询车机行驶数据
# 【接口类型】查询车机行驶数据
##########################################
##########################################
...
...
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