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 f281a9b2
authored
Dec 29, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化Gps基站数据落库业务
1 parent
db8125c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DeviceLocationMapper.java
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceLocationService.java
src/main/resources/mapper/DeviceLocationMapper.xml
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DeviceLocationMapper.java
View file @
f281a9b
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
mapper
;
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
mapper
;
import
cn.com.glsx.stdinterface.dto.DeviceLocationDto
;
import
cn.com.glsx.stdinterface.modules.model.DeviceLocation
;
import
cn.com.glsx.stdinterface.modules.model.DeviceLocation
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -22,4 +24,12 @@ public interface DeviceLocationMapper extends CommonBaseMapper<DeviceLocation> {
...
@@ -22,4 +24,12 @@ public interface DeviceLocationMapper extends CommonBaseMapper<DeviceLocation> {
List
<
String
>
getAllSnInNewEshield
();
List
<
String
>
getAllSnInNewEshield
();
DeviceLocation
getDeviceLocationBySn
(
@Param
(
"sn"
)
String
sn
);
DeviceLocation
getDeviceLocationBySn
(
@Param
(
"sn"
)
String
sn
);
/**
* 保存和更新设备定位报表
*
* @param deviceLocationDtoList 设备定位集合
* @return
*/
Integer
saveOrUpdateDeviceLocationData
(
@Param
(
"deviceLocationDtoList"
)
Collection
<
DeviceLocationDto
>
deviceLocationDtoList
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceLocationService.java
View file @
f281a9b
...
@@ -6,7 +6,6 @@ import cn.com.glsx.stdinterface.modules.model.DeviceLocation;
...
@@ -6,7 +6,6 @@ import cn.com.glsx.stdinterface.modules.model.DeviceLocation;
import
cn.com.glsx.stdinterface.modules.model.LocationCheckBO
;
import
cn.com.glsx.stdinterface.modules.model.LocationCheckBO
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -33,22 +32,11 @@ public class DeviceLocationService {
...
@@ -33,22 +32,11 @@ public class DeviceLocationService {
* @param deviceLocationDtoList
* @param deviceLocationDtoList
*/
*/
public
void
saveOrUpdateDeviceLocationData
(
Collection
<
DeviceLocationDto
>
deviceLocationDtoList
)
{
public
void
saveOrUpdateDeviceLocationData
(
Collection
<
DeviceLocationDto
>
deviceLocationDtoList
)
{
for
(
DeviceLocationDto
deviceLocationDto
:
deviceLocationDtoList
)
{
try
{
try
{
Integer
num
=
deviceLocationMapper
.
saveOrUpdateDeviceLocationData
(
deviceLocationDtoList
);
DeviceLocation
locationBySn
=
deviceLocationMapper
.
getDeviceLocationBySn
(
deviceLocationDto
.
getSn
());
log
.
info
(
"saveOrUpdateDeviceLocationData==="
+
num
);
if
(
ObjectUtil
.
isNull
(
locationBySn
))
{
}
catch
(
Exception
e
)
{
DeviceLocation
deviceLocation
=
new
DeviceLocation
();
e
.
printStackTrace
();
BeanUtils
.
copyProperties
(
deviceLocationDto
,
deviceLocation
);
deviceLocation
.
setCreatedTime
(
new
Date
());
deviceLocationMapper
.
insertSelective
(
deviceLocation
);
}
else
{
mergeData
(
locationBySn
,
deviceLocationDto
);
deviceLocationMapper
.
updateByPrimaryKeySelective
(
locationBySn
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"设备号:"
+
deviceLocationDto
.
getSn
()
+
"查询异常==="
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
}
}
...
...
src/main/resources/mapper/DeviceLocationMapper.xml
View file @
f281a9b
...
@@ -21,4 +21,22 @@
...
@@ -21,4 +21,22 @@
<select
id=
"getDeviceLocationBySn"
resultMap=
"BaseMap"
>
<select
id=
"getDeviceLocationBySn"
resultMap=
"BaseMap"
>
select * from t_device_location where sn = #{sn}
select * from t_device_location where sn = #{sn}
</select>
</select>
<insert
id=
"saveOrUpdateDeviceLocationData"
>
INSERT INTO t_device_location (sn,last_gps_time,last_bs_time,created_time,updated_time)
values
<foreach
collection=
"deviceLocationDtoList"
item=
"deviceLocation"
open=
"("
separator=
","
close=
")"
>
#{deviceLocation.sn},
#{deviceLocation.lastGpsTime},
#{deviceLocation.lastBsTime},
#{deviceLocation.createdTime},
#{deviceLocation.updatedTime}
</foreach>
ON DUPLICATE KEY UPDATE
sn=values(sn),
last_gps_time=values(last_gps_time),
last_bs_time=values(last_bs_time),
created_time=values(created_time),
updated_time=values(updated_time)
</insert>
</mapper>
</mapper>
\ No newline at end of file
\ 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