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
28fa08bb
Commit
28fa08bb
authored
Feb 03, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加批量激活设备
parent
a39d92e1
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
23 deletions
+75
-23
device-manager-ui/admin/src/views/product/list.vue
device-manager-ui/admin/src/views/product/list.vue
+23
-0
device-manager-ui/admin/src/views/product/version/drawershow.vue
...manager-ui/admin/src/views/product/version/drawershow.vue
+1
-0
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
...ls/xhx/module/app/service/impl/AppPublishServiceImpl.java
+3
-5
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
...om/mortals/xhx/module/product/service/ProductService.java
+3
-0
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductVersionService.java
...als/xhx/module/product/service/ProductVersionService.java
+5
-0
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductVersionServiceImpl.java
...odule/product/service/impl/ProductVersionServiceImpl.java
+9
-2
device-manager/src/main/java/com/mortals/xhx/module/product/web/ProductVersionController.java
...tals/xhx/module/product/web/ProductVersionController.java
+31
-16
No files found.
device-manager-ui/admin/src/views/product/list.vue
View file @
28fa08bb
...
@@ -45,6 +45,19 @@ export default {
...
@@ -45,6 +45,19 @@ export default {
});
});
},
},
distribute
(
row
)
{
this
.
$post
(
"
/product/publish
"
,
row
)
.
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
"
应用发布成功!
"
);
this
.
getData
();
}
})
.
catch
((
error
)
=>
{
this
.
$message
.
error
(
error
.
message
);
});
},
},
},
// beforeRouteEnter(to, from, next) {next(vm => {
// beforeRouteEnter(to, from, next) {next(vm => {
// // 通过 `vm` 访问组件实例
// // 通过 `vm` 访问组件实例
...
@@ -91,6 +104,16 @@ export default {
...
@@ -91,6 +104,16 @@ export default {
onView
=
{
this
.
toView
}
onView
=
{
this
.
toView
}
onDel
=
{
this
.
toDel
}
onDel
=
{
this
.
toDel
}
/
>
/
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-open
"
onClick
=
{()
=>
{
this
.
distribute
(
row
);
}}
>
发布
<
/el-button
>
<
span
>
<
/span
>
<
span
>
<
/span
>
<
el
-
button
<
el
-
button
size
=
"
mini
"
size
=
"
mini
"
...
...
device-manager-ui/admin/src/views/product/version/drawershow.vue
View file @
28fa08bb
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
afterSubmit
(
data
)
{
afterSubmit
(
data
)
{
this
.
open
=
false
;
this
.
open
=
false
;
this
.
reset
()
this
.
$emit
(
"
ok
"
);
this
.
$emit
(
"
ok
"
);
},
},
...
...
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
View file @
28fa08bb
...
@@ -131,9 +131,9 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
...
@@ -131,9 +131,9 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
String
scriptPath
=
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
;
String
scriptPath
=
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
;
// RuntimeUtil.exec("chmod 755 "+scriptPath);
// RuntimeUtil.exec("chmod 755 "+scriptPath);
ProcessBuilder
sh
=
new
ProcessBuilder
(
"sh"
,
scriptPath
);
ProcessBuilder
sh
=
new
ProcessBuilder
(
"sh"
,
scriptPath
);
File
file
=
new
File
(
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
);
File
file
=
new
File
(
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
);
asynExeLocalComand
(
null
,
sh
);
asynExeLocalComand
(
file
,
sh
);
}
}
this
.
update
(
appPublishEntity
,
context
);
this
.
update
(
appPublishEntity
,
context
);
...
@@ -141,8 +141,6 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
...
@@ -141,8 +141,6 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
}
}
public
void
asynExeLocalComand
(
File
file
,
ProcessBuilder
pb
)
throws
IOException
{
public
void
asynExeLocalComand
(
File
file
,
ProcessBuilder
pb
)
throws
IOException
{
// 不使用Runtime.getRuntime().exec(command)的方式,因为无法设置以下特性
// 不使用Runtime.getRuntime().exec(command)的方式,因为无法设置以下特性
// Java执行本地命令是启用一个子进程处理,默认情况下子进程与父进程I/O通过管道相连(默认ProcessBuilder.Redirect.PIPE)
// Java执行本地命令是启用一个子进程处理,默认情况下子进程与父进程I/O通过管道相连(默认ProcessBuilder.Redirect.PIPE)
...
...
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
View file @
28fa08bb
...
@@ -14,4 +14,7 @@ public interface ProductService extends ICRUDService<ProductEntity,Long>{
...
@@ -14,4 +14,7 @@ public interface ProductService extends ICRUDService<ProductEntity,Long>{
void
upGrade
(
Long
productId
,
Context
context
);
void
upGrade
(
Long
productId
,
Context
context
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/product/service/ProductVersionService.java
View file @
28fa08bb
package
com.mortals.xhx.module.product.service
;
package
com.mortals.xhx.module.product.service
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.product.model.ProductVersionEntity
;
import
com.mortals.xhx.module.product.model.ProductVersionEntity
;
/**
/**
* ProductVersionService
* ProductVersionService
*
*
...
@@ -11,4 +14,6 @@ import com.mortals.xhx.module.product.model.ProductVersionEntity;
...
@@ -11,4 +14,6 @@ import com.mortals.xhx.module.product.model.ProductVersionEntity;
*/
*/
public
interface
ProductVersionService
extends
ICRUDService
<
ProductVersionEntity
,
Long
>{
public
interface
ProductVersionService
extends
ICRUDService
<
ProductVersionEntity
,
Long
>{
void
appPublish
(
ProductVersionEntity
productVersionEntity
,
Context
context
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductVersionServiceImpl.java
View file @
28fa08bb
...
@@ -65,21 +65,23 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
...
@@ -65,21 +65,23 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
}
}
}
}
/*
@Override
@Override
protected void saveAfter(ProductVersionEntity entity, Context context) throws AppException {
protected void saveAfter(ProductVersionEntity entity, Context context) throws AppException {
//推送消息
//推送消息
pushUpgradMsg
(
entity
,
context
);
super.saveAfter(entity, context);
super.saveAfter(entity, context);
pushUpgradMsg(entity, context);
}
}
@Override
@Override
protected void updateAfter(ProductVersionEntity entity, Context context) throws AppException {
protected void updateAfter(ProductVersionEntity entity, Context context) throws AppException {
pushUpgradMsg
(
entity
,
context
);
super.updateAfter(entity, context);
super.updateAfter(entity, context);
pushUpgradMsg(entity, context);
}
}
*/
private
void
pushUpgradMsg
(
ProductVersionEntity
entity
,
Context
context
)
{
private
void
pushUpgradMsg
(
ProductVersionEntity
entity
,
Context
context
)
{
...
@@ -112,4 +114,9 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
...
@@ -112,4 +114,9 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
}
}
}
}
}
}
@Override
public
void
appPublish
(
ProductVersionEntity
productVersionEntity
,
Context
context
)
{
pushUpgradMsg
(
productVersionEntity
,
context
);
}
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/product/web/ProductVersionController.java
View file @
28fa08bb
package
com.mortals.xhx.module.product.web
;
package
com.mortals.xhx.module.product.web
;
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.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductVersionEntity
;
import
com.mortals.xhx.module.product.model.ProductVersionQuery
;
import
com.mortals.xhx.module.product.model.ProductVersionQuery
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.product.service.ProductVersionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
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
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.product.model.ProductVersionEntity
;
import
com.mortals.xhx.module.product.service.ProductVersionService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
/**
*
*
* 产品客户端版本
* 产品客户端版本
...
@@ -54,7 +48,6 @@ public class ProductVersionController extends BaseCRUDJsonBodyMappingController<
...
@@ -54,7 +48,6 @@ public class ProductVersionController extends BaseCRUDJsonBodyMappingController<
@Override
@Override
protected
void
saveBefore
(
ProductVersionEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
ProductVersionEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
ProductVersionEntity
productVersionEntity
=
this
.
service
.
selectOne
(
new
ProductVersionQuery
().
productId
(
entity
.
getProductId
()).
version
(
entity
.
getVersion
()));
ProductVersionEntity
productVersionEntity
=
this
.
service
.
selectOne
(
new
ProductVersionQuery
().
productId
(
entity
.
getProductId
()).
version
(
entity
.
getVersion
()));
if
(!
ObjectUtils
.
isEmpty
(
productVersionEntity
)){
if
(!
ObjectUtils
.
isEmpty
(
productVersionEntity
)){
entity
.
setId
(
productVersionEntity
.
getId
());
entity
.
setId
(
productVersionEntity
.
getId
());
...
@@ -63,4 +56,26 @@ public class ProductVersionController extends BaseCRUDJsonBodyMappingController<
...
@@ -63,4 +56,26 @@ public class ProductVersionController extends BaseCRUDJsonBodyMappingController<
}
}
super
.
saveBefore
(
entity
,
model
,
context
);
super
.
saveBefore
(
entity
,
model
,
context
);
}
}
/**
* 发布
*/
@PostMapping
(
value
=
"publish"
)
public
Rest
<
Void
>
producePublish
(
@RequestBody
ProductVersionEntity
productVersionEntity
)
{
String
busiDesc
=
this
.
getModuleDesc
()
+
"应用发布"
;
Rest
<
Void
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
try
{
ProductVersionEntity
entity
=
this
.
service
.
get
(
productVersionEntity
.
getId
());
if
(
ObjectUtils
.
isEmpty
(
entity
)){
throw
new
AppException
(
"应用不存在!"
);
}
this
.
service
.
appPublish
(
productVersionEntity
,
getContext
());
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"应用发布"
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
}
}
\ No newline at end of file
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