提交 ae9d9e51 编写于 作者: tangyaolong's avatar tangyaolong

修改时副本上传问题

上级 04fbce83
package cn.ibizlab.core.extensions.service; package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.lite.domain.DynamicModelConfig;
import cn.ibizlab.core.lite.domain.MetaDynamicModel; import cn.ibizlab.core.lite.domain.MetaDynamicModel;
import cn.ibizlab.core.lite.service.IMetaDynamicModelService; import cn.ibizlab.core.lite.service.IMetaDynamicModelService;
import cn.ibizlab.core.lite.service.impl.MetaDynamicModelServiceImpl; import cn.ibizlab.core.lite.service.impl.MetaDynamicModelServiceImpl;
...@@ -72,6 +71,11 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl { ...@@ -72,6 +71,11 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
return unzip(et); return unzip(et);
} }
@Override
public boolean update(MetaDynamicModel et) {
return unzip(et);
}
/** /**
* 将zip解压到file目录 * 将zip解压到file目录
* *
...@@ -83,8 +87,9 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl { ...@@ -83,8 +87,9 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
JSONObject system = null; JSONObject system = null;
String strModelFile = et.getModelfile(); String strModelFile = et.getModelfile();
if (StringUtils.isEmpty(strModelFile)) if (StringUtils.isEmpty(strModelFile)){
throw new BadRequestAlertException("模型文件为空", "MetaDynamicModel", "unzip"); throw new BadRequestAlertException("模型文件为空", "MetaDynamicModel", "unzip");
}
List<FileItem> items = JSONArray.parseArray(strModelFile, FileItem.class); List<FileItem> items = JSONArray.parseArray(strModelFile, FileItem.class);
if (!ObjectUtils.isEmpty(items) && items.size() > 1) { if (!ObjectUtils.isEmpty(items) && items.size() > 1) {
throw new BadRequestAlertException("单次只允许上传一个模型文件", "MetaDynamicModel", "unzip"); throw new BadRequestAlertException("单次只允许上传一个模型文件", "MetaDynamicModel", "unzip");
...@@ -109,7 +114,11 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl { ...@@ -109,7 +114,11 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
} }
et.setDynainstid(system.getString("getPSDynaInstId")); et.setDynainstid(system.getString("getPSDynaInstId"));
et.setSystemId(system.getString("name")); et.setSystemId(system.getString("name"));
super.create(et); if(StringUtils.isEmpty(et.getConfigid())){
super.create(et);
}else {
super.update(et);
}
JSONArray array = system.getJSONArray("getPSDynaInsts"); JSONArray array = system.getJSONArray("getPSDynaInsts");
if(!ObjectUtils.isEmpty(array)){ if(!ObjectUtils.isEmpty(array)){
for(int i = 0; i < array.size(); i++) { for(int i = 0; i < array.size(); i++) {
...@@ -118,6 +127,7 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl { ...@@ -118,6 +127,7 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
model.setConfigname(obj.get("name").toString()); model.setConfigname(obj.get("name").toString());
model.setDynainstid(obj.get("id").toString()); model.setDynainstid(obj.get("id").toString());
model.setPdynainstid(et.getConfigid()); model.setPdynainstid(et.getConfigid());
model.setSystemId(et.getSystemId());
dynamicModelService.create(model); dynamicModelService.create(model);
} }
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册