Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
f71e95e8
Commit
f71e95e8
authored
Mar 01, 2024
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加保洁短信提醒控制开关,添加网关离线短信提醒,去掉设备操作服务中的开门和取电延时操作
parent
f4c56ee8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
58 deletions
+150
-58
SmsTypeEnum.java
...-common/src/main/java/share/common/enums/SmsTypeEnum.java
+1
-0
YesNoEnum.java
share-common/src/main/java/share/common/enums/YesNoEnum.java
+2
-2
DeviceTask.java
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
+8
-2
DeviceGatewayService.java
.../main/java/share/system/service/DeviceGatewayService.java
+9
-2
SmsService.java
...system/src/main/java/share/system/service/SmsService.java
+7
-0
DeviceGatewayServiceImpl.java
...a/share/system/service/impl/DeviceGatewayServiceImpl.java
+49
-16
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+5
-5
SmsServiceImpl.java
...c/main/java/share/system/service/impl/SmsServiceImpl.java
+69
-31
No files found.
share-common/src/main/java/share/common/enums/SmsTypeEnum.java
View file @
f71e95e8
...
...
@@ -15,6 +15,7 @@ public enum SmsTypeEnum {
SMS_ORDER_END_TEMP
(
5
,
"sms.order.end.template"
,
"订单即将结束提示短信"
),
SMS_CLEAN_RECORDS_STOP_TEMP
(
6
,
"sms.clean.records.stop.template"
,
"保洁任务中断短信提醒"
),
SMS_DEVICE_ABNORMAL_TEMP
(
7
,
"sms.device.abnormal.template"
,
"设备状态异常变更短信提醒"
),
SMS_DEVICE_GATEWAY_TEMP
(
8
,
"sms.device.gateway.template"
,
"网关设备离线提醒短信"
),
;
private
Integer
code
;
...
...
share-common/src/main/java/share/common/enums/YesNoEnum.java
View file @
f71e95e8
...
...
@@ -8,8 +8,8 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
public
enum
YesNoEnum
{
yes
(
1
,
true
,
"是"
,
"激活"
,
"正常"
,
""
,
""
,
""
,
""
,
""
,
""
),
no
(
0
,
false
,
"否"
,
"冻结"
,
"异常"
,
""
,
""
,
""
,
""
,
""
,
""
);
yes
(
1
,
true
,
"是"
,
"激活"
,
"正常"
,
"
Y
"
,
""
,
""
,
""
,
""
,
""
),
no
(
0
,
false
,
"否"
,
"冻结"
,
"异常"
,
"
N
"
,
""
,
""
,
""
,
""
,
""
);
private
Integer
index
;
...
...
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
View file @
f71e95e8
...
...
@@ -2,9 +2,12 @@ package share.quartz.task;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
share.system.domain.DeviceGateway
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.DeviceStatusLogService
;
import
java.util.List
;
/**
* @className: share.quartz.task.DeviceTask
* @description: 设备定时任务
...
...
@@ -32,9 +35,12 @@ public class DeviceTask {
*/
public
void
deviceGatewayStatusMonitor
()
{
// 更新网关状态
boolean
b
=
deviceGatewayService
.
deviceGatewayStatusMonitor
();
if
(
b
)
{
List
<
DeviceGateway
>
list
=
deviceGatewayService
.
deviceGatewayStatusMonitor
();
if
(
list
.
size
()
>
0
)
{
// 离线网关,发送短信提醒
list
.
forEach
(
deviceGateway
->
{
deviceGatewayService
.
sendSmsByStatusOff
(
deviceGateway
);
});
}
}
...
...
share-system/src/main/java/share/system/service/DeviceGatewayService.java
View file @
f71e95e8
...
...
@@ -64,9 +64,16 @@ public interface DeviceGatewayService extends IService<DeviceGateway>
/**
* 网关状态监控
* @return
* @return
离线发送短信提醒的网关对象
*/
boolean
deviceGatewayStatusMonitor
();
List
<
DeviceGateway
>
deviceGatewayStatusMonitor
();
TableDataInfo
deviceGatewayPage
(
DeviceGatewayDto
deviceGatewayDto
);
/**
* 网关离线发送短信提醒
* @param deviceGateway
* @return
*/
boolean
sendSmsByStatusOff
(
DeviceGateway
deviceGateway
);
}
share-system/src/main/java/share/system/service/SmsService.java
View file @
f71e95e8
...
...
@@ -2,6 +2,7 @@ package share.system.service;
import
cn.hutool.json.JSONArray
;
import
share.system.domain.DeviceGateway
;
import
share.system.domain.DeviceStatusLog
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
...
...
@@ -60,5 +61,11 @@ public interface SmsService {
*/
boolean
sendSmsDeviceAbnormal
(
String
phone
,
DeviceStatusLog
deviceStatusLog
,
SStore
store
,
SRoom
room
);
/**
* 网关离线,发送短信通知
* @return
*/
boolean
sendSmsByGatewayOff
(
String
phone
,
DeviceGateway
deviceGateway
,
SStore
store
);
}
share-system/src/main/java/share/system/service/impl/DeviceGatewayServiceImpl.java
View file @
f71e95e8
...
...
@@ -17,18 +17,18 @@ import share.common.core.page.PageDomain;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableSupport
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.Device
;
import
share.system.domain.DeviceGatewayDto
;
import
share.system.domain.SStore
;
import
share.system.domain.*
;
import
share.system.domain.vo.DeviceGatewayVo
;
import
share.system.domain.vo.DeviceVo
;
import
share.system.mapper.DeviceGatewayMapper
;
import
share.system.domain.DeviceGateway
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.ISysConfigService
;
import
share.system.service.SmsService
;
/**
* 设备网关信息Service业务层处理
...
...
@@ -46,6 +46,11 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
private
Integer
deviceGatewayLastReportTime
;
@Autowired
private
SStoreMapper
storeMapper
;
@Autowired
private
ISysConfigService
sysConfigService
;
@Autowired
private
SmsService
smsService
;
/**
* 查询设备网关信息
...
...
@@ -126,19 +131,29 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
* @return
*/
@Override
public
boolean
deviceGatewayStatusMonitor
()
{
public
List
<
DeviceGateway
>
deviceGatewayStatusMonitor
()
{
List
<
DeviceGateway
>
list
=
deviceGatewayMapper
.
selectDeviceGatewayList
(
new
DeviceGatewayDto
());
list
.
stream
().
forEach
(
gateway
->
{
Date
lastReportDate
=
gateway
.
getLastReportDate
();
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceGatewayLastReportTime
);
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
}
else
{
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_OFFLINE
.
getCode
());
}
});
return
this
.
updateBatchById
(
list
);
List
<
DeviceGateway
>
sendList
=
new
ArrayList
<>();
if
(
list
.
size
()
>
0
)
{
list
.
stream
().
forEach
(
gateway
->
{
Date
lastReportDate
=
gateway
.
getLastReportDate
();
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceGatewayLastReportTime
);
String
status
=
gateway
.
getStatus
();
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
}
else
{
if
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
().
equals
(
status
))
{
// 如果网关之前在线,变更离线需要发送短信提醒
sendList
.
add
(
gateway
);
}
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_OFFLINE
.
getCode
());
}
});
// 更新数据
this
.
updateBatchById
(
list
);
}
return
sendList
;
}
@Override
...
...
@@ -169,6 +184,24 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
return
tableDataInfo
;
}
/**
* 网关离线发送短信提醒
* @param deviceGateway 网关对象
* @return
*/
@Override
public
boolean
sendSmsByStatusOff
(
DeviceGateway
deviceGateway
)
{
LambdaQueryWrapper
<
SStore
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
eq
(
SStore:
:
getDeviceGroup
,
deviceGateway
.
getGroup
());
SStore
store
=
storeMapper
.
selectOne
(
queryWrapper
);
if
(
store
!=
null
)
{
String
phone
=
sysConfigService
.
selectConfigByKey
(
"system.device.phone"
);
// 发送短信提醒
return
smsService
.
sendSmsByGatewayOff
(
phone
,
deviceGateway
,
store
);
}
return
Boolean
.
FALSE
;
}
private
List
<
DeviceGatewayVo
>
convertDosToVos
(
List
<
DeviceGateway
>
deviceGateways
)
{
List
<
DeviceGatewayVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
deviceGateways
))
{
...
...
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
f71e95e8
...
...
@@ -131,11 +131,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
if
(
device
!=
null
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
deviceParam
.
getOpType
(),
true
,
2L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
deviceParam
.
getOpType
(),
false
,
0
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
deviceParam
.
getOpType
(),
true
,
2L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
deviceParam
.
getOpType
(),
false
,
0
);
}
}
}
...
...
@@ -153,11 +153,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
OPEN_DOOR
.
getCode
(),
false
,
0
L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
OPEN_DOOR
.
getCode
(),
false
,
0
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
true
,
4L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
false
,
0
);
}
}
...
...
@@ -182,7 +182,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
true
,
4L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
false
,
0
);
}
}
...
...
share-system/src/main/java/share/system/service/impl/SmsServiceImpl.java
View file @
f71e95e8
This diff is collapsed.
Click to expand it.
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