Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d6fd82cc
authored
Mar 18, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.50.0 开发1.50.0需求版本
1 parent
ecddbc45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
21 deletions
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/test/java/cn/com/glsx/admin/modules/service/RiskAssessmentServiceTest.java
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
View file @
d6fd82c
...
...
@@ -234,25 +234,25 @@ public class RiskAssessmentService {
List
<
BasicDeviceDTO
>
basicDeviceDTOList
=
vehicleDeviceMapper
.
selectBindDeviceByVehicleIdOrderByCreatedDate
(
vehicleId
);
log
.
info
(
"basicDeviceDTOList==="
+
JSONUtil
.
toJsonStr
(
basicDeviceDTOList
));
Optional
<
BasicDeviceDTO
>
basicDeviceDTO
=
basicDeviceDTOList
.
stream
().
filter
(
dto
->
TypeConverseEnum
.
SourceEnum
.
HAS_SOURCE
.
getSourceType
().
equals
(
dto
.
getSource
())).
findFirst
();
log
.
info
(
"basicDeviceDTO==="
+
JSONUtil
.
toJsonStr
(
basicDeviceDTO
));
basicDeviceDTO
.
orElseGet
(()
->
{
log
.
warn
(
"该车辆绑定的主设备不存在"
);
throw
new
AdminException
(
"该车辆绑定的主设备不存在"
);
});
ResidentInformationVO
residentInformationVO
=
new
ResidentInformationVO
();
// 设置常住地
List
<
ResidentDTO
>
residentList
=
remoteFeignResidentService
.
getResidentList
(
buildResidentRequest
(
basicDeviceDTO
.
get
().
getSn
()));
// 常驻地,是“截止目前”的条件,选驻留次数最多的那个
residentList
.
stream
().
min
((
o1
,
o2
)
->
o2
.
getTotalTimes
()
-
o1
.
getTotalTimes
()).
ifPresent
(
residentDTO
->
{
String
addressByLngAndLat
=
remoteGpsBsService
.
getAddressByLngAndLat
(
residentDTO
.
getElng
(),
residentDTO
.
getElat
());
residentInformationVO
.
setResidence
(
addressByLngAndLat
);
});
boolean
present
=
basicDeviceDTO
.
isPresent
();
if
(
present
)
{
BasicDeviceDTO
deviceDTO
=
basicDeviceDTO
.
get
();
log
.
info
(
"deviceDTO==="
+
JSONUtil
.
toJsonStr
(
deviceDTO
));
// 设置常住地
List
<
ResidentDTO
>
residentList
=
remoteFeignResidentService
.
getResidentList
(
buildResidentRequest
(
deviceDTO
.
getSn
()));
// 常驻地,是“截止目前”的条件,选驻留次数最多的那个
residentList
.
stream
().
min
((
o1
,
o2
)
->
o2
.
getTotalTimes
()
-
o1
.
getTotalTimes
()).
ifPresent
(
residentDTO
->
{
String
addressByLngAndLat
=
remoteGpsBsService
.
getAddressByLngAndLat
(
residentDTO
.
getElng
(),
residentDTO
.
getElat
());
residentInformationVO
.
setResidence
(
addressByLngAndLat
);
});
// 添加预测家庭地址和预测工作地址
DeviceStayOften
deviceStayOften
=
deviceStayOftenMapper
.
selectOneBySn
(
basicDeviceDTO
.
get
().
getSn
());
if
(
Objects
.
nonNull
(
deviceStayOften
))
{
residentInformationVO
.
setHomeAddress
(
deviceStayOften
.
getHomeAddress
());
residentInformationVO
.
setWorkAddress
(
deviceStayOften
.
getWorkAddress
());
// 添加预测家庭地址和预测工作地址
DeviceStayOften
deviceStayOften
=
deviceStayOftenMapper
.
selectOneBySn
(
deviceDTO
.
getSn
());
if
(
Objects
.
nonNull
(
deviceStayOften
))
{
residentInformationVO
.
setHomeAddress
(
deviceStayOften
.
getHomeAddress
());
residentInformationVO
.
setWorkAddress
(
deviceStayOften
.
getWorkAddress
());
}
}
return
residentInformationVO
;
}
...
...
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
d6fd82c
...
...
@@ -120,13 +120,13 @@ public class VehicleService extends AbstractCommonService {
@Autowired
private
ElectricFenceService
fenceService
;
@DubboReference
(
version
=
"2.2.0"
)
@DubboReference
(
version
=
"2.2.0"
,
lazy
=
true
)
private
CarbrandService
carbrandService
;
@DubboReference
(
version
=
"2.2.0"
)
@DubboReference
(
version
=
"2.2.0"
,
lazy
=
true
)
private
CarseriesService
carseriesService
;
@DubboReference
(
version
=
"2.2.0"
)
@DubboReference
(
version
=
"2.2.0"
,
lazy
=
true
)
private
CartypeService
cartypeService
;
@Autowired
...
...
@@ -1646,7 +1646,7 @@ public class VehicleService extends AbstractCommonService {
bindSnList
.
add
(
deviceInfoDto
.
getSn
());
// 修改设备为激活状态
updateDeviceActiveStatus
(
deviceInfoDto
.
getSn
(),
vehicle
.
getUpdatedBy
(),
ConstantsDevice
.
DEVICE_ACTIVED
);
}
else
{
}
else
{
// 如果设备号没有变化 同步修改设备标记位 解决位置更换标记为没有更换的BUG
vehicleDevice
.
setActiveFlag
(
deviceInfoDto
.
getActiveFlag
());
vehicleDeviceService
.
updateByPrimaryKey
(
vehicleDevice
);
...
...
src/test/java/cn/com/glsx/admin/modules/service/RiskAssessmentServiceTest.java
View file @
d6fd82c
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.admin.common.enums.TypeConverseEnum
;
import
cn.com.glsx.admin.modules.mapper.VehicleDeviceMapper
;
import
cn.com.glsx.admin.modules.model.dto.BasicDeviceDTO
;
import
cn.com.glsx.admin.modules.model.vo.*
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -11,7 +14,9 @@ import org.springframework.boot.test.context.SpringBootTest;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
static
org
.
junit
.
Assert
.*;
...
...
@@ -22,6 +27,8 @@ public class RiskAssessmentServiceTest {
@Autowired
private
RiskAssessmentService
riskAssessmentService
;
@Autowired
private
VehicleDeviceMapper
vehicleDeviceMapper
;
@Test
public
void
getStayPointList
()
{
...
...
@@ -52,4 +59,12 @@ public class RiskAssessmentServiceTest {
UserBehaviorInformationVO
userBehaviorInformation
=
riskAssessmentService
.
getUserBehaviorInformation
(
67771L
);
System
.
out
.
println
(
"userBehaviorInformation = "
+
JSONUtil
.
toJsonStr
(
userBehaviorInformation
));
}
@Test
public
void
testSelectBindDeviceByVehicleIdOrderByCreatedDate
()
{
List
<
BasicDeviceDTO
>
basicDeviceDTOList
=
vehicleDeviceMapper
.
selectBindDeviceByVehicleIdOrderByCreatedDate
(
67771L
);
log
.
info
(
"basicDeviceDTOList==="
+
JSONUtil
.
toJsonStr
(
basicDeviceDTOList
));
Optional
<
BasicDeviceDTO
>
first
=
basicDeviceDTOList
.
stream
().
filter
(
dto
->
TypeConverseEnum
.
SourceEnum
.
HAS_SOURCE
.
getSourceType
().
equals
(
dto
.
getSource
())).
findFirst
();
first
.
ifPresent
(
item
->
System
.
out
.
println
(
"basicDeviceDTO = "
+
JSONUtil
.
toJsonStr
(
first
.
get
())));
}
}
\ No newline at end of file
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