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
b4e490d9
Commit
b4e490d9
authored
Feb 19, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加批量激活设备
parent
000a7121
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
34 deletions
+29
-34
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+5
-1
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
...ls/xhx/module/app/service/impl/AppPublishServiceImpl.java
+5
-8
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
...a/com/mortals/xhx/module/device/web/DeviceController.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductVersionServiceImpl.java
...odule/product/service/impl/ProductVersionServiceImpl.java
+0
-19
device-manager/src/main/resources/logback-spring.xml
device-manager/src/main/resources/logback-spring.xml
+13
-4
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
.../java/com/mortals/httpclient/device/DeviceController.http
+1
-1
device-manager/src/test/java/com/mortals/httpclient/http-client.env.json
...src/test/java/com/mortals/httpclient/http-client.env.json
+4
-0
No files found.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
b4e490d9
...
...
@@ -170,6 +170,10 @@ public class DeviceApiController {
authInfo
.
setMessageTtl
(
messageTtl
);
authInfo
.
setVirtualHost
(
virtualHost
);
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
.
getProductId
())){
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
}
ProductEntity
productEntity
=
productService
.
getCache
(
deviceEntity
.
getProductId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
...
...
@@ -988,7 +992,7 @@ public class DeviceApiController {
String
decode
=
URLDecoder
.
decode
(
str
,
Charset
.
defaultCharset
());
System
.
out
.
println
(
decode
);
str
=
"/file/
uploadfile
/1675836231156.zip"
;
str
=
"/file/
fileupload
/1675836231156.zip"
;
System
.
out
.
println
(
FileUtil
.
getPrefix
(
str
));
System
.
out
.
println
(
FileUtil
.
mainName
(
str
));
...
...
device-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppPublishServiceImpl.java
View file @
b4e490d9
...
...
@@ -43,7 +43,7 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
Map
<
String
,
String
>
appPublish
=
paramService
.
getParamByFirstOrganize
(
"appPublish"
);
String
appName
=
appPublish
.
get
(
entity
.
getAppCode
());
entity
.
setAppName
(
appName
);
String
targetPath
=
"/home/mortals/app
s/
"
;
String
targetPath
=
"/home/mortals/app
/data/apps
"
;
String
fileNewName
=
entity
.
getAppCode
()
+
"-"
+
entity
.
getVersion
()
+
"."
+
FileUtil
.
getSuffix
(
entity
.
getFilePath
());
//将zip包移动到指定目录 并更改名称
...
...
@@ -58,10 +58,7 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
log
.
info
(
"targetPath:"
+
targetPath
+
fileNewName
);
//移动文件并重命名
FileUtil
.
move
(
new
File
(
realFilePath
),
new
File
(
targetPath
+
fileNewName
),
true
);
entity
.
setFilePath
(
targetPath
+
fileNewName
);
super
.
saveBefore
(
entity
,
context
);
}
...
...
@@ -76,7 +73,7 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
String
appName
=
appPublish
.
get
(
entity
.
getAppCode
());
entity
.
setAppName
(
appName
);
String
targetPath
=
"/home/mortals/app
s/
"
;
String
targetPath
=
"/home/mortals/app
/data/apps
"
;
String
fileNewName
=
entity
.
getAppCode
()
+
"-"
+
entity
.
getVersion
()
+
"."
+
FileUtil
.
getSuffix
(
entity
.
getFilePath
());
//将zip包移动到指定目录 并更改名称
String
realFilePath
=
uploadService
.
getFilePath
(
entity
.
getFilePath
());
...
...
@@ -127,12 +124,12 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
String
disPath
=
"/home/
temp/
"
;
String
disPath
=
"/home/
mortals/app/data/temp
"
;
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
String
scriptPath
=
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
;
String
scriptPath
=
"/home/
mortals/app/data/
temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
;
// RuntimeUtil.exec("chmod 755 "+scriptPath);
ProcessBuilder
sh
=
new
ProcessBuilder
(
"sh"
,
scriptPath
);
File
file
=
new
File
(
"/home/temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
);
File
file
=
new
File
(
"/home/
mortals/app/data/
temp/"
+
appPublishEntity
.
getAppCode
()
+
"/deploy.sh"
);
asynExeLocalComand
(
file
,
sh
);
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
View file @
b4e490d9
...
...
@@ -338,7 +338,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
list
.
stream
().
peek
(
item
->
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPicObj
()))
{
String
extension
=
item
.
getPicObj
().
suggestFileExtension
();
String
newName
=
"/file/
uploadfile
/"
+
new
Date
().
getTime
()
+
"."
+
extension
;
String
newName
=
"/file/
fileupload
/"
+
new
Date
().
getTime
()
+
"."
+
extension
;
String
filePath
=
uploadService
.
getFilePath
(
newName
);
try
{
boolean
bool
=
FileUtil
.
write
(
filePath
,
item
.
getPicObj
().
getData
(),
true
,
true
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductVersionServiceImpl.java
View file @
b4e490d9
...
...
@@ -82,25 +82,6 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
}
}
/*
@Override
protected void saveAfter(ProductVersionEntity entity, Context context) throws AppException {
//推送消息
super.saveAfter(entity, context);
pushUpgradMsg(entity, context);
}
@Override
protected void updateAfter(ProductVersionEntity entity, Context context) throws AppException {
super.updateAfter(entity, context);
pushUpgradMsg(entity, context);
}
*/
private
void
pushUpgradMsg
(
ProductVersionEntity
entity
,
Context
context
)
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductId
()))
{
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
(),
context
);
...
...
device-manager/src/main/resources/logback-spring.xml
View file @
b4e490d9
...
...
@@ -40,11 +40,11 @@
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}
</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>
7
</MaxHistory>
<MaxHistory>
15
</MaxHistory>
</rollingPolicy>
</appender>
<root
level=
"
info
"
>
<root
level=
"
${logLevel}
"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"fileInfo"
/>
<appender-ref
ref=
"fileError"
/>
...
...
@@ -52,16 +52,25 @@
<!--TRACE < DEBUG < INFO < WARN < ERROR < FATAL -->
<!--用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。
<logger>仅有一个name属性,一个可选的level和一个可选的additivity属性。-->
<!--用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。<logger>仅有一个name属性,一个可选的level和一个可选的additivity属性。-->
<!-- name 用来指定受此loger约束的某一个包或者具体的某一个类-->
<!-- level 用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。如果未设置此属性,那么当前logger将会继承上级的级别-->
<!-- additivity 是否向上级logger传递打印信息。默认是true。false:表示只用当前logger的appender-ref。true:表示当前logger的appender-ref和rootLogger的appender-ref都有效。-->
<logger
name=
"com.mortals"
level=
"${logLevel}"
additivity=
"false"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"fileInfo"
/>
<appender-ref
ref=
"fileError"
/>
</logger>
<logger
name=
"com.mortals.xhx.module"
level=
"${logLevel}"
additivity=
"false"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"fileInfo"
/>
<appender-ref
ref=
"fileError"
/>
</logger>
<!-- <logger name="com.mortals.xhx.module">
<level value="debug"/>
</logger>-->
</configuration>
\ No newline at end of file
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
View file @
b4e490d9
...
...
@@ -89,7 +89,7 @@ POST {{baseUrl}}/api/register
Content-Type: application/json
{
"deviceCode": "
7E-03-67-08-7F-30
"
"deviceCode": "
0c-cf-89-09-d1-c8
"
}
> {%
...
...
device-manager/src/test/java/com/mortals/httpclient/http-client.env.json
View file @
b4e490d9
...
...
@@ -17,6 +17,10 @@
},
"yibin"
:
{
"baseUrl"
:
"http://10.12.185.213:11078/m"
},
"yibin-web"
:
{
"baseUrl"
:
"http://112.19.80.237:11078/m"
}
}
\ 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