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
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
39 deletions
+131
-39
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
+39
-6
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+5
-5
SmsServiceImpl.java
...c/main/java/share/system/service/impl/SmsServiceImpl.java
+60
-22
No files found.
share-common/src/main/java/share/common/enums/SmsTypeEnum.java
View file @
f71e95e8
...
@@ -15,6 +15,7 @@ public enum SmsTypeEnum {
...
@@ -15,6 +15,7 @@ public enum SmsTypeEnum {
SMS_ORDER_END_TEMP
(
5
,
"sms.order.end.template"
,
"订单即将结束提示短信"
),
SMS_ORDER_END_TEMP
(
5
,
"sms.order.end.template"
,
"订单即将结束提示短信"
),
SMS_CLEAN_RECORDS_STOP_TEMP
(
6
,
"sms.clean.records.stop.template"
,
"保洁任务中断短信提醒"
),
SMS_CLEAN_RECORDS_STOP_TEMP
(
6
,
"sms.clean.records.stop.template"
,
"保洁任务中断短信提醒"
),
SMS_DEVICE_ABNORMAL_TEMP
(
7
,
"sms.device.abnormal.template"
,
"设备状态异常变更短信提醒"
),
SMS_DEVICE_ABNORMAL_TEMP
(
7
,
"sms.device.abnormal.template"
,
"设备状态异常变更短信提醒"
),
SMS_DEVICE_GATEWAY_TEMP
(
8
,
"sms.device.gateway.template"
,
"网关设备离线提醒短信"
),
;
;
private
Integer
code
;
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;
...
@@ -8,8 +8,8 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
public
enum
YesNoEnum
{
public
enum
YesNoEnum
{
yes
(
1
,
true
,
"是"
,
"激活"
,
"正常"
,
""
,
""
,
""
,
""
,
""
,
""
),
yes
(
1
,
true
,
"是"
,
"激活"
,
"正常"
,
"
Y
"
,
""
,
""
,
""
,
""
,
""
),
no
(
0
,
false
,
"否"
,
"冻结"
,
"异常"
,
""
,
""
,
""
,
""
,
""
,
""
);
no
(
0
,
false
,
"否"
,
"冻结"
,
"异常"
,
"
N
"
,
""
,
""
,
""
,
""
,
""
);
private
Integer
index
;
private
Integer
index
;
...
...
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
View file @
f71e95e8
...
@@ -2,9 +2,12 @@ package share.quartz.task;
...
@@ -2,9 +2,12 @@ package share.quartz.task;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
share.system.domain.DeviceGateway
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.DeviceStatusLogService
;
import
share.system.service.DeviceStatusLogService
;
import
java.util.List
;
/**
/**
* @className: share.quartz.task.DeviceTask
* @className: share.quartz.task.DeviceTask
* @description: 设备定时任务
* @description: 设备定时任务
...
@@ -32,9 +35,12 @@ public class DeviceTask {
...
@@ -32,9 +35,12 @@ public class DeviceTask {
*/
*/
public
void
deviceGatewayStatusMonitor
()
{
public
void
deviceGatewayStatusMonitor
()
{
// 更新网关状态
// 更新网关状态
boolean
b
=
deviceGatewayService
.
deviceGatewayStatusMonitor
();
List
<
DeviceGateway
>
list
=
deviceGatewayService
.
deviceGatewayStatusMonitor
();
if
(
b
)
{
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>
...
@@ -64,9 +64,16 @@ public interface DeviceGatewayService extends IService<DeviceGateway>
/**
/**
* 网关状态监控
* 网关状态监控
* @return
* @return
离线发送短信提醒的网关对象
*/
*/
boolean
deviceGatewayStatusMonitor
();
List
<
DeviceGateway
>
deviceGatewayStatusMonitor
();
TableDataInfo
deviceGatewayPage
(
DeviceGatewayDto
deviceGatewayDto
);
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;
...
@@ -2,6 +2,7 @@ package share.system.service;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
share.system.domain.DeviceGateway
;
import
share.system.domain.DeviceStatusLog
;
import
share.system.domain.DeviceStatusLog
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
...
@@ -60,5 +61,11 @@ public interface SmsService {
...
@@ -60,5 +61,11 @@ public interface SmsService {
*/
*/
boolean
sendSmsDeviceAbnormal
(
String
phone
,
DeviceStatusLog
deviceStatusLog
,
SStore
store
,
SRoom
room
);
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;
...
@@ -17,18 +17,18 @@ import share.common.core.page.PageDomain;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableSupport
;
import
share.common.core.page.TableSupport
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
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
share.system.domain.Device
;
import
share.system.domain.*
;
import
share.system.domain.DeviceGatewayDto
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.DeviceGatewayVo
;
import
share.system.domain.vo.DeviceGatewayVo
;
import
share.system.domain.vo.DeviceVo
;
import
share.system.domain.vo.DeviceVo
;
import
share.system.mapper.DeviceGatewayMapper
;
import
share.system.mapper.DeviceGatewayMapper
;
import
share.system.domain.DeviceGateway
;
import
share.system.mapper.SStoreMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.ISysConfigService
;
import
share.system.service.SmsService
;
/**
/**
* 设备网关信息Service业务层处理
* 设备网关信息Service业务层处理
...
@@ -46,6 +46,11 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
...
@@ -46,6 +46,11 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
private
Integer
deviceGatewayLastReportTime
;
private
Integer
deviceGatewayLastReportTime
;
@Autowired
@Autowired
private
SStoreMapper
storeMapper
;
private
SStoreMapper
storeMapper
;
@Autowired
private
ISysConfigService
sysConfigService
;
@Autowired
private
SmsService
smsService
;
/**
/**
* 查询设备网关信息
* 查询设备网关信息
...
@@ -126,19 +131,29 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
...
@@ -126,19 +131,29 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
* @return
* @return
*/
*/
@Override
@Override
public
boolean
deviceGatewayStatusMonitor
()
{
public
List
<
DeviceGateway
>
deviceGatewayStatusMonitor
()
{
List
<
DeviceGateway
>
list
=
deviceGatewayMapper
.
selectDeviceGatewayList
(
new
DeviceGatewayDto
());
List
<
DeviceGateway
>
list
=
deviceGatewayMapper
.
selectDeviceGatewayList
(
new
DeviceGatewayDto
());
List
<
DeviceGateway
>
sendList
=
new
ArrayList
<>();
if
(
list
.
size
()
>
0
)
{
list
.
stream
().
forEach
(
gateway
->
{
list
.
stream
().
forEach
(
gateway
->
{
Date
lastReportDate
=
gateway
.
getLastReportDate
();
Date
lastReportDate
=
gateway
.
getLastReportDate
();
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceGatewayLastReportTime
);
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceGatewayLastReportTime
);
String
status
=
gateway
.
getStatus
();
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
}
else
{
}
else
{
if
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
().
equals
(
status
))
{
// 如果网关之前在线,变更离线需要发送短信提醒
sendList
.
add
(
gateway
);
}
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_OFFLINE
.
getCode
());
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_OFFLINE
.
getCode
());
}
}
});
});
return
this
.
updateBatchById
(
list
);
// 更新数据
this
.
updateBatchById
(
list
);
}
return
sendList
;
}
}
@Override
@Override
...
@@ -169,6 +184,24 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
...
@@ -169,6 +184,24 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
return
tableDataInfo
;
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
)
{
private
List
<
DeviceGatewayVo
>
convertDosToVos
(
List
<
DeviceGateway
>
deviceGateways
)
{
List
<
DeviceGatewayVo
>
voList
=
new
ArrayList
<>();
List
<
DeviceGatewayVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
deviceGateways
))
{
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 {
...
@@ -131,11 +131,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
if
(
device
!=
null
)
{
if
(
device
!=
null
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
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
()))
{
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 {
...
@@ -153,11 +153,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
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
()))
{
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 {
...
@@ -182,7 +182,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
}
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
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
...
@@ -16,11 +16,13 @@ import share.common.core.redis.RedisUtil;
...
@@ -16,11 +16,13 @@ import share.common.core.redis.RedisUtil;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.SmsStatusEnum
;
import
share.common.enums.SmsStatusEnum
;
import
share.common.enums.SmsTypeEnum
;
import
share.common.enums.SmsTypeEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.SmsUtil
;
import
share.common.utils.SmsUtil
;
import
share.system.domain.*
;
import
share.system.domain.*
;
import
share.system.mapper.SysConfigMapper
;
import
share.system.mapper.SysConfigMapper
;
import
share.system.service.ISysConfigService
;
import
share.system.service.SConsumerService
;
import
share.system.service.SConsumerService
;
import
share.system.service.SmsLogService
;
import
share.system.service.SmsLogService
;
import
share.system.service.SmsService
;
import
share.system.service.SmsService
;
...
@@ -64,7 +66,7 @@ public class SmsServiceImpl implements SmsService {
...
@@ -64,7 +66,7 @@ public class SmsServiceImpl implements SmsService {
@Autowired
@Autowired
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
@Autowired
private
SysConfigMapper
sysConfigMapper
;
private
ISysConfigService
sysConfigService
;
@Autowired
@Autowired
private
SmsLogService
smsLogService
;
private
SmsLogService
smsLogService
;
...
@@ -103,34 +105,46 @@ public class SmsServiceImpl implements SmsService {
...
@@ -103,34 +105,46 @@ public class SmsServiceImpl implements SmsService {
@Override
@Override
public
boolean
sendSmsCleanRecords
(
String
phone
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsCleanRecords
(
String
phone
,
SStore
store
,
SRoom
room
)
{
// 是否发送保洁短信
String
isSendSms
=
sysConfigService
.
selectConfigByKey
(
"system.isclean.send.sms"
);
if
(
YesNoEnum
.
yes
.
getDisplay_4
().
equals
(
isSendSms
))
{
// 通过配置获取短信模版
// 通过配置获取短信模版
SysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP
.
getValue
());
String
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
String
content
=
MessageFormat
.
format
(
configValue
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
}
else
{
return
Boolean
.
TRUE
;
}
}
}
@Override
@Override
public
boolean
sendSmsCleanRecordsRemind15
(
String
phone
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsCleanRecordsRemind15
(
String
phone
,
SStore
store
,
SRoom
room
)
{
// 是否发送保洁短信
String
isSendSms
=
sysConfigService
.
selectConfigByKey
(
"system.isclean.send.sms"
);
if
(
YesNoEnum
.
yes
.
getDisplay_4
().
equals
(
isSendSms
))
{
// 通过配置获取短信模版
// 通过配置获取短信模版
SysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP_15
.
getValue
());
String
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP_15
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
String
content
=
MessageFormat
.
format
(
configValue
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP_15
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_TEMP_15
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
}
else
{
return
Boolean
.
TRUE
;
}
}
}
@Override
@Override
public
boolean
sendSmsOrderStartRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsOrderStartRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
// 通过配置获取短信模版
// 通过配置获取短信模版
S
ysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_ORDER_START_TEMP
.
getValue
());
S
tring
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_ORDER_START_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
room
.
getName
(),
store
.
getAddress
());
String
content
=
MessageFormat
.
format
(
config
Value
,
room
.
getName
(),
store
.
getAddress
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_ORDER_START_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_ORDER_START_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
...
@@ -140,9 +154,9 @@ public class SmsServiceImpl implements SmsService {
...
@@ -140,9 +154,9 @@ public class SmsServiceImpl implements SmsService {
@Override
@Override
public
boolean
sendSmsOrderEndRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsOrderEndRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
// 通过配置获取短信模版
// 通过配置获取短信模版
S
ysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_ORDER_END_TEMP
.
getValue
());
S
tring
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_ORDER_END_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
room
.
getName
());
String
content
=
MessageFormat
.
format
(
config
Value
,
room
.
getName
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_ORDER_END_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_ORDER_END_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
...
@@ -151,22 +165,28 @@ public class SmsServiceImpl implements SmsService {
...
@@ -151,22 +165,28 @@ public class SmsServiceImpl implements SmsService {
@Override
@Override
public
boolean
sendSmsCleanRecordsStopRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsCleanRecordsStopRemind
(
String
phone
,
SStore
store
,
SRoom
room
)
{
// 是否发送保洁短信
String
isSendSms
=
sysConfigService
.
selectConfigByKey
(
"system.isclean.send.sms"
);
if
(
YesNoEnum
.
yes
.
getDisplay_4
().
equals
(
isSendSms
))
{
// 通过配置获取短信模版
// 通过配置获取短信模版
SysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_STOP_TEMP
.
getValue
());
String
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_CLEAN_RECORDS_STOP_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
String
content
=
MessageFormat
.
format
(
configValue
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_STOP_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_CLEAN_RECORDS_STOP_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
}
else
{
return
Boolean
.
TRUE
;
}
}
}
@Override
@Override
public
boolean
sendSmsDeviceAbnormal
(
String
phone
,
DeviceStatusLog
deviceStatusLog
,
SStore
store
,
SRoom
room
)
{
public
boolean
sendSmsDeviceAbnormal
(
String
phone
,
DeviceStatusLog
deviceStatusLog
,
SStore
store
,
SRoom
room
)
{
// 通过配置获取短信模版
// 通过配置获取短信模版
S
ysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_DEVICE_ABNORMAL_TEMP
.
getValue
());
S
tring
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_DEVICE_ABNORMAL_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
String
content
=
MessageFormat
.
format
(
config
.
getConfigValue
()
,
store
.
getName
(),
room
.
getName
(),
String
content
=
MessageFormat
.
format
(
config
Value
,
store
.
getName
(),
room
.
getName
(),
DeviceStatusEnum
.
getNameStr
(
deviceStatusLog
.
getStatus
()));
DeviceStatusEnum
.
getNameStr
(
deviceStatusLog
.
getStatus
()));
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_DEVICE_ABNORMAL_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_DEVICE_ABNORMAL_TEMP
.
getCode
(),
content
,
store
.
getId
(),
room
.
getId
());
}
else
{
}
else
{
...
@@ -174,12 +194,30 @@ public class SmsServiceImpl implements SmsService {
...
@@ -174,12 +194,30 @@ public class SmsServiceImpl implements SmsService {
}
}
}
}
@Override
public
boolean
sendSmsByGatewayOff
(
String
phone
,
DeviceGateway
deviceGateway
,
SStore
store
)
{
// 是否发送网关离线提醒短信
String
isSendSms
=
sysConfigService
.
selectConfigByKey
(
"system.gateway.issend.sms"
);
if
(
YesNoEnum
.
yes
.
getDisplay_4
().
equals
(
isSendSms
))
{
// 通过配置获取短信模版
String
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_DEVICE_GATEWAY_TEMP
.
getValue
());
if
(
StrUtil
.
isNotEmpty
(
configValue
))
{
String
content
=
MessageFormat
.
format
(
configValue
,
store
.
getName
(),
deviceGateway
.
getDevId
());
return
sendSms
(
phone
,
SmsTypeEnum
.
SMS_DEVICE_GATEWAY_TEMP
.
getCode
(),
content
,
store
.
getId
(),
null
);
}
else
{
return
Boolean
.
FALSE
;
}
}
else
{
return
Boolean
.
TRUE
;
}
}
private
String
getSmsContent
(
String
phone
,
Integer
tag
)
{
private
String
getSmsContent
(
String
phone
,
Integer
tag
)
{
// 验证码 特殊处理 code
// 验证码 特殊处理 code
if
(
tag
.
equals
(
SmsTypeEnum
.
SMS_CODE_TEMP
.
getCode
()))
{
if
(
tag
.
equals
(
SmsTypeEnum
.
SMS_CODE_TEMP
.
getCode
()))
{
// 通过配置获取短信模版
// 通过配置获取短信模版
S
ysConfig
config
=
sysConfigMapper
.
checkConfigKeyUnique
(
SmsTypeEnum
.
SMS_CODE_TEMP
.
getValue
());
S
tring
configValue
=
sysConfigService
.
selectConfigByKey
(
SmsTypeEnum
.
SMS_CODE_TEMP
.
getValue
());
if
(
config
!=
null
)
{
if
(
StrUtil
.
isNotEmpty
(
configValue
)
)
{
// 获取短信验证码过期时间
// 获取短信验证码过期时间
String
codeExpireStr
=
Constants
.
CONFIG_KEY_SMS_CODE_EXPIRE
;
String
codeExpireStr
=
Constants
.
CONFIG_KEY_SMS_CODE_EXPIRE
;
if
(
StrUtil
.
isBlank
(
codeExpireStr
)
||
Integer
.
parseInt
(
codeExpireStr
)
==
0
)
{
if
(
StrUtil
.
isBlank
(
codeExpireStr
)
||
Integer
.
parseInt
(
codeExpireStr
)
==
0
)
{
...
@@ -189,7 +227,7 @@ public class SmsServiceImpl implements SmsService {
...
@@ -189,7 +227,7 @@ public class SmsServiceImpl implements SmsService {
Integer
code
=
BaseUtil
.
randomCount
(
111111
,
999999
);
Integer
code
=
BaseUtil
.
randomCount
(
111111
,
999999
);
// 将验证码存入redis
// 将验证码存入redis
redisUtil
.
set
(
sConsumerService
.
getValidateCodeRedisKey
(
phone
),
code
,
Long
.
valueOf
(
codeExpireStr
),
TimeUnit
.
MINUTES
);
redisUtil
.
set
(
sConsumerService
.
getValidateCodeRedisKey
(
phone
),
code
,
Long
.
valueOf
(
codeExpireStr
),
TimeUnit
.
MINUTES
);
return
MessageFormat
.
format
(
config
.
getConfigValue
()
,
code
.
toString
(),
codeExpireStr
);
return
MessageFormat
.
format
(
config
Value
,
code
.
toString
(),
codeExpireStr
);
}
}
}
// 其他短信内容处理
}
// 其他短信内容处理
...
...
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