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
d64c1cc4
Commit
d64c1cc4
authored
Feb 28, 2025
by
廖旭伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
cf556ed6
6da6a96d
Changes
19
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
183 additions
and
285 deletions
+183
-285
common-lib/src/main/java/com/mortals/xhx/common/pdu/DeviceReq.java
...b/src/main/java/com/mortals/xhx/common/pdu/DeviceReq.java
+5
-5
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+55
-100
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
.../java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
+0
-29
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceTotalStatTaskImpl.java
.../com/mortals/xhx/daemon/task/DeviceTotalStatTaskImpl.java
+0
-6
device-manager/src/main/java/com/mortals/xhx/daemon/task/SmsSendTaskImpl.java
...ain/java/com/mortals/xhx/daemon/task/SmsSendTaskImpl.java
+0
-3
device-manager/src/main/java/com/mortals/xhx/module/device/model/vo/DeviceVo.java
...java/com/mortals/xhx/module/device/model/vo/DeviceVo.java
+1
-0
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceService.java
.../com/mortals/xhx/module/device/service/DeviceService.java
+65
-12
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMessageStatServiceImpl.java
...ule/device/service/impl/DeviceMessageStatServiceImpl.java
+0
-11
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleDistributeServiceImpl.java
...evice/service/impl/DeviceModuleDistributeServiceImpl.java
+0
-35
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+56
-17
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceStatServiceImpl.java
...xhx/module/device/service/impl/DeviceStatServiceImpl.java
+0
-8
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceModuleDistributeController.java
...x/module/device/web/DeviceModuleDistributeController.java
+0
-3
device-manager/src/main/java/com/mortals/xhx/module/platform/service/impl/PlatformServiceImpl.java
...xhx/module/platform/service/impl/PlatformServiceImpl.java
+0
-1
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+0
-5
device-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
...mortals/xhx/module/site/service/impl/SiteServiceImpl.java
+0
-31
device-manager/src/main/java/com/mortals/xhx/module/sitestat/service/impl/SitestatServiceImpl.java
...xhx/module/sitestat/service/impl/SitestatServiceImpl.java
+0
-2
device-manager/src/main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
...main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
+0
-4
device-manager/src/main/java/com/mortals/xhx/thread/DeviceUpdateComsumerThread.java
...va/com/mortals/xhx/thread/DeviceUpdateComsumerThread.java
+0
-11
device-manager/src/main/java/com/mortals/xhx/thread/SendThirdPartyThread.java
...ain/java/com/mortals/xhx/thread/SendThirdPartyThread.java
+1
-2
No files found.
common-lib/src/main/java/com/mortals/xhx/common/pdu/DeviceReq.java
View file @
d64c1cc4
...
@@ -149,13 +149,13 @@ public class DeviceReq implements Serializable {
...
@@ -149,13 +149,13 @@ public class DeviceReq implements Serializable {
/**
/**
* 设备宽度
* 设备宽度
*/
*/
private
Double
width
;
private
String
width
;
/**
/**
* 设备高度
* 设备高度
*/
*/
private
Double
height
;
private
String
height
;
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
@@ -171,12 +171,12 @@ public class DeviceReq implements Serializable {
...
@@ -171,12 +171,12 @@ public class DeviceReq implements Serializable {
System
.
out
.
println
(
"div >= 0.9 && div <= 1.1"
);
System
.
out
.
println
(
"div >= 0.9 && div <= 1.1"
);
}
}
//double radio=1920/1080;
//double radio=1920/1080;
System
.
out
.
println
(
NumberUtil
.
div
(
1280
,
800
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
1920
,
1080
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
1920
,
1080
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
1080
,
192
0
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
400
,
128
0
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
1
280
,
128
0
,
2
));
System
.
out
.
println
(
NumberUtil
.
div
(
1
024
,
60
0
,
2
));
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
d64c1cc4
This diff is collapsed.
Click to expand it.
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
View file @
d64c1cc4
...
@@ -47,33 +47,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -47,33 +47,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
@Override
@Override
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
log
.
info
(
"设备状态修正任务"
);
log
.
info
(
"设备状态修正任务"
);
/* List<DeviceEntity> waitDeviceInfos = new ArrayList<>();
while (true) {
DeviceEntity deviceEntity = cacheService.blpop(RedisKey.KEY_DEVICE_ONLINE_QUEUE,10, DeviceEntity.class);
if (ObjectUtils.isEmpty(deviceEntity)) {
log.info("deviceEntity:{}",deviceEntity==null);
break;
} else {
waitDeviceInfos.add(deviceEntity);
}
try {
Thread.sleep(0);
} catch (InterruptedException e) {
log.error("线程休眠异常!",e);
}
}
log.info("waitDeviceInfos size:{}", waitDeviceInfos.size());
if (!ObjectUtils.isEmpty(waitDeviceInfos)) {
for (DeviceEntity waitDeviceInfo : waitDeviceInfos) {
cacheService.lpush(RedisKey.KEY_DEVICE_UPDATE_QUEUE,waitDeviceInfo);
}
// deviceService.update(waitDeviceInfos);
}*/
//获取所有在线设备
List
<
DeviceEntity
>
deviceList
=
deviceService
.
getCacheList
().
stream
().
filter
(
f
->
DeviceStatusEnum
.
在线
.
getValue
()
==
f
.
getDeviceStatus
()).
collect
(
Collectors
.
toList
());
List
<
DeviceEntity
>
deviceList
=
deviceService
.
getCacheList
().
stream
().
filter
(
f
->
DeviceStatusEnum
.
在线
.
getValue
()
==
f
.
getDeviceStatus
()).
collect
(
Collectors
.
toList
());
// List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue()));
//更新离线
//更新离线
List
<
DeviceEntity
>
deviceOfflineList
=
deviceList
.
parallelStream
().
map
(
item
->
{
List
<
DeviceEntity
>
deviceOfflineList
=
deviceList
.
parallelStream
().
map
(
item
->
{
if
(
ObjectUtils
.
isEmpty
(
item
.
getDeviceCode
()))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
item
.
getDeviceCode
()))
return
null
;
...
@@ -90,8 +64,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -90,8 +64,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
if
(!
ObjectUtils
.
isEmpty
(
deviceOfflineList
))
{
if
(!
ObjectUtils
.
isEmpty
(
deviceOfflineList
))
{
log
.
info
(
"修正设备数量:size:{}"
,
deviceOfflineList
.
size
());
log
.
info
(
"修正设备数量:size:{}"
,
deviceOfflineList
.
size
());
// deviceService.update(deviceOfflineList);
for
(
DeviceEntity
deviceEntity
:
deviceOfflineList
)
{
for
(
DeviceEntity
deviceEntity
:
deviceOfflineList
)
{
cacheService
.
lpush
(
RedisKey
.
KEY_DEVICE_UPDATE_QUEUE
,
deviceEntity
);
cacheService
.
lpush
(
RedisKey
.
KEY_DEVICE_UPDATE_QUEUE
,
deviceEntity
);
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
.
getPlatformId
()))
continue
;
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
.
getPlatformId
()))
continue
;
...
@@ -115,7 +87,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -115,7 +87,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogTime
(
new
Date
());
bizLogPdu
.
setLogTime
(
new
Date
());
messageProducer
.
syncBizSend
(
bizLogPdu
);
messageProducer
.
syncBizSend
(
bizLogPdu
);
}
}
}
}
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceTotalStatTaskImpl.java
View file @
d64c1cc4
...
@@ -32,11 +32,8 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
...
@@ -32,11 +32,8 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
private
DeviceStatService
deviceStatService
;
private
DeviceStatService
deviceStatService
;
@Autowired
@Autowired
private
DeviceMessageStatService
deviceMessageStatService
;
private
DeviceMessageStatService
deviceMessageStatService
;
@Value
(
"${platform.type:cloud}"
)
@Value
(
"${platform.type:cloud}"
)
private
String
platFormType
;
//版本,默认云服务版本
private
String
platFormType
;
//版本,默认云服务版本
@Autowired
@Autowired
private
SiteService
siteService
;
private
SiteService
siteService
;
@Autowired
@Autowired
...
@@ -53,7 +50,6 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
...
@@ -53,7 +50,6 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
for
(
SitePdu
item
:
siteList
)
{
for
(
SitePdu
item
:
siteList
)
{
deviceStatService
.
deviceStat
(
item
.
getId
(),
null
);
deviceStatService
.
deviceStat
(
item
.
getId
(),
null
);
deviceMessageStatService
.
deviceMessageStat
(
item
.
getId
(),
null
);
deviceMessageStatService
.
deviceMessageStat
(
item
.
getId
(),
null
);
}
}
}
else
if
(
platFormType
.
equalsIgnoreCase
(
PlatformTypeEnum
.
STANDALONE
.
getValue
()))
{
}
else
if
(
platFormType
.
equalsIgnoreCase
(
PlatformTypeEnum
.
STANDALONE
.
getValue
()))
{
List
<
SiteEntity
>
siteEntities
=
siteService
.
find
(
new
SiteQuery
());
List
<
SiteEntity
>
siteEntities
=
siteService
.
find
(
new
SiteQuery
());
...
@@ -64,12 +60,10 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
...
@@ -64,12 +60,10 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
}
}
}
}
log
.
info
(
"设备统计任务,生成当天统计数据结束"
);
log
.
info
(
"设备统计任务,生成当天统计数据结束"
);
}
}
@Override
@Override
public
void
stopTask
(
ITask
task
)
throws
AppException
{
public
void
stopTask
(
ITask
task
)
throws
AppException
{
}
}
}
}
device-manager/src/main/java/com/mortals/xhx/daemon/task/SmsSendTaskImpl.java
View file @
d64c1cc4
...
@@ -60,12 +60,9 @@ public class SmsSendTaskImpl implements ITaskExcuteService {
...
@@ -60,12 +60,9 @@ public class SmsSendTaskImpl implements ITaskExcuteService {
sms
.
setSendStatus
(
SendStatusEnum
.
提交
.
getValue
());
sms
.
setSendStatus
(
SendStatusEnum
.
提交
.
getValue
());
sms
.
setSendTime
(
new
Date
());
sms
.
setSendTime
(
new
Date
());
alarmSmsSendService
.
update
(
sms
,
null
);
alarmSmsSendService
.
update
(
sms
,
null
);
});
});
}
}
@Override
@Override
public
void
stopTask
(
ITask
task
)
throws
AppException
{
public
void
stopTask
(
ITask
task
)
throws
AppException
{
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/vo/DeviceVo.java
View file @
d64c1cc4
...
@@ -63,4 +63,5 @@ public class DeviceVo extends BaseEntityLong {
...
@@ -63,4 +63,5 @@ public class DeviceVo extends BaseEntityLong {
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceService.java
View file @
d64c1cc4
...
@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context;
...
@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.xhx.busiz.req.DeviceMsgReq
;
import
com.mortals.xhx.busiz.req.DeviceMsgReq
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.ServerInfo
;
import
com.mortals.xhx.common.code.DeviceMethodEnum
;
import
com.mortals.xhx.common.code.DeviceMethodEnum
;
import
com.mortals.xhx.module.device.dao.DeviceDao
;
import
com.mortals.xhx.module.device.dao.DeviceDao
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
...
@@ -27,12 +28,31 @@ import java.util.List;
...
@@ -27,12 +28,31 @@ import java.util.List;
*/
*/
public
interface
DeviceService
extends
ICRUDCacheService
<
DeviceEntity
,
Long
>{
public
interface
DeviceService
extends
ICRUDCacheService
<
DeviceEntity
,
Long
>{
DeviceDao
getDeviceDao
();
/**
*
* @param deviceEntity
* @param info
* @param header
* @param message
* @param callback
* @param context
* @return
*/
ApiResp
<
String
>
sendDeviceMessage
(
DeviceEntity
deviceEntity
,
TopicPartitionInfo
info
,
TbQueueMsgHeaders
header
,
String
message
,
TbQueueCallback
callback
,
Context
context
);
ApiResp
<
String
>
sendDeviceMessage
(
DeviceEntity
deviceEntity
,
TopicPartitionInfo
info
,
TbQueueMsgHeaders
header
,
String
message
,
TbQueueCallback
callback
,
Context
context
);
/**
*
* @param deviceIds
* @param info
* @param header
* @param message
* @param context
* @return
*/
ApiResp
<
String
>
sendDeviceMessage
(
List
<
Long
>
deviceIds
,
TopicPartitionInfo
info
,
TbQueueMsgHeaders
header
,
String
message
,
Context
context
);
ApiResp
<
String
>
sendDeviceMessage
(
List
<
Long
>
deviceIds
,
TopicPartitionInfo
info
,
TbQueueMsgHeaders
header
,
String
message
,
Context
context
);
/**
/**
* 设备激活
* 设备激活
* @param deviceCode
* @param deviceCode
...
@@ -40,8 +60,6 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
...
@@ -40,8 +60,6 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
*/
*/
void
active
(
String
deviceCode
,
Context
context
);
void
active
(
String
deviceCode
,
Context
context
);
/**
/**
* 设备重启应用
* 设备重启应用
* @param deviceEntity
* @param deviceEntity
...
@@ -49,7 +67,11 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
...
@@ -49,7 +67,11 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
*/
*/
void
restartApp
(
DeviceEntity
deviceEntity
,
Context
context
);
void
restartApp
(
DeviceEntity
deviceEntity
,
Context
context
);
/**
*
* @param deviceEntity
* @param context
*/
void
batchUpdateHall
(
DeviceEntity
deviceEntity
,
Context
context
);
void
batchUpdateHall
(
DeviceEntity
deviceEntity
,
Context
context
);
/**
/**
...
@@ -58,24 +80,55 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
...
@@ -58,24 +80,55 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
* @param context
* @param context
*/
*/
void
deviceEnabled
(
Long
id
,
Integer
status
,
Context
context
);
void
deviceEnabled
(
Long
id
,
Integer
status
,
Context
context
);
void
stopOrStartComsumeQueue
(
Long
id
,
Integer
status
,
Context
context
);
/**
*
* @param id
* @param status
* @param context
*/
void
stopOrStartComsumeQueue
(
Long
id
,
Integer
status
,
Context
context
);
/**
*
* @param entity
* @param productEntity
* @param platformEntity
* @param update
* @return
*/
Rest
<
String
>
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
);
Rest
<
String
>
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
);
/**
*
* @param key
* @param deviceEntity
*/
void
putCache
(
String
key
,
DeviceEntity
deviceEntity
);
void
putCache
(
String
key
,
DeviceEntity
deviceEntity
);
DeviceDao
getDeviceDao
();
/**
*
* @param query
* @param context
* @return
*/
List
<
DeviceMapEntity
>
deviceMap
(
DeviceEntity
query
,
Context
context
);
List
<
DeviceMapEntity
>
deviceMap
(
DeviceEntity
query
,
Context
context
);
/**
*
* @param list
*/
void
downMsg
(
List
<
DeviceMsgReq
>
list
);
void
downMsg
(
List
<
DeviceMsgReq
>
list
);
/**
*
* @param deviceEntity
* @param productEntity
* @param serverInfo
* @param serverName
* @param serverPort
*/
void
buildHomeUrlBySite
(
DeviceEntity
deviceEntity
,
ProductEntity
productEntity
,
ServerInfo
serverInfo
,
String
serverName
,
Integer
serverPort
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMessageStatServiceImpl.java
View file @
d64c1cc4
...
@@ -11,7 +11,6 @@ import com.mortals.xhx.module.device.model.DeviceAlarmInfoQuery;
...
@@ -11,7 +11,6 @@ import com.mortals.xhx.module.device.model.DeviceAlarmInfoQuery;
import
com.mortals.xhx.module.device.model.DeviceMessageStatEntity
;
import
com.mortals.xhx.module.device.model.DeviceMessageStatEntity
;
import
com.mortals.xhx.module.device.model.DeviceMessageStatQuery
;
import
com.mortals.xhx.module.device.model.DeviceMessageStatQuery
;
import
com.mortals.xhx.module.device.service.DeviceAlarmInfoService
;
import
com.mortals.xhx.module.device.service.DeviceAlarmInfoService
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceMessageStatService
;
import
com.mortals.xhx.module.device.service.DeviceMessageStatService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.product.service.ProductService
;
...
@@ -35,15 +34,11 @@ import java.util.List;
...
@@ -35,15 +34,11 @@ import java.util.List;
@Slf4j
@Slf4j
public
class
DeviceMessageStatServiceImpl
extends
AbstractCRUDServiceImpl
<
DeviceMessageStatDao
,
DeviceMessageStatEntity
,
Long
>
implements
DeviceMessageStatService
{
public
class
DeviceMessageStatServiceImpl
extends
AbstractCRUDServiceImpl
<
DeviceMessageStatDao
,
DeviceMessageStatEntity
,
Long
>
implements
DeviceMessageStatService
{
@Autowired
@Autowired
private
DeviceAlarmInfoService
deviceAlarmInfoService
;
private
DeviceAlarmInfoService
deviceAlarmInfoService
;
@Autowired
@Autowired
private
DeviceLogService
deviceLogService
;
@Autowired
private
ProductService
productService
;
private
ProductService
productService
;
@Override
@Override
public
void
deviceMessageStat
(
Long
siteId
,
Context
context
)
{
public
void
deviceMessageStat
(
Long
siteId
,
Context
context
)
{
//查询当天统计,如果有 则更新统计结果,否则新增
//查询当天统计,如果有 则更新统计结果,否则新增
...
@@ -87,9 +82,7 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
...
@@ -87,9 +82,7 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
deviceStatEntity
.
setUpdateTime
(
new
Date
());
deviceStatEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
deviceStatEntity
);
this
.
update
(
deviceStatEntity
);
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"统计异常"
,
e
);
log
.
error
(
"统计异常"
,
e
);
throw
new
AppException
(
"统计异常!"
);
throw
new
AppException
(
"统计异常!"
);
...
@@ -106,8 +99,4 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
...
@@ -106,8 +99,4 @@ public class DeviceMessageStatServiceImpl extends AbstractCRUDServiceImpl<Device
return
deviceStatEntityResult
;
return
deviceStatEntityResult
;
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleDistributeServiceImpl.java
View file @
d64c1cc4
...
@@ -50,15 +50,11 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -50,15 +50,11 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
@Override
@Override
public
void
putCache
(
String
key
,
DeviceModuleDistributeEntity
data
)
{
public
void
putCache
(
String
key
,
DeviceModuleDistributeEntity
data
)
{
super
.
putCache
(
key
,
data
);
super
.
putCache
(
key
,
data
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
data
.
getSelected
())
{
if
(
YesNoEnum
.
YES
.
getValue
()
==
data
.
getSelected
())
{
updateYesSelectedPath
(
data
,
YesNoEnum
.
YES
);
updateYesSelectedPath
(
data
,
YesNoEnum
.
YES
);
}
else
{
}
else
{
updateYesSelectedPath
(
data
,
YesNoEnum
.
NO
);
updateYesSelectedPath
(
data
,
YesNoEnum
.
NO
);
}
}
//设置yes与no
}
}
@Override
@Override
...
@@ -67,7 +63,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -67,7 +63,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
entity
.
setProductCode
(
productEntity
.
getProductCode
());
entity
.
setProductCode
(
productEntity
.
getProductCode
());
entity
.
setProductName
(
productEntity
.
getProductName
());
entity
.
setProductName
(
productEntity
.
getProductName
());
entity
.
setImageResolutionValue
(
entity
.
getImageResolution
());
entity
.
setImageResolutionValue
(
entity
.
getImageResolution
());
super
.
updateBefore
(
entity
,
context
);
super
.
updateBefore
(
entity
,
context
);
}
}
...
@@ -123,10 +118,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -123,10 +118,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
log
.
error
(
"异常"
,
e
);
}
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
// ZipReader.of(disPath,fileEncode).setMaxSizeDiff(1024 * 1024 * 1024)
//更新
//更新
distributeEntity
.
setDistributeFilePath
(
disPath
);
distributeEntity
.
setDistributeFilePath
(
disPath
);
distributeEntity
.
setDistribute
(
YesNoEnum
.
YES
.
getValue
());
distributeEntity
.
setDistribute
(
YesNoEnum
.
YES
.
getValue
());
...
@@ -138,7 +130,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -138,7 +130,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
@Override
@Override
public
Rest
<
String
>
selected
(
DeviceModuleDistributeEntity
distributeEntity
,
Context
context
)
{
public
Rest
<
String
>
selected
(
DeviceModuleDistributeEntity
distributeEntity
,
Context
context
)
{
DeviceModuleDistributeEntity
deviceModuleDistributeEntity
=
this
.
get
(
distributeEntity
.
getId
(),
context
);
DeviceModuleDistributeEntity
deviceModuleDistributeEntity
=
this
.
get
(
distributeEntity
.
getId
(),
context
);
//选择默认资源默认分辨率
//选择默认资源默认分辨率
//如果选择的资源未部署,则提示先部署后才能选择
//如果选择的资源未部署,则提示先部署后才能选择
if
(!
ObjectUtils
.
isEmpty
(
deviceModuleDistributeEntity
)
&&
deviceModuleDistributeEntity
.
getDistribute
()
==
YesNoEnum
.
NO
.
getValue
())
{
if
(!
ObjectUtils
.
isEmpty
(
deviceModuleDistributeEntity
)
&&
deviceModuleDistributeEntity
.
getDistribute
()
==
YesNoEnum
.
NO
.
getValue
())
{
...
@@ -163,7 +154,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -163,7 +154,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
distributeEntity
.
setSelected
(
YesNoEnum
.
NO
.
getValue
());
distributeEntity
.
setSelected
(
YesNoEnum
.
NO
.
getValue
());
distributeEntity
.
setUpdateTime
(
new
Date
());
distributeEntity
.
setUpdateTime
(
new
Date
());
distributeEntity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
distributeEntity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
this
.
getDao
().
update
(
distributeEntity
);
this
.
getDao
().
update
(
distributeEntity
);
updateYesSelectedPath
(
deviceModuleDistributeEntity
,
YesNoEnum
.
NO
);
updateYesSelectedPath
(
deviceModuleDistributeEntity
,
YesNoEnum
.
NO
);
...
@@ -172,30 +162,9 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -172,30 +162,9 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
distributeEntity
.
setSelected
(
YesNoEnum
.
YES
.
getValue
());
distributeEntity
.
setSelected
(
YesNoEnum
.
YES
.
getValue
());
distributeEntity
.
setUpdateTime
(
new
Date
());
distributeEntity
.
setUpdateTime
(
new
Date
());
distributeEntity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
distributeEntity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
this
.
getDao
().
update
(
distributeEntity
);
this
.
getDao
().
update
(
distributeEntity
);
updateYesSelectedPath
(
deviceModuleDistributeEntity
,
YesNoEnum
.
YES
);
updateYesSelectedPath
(
deviceModuleDistributeEntity
,
YesNoEnum
.
YES
);
//更新缓存
}
}
//查询同类资源,变更为非默认值后 再更新
/* DeviceModuleDistributeQuery query = new DeviceModuleDistributeQuery();
query.setProductId(deviceModuleDistributeEntity.getProductId());
query.setSiteId(deviceModuleDistributeEntity.getSiteId());
List<Long> idList = this.find(query, context).stream().map(i -> i.getId()).collect(Collectors.toList());
DeviceModuleDistributeQuery condition = new DeviceModuleDistributeQuery();
condition.setIdList(idList);
DeviceModuleDistributeEntity entity = new DeviceModuleDistributeEntity();
entity.setSelected(YesNoEnum.NO.getValue());*/
//this.updateBatch(entity, condition, context);
return
Rest
.
ok
();
return
Rest
.
ok
();
}
}
...
@@ -207,19 +176,15 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
...
@@ -207,19 +176,15 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDCacheServiceI
@Override
@Override
public
Rest
<
String
>
cloneAppBySite
(
DeviceModuleDistributeEntity
deviceModuleDistributeEntity
,
Context
context
)
{
public
Rest
<
String
>
cloneAppBySite
(
DeviceModuleDistributeEntity
deviceModuleDistributeEntity
,
Context
context
)
{
//拷贝应用
//拷贝应用
Long
targetSiteId
=
deviceModuleDistributeEntity
.
getTargetSiteId
();
Long
targetSiteId
=
deviceModuleDistributeEntity
.
getTargetSiteId
();
Long
sourceSiteId
=
deviceModuleDistributeEntity
.
getSourceSiteId
();
Long
sourceSiteId
=
deviceModuleDistributeEntity
.
getSourceSiteId
();
Rest
<
SitePdu
>
sitePduRest
=
siteFeign
.
info
(
targetSiteId
);
Rest
<
SitePdu
>
sitePduRest
=
siteFeign
.
info
(
targetSiteId
);
if
(
YesNoEnum
.
NO
.
getValue
()
==
sitePduRest
.
getCode
())
{
if
(
YesNoEnum
.
NO
.
getValue
()
==
sitePduRest
.
getCode
())
{
throw
new
AppException
(
"未查询到当前站点!"
);
throw
new
AppException
(
"未查询到当前站点!"
);
}
}
SitePdu
sitePdu
=
sitePduRest
.
getData
();
SitePdu
sitePdu
=
sitePduRest
.
getData
();
DeviceModuleDistributeQuery
distributeQuery
=
new
DeviceModuleDistributeQuery
();
DeviceModuleDistributeQuery
distributeQuery
=
new
DeviceModuleDistributeQuery
();
distributeQuery
.
setSiteId
(
sourceSiteId
);
distributeQuery
.
setSiteId
(
sourceSiteId
);
List
<
DeviceModuleDistributeEntity
>
deviceModuleDistributeEntities
=
this
.
find
(
distributeQuery
);
List
<
DeviceModuleDistributeEntity
>
deviceModuleDistributeEntities
=
this
.
find
(
distributeQuery
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
d64c1cc4
package
com.mortals.xhx.module.device.service.impl
;
package
com.mortals.xhx.module.device.service.impl
;
import
cn.hutool.core.lang.Validator
;
import
cn.hutool.core.net.URLDecoder
;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.net.url.UrlPath
;
import
cn.hutool.core.net.url.UrlPath
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.ErrorLogPdu
;
import
com.mortals.framework.model.ErrorLogPdu
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.xhx.base.system.message.MessageService
;
import
com.mortals.xhx.base.system.message.MessageService
;
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.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.ServerInfo
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.QueueKey
;
import
com.mortals.xhx.common.key.QueueKey
;
...
@@ -29,11 +35,9 @@ import com.mortals.xhx.feign.IOfficeDeviceFeign;
...
@@ -29,11 +35,9 @@ import com.mortals.xhx.feign.IOfficeDeviceFeign;
import
com.mortals.xhx.feign.ISampleDeviceFeign
;
import
com.mortals.xhx.feign.ISampleDeviceFeign
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.device.dao.DeviceDao
;
import
com.mortals.xhx.module.device.dao.DeviceDao
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.*
;
import
com.mortals.xhx.module.device.model.DeviceLogEntity
;
import
com.mortals.xhx.module.device.model.DeviceMapEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceModuleDistributeService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.platform.model.PlatformQuery
;
import
com.mortals.xhx.module.platform.model.PlatformQuery
;
...
@@ -62,6 +66,7 @@ import java.util.*;
...
@@ -62,6 +66,7 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
MESSAGETYPE_NOTIFY_RESTART_APP
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
MESSAGETYPE_NOTIFY_RESTART_APP
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_HTTP_URL
;
import
static
java
.
math
.
BigDecimal
.
ROUND_HALF_DOWN
;
import
static
java
.
math
.
BigDecimal
.
ROUND_HALF_DOWN
;
/**
/**
...
@@ -96,17 +101,14 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -96,17 +101,14 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
private
ISampleDeviceFeign
sampleDeviceFeign
;
private
ISampleDeviceFeign
sampleDeviceFeign
;
@Autowired
@Autowired
private
IFillDeviceFeign
fillDeviceFeign
;
private
IFillDeviceFeign
fillDeviceFeign
;
@Autowired
@Autowired
private
IInfoPublishDeviceFeign
infoPublishDeviceFeign
;
private
IInfoPublishDeviceFeign
infoPublishDeviceFeign
;
@Value
(
"${thirdPartyPath:/inter/device/deviceIn}"
)
private
String
thirdPartyPath
;
@Value
(
"${platform.type:cloud}"
)
@Value
(
"${platform.type:cloud}"
)
private
String
platFormType
;
//版本,默认云服务版本
private
String
platFormType
;
//版本,默认云服务版本
@Autowired
@Autowired
private
SiteService
siteService
;
private
SiteService
siteService
;
@Autowired
private
DeviceModuleDistributeService
deviceModuleDistributeService
;
public
void
refresh
()
{
public
void
refresh
()
{
log
.
info
(
"开始初始化系统参数..."
);
log
.
info
(
"开始初始化系统参数..."
);
...
@@ -372,9 +374,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -372,9 +374,7 @@ 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
);
}
}
...
@@ -384,12 +384,12 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -384,12 +384,12 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
@Override
public
Rest
<
String
>
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
)
{
public
Rest
<
String
>
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
)
{
//todo 修改为异步发送消息,当前消息存放到redis的队列中
//todo 修改为异步发送消息,当前消息存放到redis的队列中
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
return
Rest
.
fail
(
"产品实体为空!deviceCode:"
+
entity
.
getDeviceCode
());
return
Rest
.
fail
(
"产品实体为空!deviceCode:"
+
entity
.
getDeviceCode
());
}
}
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
return
Rest
.
fail
(
"所属平台实体为空!deviceCode:"
+
entity
.
getDeviceCode
());
return
Rest
.
fail
(
"所属平台实体为空!deviceCode:"
+
entity
.
getDeviceCode
());
}
}
...
@@ -762,8 +762,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -762,8 +762,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
public
boolean
restartMessageListener
(
String
queueName
)
{
public
boolean
restartMessageListener
(
String
queueName
)
{
try
{
try
{
String
key
=
StringUtils
.
trim
(
queueName
);
String
key
=
StringUtils
.
trim
(
queueName
);
List
<
String
>
queues
=
Arrays
.
asList
(
container
.
getQueueNames
());
if
(!
queues
.
contains
(
key
)){
container
.
addQueueNames
(
key
);
container
.
addQueueNames
(
key
);
}
if
(
container
.
isRunning
())
{
if
(
container
.
isRunning
())
{
container
.
stop
();
container
.
stop
();
container
.
start
();
container
.
start
();
...
@@ -776,6 +778,43 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -776,6 +778,43 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
return
true
;
return
true
;
}
}
@Override
public
void
buildHomeUrlBySite
(
DeviceEntity
deviceEntity
,
ProductEntity
productEntity
,
ServerInfo
serverInfo
,
String
serverName
,
Integer
serverPort
)
{
String
scheme
=
serverInfo
.
getScheme
();
String
homeUrl
=
""
;
//根据站点与资源部署来生成homeurl
DeviceModuleDistributeQuery
query
=
new
DeviceModuleDistributeQuery
();
query
.
setSiteId
(
deviceEntity
.
getSiteId
());
query
.
setProductId
(
productEntity
.
getId
());
query
.
setDistribute
(
DistributeEnum
.
是
.
getValue
());
query
.
setSelectedList
(
Arrays
.
asList
(
YesNoEnum
.
YES
.
getValue
(),
YesNoEnum
.
NO
.
getValue
()));
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"selected"
,
OrderCol
.
DESCENDING
)));
DeviceModuleDistributeEntity
deviceModuleDistributeEntity
=
deviceModuleDistributeService
.
selectOne
(
query
);
if
(
ObjectUtils
.
isEmpty
(
deviceModuleDistributeEntity
))
{
//判断如果宽和高存在 找一个相近的资源。
}
else
{
//homeDeviceUrl/1/pdj/1920x1080
homeUrl
=
String
.
format
(
"/homeDeviceUrl/%s/%s/%s"
,
deviceModuleDistributeEntity
.
getSiteId
(),
deviceModuleDistributeEntity
.
getProductCode
(),
deviceModuleDistributeEntity
.
getImageResolutionValue
());
//根据部署的资源 生成homeurl
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11078"
);
if
(!
ObjectUtils
.
isEmpty
(
serverName
)
&&
Validator
.
isIpv4
(
serverName
))
{
String
str
=
UrlBuilder
.
of
().
setScheme
(
scheme
).
setHost
(
serverName
).
setPort
(
serverPort
>
0
?
serverPort
:
11078
).
addPath
(
homeUrl
).
build
();
String
decodeStr
=
URLDecoder
.
decode
(
str
,
Charset
.
defaultCharset
());
serverInfo
.
setHomeUrl
(
decodeStr
);
serverInfo
.
setEventUrl
(
productEntity
.
getEventUrl
());
}
else
{
String
str
=
UrlBuilder
.
of
(
domain
.
trim
()).
addPath
(
homeUrl
).
build
();
String
decodeStr
=
URLDecoder
.
decode
(
str
,
Charset
.
defaultCharset
());
serverInfo
.
setHomeUrl
(
decodeStr
);
serverInfo
.
setEventUrl
(
productEntity
.
getEventUrl
());
}
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
BigDecimal
bigDecimal
=
new
BigDecimal
(
"104.22241"
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
"104.22241"
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceStatServiceImpl.java
View file @
d64c1cc4
...
@@ -45,7 +45,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
...
@@ -45,7 +45,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
@Autowired
@Autowired
private
DeviceService
deviceService
;
private
DeviceService
deviceService
;
@Autowired
@Autowired
private
SiteService
siteService
;
private
SiteService
siteService
;
@Value
(
"${platform.type:cloud}"
)
@Value
(
"${platform.type:cloud}"
)
...
@@ -58,7 +57,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
...
@@ -58,7 +57,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
private
AlarmSmsSendService
alarmSmsSendService
;
private
AlarmSmsSendService
alarmSmsSendService
;
@Autowired
@Autowired
private
DeviceLogService
deviceLogService
;
private
DeviceLogService
deviceLogService
;
@Autowired
@Autowired
private
ISiteFeign
siteFeign
;
private
ISiteFeign
siteFeign
;
...
@@ -98,7 +96,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
...
@@ -98,7 +96,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
billInfos
=
this
.
getBillInfos
(
query
.
getSiteId
(),
query
.
getCreateTimeStart
(),
TimeUnitEnum
.
MONTH
.
getValue
(),
page
,
context
);
billInfos
=
this
.
getBillInfos
(
query
.
getSiteId
(),
query
.
getCreateTimeStart
(),
TimeUnitEnum
.
MONTH
.
getValue
(),
page
,
context
);
deviceStatEntityResult
.
setList
(
billInfos
);
deviceStatEntityResult
.
setList
(
billInfos
);
deviceStatEntityResult
.
setPageInfo
(
page
);
deviceStatEntityResult
.
setPageInfo
(
page
);
updateDeviceOnlineStats
(
query
,
context
,
page
,
billInfos
);
updateDeviceOnlineStats
(
query
,
context
,
page
,
billInfos
);
break
;
break
;
case
今年:
case
今年:
...
@@ -322,11 +319,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
...
@@ -322,11 +319,6 @@ public class DeviceStatServiceImpl extends AbstractCRUDServiceImpl<DeviceStatDao
int
day
=
dateTime
.
dayOfMonth
();
int
day
=
dateTime
.
dayOfMonth
();
int
month
=
dateTime
.
month
()+
1
;
int
month
=
dateTime
.
month
()+
1
;
int
year
=
dateTime
.
year
();
int
year
=
dateTime
.
year
();
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceModuleDistributeController.java
View file @
d64c1cc4
...
@@ -10,7 +10,6 @@ import com.mortals.framework.model.Context;
...
@@ -10,7 +10,6 @@ import com.mortals.framework.model.Context;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.feign.skin.ISkinBaseFeign
;
import
com.mortals.xhx.feign.skin.ISkinBaseFeign
;
import
com.mortals.xhx.module.device.model.DeviceModuleDistributeEntity
;
import
com.mortals.xhx.module.device.model.DeviceModuleDistributeEntity
;
...
@@ -43,8 +42,6 @@ import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_URL;
...
@@ -43,8 +42,6 @@ import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_URL;
@RequestMapping
(
"device/module/distribute"
)
@RequestMapping
(
"device/module/distribute"
)
public
class
DeviceModuleDistributeController
extends
BaseCRUDJsonBodyMappingController
<
DeviceModuleDistributeService
,
DeviceModuleDistributeEntity
,
Long
>
{
public
class
DeviceModuleDistributeController
extends
BaseCRUDJsonBodyMappingController
<
DeviceModuleDistributeService
,
DeviceModuleDistributeEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
@Autowired
@Autowired
private
ProductService
productService
;
private
ProductService
productService
;
@Autowired
@Autowired
...
...
device-manager/src/main/java/com/mortals/xhx/module/platform/service/impl/PlatformServiceImpl.java
View file @
d64c1cc4
...
@@ -21,7 +21,6 @@ import org.springframework.util.ObjectUtils;
...
@@ -21,7 +21,6 @@ import org.springframework.util.ObjectUtils;
public
class
PlatformServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
PlatformDao
,
PlatformEntity
,
Long
>
implements
PlatformService
{
public
class
PlatformServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
PlatformDao
,
PlatformEntity
,
Long
>
implements
PlatformService
{
@Override
@Override
protected
void
validData
(
PlatformEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
validData
(
PlatformEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSendUrl
())){
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSendUrl
())){
if
(!
PatternPool
.
URL_HTTP
.
matcher
(
entity
.
getSendUrl
()).
find
())
{
if
(!
PatternPool
.
URL_HTTP
.
matcher
(
entity
.
getSendUrl
()).
find
())
{
throw
new
AppException
(
"URL不合法"
);
throw
new
AppException
(
"URL不合法"
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
d64c1cc4
...
@@ -166,10 +166,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -166,10 +166,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogService
.
save
(
deviceLogEntity
,
context
);
deviceLogService
.
save
(
deviceLogEntity
,
context
);
log
.
info
(
"【发送中】发送升级版本信息,设备编码:{}"
,
deviceEntity
.
getDeviceCode
());
log
.
info
(
"【发送中】发送升级版本信息,设备编码:{}"
,
deviceEntity
.
getDeviceCode
());
// deviceService.sendDeviceMessage(deviceEntity, info, header, Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()), callback, null);
});
});
}
}
...
@@ -179,8 +176,6 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -179,8 +176,6 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
download
=
productVersionEntity
.
getFilePath
();
download
=
productVersionEntity
.
getFilePath
();
}
}
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
);
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
);
// String temp= domain+"/"+download;
//productVersionInfo.setDownloadUrl(temp);
productVersionInfo
.
setDownloadUrl
(
UrlBuilder
.
of
(
domain
).
addPath
(
download
).
toString
());
productVersionInfo
.
setDownloadUrl
(
UrlBuilder
.
of
(
domain
).
addPath
(
download
).
toString
());
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
View file @
d64c1cc4
...
@@ -38,8 +38,6 @@ import java.util.stream.Collectors;
...
@@ -38,8 +38,6 @@ import java.util.stream.Collectors;
@Service
(
"siteService"
)
@Service
(
"siteService"
)
@Slf4j
@Slf4j
public
class
SiteServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
SiteDao
,
SiteEntity
,
Long
>
implements
SiteService
{
public
class
SiteServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
SiteDao
,
SiteEntity
,
Long
>
implements
SiteService
{
// private List<SiteTreeSelect> siteTreeList;
/**
/**
* 根据用户id 暂存对应站点树 默认0为全站点树
* 根据用户id 暂存对应站点树 默认0为全站点树
*/
*/
...
@@ -209,9 +207,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -209,9 +207,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
else
{
}
else
{
//云服务版本,获取站点树
//云服务版本,获取站点树
// siteFeign.siteTree()
// siteFeign.siteTree()
}
}
return
siteTreeSelects
;
return
siteTreeSelects
;
}
}
...
@@ -256,36 +252,9 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -256,36 +252,9 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
SiteQuery
siteQuery
=
new
SiteQuery
();
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
//
// List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site -> changeUrlPath(site)).collect(Collectors.toList());
// ;
// for (SiteEntity siteEntity : siteEntities) {
// boolean bool = getSite(siteCache.getAreaCode(), siteEntity.getAreaCode(), siteList, siteEntity);
// if (bool) continue;
//
// }
return
siteEntities
;
return
siteEntities
;
}
}
private
boolean
getSite
(
String
rootAreaCode
,
String
areaCode
,
List
<
SiteEntity
>
siteList
,
SiteEntity
siteEntity
)
{
// AreaEntity areaTemp = areaService.getExtCache(siteEntity.getAreaCode());
if
(
rootAreaCode
.
equals
(
areaCode
))
{
siteList
.
add
(
siteEntity
);
//log.info("add site:{}", siteEntity.getSiteCode());
return
true
;
}
else
{
AreaEntity
areaTemp
=
areaService
.
getExtCache
(
areaCode
);
if
(!
ObjectUtils
.
isEmpty
(
areaTemp
)
&&
!
ObjectUtils
.
isEmpty
(
areaTemp
.
getPid
()))
{
//根据子节点查找父节点
AreaEntity
areaEntity
=
areaService
.
selectOne
(
new
AreaQuery
().
iid
(
areaTemp
.
getPid
()));
if
(!
ObjectUtils
.
isEmpty
(
areaEntity
))
{
return
getSite
(
rootAreaCode
,
areaEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
}
}
return
false
;
}
}
@Override
@Override
public
void
setSiteTree
(
List
<
SiteTreeSelect
>
list
,
Context
context
)
{
public
void
setSiteTree
(
List
<
SiteTreeSelect
>
list
,
Context
context
)
{
siteTreeMap
.
put
(
context
.
getUser
().
getId
(),
list
);
siteTreeMap
.
put
(
context
.
getUser
().
getId
(),
list
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/sitestat/service/impl/SitestatServiceImpl.java
View file @
d64c1cc4
...
@@ -337,9 +337,7 @@ public class SitestatServiceImpl extends AbstractCRUDCacheServiceImpl<SitestatDa
...
@@ -337,9 +337,7 @@ public class SitestatServiceImpl extends AbstractCRUDCacheServiceImpl<SitestatDa
SiteTreeSelect
siteTreeSelect
=
JSON
.
parseObject
(
item
.
toString
(),
SiteTreeSelect
.
class
);
SiteTreeSelect
siteTreeSelect
=
JSON
.
parseObject
(
item
.
toString
(),
SiteTreeSelect
.
class
);
return
siteTreeSelect
;
return
siteTreeSelect
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
JSON
.
toJSONString
(
collect
));
System
.
out
.
println
(
JSON
.
toJSONString
(
collect
));
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/thread/DeviceDownMsgThread.java
View file @
d64c1cc4
...
@@ -65,16 +65,13 @@ public class DeviceDownMsgThread extends AbstractThread {
...
@@ -65,16 +65,13 @@ public class DeviceDownMsgThread extends AbstractThread {
while
(
true
)
{
while
(
true
)
{
DeviceMsgReq
deviceMsgReq
=
cacheService
.
lpop
(
KEY_DEVICE_DOWN_MSG_QUEUE
,
DeviceMsgReq
.
class
);
DeviceMsgReq
deviceMsgReq
=
cacheService
.
lpop
(
KEY_DEVICE_DOWN_MSG_QUEUE
,
DeviceMsgReq
.
class
);
if
(
ObjectUtils
.
isEmpty
(
deviceMsgReq
))
{
if
(
ObjectUtils
.
isEmpty
(
deviceMsgReq
))
{
// log.info("deviceMsgReq:{}", deviceMsgReq == null);
break
;
break
;
}
}
deviceMsgReqs
.
add
(
deviceMsgReq
);
deviceMsgReqs
.
add
(
deviceMsgReq
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
deviceMsgReqs
))
{
if
(!
ObjectUtils
.
isEmpty
(
deviceMsgReqs
))
{
log
.
info
(
"消息下发数量:{}"
,
deviceMsgReqs
.
size
());
log
.
info
(
"消息下发数量:{}"
,
deviceMsgReqs
.
size
());
ArrayList
<
DeviceLogEntity
>
deviceLogList
=
new
ArrayList
<>();
ArrayList
<
DeviceLogEntity
>
deviceLogList
=
new
ArrayList
<>();
for
(
DeviceMsgReq
item
:
deviceMsgReqs
)
{
for
(
DeviceMsgReq
item
:
deviceMsgReqs
)
{
//根据设备编码查询设备
//根据设备编码查询设备
DeviceEntity
deviceEntity
=
null
;
DeviceEntity
deviceEntity
=
null
;
...
@@ -107,7 +104,6 @@ public class DeviceDownMsgThread extends AbstractThread {
...
@@ -107,7 +104,6 @@ public class DeviceDownMsgThread extends AbstractThread {
deviceLogEntity
.
setCreateUserId
(
1L
);
deviceLogEntity
.
setCreateUserId
(
1L
);
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogList
.
add
(
deviceLogEntity
);
deviceLogList
.
add
(
deviceLogEntity
);
// deviceLogService.save(deviceLogEntity, null);
}
else
{
}
else
{
log
.
info
(
"未找到设备,deviceCode:{}"
,
item
.
getDeviceCode
());
log
.
info
(
"未找到设备,deviceCode:{}"
,
item
.
getDeviceCode
());
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/thread/DeviceUpdateComsumerThread.java
View file @
d64c1cc4
...
@@ -34,8 +34,6 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
...
@@ -34,8 +34,6 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
@Autowired
@Autowired
private
DeviceService
deviceService
;
private
DeviceService
deviceService
;
//
@Override
@Override
protected
int
getSleepTime
()
{
protected
int
getSleepTime
()
{
return
60
*
1000
;
return
60
*
1000
;
...
@@ -48,7 +46,6 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
...
@@ -48,7 +46,6 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
while
(
true
)
{
while
(
true
)
{
DeviceEntity
deviceEntity
=
cacheService
.
lpop
(
RedisKey
.
KEY_DEVICE_UPDATE_QUEUE
,
DeviceEntity
.
class
);
DeviceEntity
deviceEntity
=
cacheService
.
lpop
(
RedisKey
.
KEY_DEVICE_UPDATE_QUEUE
,
DeviceEntity
.
class
);
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
// log.info("deviceEntity:{}", deviceEntity == null);
break
;
break
;
}
}
waitUpdateDeviceList
.
add
(
deviceEntity
);
waitUpdateDeviceList
.
add
(
deviceEntity
);
...
@@ -85,15 +82,7 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
...
@@ -85,15 +82,7 @@ public class DeviceUpdateComsumerThread extends AbstractThread {
}
}
}
}
});
});
/*
for (DeviceEntity deviceEntity : waitUpdateDeviceList) {
deviceService.update(deviceEntity);
}
}
*/
}
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/thread/SendThirdPartyThread.java
View file @
d64c1cc4
...
@@ -54,7 +54,6 @@ public class SendThirdPartyThread extends AbstractThread {
...
@@ -54,7 +54,6 @@ public class SendThirdPartyThread extends AbstractThread {
while
(
true
)
{
while
(
true
)
{
DeviceReq
deviceReq
=
cacheService
.
lpop
(
KEY_DEVICE_THIRDPARTY_QUEUE
,
DeviceReq
.
class
);
DeviceReq
deviceReq
=
cacheService
.
lpop
(
KEY_DEVICE_THIRDPARTY_QUEUE
,
DeviceReq
.
class
);
if
(
ObjectUtils
.
isEmpty
(
deviceReq
))
{
if
(
ObjectUtils
.
isEmpty
(
deviceReq
))
{
// log.info("deviceMsgReq:{}", deviceMsgReq == null);
break
;
break
;
}
}
deviceMsgReqs
.
add
(
deviceReq
);
deviceMsgReqs
.
add
(
deviceReq
);
...
...
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