Commit b4e490d9 authored by 赵啸非's avatar 赵啸非

添加批量激活设备

parent 000a7121
......@@ -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));
......
......@@ -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/apps/";
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/apps/";
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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......@@ -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"
}
> {%
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment