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
6cd87910
Commit
6cd87910
authored
Dec 09, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加巴中经开区windows shell
parent
31e54e96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
17 deletions
+37
-17
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceDownMsgService.java
...s/xhx/daemon/applicationservice/DeviceDownMsgService.java
+8
-1
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
...ava/com/mortals/xhx/module/device/model/DeviceEntity.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceLogServiceImpl.java
.../xhx/module/device/service/impl/DeviceLogServiceImpl.java
+5
-4
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+23
-11
No files found.
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceDownMsgService.java
View file @
6cd87910
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
import
com.mortals.xhx.busiz.req.DeviceMsgReq
;
import
com.mortals.xhx.busiz.req.DeviceMsgReq
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
...
@@ -50,6 +51,10 @@ public class DeviceDownMsgService implements IApplicationStartedService {
...
@@ -50,6 +51,10 @@ public class DeviceDownMsgService implements IApplicationStartedService {
public
void
start
()
{
public
void
start
()
{
log
.
info
(
"DeviceDownMsgService start"
);
log
.
info
(
"DeviceDownMsgService start"
);
ThreadPool
.
getInstance
().
init
(
10
);
Thread
sendThread
=
new
Thread
(
new
Runnable
()
{
Thread
sendThread
=
new
Thread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -111,7 +116,9 @@ public class DeviceDownMsgService implements IApplicationStartedService {
...
@@ -111,7 +116,9 @@ public class DeviceDownMsgService implements IApplicationStartedService {
}
}
});
});
sendThread
.
start
();
ThreadPool
.
getInstance
().
execute
(
sendThread
);
// sendThread.start();
}
}
@Override
@Override
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
View file @
6cd87910
...
@@ -245,7 +245,7 @@ public class DeviceEntity extends DeviceVo {
...
@@ -245,7 +245,7 @@ public class DeviceEntity extends DeviceVo {
this
.
deviceName
=
""
;
this
.
deviceName
=
""
;
this
.
deviceCode
=
""
;
this
.
deviceCode
=
""
;
this
.
deviceMac
=
""
;
this
.
deviceMac
=
""
;
this
.
siteId
=
null
;
this
.
siteId
=
-
1L
;
this
.
siteCode
=
""
;
this
.
siteCode
=
""
;
this
.
siteName
=
""
;
this
.
siteName
=
""
;
this
.
platformId
=
null
;
this
.
platformId
=
null
;
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceLogServiceImpl.java
View file @
6cd87910
...
@@ -7,14 +7,14 @@ import com.mortals.framework.model.BizLogPdu;
...
@@ -7,14 +7,14 @@ import com.mortals.framework.model.BizLogPdu;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.service.IMessageProduceService
;
import
com.mortals.framework.service.IMessageProduceService
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
com.mortals.xhx.module.device.dao.DeviceLogDao
;
import
com.mortals.xhx.module.device.dao.DeviceLogDao
;
import
com.mortals.xhx.module.device.model.DeviceLogEntity
;
import
com.mortals.xhx.module.device.model.DeviceLogEntity
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -49,6 +49,7 @@ public class DeviceLogServiceImpl extends AbstractCRUDServiceImpl<DeviceLogDao,
...
@@ -49,6 +49,7 @@ public class DeviceLogServiceImpl extends AbstractCRUDServiceImpl<DeviceLogDao,
@Override
@Override
protected
void
saveAfter
(
DeviceLogEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
DeviceLogEntity
entity
,
Context
context
)
throws
AppException
{
log
.
debug
(
"业务日志保存成功!"
);
log
.
debug
(
"业务日志保存成功!"
);
BizLogPdu
bizLogPdu
=
new
BizLogPdu
();
BizLogPdu
bizLogPdu
=
new
BizLogPdu
();
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
6cd87910
...
@@ -222,8 +222,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -222,8 +222,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
deviceCode
,
Constant
.
DOWN_TOPIC
+
deviceCode
);
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
deviceCode
,
Constant
.
DOWN_TOPIC
+
deviceCode
);
//订阅上行队列
//订阅上行队列
// container.addQueueNames(Constant.UPLOAD_TOPIC + deviceCode);
// container.addQueueNames(Constant.UPLOAD_TOPIC + deviceCode);
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
//新增设备通知第三方平台,先新增后激活
//新增设备通知第三方平台,先新增后激活
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
...
@@ -370,8 +372,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -370,8 +372,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
//注册rabbmit相关队列与绑定
//注册rabbmit相关队列与绑定
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
());
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
//监听上行队列
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
//监听上行队列
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
UPDATE
);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
UPDATE
);
}
}
}
}
...
@@ -609,7 +613,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -609,7 +613,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
}
}
}
}
}
else
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductName
()))
{
}
else
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductName
()))
{
ProductEntity
productEntity
=
productService
.
selectOne
(
new
ProductQuery
().
productName
(
entity
.
getProductName
()));
ProductEntity
productEntity
=
productService
.
selectOne
(
new
ProductQuery
().
productName
(
entity
.
getProductName
()));
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
entity
.
setProductId
(
productEntity
.
getId
());
entity
.
setProductId
(
productEntity
.
getId
());
...
@@ -638,7 +642,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -638,7 +642,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getDeviceStatus
())
&&
entity
.
getDeviceStatus
()
>
DeviceStatusEnum
.
未激活
.
getValue
())
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getDeviceStatus
())
&&
entity
.
getDeviceStatus
()
>
DeviceStatusEnum
.
未激活
.
getValue
())
{
//激活设备,添加队列订阅
//激活设备,添加队列订阅
//container.addQueueNames(Constant.UPLOAD_TOPIC + entity.getDeviceCode());
//container.addQueueNames(Constant.UPLOAD_TOPIC + entity.getDeviceCode());
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
restartMessageListener
(
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
PlatformEntity
platformEntity
=
platformService
.
getCache
(
entity
.
getPlatformId
().
toString
());
PlatformEntity
platformEntity
=
platformService
.
getCache
(
entity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
getCache
(
entity
.
getProductId
().
toString
());
ProductEntity
productEntity
=
productService
.
getCache
(
entity
.
getProductId
().
toString
());
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
...
@@ -740,18 +746,24 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -740,18 +746,24 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
/**
/**
* 重启对消息队列的监听
* 重启对消息队列的监听
*
* @param queueName
* @param queueName
* @return
* @return
*/
*/
public
boolean
restartMessageListener
(
String
queueName
)
{
public
boolean
restartMessageListener
(
String
queueName
)
{
String
key
=
StringUtils
.
trim
(
queueName
);
try
{
container
.
addQueueNames
(
key
);
String
key
=
StringUtils
.
trim
(
queueName
);
container
.
addQueueNames
(
key
);
if
(
container
.
isRunning
()){
if
(
container
.
isRunning
())
{
container
.
stop
();
container
.
stop
();
container
.
start
();
}
container
.
start
();
container
.
start
();
}
catch
(
AppException
e
)
{
log
.
error
(
"重启消息监听失败"
,
e
);
return
false
;
}
}
container
.
start
();
return
true
;
return
true
;
}
}
...
...
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