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 8cf8d636
authored
Oct 29, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
fd18aa1f
fcee8cb8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
19 deletions
src/main/java/cn/com/glsx/admin/modules/mapper/ElectricFenceSnsMapper.java
src/main/java/cn/com/glsx/admin/modules/model/export/TrialDriveReportDetailExport.java
src/main/java/cn/com/glsx/admin/modules/service/ElectricFenceService.java
src/main/resources/mapper/ElectricFenceSnsMapper.xml
src/main/resources/mapper/TrialDriveReportMapper.xml
src/main/java/cn/com/glsx/admin/modules/mapper/ElectricFenceSnsMapper.java
View file @
8cf8d63
...
...
@@ -5,6 +5,7 @@ import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Collection
;
import
java.util.List
;
@Mapper
...
...
@@ -24,4 +25,13 @@ public interface ElectricFenceSnsMapper extends CommonBaseMapper<ElectricFenceSn
*/
int
logicDeleteByFenceId
(
@Param
(
"fenceId"
)
Long
fenceId
);
/**
* 删除围栏下设备
*
* @param fenceId
* @param delSns
* @return
*/
int
deleteByFenceIdAndSns
(
@Param
(
"fenceId"
)
Long
fenceId
,
@Param
(
"sns"
)
Collection
<
String
>
delSns
);
}
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/model/export/TrialDriveReportDetailExport.java
View file @
8cf8d63
...
...
@@ -28,33 +28,27 @@ public class TrialDriveReportDetailExport {
@ExcelProperty
(
value
=
"设备号"
,
index
=
4
)
private
String
sn
;
@ExcelProperty
(
value
=
"车系"
,
index
=
5
)
private
String
seriesName
;
@ExcelProperty
(
value
=
"车型"
,
index
=
6
)
private
String
typeName
;
@ExcelProperty
(
value
=
"开始时间"
,
index
=
7
)
@ExcelProperty
(
value
=
"开始时间"
,
index
=
5
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
journeyBeginTime
;
@ExcelProperty
(
value
=
"结束时间"
,
index
=
8
)
@ExcelProperty
(
value
=
"结束时间"
,
index
=
6
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
journeyEndTime
;
@ExcelProperty
(
value
=
"试驾时长"
,
index
=
9
)
@ExcelProperty
(
value
=
"试驾时长"
,
index
=
7
)
private
String
journeyTime
;
@ExcelProperty
(
value
=
"试驾里程(KM)"
,
index
=
10
)
@ExcelProperty
(
value
=
"试驾里程(KM)"
,
index
=
8
)
private
Float
totalMileage
;
@ExcelIgnore
private
Integer
percent
;
@ExcelProperty
(
value
=
"是否有效"
,
index
=
11
)
@ExcelProperty
(
value
=
"是否有效"
,
index
=
9
)
private
String
valid
;
@ExcelProperty
(
value
=
"无效原因"
,
index
=
1
2
)
@ExcelProperty
(
value
=
"无效原因"
,
index
=
1
0
)
private
String
reason
;
}
src/main/java/cn/com/glsx/admin/modules/service/ElectricFenceService.java
View file @
8cf8d63
...
...
@@ -643,9 +643,14 @@ public class ElectricFenceService {
List
<
VehicleLinkSnsDTO
>
linkSnsDTOList
=
vehicleMapper
.
selectVehicleLinkSnsByUserId
(
fence
.
getCreatedBy
(),
1
);
log
.
info
(
"用户围栏{}设备{}"
,
fence
.
getId
(),
JSON
.
toJSONString
(
linkSnsDTOList
));
List
<
ElectricFenceSns
>
snsList
=
Lists
.
newArrayList
();
Set
<
String
>
vehicleSnSet
=
linkSnsDTOList
.
stream
().
map
(
VehicleLinkSnsDTO:
:
getSns
).
collect
(
Collectors
.
toSet
());
List
<
ElectricFenceSns
>
addSnsList
=
Lists
.
newArrayList
();
List
<
String
>
delSnsList
=
Lists
.
newArrayList
();
List
<
ElectricFenceSns
>
syncEsnList
=
Lists
.
newArrayList
();
//新增设备关联围栏,所有设备重新同步设备到大数据侧
linkSnsDTOList
.
forEach
(
efsm
->
{
ElectricFenceSns
fenceSns
=
new
ElectricFenceSns
();
fenceSns
.
setFenceId
(
fence
.
getId
());
...
...
@@ -656,13 +661,25 @@ public class ElectricFenceService {
fenceSns
.
setCreatedDate
(
now
);
fenceSns
.
setCreatedBy
(
fence
.
getCreatedBy
());
if
(!
fenceExistSnSet
.
contains
(
efsm
.
getSns
()))
{
s
nsList
.
add
(
fenceSns
);
addS
nsList
.
add
(
fenceSns
);
}
syncEsnList
.
add
(
fenceSns
);
});
if
(
CollectionUtils
.
isNotEmpty
(
snsList
))
{
log
.
info
(
"围栏{}本次关联设备{}"
,
fence
.
getId
(),
JSON
.
toJSONString
(
snsList
));
electricFenceSnsMapper
.
insertList
(
snsList
);
//删除车辆后,围栏设备不在车辆设备里面,删除对应围栏设备
fenceExistSnSet
.
forEach
(
fenceSn
->
{
if
(!
vehicleSnSet
.
contains
(
fenceSn
))
{
delSnsList
.
add
(
fenceSn
);
}
});
if
(
CollectionUtils
.
isNotEmpty
(
addSnsList
))
{
log
.
info
(
"围栏{}本次新关联设备{}"
,
fence
.
getId
(),
JSON
.
toJSONString
(
addSnsList
));
electricFenceSnsMapper
.
insertList
(
addSnsList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
delSnsList
))
{
log
.
info
(
"围栏{}本次删除设备{}"
,
fence
.
getId
(),
JSON
.
toJSONString
(
delSnsList
));
electricFenceSnsMapper
.
deleteByFenceIdAndSns
(
fence
.
getId
(),
delSnsList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
syncEsnList
))
{
log
.
info
(
"围栏{}同步关联设备{}"
,
fence
.
getId
(),
JSON
.
toJSONString
(
syncEsnList
));
...
...
src/main/resources/mapper/ElectricFenceSnsMapper.xml
View file @
8cf8d63
...
...
@@ -55,4 +55,14 @@
set del_flag = -1
where fence_id = #{fenceId}
</update>
<update
id=
"deleteByFenceIdAndSns"
>
update t_electric_fence_sns
set del_flag = -1
where fence_id = #{fenceId}
and sn in
<foreach
collection=
"sns"
separator=
","
open=
"("
close=
")"
item=
"item"
>
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
src/main/resources/mapper/TrialDriveReportMapper.xml
View file @
8cf8d63
...
...
@@ -129,8 +129,6 @@
tv.license_plate licensePlate,
tv.vin,
tefd.sn,
concat(tv.sub_brand_name, '/', tv.series_name, '/') seriesName,
tv.type_name typeName,
journey_time journeyBeginTime,
journey_end_time journeyEndTime,
total_mileage totalMileage,
...
...
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