Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
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
常超
map-parent
Commits
bd3b33cd
Commit
bd3b33cd
authored
Jun 15, 2021
by
YANGYANG
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
心率和血压添加 最新位置接口
parent
51a21375
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
508 additions
and
13 deletions
+508
-13
common/common_utils/src/main/java/com/founder/commonutils/ZdryAndZdryApiVo/UsersAndOnlineVo.java
+3
-0
common/common_utils/src/main/java/com/founder/commonutils/ZdryApiEntity/DbpMessage.java
+65
-0
common/common_utils/src/main/java/com/founder/commonutils/ZdryApiEntity/HeartrateMessage.java
+62
-0
common/common_utils/src/main/java/com/founder/commonutils/zdryEntity/Users.java
+18
-1
service/zdry/src/main/java/com/founder/zdry/controller/UsersController.java
+4
-0
service/zdry/src/main/java/com/founder/zdry/mapper/xml/UsersMapper.xml
+6
-2
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/controller/ZdryApiController.java
+23
-1
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/controller/ZdryPushDataController.java
+34
-1
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/UsersMapper.java
+24
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/ZdryDbpMessageMapper.java
+21
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/ZdryHeartrateMessageMapper.java
+21
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/UsersMapper.xml
+5
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/ZdryDbpMessageMapper.xml
+5
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/ZdryHeartrateMessageMapper.xml
+5
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/ZdryApiService.java
+5
-1
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/ZdryPushDataService.java
+4
-0
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/impl/ZdryApiServiceImpl.java
+141
-5
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/impl/ZdryPushDataServiceImpl.java
+62
-2
No files found.
common/common_utils/src/main/java/com/founder/commonutils/ZdryAndZdryApiVo/UsersAndOnlineVo.java
View file @
bd3b33cd
...
@@ -94,4 +94,7 @@ public class UsersAndOnlineVo implements Serializable {
...
@@ -94,4 +94,7 @@ public class UsersAndOnlineVo implements Serializable {
@ApiModelProperty
(
value
=
"最新位置地址"
)
@ApiModelProperty
(
value
=
"最新位置地址"
)
private
String
lastAddress
;
private
String
lastAddress
;
@ApiModelProperty
(
value
=
"1本人佩戴 0不是本人"
)
private
Integer
ismeWearFlag
;
}
}
common/common_utils/src/main/java/com/founder/commonutils/ZdryApiEntity/DbpMessage.java
0 → 100644
View file @
bd3b33cd
package
com
.
founder
.
commonutils
.
ZdryApiEntity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"DbpMessage对象"
,
description
=
"DbpMessage对象"
)
@TableName
(
"gk_dbp"
)
public
class
DbpMessage
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"信息主键编号自增长"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"设备Imei"
)
@TableField
(
value
=
"sb_imei"
)
private
String
sbImei
;
@ApiModelProperty
(
value
=
"发生时间YYYY-MM-DD HH:mm:SS"
)
@TableField
(
value
=
"time_begin"
)
private
String
timeBegin
;
@ApiModelProperty
(
value
=
"舒张压"
)
@TableField
(
value
=
"dbp"
)
private
int
dbp
;
@ApiModelProperty
(
value
=
"舒张压报警下限"
)
@TableField
(
value
=
"dbp_l"
)
private
int
dbp_l
;
@ApiModelProperty
(
value
=
"收缩压"
)
@TableField
(
value
=
"sbp"
)
private
int
sbp
;
@ApiModelProperty
(
value
=
"收缩压报警上限"
)
@TableField
(
value
=
"sbp_h"
)
private
int
sbp_h
;
@ApiModelProperty
(
value
=
"登记时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
djsj
;
@ApiModelProperty
(
value
=
"改写时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
gxsj
;
}
common/common_utils/src/main/java/com/founder/commonutils/ZdryApiEntity/HeartrateMessage.java
0 → 100644
View file @
bd3b33cd
package
com
.
founder
.
commonutils
.
ZdryApiEntity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"HeartrateMessage对象"
,
description
=
"HeartrateMessage对象"
)
@TableName
(
"gk_heartrate"
)
public
class
HeartrateMessage
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"信息主键编号自增长"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"设备Imei"
)
@TableField
(
value
=
"sb_imei"
)
private
String
sbImei
;
@ApiModelProperty
(
value
=
"发生时间YYYY-MM-DD HH:mm:SS"
)
@TableField
(
value
=
"time_begin"
)
private
String
timeBegin
;
@ApiModelProperty
(
value
=
"心率"
)
@TableField
(
value
=
"heartrate"
)
private
int
heartrate
;
@ApiModelProperty
(
value
=
"心率阈值上限"
)
@TableField
(
value
=
"theshold_heartrate_h"
)
private
int
theshold_heartrate_h
;
@ApiModelProperty
(
value
=
"心率阈值下限"
)
@TableField
(
value
=
"theshold_heartrate_l"
)
private
int
theshold_heartrate_l
;
@ApiModelProperty
(
value
=
"登记时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
djsj
;
@ApiModelProperty
(
value
=
"改写时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
gxsj
;
}
common/common_utils/src/main/java/com/founder/commonutils/zdryEntity/Users.java
View file @
bd3b33cd
...
@@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
org.springframework.stereotype.Component
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -95,4 +94,22 @@ public class Users implements Serializable {
...
@@ -95,4 +94,22 @@ public class Users implements Serializable {
@ApiModelProperty
(
value
=
"身份证号码"
)
@ApiModelProperty
(
value
=
"身份证号码"
)
private
String
sfzhm
;
private
String
sfzhm
;
@ApiModelProperty
(
value
=
"心率阈值下限"
)
private
Integer
thesholdHeartrateL
;
@ApiModelProperty
(
value
=
"心率阈值上限"
)
private
Integer
thesholdHeartrateH
;
@ApiModelProperty
(
value
=
"舒张压报警下限"
)
private
Integer
dbpL
;
@ApiModelProperty
(
value
=
"收缩压报警上限"
)
private
Integer
sbpH
;
@ApiModelProperty
(
value
=
"是否佩戴 1佩戴 0未佩戴"
)
private
Integer
wearFlag
;
@ApiModelProperty
(
value
=
"1本人佩戴 0不是本人"
)
private
Integer
ismeWearFlag
;
}
}
service/zdry/src/main/java/com/founder/zdry/controller/UsersController.java
View file @
bd3b33cd
...
@@ -225,6 +225,9 @@ public class UsersController {
...
@@ -225,6 +225,9 @@ public class UsersController {
@ApiParam
(
name
=
"online"
,
value
=
"1在线 0离线"
)
@ApiParam
(
name
=
"online"
,
value
=
"1在线 0离线"
)
@RequestParam
(
required
=
false
)
String
online
,
@RequestParam
(
required
=
false
)
String
online
,
@ApiParam
(
name
=
"ismeWearFlag"
,
value
=
"1是 0否"
)
@RequestParam
(
required
=
false
)
String
ismeWearFlag
,
@ApiParam
(
name
=
"wearFlag"
,
value
=
"1佩戴 0未佩戴"
)
@ApiParam
(
name
=
"wearFlag"
,
value
=
"1佩戴 0未佩戴"
)
@RequestParam
(
required
=
false
)
String
wearFlag
){
@RequestParam
(
required
=
false
)
String
wearFlag
){
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
...
@@ -234,6 +237,7 @@ public class UsersController {
...
@@ -234,6 +237,7 @@ public class UsersController {
map
.
put
(
"sbimei"
,
sbimei
);
map
.
put
(
"sbimei"
,
sbimei
);
map
.
put
(
"online"
,
online
);
map
.
put
(
"online"
,
online
);
map
.
put
(
"wearFlag"
,
wearFlag
);
map
.
put
(
"wearFlag"
,
wearFlag
);
map
.
put
(
"ismeWearFlag"
,
ismeWearFlag
);
List
<
UsersAndOnlineVo
>
list
=
usersService
.
userPageOnlineList
(
map
);
List
<
UsersAndOnlineVo
>
list
=
usersService
.
userPageOnlineList
(
map
);
Integer
total
=
usersService
.
userPageOnlineListCount
(
map
);
Integer
total
=
usersService
.
userPageOnlineListCount
(
map
);
return
MapRestResult
.
build
(
ResultCode
.
SUCCESS
,
"成功获取用户列表信息"
,
total
,
list
);
return
MapRestResult
.
build
(
ResultCode
.
SUCCESS
,
"成功获取用户列表信息"
,
total
,
list
);
...
...
service/zdry/src/main/java/com/founder/zdry/mapper/xml/UsersMapper.xml
View file @
bd3b33cd
...
@@ -12,7 +12,10 @@
...
@@ -12,7 +12,10 @@
AND online.online= #{ online, jdbcType=INTEGER }
AND online.online= #{ online, jdbcType=INTEGER }
</if>
</if>
<if
test=
"wearFlag!= null and wearFlag != ''"
>
<if
test=
"wearFlag!= null and wearFlag != ''"
>
AND online.wear_flag= #{ wearFlag, jdbcType=INTEGER }
AND users.wear_flag= #{ wearFlag, jdbcType=INTEGER }
</if>
<if
test=
"ismeWearFlag!= null and ismeWearFlag != ''"
>
AND users.isme_wear_flag= #{ ismeWearFlag, jdbcType=INTEGER }
</if>
</if>
</sql>
</sql>
<select
id=
"userPageOnlineList"
parameterType=
"Map"
resultType=
"com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo"
>
<select
id=
"userPageOnlineList"
parameterType=
"Map"
resultType=
"com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo"
>
...
@@ -36,7 +39,8 @@
...
@@ -36,7 +39,8 @@
users. sb_xh as sbXh,
users. sb_xh as sbXh,
users.sfzhm as sfzhm,
users.sfzhm as sfzhm,
online.online as online,
online.online as online,
online.Wear_flag as WearFlag,
users.Wear_flag as WearFlag,
users.isme_wear_flag as ismeWearFlag,
online.location_updated_at as locationUpdatedAt,
online.location_updated_at as locationUpdatedAt,
online.last_location_x as lastLocationX,
online.last_location_x as lastLocationX,
online.last_location_y as lastLocationY,
online.last_location_y as lastLocationY,
...
...
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/controller/ZdryApiController.java
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
controller
;
package
com
.
founder
.
zdryapi
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.founder.commonutils.ZdryApiEntity.Device
;
import
com.founder.commonutils.ZdryApiEntity.Device
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.ResultCode
;
import
com.founder.commonutils.zdryEntity.Users
;
import
com.founder.zdryapi.service.ZdryApiService
;
import
com.founder.zdryapi.service.ZdryApiService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -107,5 +110,24 @@ public class ZdryApiController {
...
@@ -107,5 +110,24 @@ public class ZdryApiController {
{
{
return
zdryApiService
.
FenceWarning
();
return
zdryApiService
.
FenceWarning
();
}
}
}
@ApiOperation
(
value
=
"是否佩戴是否本人佩戴定时"
)
@GetMapping
(
value
=
"/wearFlag"
)
//每隔5秒执行一次:*/5 * * * * ?
//每隔5分执行一次:0 */5 * * * ?
//每个整点执行一次:0 0 0/1 * * ?
//每天凌晨2点执行一次:0 0 2 * * ?
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
public
MapRestResult
wearFlag
()
{
return
zdryApiService
.
wearFlag
();
}
@ApiOperation
(
value
=
"批量获取设备最新位置"
)
@PostMapping
(
"/newLocationdataList"
)
public
MapRestResult
newLocationdataList
(
@RequestBody
String
[]
imeis
)
{
return
zdryApiService
.
newLocationdataList
(
imeis
);
}
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/controller/ZdryPushDataController.java
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
controller
;
package
com
.
founder
.
zdryapi
.
controller
;
import
cn.hutool.core.date.DateTime
;
import
com.founder.zdryapi.service.ZdryPushDataService
;
import
com.founder.zdryapi.service.ZdryPushDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -68,5 +67,39 @@ public class ZdryPushDataController {
...
@@ -68,5 +67,39 @@ public class ZdryPushDataController {
)
{
)
{
zdryPushDataService
.
locationMessage
(
imei
,
time_begin
,
is_reply
,
is_track
,
city
,
address
,
lon
,
lat
,
type
);
zdryPushDataService
.
locationMessage
(
imei
,
time_begin
,
is_reply
,
is_track
,
city
,
address
,
lon
,
lat
,
type
);
}
}
@ApiOperation
(
value
=
"心率数据发送接口"
)
@PostMapping
(
value
=
"/heartrateMessage"
)
public
void
heartrateMessage
(
@ApiParam
(
name
=
"imei"
,
value
=
"设备IMEI"
,
required
=
true
)
@RequestParam
(
value
=
"imei"
)
String
imei
,
@ApiParam
(
name
=
"time_begin"
,
value
=
"发生时间YYYY-MM-DD HH:mm:SS"
,
required
=
true
)
@RequestParam
(
value
=
"time_begin"
)
String
time_begin
,
@ApiParam
(
name
=
"heartrate"
,
value
=
"心率"
,
required
=
true
)
@RequestParam
(
value
=
"heartrate"
)
int
heartrate
,
@ApiParam
(
name
=
"theshold_heartrate_h"
,
value
=
"心率阈值上限"
,
required
=
true
)
@RequestParam
(
value
=
"theshold_heartrate_h"
)
int
theshold_heartrate_h
,
@ApiParam
(
name
=
"theshold_heartrate_l"
,
value
=
"心率阈值下限"
,
required
=
true
)
@RequestParam
(
value
=
"theshold_heartrate_l"
)
int
theshold_heartrate_l
)
{
zdryPushDataService
.
heartrateMessage
(
imei
,
time_begin
,
heartrate
,
theshold_heartrate_h
,
theshold_heartrate_l
);
}
@ApiOperation
(
value
=
"血压数据发送接口"
)
@PostMapping
(
value
=
"/dbpMessage"
)
public
void
dbpMessage
(
@ApiParam
(
name
=
"imei"
,
value
=
"设备IMEI"
,
required
=
true
)
@RequestParam
(
value
=
"imei"
)
String
imei
,
@ApiParam
(
name
=
"time_begin"
,
value
=
"发生时间YYYY-MM-DD HH:mm:SS"
,
required
=
true
)
@RequestParam
(
value
=
"time_begin"
)
String
time_begin
,
@ApiParam
(
name
=
"dbp"
,
value
=
"舒张压"
,
required
=
true
)
@RequestParam
(
value
=
"dbp"
)
int
dbp
,
@ApiParam
(
name
=
"dbp_l"
,
value
=
"舒张压报警下限"
,
required
=
true
)
@RequestParam
(
value
=
"dbp_l"
)
int
dbp_l
,
@ApiParam
(
name
=
"sbp"
,
value
=
"收缩压"
,
required
=
true
)
@RequestParam
(
value
=
"sbp"
)
int
sbp
,
@ApiParam
(
name
=
"sbp_h"
,
value
=
"收缩压报警上限"
,
required
=
true
)
@RequestParam
(
value
=
"sbp_h"
)
int
sbp_h
)
{
zdryPushDataService
.
dbpMessage
(
imei
,
time_begin
,
dbp
,
dbp_l
,
sbp
,
sbp_h
);
}
}
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/UsersMapper.java
0 → 100644
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo
;
import
com.founder.commonutils.zdryEntity.Users
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-14
*/
@Mapper
@Component
public
interface
UsersMapper
extends
BaseMapper
<
Users
>
{
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/ZdryDbpMessageMapper.java
0 → 100644
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.founder.commonutils.ZdryApiEntity.DbpMessage
;
import
com.founder.commonutils.ZdryApiEntity.HeartrateMessage
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Mapper
@Component
public
interface
ZdryDbpMessageMapper
extends
BaseMapper
<
DbpMessage
>
{
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/ZdryHeartrateMessageMapper.java
0 → 100644
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.founder.commonutils.ZdryApiEntity.HeartrateMessage
;
import
com.founder.commonutils.ZdryApiEntity.LocationMessage
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Mapper
@Component
public
interface
ZdryHeartrateMessageMapper
extends
BaseMapper
<
HeartrateMessage
>
{
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/UsersMapper.xml
0 → 100644
View file @
bd3b33cd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.founder.zdryapi.mapper.UsersMapper"
>
</mapper>
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/ZdryDbpMessageMapper.xml
0 → 100644
View file @
bd3b33cd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.founder.zdryapi.mapper.ZdryDbpMessageMapper"
>
</mapper>
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/mapper/xml/ZdryHeartrateMessageMapper.xml
0 → 100644
View file @
bd3b33cd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.founder.zdryapi.mapper.ZdryHeartrateMessageMapper"
>
</mapper>
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/ZdryApiService.java
View file @
bd3b33cd
...
@@ -25,5 +25,9 @@ public interface ZdryApiService {
...
@@ -25,5 +25,9 @@ public interface ZdryApiService {
MapRestResult
deviceFenceTask
(
String
sbImei
,
String
name
,
String
time_begin
,
String
time_end
,
String
safe_area
,
int
gklx
);
MapRestResult
deviceFenceTask
(
String
sbImei
,
String
name
,
String
time_begin
,
String
time_end
,
String
safe_area
,
int
gklx
);
public
MapRestResult
FenceWarning
();
MapRestResult
FenceWarning
();
MapRestResult
wearFlag
();
MapRestResult
newLocationdataList
(
String
[]
imeis
);
}
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/ZdryPushDataService.java
View file @
bd3b33cd
...
@@ -15,4 +15,8 @@ public interface ZdryPushDataService {
...
@@ -15,4 +15,8 @@ public interface ZdryPushDataService {
void
message
(
int
type
,
String
deviceid
,
String
communityid
,
String
url
,
String
name
);
void
message
(
int
type
,
String
deviceid
,
String
communityid
,
String
url
,
String
name
);
void
locationMessage
(
String
imei
,
String
time_begin
,
boolean
is_reply
,
boolean
is_track
,
String
city
,
String
address
,
double
lon
,
double
lat
,
int
type
);
void
locationMessage
(
String
imei
,
String
time_begin
,
boolean
is_reply
,
boolean
is_track
,
String
city
,
String
address
,
double
lon
,
double
lat
,
int
type
);
void
heartrateMessage
(
String
imei
,
String
time_begin
,
int
heartrate
,
int
theshold_heartrate_h
,
int
theshold_heartrate_l
);
void
dbpMessage
(
String
imei
,
String
time_begin
,
int
dbp
,
int
dbp_l
,
int
sbp
,
int
sbp_h
);
}
}
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/impl/ZdryApiServiceImpl.java
View file @
bd3b33cd
...
@@ -7,10 +7,8 @@ import com.founder.commonutils.ZdryApiEntity.*;
...
@@ -7,10 +7,8 @@ import com.founder.commonutils.ZdryApiEntity.*;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.ResultCode
;
import
com.founder.commonutils.publicEntity.ResultCode
;
import
com.founder.zdryapi.mapper.ZdryApiMapper
;
import
com.founder.commonutils.zdryEntity.Users
;
import
com.founder.zdryapi.mapper.ZdryFenceTaskMapper
;
import
com.founder.zdryapi.mapper.*
;
import
com.founder.zdryapi.mapper.ZdryLocationMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryMessageMapper
;
import
com.founder.zdryapi.service.ZdryApiService
;
import
com.founder.zdryapi.service.ZdryApiService
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -75,6 +73,15 @@ public class ZdryApiServiceImpl implements ZdryApiService {
...
@@ -75,6 +73,15 @@ public class ZdryApiServiceImpl implements ZdryApiService {
@Autowired
@Autowired
private
ZdryLocationMessageMapper
zdryLocationMessageMapper
;
private
ZdryLocationMessageMapper
zdryLocationMessageMapper
;
@Autowired
private
UsersMapper
usersMapper
;
@Autowired
private
ZdryDbpMessageMapper
zdryDbpMessageMapper
;
@Autowired
private
ZdryHeartrateMessageMapper
zdryHeartrateMessageMapper
;
public
Device
getDevice
(
String
deviceId
){
public
Device
getDevice
(
String
deviceId
){
Device
device
=
new
Device
();
Device
device
=
new
Device
();
try
{
try
{
...
@@ -473,7 +480,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
...
@@ -473,7 +480,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
@Override
@Override
public
MapRestResult
FenceWarning
()
{
public
MapRestResult
FenceWarning
()
{
QueryWrapper
<
FenceTask
>
wrapperTask
=
new
QueryWrapper
<>();
QueryWrapper
<
FenceTask
>
wrapperTask
=
new
QueryWrapper
<>();
wrapperTask
.
ge
(
"xxsc_pdbz"
,
"0"
);
wrapperTask
.
eq
(
"xxsc_pdbz"
,
"0"
);
// 先查询出所有围栏任务中设备编号
// 先查询出所有围栏任务中设备编号
List
<
FenceTask
>
listImei
=
zdryFenceTaskMapper
.
selectList
(
wrapperTask
);
List
<
FenceTask
>
listImei
=
zdryFenceTaskMapper
.
selectList
(
wrapperTask
);
...
@@ -539,6 +546,135 @@ public class ZdryApiServiceImpl implements ZdryApiService {
...
@@ -539,6 +546,135 @@ public class ZdryApiServiceImpl implements ZdryApiService {
}
}
}
}
@Override
public
MapRestResult
wearFlag
()
{
QueryWrapper
<
Users
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"xxsc_pdbz"
,
"0"
);
// 先查询出所有围栏任务中设备编号
List
<
Users
>
listImei
=
usersMapper
.
selectList
(
wrapper
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
thirtyLater
=
now
.
minusMinutes
(
30
);
System
.
out
.
println
(
"30分钟前的时间:"
+
thirtyLater
);
// gk_heartrate心率和gk_dbp血压修改时间大于 当前时间减去30分钟则任务佩戴 不触发不推送 频率30分钟
if
(
listImei
.
size
()>
0
){
for
(
Users
data:
listImei
){
QueryWrapper
<
DbpMessage
>
wrapper1
=
new
QueryWrapper
<>();
wrapper1
.
ge
(
"gxsj"
,
thirtyLater
);
wrapper1
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
DbpMessage
dbpMessage
=
zdryDbpMessageMapper
.
selectOne
(
wrapper1
);
QueryWrapper
<
HeartrateMessage
>
wrapper2
=
new
QueryWrapper
<>();
wrapper2
.
ge
(
"gxsj"
,
thirtyLater
);
wrapper2
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
HeartrateMessage
heartrateMessage
=
zdryHeartrateMessageMapper
.
selectOne
(
wrapper2
);
if
(
null
!=
dbpMessage
&&
null
!=
heartrateMessage
){
// 查询对应用户
QueryWrapper
<
Users
>
wrapper3
=
new
QueryWrapper
<>();
wrapper3
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
Users
users
=
usersMapper
.
selectOne
(
wrapper3
);
// 根棍gk_users 是否佩戴
users
.
setWearFlag
(
1
);
usersMapper
.
updateById
(
users
);
// 根据血压和心率 是否在用户设定的范围内判定是否本人佩戴
if
(
dbpMessage
.
getSbp
()<
data
.
getSbpH
()&&
dbpMessage
.
getDbp
()>
data
.
getDbpL
()
&&
data
.
getThesholdHeartrateL
()<
heartrateMessage
.
getHeartrate
()&&
heartrateMessage
.
getHeartrate
()<
data
.
getThesholdHeartrateH
()){
// 查询对应用户
QueryWrapper
<
Users
>
wrapper4
=
new
QueryWrapper
<>();
wrapper4
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
Users
users4
=
usersMapper
.
selectOne
(
wrapper4
);
// 根棍gk_users 是否本人佩戴 1是 0否
users4
.
setIsmeWearFlag
(
1
);
usersMapper
.
updateById
(
users4
);
}
else
{
// 查询对应用户
QueryWrapper
<
Users
>
wrapper4
=
new
QueryWrapper
<>();
wrapper4
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
Users
users4
=
usersMapper
.
selectOne
(
wrapper4
);
// 根棍gk_users 是否本人佩戴 1是 0否
users4
.
setIsmeWearFlag
(
0
);
usersMapper
.
updateById
(
users4
);
}
}
else
{
// 查询对应用户
QueryWrapper
<
Users
>
wrapper3
=
new
QueryWrapper
<>();
wrapper3
.
eq
(
"sb_imei"
,
data
.
getSbImei
());
Users
users
=
usersMapper
.
selectOne
(
wrapper3
);
// 根棍gk_users 是否佩戴 1佩戴 0未佩戴
users
.
setWearFlag
(
0
);
usersMapper
.
updateById
(
users
);
}
}
}
else
{
return
MapRestResult
.
build
(
201
,
"参数不能为空"
,
"1"
,
"1"
);
}
return
MapRestResult
.
build
(
200
,
"是否佩戴是否本人佩戴定时任务完成"
,
"1"
,
"1"
);
}
@Override
public
MapRestResult
newLocationdataList
(
String
[]
imeis
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
for
(
String
imei
:
imeis
)
{
String
url
=
zdryUrl
+
"/api/device/"
+
imei
+
"/data/locationdata/"
;
String
resultString
=
restTemplate
.
getForEntity
(
url
,
String
.
class
).
getBody
();
if
(
StringUtils
.
isNotEmpty
(
resultString
))
{
JSONObject
result
=
JSONObject
.
parseObject
(
resultString
);
// 查看是否登录
if
(
result
.
containsKey
(
"error_code"
))
{
if
(
getToken
().
equals
(
"success"
))
{
resultString
=
restTemplate
.
getForEntity
(
url
,
String
.
class
).
getBody
();
}
else
{
return
MapRestResult
.
build
(
201
,
"登陆失败"
,
1
);
}
;
}
JSONObject
resultLast
=
JSONObject
.
parseObject
(
StringEscapeUtils
.
unescapeJava
(
resultString
));
if
(
resultLast
.
getString
(
"success"
).
equals
(
"true"
))
{
JSONObject
jsonObject
=
resultLast
.
getJSONObject
(
"obj"
);
//当前页返回的结果总数
if
(
null
!=
jsonObject
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
JSONObject
lastJsonObject
=
jsonObject
.
getJSONObject
(
"locationdata"
);
String
city
=
lastJsonObject
.
getString
(
"city"
);
String
address
=
lastJsonObject
.
getString
(
"address"
);
JSONObject
time_beginJson
=
lastJsonObject
.
getJSONObject
(
"time_begin"
);
JSONObject
point
=
lastJsonObject
.
getJSONObject
(
"point"
);
JSONArray
jsonArrayPoint
=
point
.
getJSONArray
(
"coordinates"
);
String
time_begin
=
time_beginJson
.
getString
(
"$date"
);
String
x
=
jsonArrayPoint
.
get
(
0
).
toString
();
String
y
=
jsonArrayPoint
.
get
(
1
).
toString
();
map
.
put
(
"设备编号"
,
imei
);
map
.
put
(
"城市"
,
city
);
map
.
put
(
"详细地址"
,
address
);
map
.
put
(
"经度"
,
x
);
map
.
put
(
"纬度"
,
y
);
map
.
put
(
"最新时间"
,
sf
.
format
(
new
Date
(
Long
.
parseLong
(
time_begin
)
-
TimeZone
.
getDefault
().
getRawOffset
()))
);
resultList
.
add
(
map
);
}
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
MapRestResult
.
build
(
200
,
"批量获取设备最新位置失败"
,
resultList
.
size
(),
e
.
getMessage
());
}
return
MapRestResult
.
build
(
200
,
"批量获取设备最新位置"
,
resultList
.
size
(),
resultList
);
}
public
String
getToken
()
{
public
String
getToken
()
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
MediaType
type
=
MediaType
.
parseMediaType
(
"application/json"
);
MediaType
type
=
MediaType
.
parseMediaType
(
"application/json"
);
...
...
serviceapi/zdryapi/src/main/java/com/founder/zdryapi/service/impl/ZdryPushDataServiceImpl.java
View file @
bd3b33cd
package
com
.
founder
.
zdryapi
.
service
.
impl
;
package
com
.
founder
.
zdryapi
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.founder.commonutils.ZdryApiEntity.DbpMessage
;
import
com.founder.commonutils.ZdryApiEntity.HeartrateMessage
;
import
com.founder.commonutils.ZdryApiEntity.LocationMessage
;
import
com.founder.commonutils.ZdryApiEntity.LocationMessage
;
import
com.founder.commonutils.ZdryApiEntity.Message
;
import
com.founder.commonutils.ZdryApiEntity.Message
;
import
com.founder.zdryapi.mapper.ZdryDbpMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryHeartrateMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryLocationMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryLocationMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryMessageMapper
;
import
com.founder.zdryapi.mapper.ZdryMessageMapper
;
import
com.founder.zdryapi.service.ZdryPushDataService
;
import
com.founder.zdryapi.service.ZdryPushDataService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/*
/*
*
*
* <p>
* <p>
...
@@ -28,6 +30,10 @@ public class ZdryPushDataServiceImpl implements ZdryPushDataService {
...
@@ -28,6 +30,10 @@ public class ZdryPushDataServiceImpl implements ZdryPushDataService {
private
ZdryMessageMapper
zdryMessageMapper
;
private
ZdryMessageMapper
zdryMessageMapper
;
@Autowired
@Autowired
private
ZdryLocationMessageMapper
zdryLocationMessageMapper
;
private
ZdryLocationMessageMapper
zdryLocationMessageMapper
;
@Autowired
private
ZdryHeartrateMessageMapper
zdryHeartrateMessageMapper
;
@Autowired
private
ZdryDbpMessageMapper
zdryDbpMessageMapper
;
@Override
@Override
public
void
message
(
int
type
,
String
deviceid
,
String
communityid
,
String
url
,
String
name
)
{
public
void
message
(
int
type
,
String
deviceid
,
String
communityid
,
String
url
,
String
name
)
{
...
@@ -106,4 +112,58 @@ public class ZdryPushDataServiceImpl implements ZdryPushDataService {
...
@@ -106,4 +112,58 @@ public class ZdryPushDataServiceImpl implements ZdryPushDataService {
zdryLocationMessageMapper
.
insert
(
locationMessage1
);
zdryLocationMessageMapper
.
insert
(
locationMessage1
);
}
}
}
}
@Override
public
void
heartrateMessage
(
String
imei
,
String
time_begin
,
int
heartrate
,
int
theshold_heartrate_h
,
int
theshold_heartrate_l
)
{
QueryWrapper
<
HeartrateMessage
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"sb_imei"
,
imei
);
// 查询
HeartrateMessage
heartrateMessage
=
zdryHeartrateMessageMapper
.
selectOne
(
wrapper
);
if
(
null
!=
heartrateMessage
){
heartrateMessage
.
setSbImei
(
imei
);
heartrateMessage
.
setTimeBegin
(
time_begin
);
heartrateMessage
.
setHeartrate
(
heartrate
);
heartrateMessage
.
setTheshold_heartrate_h
(
theshold_heartrate_h
);
heartrateMessage
.
setTheshold_heartrate_l
(
theshold_heartrate_l
);
// 执行更新
zdryHeartrateMessageMapper
.
updateById
(
heartrateMessage
);
}
else
{
HeartrateMessage
HeartrateMessage1
=
new
HeartrateMessage
();
HeartrateMessage1
.
setSbImei
(
imei
);
HeartrateMessage1
.
setTimeBegin
(
time_begin
);
HeartrateMessage1
.
setHeartrate
(
heartrate
);
HeartrateMessage1
.
setTheshold_heartrate_h
(
theshold_heartrate_h
);
HeartrateMessage1
.
setTheshold_heartrate_l
(
theshold_heartrate_l
);
// 插入数据
zdryHeartrateMessageMapper
.
insert
(
HeartrateMessage1
);
}
}
@Override
public
void
dbpMessage
(
String
imei
,
String
time_begin
,
int
dbp
,
int
dbp_l
,
int
sbp
,
int
sbp_h
)
{
QueryWrapper
<
DbpMessage
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"sb_imei"
,
imei
);
// 查询
DbpMessage
dbpMessage
=
zdryDbpMessageMapper
.
selectOne
(
wrapper
);
if
(
null
!=
dbpMessage
){
dbpMessage
.
setSbImei
(
imei
);
dbpMessage
.
setTimeBegin
(
time_begin
);
dbpMessage
.
setDbp
(
dbp
);
dbpMessage
.
setDbp_l
(
dbp_l
);
dbpMessage
.
setSbp
(
sbp
);
dbpMessage
.
setSbp_h
(
sbp_h
);
// 执行更新
zdryDbpMessageMapper
.
updateById
(
dbpMessage
);
}
else
{
DbpMessage
dbpMessage1
=
new
DbpMessage
();
dbpMessage1
.
setSbImei
(
imei
);
dbpMessage1
.
setTimeBegin
(
time_begin
);
dbpMessage1
.
setDbp
(
dbp
);
dbpMessage1
.
setDbp_l
(
dbp_l
);
dbpMessage1
.
setSbp
(
sbp
);
dbpMessage1
.
setSbp_h
(
sbp_h
);
// 插入数据
zdryDbpMessageMapper
.
insert
(
dbpMessage1
);
}
}
}
}
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