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

修复bug

上级 6209ea50
......@@ -24,6 +24,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
......@@ -31,7 +32,10 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 实体[动态模型] 自定义服务对象
......@@ -46,7 +50,7 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
@Value("${ibiz.filePath:d:/app/file/}")
@Value("${ibiz.filePath:/app/file/}")
private String fileRoot;
@Autowired
......@@ -59,7 +63,7 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
@Lazy
private IBZWFFeignClient wfClient;
@Value("${ibiz.dynamic.publishpath:d:/app/file/dynamicModel/publicpath}")
@Value("${ibiz.dynamic.publishpath:/app/file/dynamicModel/publicpath}")
private String publishPath;
@Autowired
......@@ -68,11 +72,14 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
@Override
public boolean create(MetaDynamicModel et) {
et.setConfigid((String)et.getDefaultKey(true));
super.create(et);
return unzip(et);
}
@Override
public boolean update(MetaDynamicModel et) {
super.update(et);
return unzip(et);
}
......@@ -94,7 +101,6 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
if (!ObjectUtils.isEmpty(items) && items.size() > 1) {
throw new BadRequestAlertException("单次只允许上传一个模型文件", "MetaDynamicModel", "unzip");
}
String dirPath = this.fileRoot + "ibizutil" + File.separator + items.get(0).getId();
File parent = new File(dirPath);
if (parent.exists() && parent.isDirectory() && parent.listFiles().length > 0) {
......@@ -114,18 +120,21 @@ public class MetaDynamicModelExService extends MetaDynamicModelServiceImpl {
}
et.setDynainstid(system.getString("getPSDynaInstId"));
et.setSystemId(system.getString("name"));
super.saveOrUpdate(et);
JSONArray array = system.getJSONArray("getPSDynaInsts");
List<MetaDynamicModel> metaDynamicModels = new ArrayList<>();
if(!ObjectUtils.isEmpty(array)){
for(int i = 0; i < array.size(); i++) {
MetaDynamicModel model = new MetaDynamicModel();
JSONObject obj = array.getJSONObject(i);
model.setConfigname(obj.get("name").toString());
model.setDynainstid(obj.get("id").toString());
model.setConfigid(DigestUtils.md5DigestAsHex(String.format("%s||%s" ,et.getSystemId(),obj.get("id").toString()).getBytes()));
model.setStatus("0");
model.setPdynainstid(et.getConfigid());
model.setSystemId(et.getSystemId());
dynamicModelService.saveOrUpdate(model);
metaDynamicModels.add(model);
}
dynamicModelService.saveOrUpdateBatch(metaDynamicModels);
}
return true;
} catch (IOException e) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册