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
9cdf9f97
Commit
9cdf9f97
authored
Feb 04, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加批量激活设备
parent
8fed0612
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
27 deletions
+45
-27
device-manager-ui/admin/src/components/FileUpload.vue
device-manager-ui/admin/src/components/FileUpload.vue
+0
-4
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+9
-19
device-manager/src/main/java/com/mortals/xhx/common/utils/SendThirdPartyTask.java
...java/com/mortals/xhx/common/utils/SendThirdPartyTask.java
+30
-0
device-manager/src/main/java/com/mortals/xhx/module/platform/service/PlatformService.java
.../mortals/xhx/module/platform/service/PlatformService.java
+3
-2
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
...om/mortals/xhx/module/product/service/ProductService.java
+3
-2
No files found.
device-manager-ui/admin/src/components/FileUpload.vue
View file @
9cdf9f97
...
...
@@ -131,10 +131,6 @@ export default {
},
},
methods
:
{
refresh
(
data
)
{
this
.
fileList
=
data
;
},
// 上传前校检格式和大小
handleBeforeUpload
(
file
)
{
// 校检文件类型
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
9cdf9f97
...
...
@@ -32,10 +32,7 @@ import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import
com.mortals.xhx.common.model.MessageHeader
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.common.utils.DownMsgTask
;
import
com.mortals.xhx.common.utils.EncryptUtil
;
import
com.mortals.xhx.common.utils.SendTaskThreadPool
;
import
com.mortals.xhx.common.utils.*
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
...
...
@@ -158,7 +155,7 @@ public class DeviceApiController {
authInfo
.
setMessageTtl
(
messageTtl
);
authInfo
.
setVirtualHost
(
virtualHost
);
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
}
...
...
@@ -167,7 +164,7 @@ public class DeviceApiController {
throw
new
AppException
(
PLATFORM_UNEXIST
,
PLATFORM_UNEXIST_CONTENT
);
}
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
PLATFORM_IS_EMPTY
,
PLATFORM_IS_EMPTY_CONTENT
);
}
...
...
@@ -176,21 +173,16 @@ public class DeviceApiController {
throw
new
AppException
(
DEVICE_UNACTIVE
,
DEVICE_UNACTIVE_CONTENT
);
}
// authInfo.setExchangeName(platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode());
//单一交换机
authInfo
.
setExchangeName
(
QueueKey
.
DEFAULT_EXCHANGE
);
authInfo
.
setUploadTopicFilter
(
Constant
.
UPLOAD_TOPIC
+
deviceEntity
.
getDeviceCode
());
authInfo
.
setDownTopicFilter
(
Constant
.
DOWN_TOPIC
+
deviceEntity
.
getDeviceCode
());
RegisterResp
registerResp
=
new
RegisterResp
();
registerResp
.
setRabbmitInfo
(
authInfo
);
ServerInfo
serverInfo
=
new
ServerInfo
();
//判断设备是否设置了url 如果设置了,则用设备的 否则用产品的
buildHomeUrl
(
deviceEntity
,
productEntity
,
serverInfo
);
//对外
// serverInfo.setServerUrl(platformEntity.getSendUrl());
String
phpUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_HTTP_URL
,
"http://10.12.185.213:8090"
);
serverInfo
.
setServerUrl
(
phpUrl
);
...
...
@@ -214,8 +206,8 @@ public class DeviceApiController {
deviceEntity
.
setDeviceVersion
(
req
.
getDeviceVersion
()
==
null
?
""
:
req
.
getDeviceVersion
());
deviceService
.
getDeviceDao
().
update
(
deviceEntity
);
rsp
.
setData
(
deviceResp
);
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ONLINE
);
SendThirdPartyTask
sendThirdPartyTask
=
new
SendThirdPartyTask
(
deviceEntity
,
productEntity
,
platformEntity
,
deviceService
);
sendTaskThreadPool
.
execute
(
sendThirdPartyTask
);
}
catch
(
AppException
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
rsp
.
setCode
(
e
.
getCode
());
...
...
@@ -362,7 +354,7 @@ public class DeviceApiController {
if
(
ObjectUtils
.
isEmpty
(
req
.
getSiteId
()))
{
throw
new
AppException
(
SITEID_IS_EMPTY
,
SITEID_IS_EMPTY_CONTENT
);
}
ProductEntity
productEntity
=
productService
.
get
(
req
.
getProductId
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
req
.
getProductId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
}
...
...
@@ -371,7 +363,7 @@ public class DeviceApiController {
throw
new
AppException
(
PLATFORM_UNEXIST
,
PLATFORM_UNEXIST_CONTENT
);
}
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
PLATFORM_IS_EMPTY
,
PLATFORM_IS_EMPTY_CONTENT
);
}
...
...
@@ -907,15 +899,14 @@ public class DeviceApiController {
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
.
getHomeUrl
()))
{
homeUrl
=
deviceEntity
.
getHomeUrl
();
}
log
.
info
(
"domain:"
+
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
""
));
//
log.info("domain:" + GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, ""));
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.3.24:11078"
);
//domain+homeUrl;
String
str
=
UrlBuilder
.
of
(
domain
.
trim
()).
addPath
(
homeUrl
).
build
();
String
decodeStr
=
URLDecoder
.
decode
(
str
,
Charset
.
defaultCharset
());
serverInfo
.
setHomeUrl
(
decodeStr
);
//serverInfo.setHomeUrl(domain + "/" + homeUrl);
log
.
info
(
"homeurl:"
+
serverInfo
.
getHomeUrl
());
//
log.info("homeurl:" + serverInfo.getHomeUrl());
serverInfo
.
setEventUrl
(
productEntity
.
getEventUrl
());
}
...
...
@@ -925,7 +916,6 @@ public class DeviceApiController {
download
=
productVersionEntity
.
getFilePath
();
}
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
);
//String temp = domain + "/" + download;
productVersionInfo
.
setDownloadUrl
(
UrlBuilder
.
of
(
domain
).
addPath
(
download
).
build
());
//productVersionInfo.setDownloadUrl(temp);
...
...
device-manager/src/main/java/com/mortals/xhx/common/utils/SendThirdPartyTask.java
0 → 100644
View file @
9cdf9f97
package
com.mortals.xhx.common.utils
;
import
com.mortals.xhx.common.code.DeviceMethodEnum
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
/**
* 发送任务
*
* @author: zxfei
* @date: 2022/4/28 10:56
* @description:
**/
@Slf4j
@AllArgsConstructor
public
class
SendThirdPartyTask
implements
Runnable
{
private
DeviceEntity
deviceEntity
;
private
ProductEntity
productEntity
;
private
PlatformEntity
platformEntity
;
private
DeviceService
deviceService
;
@Override
public
void
run
()
{
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ONLINE
);
}
}
device-manager/src/main/java/com/mortals/xhx/module/platform/service/PlatformService.java
View file @
9cdf9f97
package
com.mortals.xhx.module.platform.service
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
/**
* PlatformService
...
...
@@ -9,6 +10,6 @@ import com.mortals.xhx.module.platform.model.PlatformEntity;
* @author zxfei
* @date 2022-06-27
*/
public
interface
PlatformService
extends
ICRUDService
<
PlatformEntity
,
Long
>{
public
interface
PlatformService
extends
ICRUD
Cache
Service
<
PlatformEntity
,
Long
>{
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
View file @
9cdf9f97
package
com.mortals.xhx.module.product.service
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUD
Cache
Service
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
/**
* ProductService
...
...
@@ -10,7 +11,7 @@ import com.mortals.xhx.module.product.model.ProductEntity;
* @author zxfei
* @date 2022-06-27
*/
public
interface
ProductService
extends
ICRUDService
<
ProductEntity
,
Long
>{
public
interface
ProductService
extends
ICRUD
Cache
Service
<
ProductEntity
,
Long
>{
void
upGrade
(
Long
productId
,
Context
context
);
...
...
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