Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6d1cd589
authored
Apr 20, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:总里程计算错误
1 parent
1d7812d1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
1 deletions
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
src/test/java/cn/com/glsx/stdinterface/modules/mapper/DeviceJourneyOverviewMapperTest.java
src/test/java/cn/com/glsx/stdinterface/modules/service/JourneyServiceTest.java
src/test/java/cn/com/glsx/stdinterface/modules/service/VehicleServiceTest.java
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
View file @
6d1cd58
...
@@ -77,6 +77,7 @@ public class JourneyService {
...
@@ -77,6 +77,7 @@ public class JourneyService {
deviceJourneyMapper
.
insert
(
deviceJourney
);
deviceJourneyMapper
.
insert
(
deviceJourney
);
//如果行程数据的设备未关联车辆 不计入从次数和总信息
//如果行程数据的设备未关联车辆 不计入从次数和总信息
log
.
info
(
"vdId{}"
,
vdId
);
if
(
Objects
.
isNull
(
vdId
))
{
if
(
Objects
.
isNull
(
vdId
))
{
log
.
warn
(
"该设备没有绑定车辆"
+
deviceJourneyDTO
.
getSn
());
log
.
warn
(
"该设备没有绑定车辆"
+
deviceJourneyDTO
.
getSn
());
log
.
info
(
"同步里程总耗时{}"
,
t4
-
t1
);
log
.
info
(
"同步里程总耗时{}"
,
t4
-
t1
);
...
@@ -95,7 +96,7 @@ public class JourneyService {
...
@@ -95,7 +96,7 @@ public class JourneyService {
return
;
return
;
}
}
overview
.
setDistance
(
overview
.
getDistance
()
+
overviewDO
.
getDistance
());
overview
.
setDistance
(
overview
.
getDistance
()
+
overviewDO
.
getDistance
());
overview
.
set
Distance
(
overview
.
getTotalJourneyCount
()
+
1
);
overview
.
set
TotalJourneyCount
(
overview
.
getTotalJourneyCount
()
+
1
);
overview
.
setUpdatedDate
(
new
Date
());
overview
.
setUpdatedDate
(
new
Date
());
deviceJourneyOverviewMapper
.
updateByPrimaryKeySelective
(
overview
);
deviceJourneyOverviewMapper
.
updateByPrimaryKeySelective
(
overview
);
long
t6
=
System
.
currentTimeMillis
();
long
t6
=
System
.
currentTimeMillis
();
...
...
src/test/java/cn/com/glsx/stdinterface/modules/mapper/DeviceJourneyOverviewMapperTest.java
View file @
6d1cd58
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
mapper
;
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
mapper
;
import
cn.com.glsx.Application
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
/**
/**
...
@@ -7,6 +13,9 @@ import static org.junit.jupiter.api.Assertions.*;
...
@@ -7,6 +13,9 @@ import static org.junit.jupiter.api.Assertions.*;
* @author xiangyanlin
* @author xiangyanlin
* @date 2022/4/8
* @date 2022/4/8
*/
*/
@Slf4j
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
class
DeviceJourneyOverviewMapperTest
{
class
DeviceJourneyOverviewMapperTest
{
}
}
\ No newline at end of file
\ No newline at end of file
src/test/java/cn/com/glsx/stdinterface/modules/service/JourneyServiceTest.java
0 → 100644
View file @
6d1cd58
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
service
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.stdinterface.dto.DeviceJourneyDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Date
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
/**
* @author xiangyanlin
* @date 2022/4/20
*/
@Slf4j
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
JourneyServiceTest
{
@Autowired
private
JourneyService
journeyService
;
@Test
public
void
testSave
()
{
DeviceJourneyDTO
deviceJourneyDTO
=
new
DeviceJourneyDTO
();
deviceJourneyDTO
.
setSn
(
"1510112899"
);
deviceJourneyDTO
.
setBeginTime
(
new
Date
());
deviceJourneyDTO
.
setBeginTime
(
new
Date
());
deviceJourneyDTO
.
setBeginAddress
(
"{\"lat\":\"22.590676\",\"lng\":\"113.987488\"}"
);
deviceJourneyDTO
.
setEndAddress
(
"{\"lat\":\"22.590884\",\"lng\":\"113.988520\"}"
);
deviceJourneyDTO
.
setMileage
(
7111
);
journeyService
.
saveDeviceJourney
(
deviceJourneyDTO
);
}
}
\ No newline at end of file
\ No newline at end of file
src/test/java/cn/com/glsx/stdinterface/modules/service/VehicleServiceTest.java
View file @
6d1cd58
...
@@ -35,4 +35,11 @@ public class VehicleServiceTest {
...
@@ -35,4 +35,11 @@ public class VehicleServiceTest {
System
.
out
.
println
(
"end"
);
System
.
out
.
println
(
"end"
);
}
}
@Test
public
void
testGetVdId
()
{
Long
vdId
=
vehicleService
.
getVdId
(
"1510112899"
);
System
.
out
.
println
(
vdId
);
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment