Commit 568a26b2 authored by 赵啸非's avatar 赵啸非

添加批量激活设备

parent 5b690a13
......@@ -4,7 +4,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="应用名称" :span="20" prop="appName" type="select" :enumData="dict.appPublish" v-model="form.appName" placeholder="请选择应用"/>
<Field label="应用名称" :span="20" prop="appCode" type="select" :enumData="dict.appPublish" v-model="form.appCode" placeholder="请选择应用"/>
<Field :span="20" label="文件路径地址"><fileUpload v-model="form.filePath" prePath="/file/uploadfile"/></Field>
......
......@@ -37,6 +37,9 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
@Override
protected void saveBefore(AppPublishEntity entity, Context context) throws AppException {
Map<String, String> appPublish = paramService.getParamByFirstOrganize("appPublish");
String appName = appPublish.get(entity.getAppCode());
entity.setAppName(appName);
String targetPath = "/home/mortals/apps/";
String fileNewName = entity.getAppCode() + "-" + entity.getVersion()+"."+FileUtil.getSuffix(entity.getFilePath());
......@@ -55,10 +58,7 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
entity.setFilePath(targetPath + fileNewName);
Map<String, String> appPublish = paramService.getParamByFirstOrganize("appPublish");
String appCode = appPublish.get(entity.getAppName());
entity.setAppCode(appCode);
super.saveBefore(entity, context);
}
......@@ -68,6 +68,12 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
super.updateBefore(entity, context);
AppPublishEntity appPublishEntity = this.get(entity.getId());
if (entity.getFilePath().equals(appPublishEntity.getFilePath())) {
Map<String, String> appPublish = paramService.getParamByFirstOrganize("appPublish");
String appName = appPublish.get(entity.getAppCode());
entity.setAppName(appName);
String targetPath = "/home/mortals/apps/";
String fileNewName = entity.getAppCode() + "-" + entity.getVersion()+"."+FileUtil.getSuffix(entity.getFilePath());
//将zip包移动到指定目录 并更改名称
......@@ -83,10 +89,6 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
//移动文件并重命名
FileUtil.move(new File(realFilePath), new File(targetPath + fileNewName), true);
entity.setFilePath(targetPath + fileNewName);
Map<String, String> appPublish = paramService.getParamByFirstOrganize("appPublish");
String appCode = appPublish.get(entity.getAppName());
entity.setAppCode(appCode);
}
......
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