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
71766675
Commit
71766675
authored
Feb 02, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加批量激活设备
parent
895bd40a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
33 deletions
+144
-33
device-manager-ui/admin/src/views/app/publish/list.vue
device-manager-ui/admin/src/views/app/publish/list.vue
+24
-3
device-manager-ui/admin/src/views/device/list.vue
device-manager-ui/admin/src/views/device/list.vue
+25
-28
device-manager/src/main/java/com/mortals/xhx/module/app/service/AppPublishService.java
...com/mortals/xhx/module/app/service/AppPublishService.java
+5
-0
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
...ls/xhx/module/app/service/impl/AppPublishServiceImpl.java
+34
-0
device-manager/src/main/java/com/mortals/xhx/module/app/web/AppPublishController.java
.../com/mortals/xhx/module/app/web/AppPublishController.java
+21
-0
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleDistributeServiceImpl.java
...evice/service/impl/DeviceModuleDistributeServiceImpl.java
+8
-2
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
...a/com/mortals/xhx/module/device/web/DeviceController.java
+27
-0
No files found.
device-manager-ui/admin/src/views/app/publish/list.vue
View file @
71766675
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
<div
class=
"page"
>
<div
class=
"page"
>
<LayoutTable
:data=
"tableData"
:config=
"tableConfig"
>
<LayoutTable
:data=
"tableData"
:config=
"tableConfig"
>
</LayoutTable>
</LayoutTable>
<dialog-show
ref=
"dialogform"
@
ok=
"getData"
/>
<dialog-show
ref=
"dialogform"
@
ok=
"getData"
/>
</div>
</div>
</
template
>
</
template
>
...
@@ -33,6 +31,18 @@
...
@@ -33,6 +31,18 @@
toView
(
row
)
{
toView
(
row
)
{
this
.
$refs
.
dialogform
.
view
(
row
);
this
.
$refs
.
dialogform
.
view
(
row
);
},
},
distribute
(
row
)
{
this
.
$post
(
"
/app/publish/active
"
,
row
)
.
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
"
模块部署成功!
"
);
this
.
getData
();
}
})
.
catch
((
error
)
=>
{
this
.
$message
.
error
(
error
.
message
);
});
},
},
},
data
()
{
data
()
{
...
@@ -63,6 +73,17 @@
...
@@ -63,6 +73,17 @@
formatter
:
row
=>
{
formatter
:
row
=>
{
return
(
return
(
<
table
-
buttons
noAdd
row
=
{
row
}
onEdit
=
{
this
.
toEdit
}
onView
=
{
this
.
toView
}
onDel
=
{
this
.
toDel
}
/
>
<
table
-
buttons
noAdd
row
=
{
row
}
onEdit
=
{
this
.
toEdit
}
onView
=
{
this
.
toView
}
onDel
=
{
this
.
toDel
}
/
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-open
"
onClick
=
{()
=>
{
this
.
distribute
(
row
);
}}
>
部署
<
/el-button
>
);
);
}
}
}
}
...
@@ -71,4 +92,4 @@
...
@@ -71,4 +92,4 @@
};
};
}
}
};
};
</
script
>
</
script
>
\ No newline at end of file
device-manager-ui/admin/src/views/device/list.vue
View file @
71766675
...
@@ -40,6 +40,15 @@
...
@@ -40,6 +40,15 @@
:disabled=
"isExport"
:disabled=
"isExport"
>
导出
</el-button
>
导出
</el-button
>
>
<el-button
slot=
"table-head-left2"
style=
"margin-left: 10px"
icon=
"el-icon-tickets"
size=
"mini"
@
click=
"batchActiveDevice"
>
批量激活设备
</el-button
>
<el-tag
<el-tag
slot=
"table-head-row2-left"
slot=
"table-head-row2-left"
size=
"mini"
size=
"mini"
...
@@ -317,33 +326,6 @@ export default {
...
@@ -317,33 +326,6 @@ export default {
// delete this.query.deviceStatusList
// delete this.query.deviceStatusList
},
},
downMsg
(
row
)
{
this
.
$prompt
(
"
请输入下发消息内容
"
,
"
提示
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
})
.
then
(({
value
})
=>
{
this
.
$post
(
"
/device/downMsg
"
,
{
deviceId
:
row
.
id
,
content
:
value
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
"
下发设备成功!
"
);
this
.
getData
();
}
})
.
catch
((
error
)
=>
{
this
.
$message
.
error
(
error
.
message
);
});
})
.
catch
(()
=>
{
this
.
$message
({
type
:
"
info
"
,
message
:
"
取消输入
"
,
});
});
},
activeDevice
(
row
)
{
activeDevice
(
row
)
{
this
.
$post
(
"
/device/active
"
,
{
this
.
$post
(
"
/device/active
"
,
{
...
@@ -360,6 +342,21 @@ export default {
...
@@ -360,6 +342,21 @@ export default {
});
});
},
},
batchActiveDevice
(
row
)
{
this
.
$post
(
"
/device/batchActive
"
,
{
idList
:
this
.
selection
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
"
批量激活设备成功!
"
);
this
.
getData
();
}
})
.
catch
((
error
)
=>
{
this
.
$message
.
error
(
error
.
message
);
});
},
updateSite
(
row
)
{
updateSite
(
row
)
{
this
.
$get
(
"
/sitestat/siteTree
"
,
{}).
then
(({
data
})
=>
{
this
.
$get
(
"
/sitestat/siteTree
"
,
{}).
then
(({
data
})
=>
{
this
.
areaData
=
data
.
siteTree
;
this
.
areaData
=
data
.
siteTree
;
...
@@ -606,4 +603,4 @@ export default {
...
@@ -606,4 +603,4 @@ export default {
.cursord {
.cursord {
cursor: pointer;
cursor: pointer;
}
}
</
style
>
</
style
>
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/app/service/AppPublishService.java
View file @
71766675
package
com.mortals.xhx.module.app.service
;
package
com.mortals.xhx.module.app.service
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
/**
/**
* AppPublishService
* AppPublishService
*
*
...
@@ -11,4 +14,6 @@ import com.mortals.xhx.module.app.model.AppPublishEntity;
...
@@ -11,4 +14,6 @@ import com.mortals.xhx.module.app.model.AppPublishEntity;
*/
*/
public
interface
AppPublishService
extends
ICRUDService
<
AppPublishEntity
,
Long
>{
public
interface
AppPublishService
extends
ICRUDService
<
AppPublishEntity
,
Long
>{
void
active
(
AppPublishEntity
appPublishEntity
,
Context
context
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
View file @
71766675
package
com.mortals.xhx.module.app.service.impl
;
package
com.mortals.xhx.module.app.service.impl
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.ZipUtil
;
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.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.AppTypeEnum
;
import
com.mortals.xhx.module.app.dao.AppPublishDao
;
import
com.mortals.xhx.module.app.dao.AppPublishDao
;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
import
com.mortals.xhx.module.app.service.AppPublishService
;
import
com.mortals.xhx.module.app.service.AppPublishService
;
import
com.mortals.xhx.utils.EncodeUtil
;
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
java.io.File
;
import
java.io.File
;
import
java.nio.charset.Charset
;
/**
/**
* AppPublishService
* AppPublishService
...
@@ -44,4 +48,34 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
...
@@ -44,4 +48,34 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
super
.
saveBefore
(
entity
,
context
);
super
.
saveBefore
(
entity
,
context
);
}
}
@Override
public
void
active
(
AppPublishEntity
appPublishEntity
,
Context
context
)
{
if
(
AppTypeEnum
.
前端
.
getValue
()==
appPublishEntity
.
getAppType
()){
String
targetFilePath
=
uploadService
.
getFilePath
(
appPublishEntity
.
getFilePath
());
String
disPath
=
"/"
;
boolean
directory
=
FileUtil
.
isDirectory
(
new
File
(
disPath
));
if
(
directory
){
FileUtil
.
del
(
new
File
(
disPath
));
}
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
}
else
{
}
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/app/web/AppPublishController.java
View file @
71766675
package
com.mortals.xhx.module.app.web
;
package
com.mortals.xhx.module.app.web
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
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.base.system.param.service.ParamService
;
...
@@ -8,6 +9,8 @@ import com.mortals.xhx.common.code.DistributeEnum;
...
@@ -8,6 +9,8 @@ import com.mortals.xhx.common.code.DistributeEnum;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
import
com.mortals.xhx.module.app.model.AppPublishEntity
;
import
com.mortals.xhx.module.app.service.AppPublishService
;
import
com.mortals.xhx.module.app.service.AppPublishService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -30,6 +33,24 @@ public class AppPublishController extends BaseCRUDJsonBodyMappingController<AppP
...
@@ -30,6 +33,24 @@ public class AppPublishController extends BaseCRUDJsonBodyMappingController<AppP
super
.
setModuleDesc
(
"应用发布部署"
);
super
.
setModuleDesc
(
"应用发布部署"
);
}
}
/**
* 部署
*/
@PostMapping
(
value
=
"active"
)
public
Rest
<
Void
>
deviceActive
(
@RequestBody
AppPublishEntity
appPublishEntity
)
{
String
busiDesc
=
this
.
getModuleDesc
()
+
"应用部署"
;
Rest
<
Void
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
try
{
this
.
service
.
active
(
appPublishEntity
,
getContext
());
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"应用部署"
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
@Override
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"appType"
,
AppTypeEnum
.
getEnumMap
());
this
.
addDict
(
model
,
"appType"
,
AppTypeEnum
.
getEnumMap
());
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleDistributeServiceImpl.java
View file @
71766675
...
@@ -10,7 +10,6 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
...
@@ -10,7 +10,6 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import
com.mortals.xhx.common.code.ImageReEnum
;
import
com.mortals.xhx.common.code.ImageReEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.utils.ZipUtils
;
import
com.mortals.xhx.module.device.dao.DeviceModuleDistributeDao
;
import
com.mortals.xhx.module.device.dao.DeviceModuleDistributeDao
;
import
com.mortals.xhx.module.device.model.DeviceModuleDistributeEntity
;
import
com.mortals.xhx.module.device.model.DeviceModuleDistributeEntity
;
import
com.mortals.xhx.module.device.service.DeviceModuleDistributeService
;
import
com.mortals.xhx.module.device.service.DeviceModuleDistributeService
;
...
@@ -84,7 +83,14 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
...
@@ -84,7 +83,14 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
FileUtil
.
del
(
disPath
);
FileUtil
.
del
(
disPath
);
}
}
ZipUtils
.
unzip
(
new
File
(
targetFilePath
),
disPath
);
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
//更新
//更新
distributeEntity
.
setDistributeFilePath
(
disPath
);
distributeEntity
.
setDistributeFilePath
(
disPath
);
distributeEntity
.
setDistribute
(
YesNoEnum
.
YES
.
getValue
());
distributeEntity
.
setDistribute
(
YesNoEnum
.
YES
.
getValue
());
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
View file @
71766675
...
@@ -149,6 +149,33 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -149,6 +149,33 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
return
rest
;
return
rest
;
}
}
/**
* 设备批量激活
*/
@PostMapping
(
value
=
"batchActive"
)
public
Rest
<
Void
>
deviceBatchActive
(
@RequestBody
DeviceEntity
deviceEntity
)
{
log
.
info
(
"批量设备激活:{}"
,
deviceEntity
.
getDeviceCode
());
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备激活"
;
Rest
<
Void
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
try
{
DeviceQuery
deviceQuery
=
new
DeviceQuery
();
deviceQuery
.
setIdList
(
deviceEntity
.
getIdList
());
List
<
DeviceEntity
>
deviceEntities
=
this
.
service
.
find
(
deviceQuery
,
getContext
());
for
(
DeviceEntity
entity
:
deviceEntities
)
{
try
{
this
.
service
.
active
(
entity
.
getDeviceCode
(),
getContext
());
}
catch
(
Exception
e
)
{
log
.
error
(
"设备激活"
,
e
);
}
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"批量设备激活"
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
/**
* 查看二维码
* 查看二维码
*/
*/
...
...
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