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

添加批量激活设备

parent e0a07049
......@@ -8,6 +8,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.AppTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.SynchronousLocalShellCommand;
import com.mortals.xhx.module.app.dao.AppPublishDao;
import com.mortals.xhx.module.app.model.AppPublishEntity;
......@@ -20,6 +21,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -71,8 +73,7 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
protected void updateBefore(AppPublishEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
AppPublishEntity appPublishEntity = this.get(entity.getId());
if (entity.getFilePath().equals(appPublishEntity.getFilePath())) {
if (!entity.getFilePath().equals(appPublishEntity.getFilePath())) {
Map<String, String> appPublish = paramService.getParamByFirstOrganize("appPublish");
String appName = appPublish.get(entity.getAppCode());
......@@ -114,6 +115,11 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
log.error("异常", e);
}
ZipUtil.unzip(targetFilePath, disPath, Charset.forName(fileEncode));
//更新
appPublishEntity.setDistributeFilePath(disPath);
appPublishEntity.setDistribute(YesNoEnum.YES.getValue());
appPublishEntity.setUpdateTime(new Date());
} else {
//后端部署 执行sh 脚本程序部署
//解压到临时目录
......@@ -139,6 +145,11 @@ public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao
//执行sh发布脚本
// RuntimeUtil.exec("/bin/sh /home/temp/"+appPublishEntity.getAppCode()+"/deploy.sh");
}
this.update(appPublishEntity, context);
}
......
......@@ -54,7 +54,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
ProductEntity productEntity = productService.get(entity.getProductId(), context);
entity.setProductCode(productEntity.getProductCode());
entity.setProductName(productEntity.getProductName());
entity.setImageResolutionValue(ImageReEnum.getByValue(Integer.parseInt(entity.getImageResolution())).getDesc());
super.updateBefore(entity, context);
......
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