制度生成条款生时自动生成编号

This commit is contained in:
lihongyu 2022-11-02 10:22:34 +08:00
parent ed7e3f55d5
commit 859402c698
3 changed files with 80 additions and 1 deletions

View File

@ -319,7 +319,6 @@ public class CreateMaps implements IJob {
// 设置画布大小
setDiagramHeightWidth(definition, elements);
System.err.println("==========>"+elements);
defineModel.setDefinition(definition.toString());
// 保存文件
if(CoeDesignerAPIManager.getInstance().storeDefinition(defineModel)>0) {

View File

@ -7,6 +7,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.no.epc.web.EpcGraphWeb;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
@ -296,6 +297,8 @@ public class ReadWordUtil {
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
if(new CreateMaps().updateMaps2(userContext, wsId, dcContextpdf1, name, groupValue, fileValue, fileName)) {
PALRepositoryModel model = PALRepositoryCache.getCache().get(fileValue);
RefreshNo(model);
logMaps.put("CREATESHAPE", "图形创建成功!");
}else {
logMaps.put("CREATESHAPE", "图形创建失败!");
@ -390,6 +393,8 @@ public class ReadWordUtil {
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docxname);
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
if(new CreateMaps().updateMaps(userContext, wsId, docxfile, title)) {
PALRepositoryModel model = PALRepositoryCache.getCache().get(fileValue);
RefreshNo(model);
logMaps.put("CREATESHAPE", "图形创建成功!");
}else {
logMaps.put("CREATESHAPE", "图形创建失败!");
@ -918,4 +923,66 @@ public class ReadWordUtil {
public void setFileFieldMap(Map<String, WordField<Object>> fileFieldMap) {
this.fileFieldMap = fileFieldMap;
}
public void RefreshNo(PALRepositoryModel palRepositoryModel) {
try {
//获取节点json
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(palRepositoryModel.getId(), 0);
if(defineModel==null) {
}else {
String define = defineModel.getDefinition();
JSONObject definition = null;
JSONObject elements = null;
try {
definition = JSONObject.parseObject(define);
elements = definition.getJSONObject("elements");
} catch (Exception e) {
// TODO: handle exception
}
//刷新后生成的编号
EpcGraphWeb web = new EpcGraphWeb(UserContext.fromUID(palRepositoryModel.getCreateUser()));
String refreshDesignerNo = web.refreshDesignerNo(palRepositoryModel.getId());
JSONObject refreshDesignerNoJson = JSONObject.parseObject(refreshDesignerNo);
JSONObject refreshDesignerNoJson2 = refreshDesignerNoJson.getJSONObject("data");
JSONObject json = refreshDesignerNoJson2.getJSONObject("data");
//把编号添加到对应的节点
if(elements!=null) {
for (String key : elements.keySet()) {
JSONObject shape1 = elements.getJSONObject(key);
if ("item2".equals(shape1.getString("name"))) {
//String shapeText = shape1.getString("text");
JSONArray dataAttributes = shape1.getJSONArray("dataAttributes");
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
for (Object attribute : dataAttributes) {
JSONObject obj = (JSONObject) attribute;
if (obj.containsKey("attributesJsonArray")) {
JSONArray attributesJsonArray = obj.getJSONArray("attributesJsonArray");
for (int i = 0; i < attributesJsonArray.size(); i++) {
if (attributesJsonArray.getJSONObject(i).containsKey("id")) {
String getid = attributesJsonArray.getJSONObject(i).getString("id");
if (getid.equals("activity_number")) {
attributesJsonArray.getJSONObject(i).replace("value",json.getString(key));
}
}
}
}
}
}
}
}
// 保存文件
defineModel.setDefinition(definition.toString());
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
}
}
} catch (Exception e) {
// TODO: handle exception
}
}
}

View File

@ -977,7 +977,20 @@ public class WordUtilXWPF {
tmp.put("value", str);
tmp.put("groupPath", "baseAttribute");
tmp.put("key", "desc");
JSONObject file_numberJson = new JSONObject();
file_numberJson.put("ref", "");
file_numberJson.put("readonly", false);
file_numberJson.put("scope", "*");
file_numberJson.put("name", "序号");
file_numberJson.put("id", "activity_number");
file_numberJson.put("type", "string");
file_numberJson.put("value", "");
file_numberJson.put("groupPath", "baseAttribute");
file_numberJson.put("key", "activity_number");
attribute.add(tmp);
attribute.add(file_numberJson);
// shape1.put("text",orgdepartmentList.get(i).getString("POSITION_NAME"));
if (lastshap.getString("text").contains("适用范围设定")) {
System.out.println("断点");