Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
70d2fc07
Commit
70d2fc07
authored
Jul 28, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信发送查询基础服务开关添加
parent
aad3037a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1267 additions
and
18 deletions
+1267
-18
common-lib/src/main/java/com/mortals/xhx/common/pdu/sms/SmsSetPdu.java
...c/main/java/com/mortals/xhx/common/pdu/sms/SmsSetPdu.java
+1132
-0
common-lib/src/main/java/com/mortals/xhx/feign/sms/ISmsSetFeign.java
...src/main/java/com/mortals/xhx/feign/sms/ISmsSetFeign.java
+99
-0
device-manager-ui/admin/src/components/Header.vue
device-manager-ui/admin/src/components/Header.vue
+3
-4
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
...ase/framework/listener/CustomerKeyExpirationListener.java
+31
-11
device-manager/src/main/java/com/mortals/xhx/module/alarm/service/impl/AlarmSmsSendServiceImpl.java
...hx/module/alarm/service/impl/AlarmSmsSendServiceImpl.java
+2
-3
No files found.
common-lib/src/main/java/com/mortals/xhx/common/pdu/sms/SmsSetPdu.java
0 → 100644
View file @
70d2fc07
This diff is collapsed.
Click to expand it.
common-lib/src/main/java/com/mortals/xhx/feign/sms/ISmsSetFeign.java
0 → 100644
View file @
70d2fc07
package
com.mortals.xhx.feign.sms
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.sms.SmsSetPdu
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.feign.IFeign
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 短信设置 Feign接口
* @author zxfei
* @date 2022-07-28
*/
@FeignClient
(
name
=
"base-manager"
,
path
=
"/base"
,
fallbackFactory
=
SmsSetFeignFallbackFactory
.
class
)
public
interface
ISmsSetFeign
extends
IFeign
{
/**
* 查看短信设置列表
*
* @param smsSetPdu
* @return
*/
@PostMapping
(
value
=
"/sms/set/list"
)
Rest
<
RespData
<
List
<
SmsSetPdu
>>>
list
(
@RequestBody
SmsSetPdu
smsSetPdu
);
/**
* 查看短信设置
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/sms/set/info"
)
Rest
<
SmsSetPdu
>
info
(
@RequestParam
(
value
=
"id"
)
Long
id
);
/**
* 删除短信设置
*
* @param ids
* @return
*/
@GetMapping
(
value
=
"/sms/set/delete"
)
Rest
<
Void
>
delete
(
Long
[]
ids
,
@RequestHeader
(
"Authorization"
)
String
authorization
);
/**
* 短信设置保存更新
*
* @param smsSetPdu
* @return
*/
@PostMapping
(
value
=
"/sms/set/save"
)
Rest
<
RespData
<
SmsSetPdu
>>
save
(
@RequestBody
SmsSetPdu
smsSetPdu
,
@RequestHeader
(
"Authorization"
)
String
authorization
);
}
@Slf4j
@Component
class
SmsSetFeignFallbackFactory
implements
FallbackFactory
<
ISmsSetFeign
>
{
@Override
public
ISmsSetFeign
create
(
Throwable
t
)
{
return
new
ISmsSetFeign
()
{
@Override
public
Rest
<
RespData
<
List
<
SmsSetPdu
>>>
list
(
SmsSetPdu
smsSetPdu
)
{
return
Rest
.
fail
(
"暂时无法获取短信设置列表,请稍后再试!"
);
}
@Override
public
Rest
<
SmsSetPdu
>
info
(
Long
id
)
{
return
Rest
.
fail
(
"暂时无法获取短信设置详细,请稍后再试!"
);
}
@Override
public
Rest
<
Void
>
delete
(
Long
[]
ids
,
String
authorization
)
{
return
Rest
.
fail
(
"暂时无法删除短信设置,请稍后再试!"
);
}
@Override
public
Rest
<
RespData
<
SmsSetPdu
>>
save
(
SmsSetPdu
smsSetPdu
,
String
authorization
)
{
return
Rest
.
fail
(
"暂时无法保存短信设置,请稍后再试!"
);
}
};
}
}
device-manager-ui/admin/src/components/Header.vue
View file @
70d2fc07
...
...
@@ -16,7 +16,7 @@
<li
v-for=
'item in menu'
:key=
'item.id'
>
<router-link
:to=
"item.path"
:active=
'submenu.path === item.path'
:title=
"item.name"
>
<i
:class=
"'el-icon-'+item.icon"
></i>
{{
item
.
name
}}
{{
item
.
name
}}
</router-link>
</li>
</ul>
...
...
@@ -228,9 +228,8 @@ export default {
//background: #1890ff;
color: #fff;
list-style-type:none;
border-bottom:3px solid #fff;
padding-bottom: 2px;
border-bottom:3px solid #fff;
padding-bottom: 2px;
}
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
View file @
70d2fc07
...
...
@@ -3,9 +3,13 @@ package com.mortals.xhx.base.framework.listener;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.util.UuidUtil
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.sms.SmsSetPdu
;
import
com.mortals.xhx.feign.sms.ISmsSetFeign
;
import
com.mortals.xhx.module.alarm.model.AlarmConfigEntity
;
import
com.mortals.xhx.module.alarm.model.AlarmConfigQuery
;
import
com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity
;
...
...
@@ -28,6 +32,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.ObjectUtils
;
import
java.util.Date
;
import
java.util.List
;
/**
* 离线通知
...
...
@@ -52,6 +57,8 @@ public class CustomerKeyExpirationListener implements MessageListener {
private
DeviceAlarmInfoService
deviceAlarmInfoService
;
@Autowired
private
AlarmSmsSendService
alarmSmsSendService
;
@Autowired
private
ISmsSetFeign
smsSetFeign
;
@Override
...
...
@@ -78,18 +85,31 @@ public class CustomerKeyExpirationListener implements MessageListener {
if
(!
ObjectUtils
.
isEmpty
(
alarmConfigEntity
))
{
if
(
alarmConfigEntity
.
getAlarmPusW1ay
()==
AlarmPusW1ayEnum
.
短信
.
getValue
()){
// TODO: 2022/7/4 发送短信
DeviceAlarmInfoEntity
deviceAlarmInfoEntity
=
deviceAlarmInfoService
.
selectOne
(
new
DeviceAlarmInfoQuery
().
alarmDevice
(
deviceEntity
.
getId
()));
if
(!
ObjectUtils
.
isEmpty
(
deviceAlarmInfoEntity
)){
AlarmSmsSendEntity
alarmSmsSendEntity
=
new
AlarmSmsSendEntity
();
alarmSmsSendEntity
.
initAttrValue
();
alarmSmsSendEntity
.
setId
(
IdUtil
.
getSnowflake
().
nextId
());
alarmSmsSendEntity
.
setMobile
(
deviceAlarmInfoEntity
.
getReceivePersonnelTelephone
());
alarmSmsSendEntity
.
setReceiver
(
deviceAlarmInfoEntity
.
getAlarmReceivePersonnel
());
alarmSmsSendEntity
.
setSendMess
(
deviceAlarmInfoEntity
.
getAlarmContent
());
alarmSmsSendEntity
.
setSendStatus
(
SendStatusEnum
.
未发送
.
getValue
());
alarmSmsSendService
.
save
(
alarmSmsSendEntity
,
null
);
}
Rest
<
RespData
<
List
<
SmsSetPdu
>>>
respDataRest
=
smsSetFeign
.
list
(
new
SmsSetPdu
().
siteId
(
deviceEntity
.
getSiteId
()));
if
(
respDataRest
.
getCode
()==
YesNoEnum
.
YES
.
getValue
()){
List
<
SmsSetPdu
>
data
=
respDataRest
.
getData
().
getData
();
if
(!
ObjectUtils
.
isEmpty
(
data
)){
Integer
messageoff
=
data
.
get
(
0
).
getMessageoff
();
if
(
messageoff
==
YesNoEnum
.
YES
.
getValue
()){
// todo 发送短信
DeviceAlarmInfoEntity
deviceAlarmInfoEntity
=
deviceAlarmInfoService
.
selectOne
(
new
DeviceAlarmInfoQuery
().
alarmDevice
(
deviceEntity
.
getId
()));
if
(!
ObjectUtils
.
isEmpty
(
deviceAlarmInfoEntity
)){
AlarmSmsSendEntity
alarmSmsSendEntity
=
new
AlarmSmsSendEntity
();
alarmSmsSendEntity
.
initAttrValue
();
alarmSmsSendEntity
.
setId
(
IdUtil
.
getSnowflake
().
nextId
());
alarmSmsSendEntity
.
setMobile
(
deviceAlarmInfoEntity
.
getReceivePersonnelTelephone
());
alarmSmsSendEntity
.
setReceiver
(
deviceAlarmInfoEntity
.
getAlarmReceivePersonnel
());
alarmSmsSendEntity
.
setSendMess
(
deviceAlarmInfoEntity
.
getAlarmContent
());
alarmSmsSendEntity
.
setSendStatus
(
SendStatusEnum
.
未发送
.
getValue
());
alarmSmsSendService
.
save
(
alarmSmsSendEntity
,
null
);
}
}
else
{
}
}
}
}
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/alarm/service/impl/AlarmSmsSendServiceImpl.java
View file @
70d2fc07
package
com.mortals.xhx.module.alarm.service.impl
;
import
com.mortals.xhx.queue.TbQueueMsg
;
import
lombok.Getter
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.module.alarm.dao.AlarmSmsSendDao
;
import
com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity
;
import
com.mortals.xhx.module.alarm.service.AlarmSmsSendService
;
import
org.springframework.stereotype.Service
;
import
java.util.Queue
;
import
java.util.concurrent.LinkedBlockingQueue
;
...
...
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