Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
TDLCloud
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
WitCloud
TDLCloud
Commits
167c4c1b
Commit
167c4c1b
authored
Apr 02, 2018
by
chenying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.2修改线路和数据的接口,根据公司名查询数据
parent
b8d0e060
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
636 additions
and
319 deletions
+636
-319
CircuitTermVo.java
src/main/java/com/example/tdl/domain/vo/CircuitTermVo.java
+10
-0
ResultCircuitForAppVo.java
...java/com/example/tdl/domain/vo/ResultCircuitForAppVo.java
+93
-0
CircuitMapper.java
src/main/java/com/example/tdl/mapper/CircuitMapper.java
+15
-12
CircuitService.java
src/main/java/com/example/tdl/service/CircuitService.java
+26
-22
AlarmDataController.java
src/main/java/com/example/tdl/web/AlarmDataController.java
+10
-2
CircuitController.java
src/main/java/com/example/tdl/web/CircuitController.java
+221
-122
DataController.java
src/main/java/com/example/tdl/web/DataController.java
+174
-117
HomePageController.java
src/main/java/com/example/tdl/web/HomePageController.java
+13
-5
application.properties
src/main/resources/application.properties
+2
-2
CircuitMapper.xml
src/main/resources/mapper/CircuitMapper.xml
+72
-37
No files found.
src/main/java/com/example/tdl/domain/vo/CircuitTermVo.java
View file @
167c4c1b
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
CircuitTermVo
{
private
String
companyName
;
private
String
cargoNo
;
private
Integer
circuitState
;
...
...
@@ -9,6 +11,14 @@ public class CircuitTermVo {
private
Long
endTime
;
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getCargoNo
()
{
return
cargoNo
;
}
...
...
src/main/java/com/example/tdl/domain/vo/ResultCircuitForAppVo.java
0 → 100644
View file @
167c4c1b
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ResultCircuitForAppVo
{
private
String
transportationNo
;
private
String
city
;
private
Long
startTime
;
private
String
cargoNo
;
private
String
plateNo
;
private
String
deliveryAddress
;
private
String
transportation
;
private
String
transportationType
;
private
String
remark
;
public
Long
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Long
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getCargoNo
()
{
return
cargoNo
;
}
public
void
setCargoNo
(
String
cargoNo
)
{
this
.
cargoNo
=
cargoNo
;
}
public
String
getPlateNo
()
{
return
plateNo
;
}
public
void
setPlateNo
(
String
plateNo
)
{
this
.
plateNo
=
plateNo
;
}
public
String
getDeliveryAddress
()
{
return
deliveryAddress
;
}
public
void
setDeliveryAddress
(
String
deliveryAddress
)
{
this
.
deliveryAddress
=
deliveryAddress
;
}
public
String
getTransportation
()
{
return
transportation
;
}
public
void
setTransportation
(
String
transportation
)
{
this
.
transportation
=
transportation
;
}
public
String
getTransportationType
()
{
return
transportationType
;
}
public
void
setTransportationType
(
String
transportationType
)
{
this
.
transportationType
=
transportationType
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
}
src/main/java/com/example/tdl/mapper/CircuitMapper.java
View file @
167c4c1b
...
...
@@ -9,12 +9,10 @@ import java.util.Map;
@Mapper
public
interface
CircuitMapper
{
List
<
ResultCircuitVo
>
getAll
();
List
<
ResultCircuitVo
>
getAll
(
String
companyName
);
List
<
ResultCircuitVo
>
getByTerm
(
CircuitTermVo
circuitTermVo
);
// List<CircuitVo> getDistinct();
int
addCircuit
(
Map
<
Object
,
Object
>
map
);
int
add
(
Map
<
Object
,
Object
>
map
);
...
...
@@ -25,25 +23,30 @@ public interface CircuitMapper {
int
delCircuit
(
String
transportationNo
);
ResultCircuitVo
getByTransportationNo
(
String
transportation
);
ResultCircuitVo
getByTransportationNo
(
@Param
(
"transportationNo"
)
String
transportationNo
,
@Param
(
"companyName"
)
String
companyName
);
Integer
getOnRoute
(
String
ti
me
);
Integer
getOnRoute
(
@Param
(
"time"
)
String
time
,
@Param
(
"companyName"
)
String
companyNa
me
);
Integer
getDelayCount
(
@Param
(
"compTime"
)
Long
compTime
,
@Param
(
"time"
)
String
time
);
Integer
getDelayCount
(
@Param
(
"compTime"
)
Long
compTime
,
@Param
(
"time"
)
String
time
,
@Param
(
"companyName"
)
String
companyName
);
Integer
getCo
mplted
(
String
ti
me
);
Integer
getCo
unt
(
@Param
(
"time"
)
String
time
,
@Param
(
"companyName"
)
String
companyNa
me
);
Integer
getCount
(
String
ti
me
);
List
<
ResultCircuitVo
>
getByContainerNo
(
@Param
(
"cargoNo"
)
String
cargoNo
,
@Param
(
"companyName"
)
String
companyNa
me
);
List
<
ResultCircuitVo
>
getByTime
(
String
ti
me
);
ResultCircuitForAppVo
getByTransportationNoForApp
(
@Param
(
"transportationNo"
)
String
transportationNo
,
@Param
(
"companyName"
)
String
companyNa
me
);
List
<
ResultCircuitVo
>
getByC
ontainerNo
(
String
cargoNo
);
List
<
ResultCircuitVo
>
getByC
ircuitState
(
@Param
(
"circuitState"
)
Integer
circuitState
,
@Param
(
"companyName"
)
String
companyName
);
int
updateEvaluate
(
UpdateEvaluateVo
updateEvaluateVo
);
List
<
ResultCircuitVo
>
getByCircuitState
(
Integer
circuitState
);
Integer
getNo
(
String
transportationNo
);
ResultGatewayVo
getByNo
(
String
transportationNo
);
List
<
ResultCircuitVo
>
getByTime
(
@Param
(
"time"
)
String
time
,
@Param
(
"companyName"
)
String
companyName
);
// Integer getComplted(@Param("time") String time);
// List<CircuitVo> getDistinct();
}
src/main/java/com/example/tdl/service/CircuitService.java
View file @
167c4c1b
...
...
@@ -14,8 +14,8 @@ public class CircuitService {
@Autowired
private
CircuitMapper
circuitMapper
;
public
List
<
ResultCircuitVo
>
getAll
(){
return
circuitMapper
.
getAll
();
public
List
<
ResultCircuitVo
>
getAll
(
String
companyName
){
return
circuitMapper
.
getAll
(
companyName
);
}
public
List
<
ResultCircuitVo
>
getByTerm
(
CircuitTermVo
circuitTermVo
){
...
...
@@ -43,43 +43,38 @@ public class CircuitService {
return
circuitMapper
.
delCircuit
(
transportationNo
);
}
public
ResultCircuitVo
getByTransportationNo
(
String
transportationNo
){
return
circuitMapper
.
getByTransportationNo
(
transportationNo
);
public
ResultCircuitVo
getByTransportationNo
(
String
transportationNo
,
String
companyName
){
return
circuitMapper
.
getByTransportationNo
(
transportationNo
,
companyName
);
}
public
Integer
getOnRoute
(
String
ti
me
){
return
circuitMapper
.
get
OnRoute
(
ti
me
);
public
ResultCircuitForAppVo
getByTransportationNoForApp
(
String
transportationNo
,
String
companyNa
me
){
return
circuitMapper
.
get
ByTransportationNoForApp
(
transportationNo
,
companyNa
me
);
}
public
Integer
get
DelayCount
(
Long
compTime
,
String
ti
me
){
return
circuitMapper
.
get
DelayCount
(
compTime
,
ti
me
);
public
Integer
get
OnRoute
(
String
time
,
String
comapnyNa
me
){
return
circuitMapper
.
get
OnRoute
(
time
,
comapnyNa
me
);
}
public
Integer
get
Complted
(
String
ti
me
){
return
circuitMapper
.
get
Complted
(
ti
me
);
public
Integer
get
DelayCount
(
Long
compTime
,
String
time
,
String
companyNa
me
){
return
circuitMapper
.
get
DelayCount
(
compTime
,
time
,
companyNa
me
);
}
public
Integer
getCount
(
String
time
){
return
circuitMapper
.
getCount
(
time
);
public
Integer
getCount
(
String
time
,
String
companyName
){
return
circuitMapper
.
getCount
(
time
,
companyName
);
}
public
List
<
ResultCircuitVo
>
getBy
Time
(
String
ti
me
){
return
circuitMapper
.
getBy
Time
(
ti
me
);
public
List
<
ResultCircuitVo
>
getBy
ContainerNo
(
String
cargoNo
,
String
companyNa
me
){
return
circuitMapper
.
getBy
ContainerNo
(
cargoNo
,
companyNa
me
);
}
public
List
<
ResultCircuitVo
>
getByC
ontainerNo
(
String
cargoNo
){
return
circuitMapper
.
getByC
ontainerNo
(
cargoNo
);
public
List
<
ResultCircuitVo
>
getByC
ircuitState
(
Integer
circuitState
,
String
companyName
){
return
circuitMapper
.
getByC
ircuitState
(
circuitState
,
companyName
);
}
public
int
updateEvaluate
(
UpdateEvaluateVo
updateEvaluateVo
){
return
circuitMapper
.
updateEvaluate
(
updateEvaluateVo
);
}
public
List
<
ResultCircuitVo
>
getByCircuitState
(
Integer
circuitState
){
return
circuitMapper
.
getByCircuitState
(
circuitState
);
}
public
Integer
getNo
(
String
transportationNo
){
return
circuitMapper
.
getNo
(
transportationNo
);
}
...
...
@@ -88,8 +83,17 @@ public class CircuitService {
return
circuitMapper
.
getByNo
(
transportationNo
);
}
// public List<CircuitVo> getDistinct(){
public
List
<
ResultCircuitVo
>
getByTime
(
String
time
,
String
companyName
){
return
circuitMapper
.
getByTime
(
time
,
companyName
);
}
// public List<CircuitVo> getDistinct(){
// return circuitMapper.getDistinct();
// }
// public Integer getComplted(String time){
// return circuitMapper.getComplted(time);
// }
}
src/main/java/com/example/tdl/web/AlarmDataController.java
View file @
167c4c1b
...
...
@@ -7,6 +7,7 @@ import com.example.tdl.domain.vo.*;
import
com.example.tdl.service.CircuitService
;
import
com.example.tdl.service.TDLDeviceService
;
import
com.example.tdl.service.redis.RealRedisService
;
import
com.example.tdl.service.redis.TokenRedisService
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.influxdb.InfluxDBTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -37,6 +39,9 @@ public class AlarmDataController {
@Autowired
private
RealRedisService
realRedisService
;
@Autowired
private
TokenRedisService
tokenRedisService
;
private
final
static
String
database
=
"original"
;
@ApiImplicitParams
({
...
...
@@ -134,7 +139,10 @@ public class AlarmDataController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getAlarmCircuit"
,
method
=
RequestMethod
.
POST
)
public
Object
getAlarmCircuit
(
@RequestBody
String
transportationNo
){
public
Object
getAlarmCircuit
(
@RequestBody
String
transportationNo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
// String transportationNo="CHN20180323G1111";
JSONObject
jsonObject
=
JSON
.
parseObject
(
transportationNo
);
transportationNo
=(
String
)
jsonObject
.
get
(
"transportationNo"
);
...
...
@@ -144,7 +152,7 @@ public class AlarmDataController {
fb
.
setMessage
(
"该线路没有绑定网关"
);
return
gson
.
toJson
(
fb
);
}
Integer
circuitState
=
circuitService
.
getByTransportationNo
(
transportationNo
).
getCircuitState
();
Integer
circuitState
=
circuitService
.
getByTransportationNo
(
transportationNo
,
user
.
getCompanyName
()
).
getCircuitState
();
String
device
=
resultGatewayVo
.
getType
()
+
"_"
+
resultGatewayVo
.
getSN
();
if
(
circuitState
==
0
){
return
null
;
...
...
src/main/java/com/example/tdl/web/CircuitController.java
View file @
167c4c1b
This diff is collapsed.
Click to expand it.
src/main/java/com/example/tdl/web/DataController.java
View file @
167c4c1b
This diff is collapsed.
Click to expand it.
src/main/java/com/example/tdl/web/HomePageController.java
View file @
167c4c1b
...
...
@@ -8,6 +8,7 @@ import com.example.tdl.service.AlarmLogService;
import
com.example.tdl.service.CircuitService
;
import
com.example.tdl.service.TDLLogService
;
import
com.example.tdl.service.redis.TokenRedisService
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.influxdb.InfluxDBTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
...
...
@@ -47,6 +49,9 @@ public class HomePageController {
@Autowired
private
InfluxDBTemplate
influxDBTemplate
;
@Autowired
private
TokenRedisService
tokenRedisService
;
private
final
static
String
database
=
"original"
;
//获取当天所有的设备数据
...
...
@@ -77,22 +82,25 @@ public class HomePageController {
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
public
Object
getAll
(
@RequestBody
String
time
){
public
Object
getAll
(
@RequestBody
String
time
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
time
);
time
=(
String
)
jsonObject
.
get
(
"time"
);
//获取数量
HomePageDataVo
dataVo
=
new
HomePageDataVo
();
//获取所有的线路数量
dataVo
.
setSum
(
circuitService
.
getCount
(
time
));
//总数量
dataVo
.
setOnRoute
(
circuitService
.
getOnRoute
(
time
));
//在途数量
dataVo
.
setDelay
(
circuitService
.
getDelayCount
(
System
.
currentTimeMillis
(),
time
));
//延误数量
dataVo
.
setSum
(
circuitService
.
getCount
(
time
,
user
.
getCompanyName
()
));
//总数量
dataVo
.
setOnRoute
(
circuitService
.
getOnRoute
(
time
,
user
.
getCompanyName
()
));
//在途数量
dataVo
.
setDelay
(
circuitService
.
getDelayCount
(
System
.
currentTimeMillis
(),
time
,
user
.
getCompanyName
()
));
//延误数量
dataVo
.
setAlarmed
(
alarmLogServcie
.
getCount
(
time
));
//报警数量
dataVo
.
setBump
(
alarmLogServcie
.
getBumpCount
(
time
));
//获取颠簸数量
dataVo
.
setAlarmLogVoList
(
alarmLogServcie
.
getAlarmLog
(
time
));
//报警列表
List
<
HistogramData
>
list
=
alarmLogServcie
.
getByCount
(
time
);
//获取报警柱状图
//获取设备的当前位置
List
<
ResultCircuitVo
>
circuitVos
=
circuitService
.
getByTime
(
time
);
List
<
ResultCircuitVo
>
circuitVos
=
circuitService
.
getByTime
(
time
,
user
.
getCompanyName
()
);
List
<
CircuitVo
>
circuitList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
circuitVos
.
size
();
i
++){
CircuitVo
circuitVo
=
new
CircuitVo
();
...
...
src/main/resources/application.properties
View file @
167c4c1b
spring.datasource.url
=
jdbc:mysql://1
92.168.1.16
:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url
=
jdbc:mysql://1
27.0.0.1
:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username
=
root
spring.datasource.password
=
37774020
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
threadpool.corepoolsize
=
30
...
...
src/main/resources/mapper/CircuitMapper.xml
View file @
167c4c1b
This diff is collapsed.
Click to expand it.
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