处理扩展属性出现链接信息的错误
This commit is contained in:
parent
901f047405
commit
e9c8701cc0
Binary file not shown.
@ -0,0 +1,180 @@
|
||||
package com.actionsoft.apps.coe.pal.processlist.util;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeGroupModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.bpms.commons.login.constant.LoginConst;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.RoleModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ProcessListUtil {
|
||||
|
||||
/**
|
||||
* 文件自定义属性
|
||||
* @param uuid
|
||||
*/
|
||||
public static JSONObject getProcessLevelPropertyVal(String uuid, PALRepositoryModel m, List<PALRepositoryPropertyModel> propertys) {
|
||||
int index = 1;
|
||||
JSONObject result = new JSONObject();
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
// PALRepositoryModel m = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plModel.getId());
|
||||
// 获取所有文件属性
|
||||
List<PALMethodAttributeModel> methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAttributeModels(m.getWsId(), m.getMethodId());
|
||||
if (methodAttrModels != null && methodAttrModels.size() > 0) {
|
||||
Map<String, PALMethodAttributeModel> attributeModelMap = new HashMap<>();
|
||||
Map<String, Integer> sortAttrMap = new HashMap<>();
|
||||
if (methodAttrModels != null) {
|
||||
int sort = 0;
|
||||
for (PALMethodAttributeModel attr : methodAttrModels) {
|
||||
attributeModelMap.put(attr.getKey(), attr);
|
||||
sortAttrMap.put(attr.getKey(), ++sort);
|
||||
}
|
||||
}
|
||||
PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(m.getMethodId());
|
||||
List<PALMethodAttributeGroupModel> groups = methodModel.getGroup();
|
||||
// PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
|
||||
// List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(plModel.getId(), null);
|
||||
//List<PALRepositoryPropertyModel> propertys = PALRepositoryPropertyCache.getPropertyByPlId(plModel.getId());
|
||||
// 排序
|
||||
propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
|
||||
|
||||
for (PALRepositoryPropertyModel property : propertys) {
|
||||
String id = property.getPropertyId();
|
||||
if (!attributeModelMap.containsKey(id) || !attributeModelMap.get(id).getUse()) {
|
||||
continue;
|
||||
}
|
||||
PALMethodAttributeModel attributeModel = attributeModelMap.get(id);
|
||||
String inputValue = property.getPropertyValue();
|
||||
if ("relation".equals(attributeModel.getType())) {
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey());
|
||||
if (list != null && list.size() > 0) {
|
||||
// 判断是否有重复数据,进行重复过滤
|
||||
Set<String> tempStrs = new HashSet<>();
|
||||
List<DesignerShapeRelationModel> tempList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DesignerShapeRelationModel model = list.get(i);
|
||||
String str = model.getFileId() + model.getShapeId() + model.getAttrId() + model.getRelationFileId() + model.getRelationShapeId();
|
||||
if (!tempStrs.contains(str)) {
|
||||
tempList.add(model);
|
||||
tempStrs.add(str);
|
||||
}
|
||||
}
|
||||
list = tempList;
|
||||
List<String> inputValueList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DesignerShapeRelationModel model = list.get(i);
|
||||
JSONObject refObj = JSONObject.parseObject(attributeModel.getRef());
|
||||
String relationTyp = refObj.containsKey("type") ? refObj.getString("type") : "shape";
|
||||
if ("file".equals(relationTyp)) {// 关联的模型文件
|
||||
if (model.getRelationFileId().length() < 36) {
|
||||
continue;
|
||||
}
|
||||
List<PALRepositoryModel> list2 = PALRepositoryCache.getByVersionId(m.getWsId(), model.getRelationFileId());
|
||||
for (PALRepositoryModel model2 : list2) {
|
||||
if (model2.isUse()) {
|
||||
inputValueList.add(model2.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ("shapeAndFile".equals(relationTyp)) {// 关联的有形状属性和文件属性 伊利
|
||||
if (UtilString.isEmpty(model.getRelationShapeId())) {// 关联文件,发现记录的不是versionID,而是id 伊利
|
||||
PALRepositoryModel relationModel = PALRepositoryCache.getCache().get(model.getRelationFileId());
|
||||
if (relationModel != null) {
|
||||
inputValueList.add(relationModel.getName());
|
||||
}
|
||||
} else {
|
||||
// 关联形状
|
||||
inputValueList.add(model.getRelationShapeText());
|
||||
}
|
||||
} else {// 关联的形状属性
|
||||
inputValueList.add(model.getRelationShapeText());
|
||||
}
|
||||
}
|
||||
inputValue = StringUtils.join(inputValueList, ",");
|
||||
} else {//db中无关联数据
|
||||
inputValue = "";
|
||||
}
|
||||
}
|
||||
// 关联bpm组织架构
|
||||
if ("awsorg".equals(attributeModel.getType())) {
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey());
|
||||
List<String> deptValList = new ArrayList<>();
|
||||
List<String> positionValList = new ArrayList<>();
|
||||
List<String> roleValList = new ArrayList<>();
|
||||
List<String> userValList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
Set<String> filter = new HashSet<String>();// 去重记录
|
||||
|
||||
list.sort((m1, m2) -> {return m1.getId().compareTo(m2.getId());});
|
||||
for (DesignerShapeRelationModel model : list) {
|
||||
if ("00000000-0000-0000-0000-000000000000".equals(model.getRelationFileId()) && "00000000-0000-0000-0000-000000000000".equals(model.getRelationShapeId())) {
|
||||
JSONObject object = JSONObject.parseObject(model.getRelationShapeText());
|
||||
// 查询最新名称
|
||||
if ("department".equals(object.getString("type"))) {
|
||||
DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id"));
|
||||
if (dept != null && !filter.contains(dept.getId())) {
|
||||
deptValList.add(dept.getName());
|
||||
filter.add(dept.getId());
|
||||
}
|
||||
}
|
||||
if ("position".equals(object.getString("type"))) {// 岗位,先用角色代替
|
||||
RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id"));
|
||||
if (role != null && !filter.contains(role.getId())) {
|
||||
positionValList.add(role.getName());
|
||||
filter.add(role.getId());
|
||||
}
|
||||
}
|
||||
if ("user".equals(object.getString("type"))) {
|
||||
UserModel user = SDK.getORGAPI().getUser(object.getString("id"));
|
||||
if (user != null && !filter.contains(user.getUID())) {
|
||||
userValList.add(user.getUserName());
|
||||
filter.add(user.getUID());
|
||||
}
|
||||
}
|
||||
if ("role".equals(object.getString("type"))) {
|
||||
RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id"));
|
||||
if (role != null && !filter.contains(role.getId())) {
|
||||
roleValList.add(role.getName());
|
||||
filter.add(role.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据组合
|
||||
deptValList.addAll(positionValList);
|
||||
deptValList.addAll(roleValList);
|
||||
deptValList.addAll(userValList);
|
||||
inputValue = StringUtils.join(deptValList, ",");
|
||||
}
|
||||
inputValue = inputValue.replaceAll("'", "'");
|
||||
inputValue = inputValue.replaceAll("\"", """);
|
||||
JSONObject attribute = new JSONObject();
|
||||
attribute.put("name", property.getPropertyName());
|
||||
attribute.put("key", property.getPropertyId());
|
||||
attribute.put("value", inputValue);
|
||||
attribute.put("type", attributeModel.getType());
|
||||
result.put(String.valueOf(index++), attribute);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package com.actionsoft.apps.coe.pal.processlist.util;
|
||||
|
||||
public class ProcssListUtil {
|
||||
|
||||
}
|
||||
@ -28,6 +28,7 @@ import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
|
||||
import com.actionsoft.apps.coe.pal.processlist.cache.ProcessListConfigCache;
|
||||
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListConfigModel;
|
||||
import com.actionsoft.apps.coe.pal.processlist.util.ProcessListUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.SubUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -886,7 +887,7 @@ public class PALRepositoryListWeb extends ActionWeb {
|
||||
// obj.put("statusCode", model.isApproval() ? "approval" : model.isPublish() ? "publish" : model.isStop() ? "stop" : "designer");
|
||||
obj.put("version", VersionUtil.getVersionStrV(model.getVersion()));
|
||||
// 获取所有扩展属性的值
|
||||
JSONObject extendAttrValObj = CoeProcessLevelUtil.getProcessLevelPropertyVal(model.getId(), model, props);
|
||||
JSONObject extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props);
|
||||
JSONObject object = new JSONObject();
|
||||
Iterator iter = extendAttrValObj.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -1191,7 +1192,7 @@ public class PALRepositoryListWeb extends ActionWeb {
|
||||
if (extendAttr) {// 如果表格中没有更多特性,则不查询,节省时间
|
||||
if(null!=model) {
|
||||
try {
|
||||
extendAttrValObj = CoeProcessLevelUtil.getProcessLevelPropertyVal(model.getId(), model, props);
|
||||
extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props);
|
||||
} catch (Exception e) {
|
||||
System.err.println("清单无法导出的模型ID:"+model.getId());
|
||||
// TODO: handle exception
|
||||
|
||||
Loading…
Reference in New Issue
Block a user