发布校验提交/移动端阅览显示
This commit is contained in:
parent
7c2c31b750
commit
79f24052db
Binary file not shown.
@ -1,8 +1,16 @@
|
||||
package com.actionsoft.apps.coe.pal.publisher.event;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
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.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||
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.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
|
||||
@ -23,6 +31,8 @@ import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -40,166 +50,323 @@ public class PublishFormBeforeSaveEvent extends InterruptListener implements Int
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(ProcessExecutionContext param) throws Exception {
|
||||
|
||||
List<BO> gridNData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(param.getProcessInstance().getId()).list();
|
||||
String bindid=param.getProcessInstance().getId();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
StringBuffer sb=new StringBuffer();
|
||||
StringBuffer sb1=new StringBuffer();
|
||||
if (gridNData.size() > 0) {
|
||||
for (BO rowData : gridNData) {
|
||||
//下面一行示例代码,可以获取Ajax子表的每行记录的新建状态
|
||||
String publishfileid = String.valueOf(rowData.getString("PUBLISHFILEID"));//注意:isCreate并不是BO的一个字段,该字段是有接口上层赋值的
|
||||
|
||||
// 校验
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid);
|
||||
if (model == null) {
|
||||
throw new AWSException("没有找到文件:" + publishfileid);
|
||||
}
|
||||
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, "");
|
||||
if (oldPropertyList != null && oldPropertyList.size() > 0) {
|
||||
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
|
||||
|
||||
//获取文件属性中支持文件
|
||||
if(propertyModel.getPropertyId().equals("support_files")){
|
||||
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
|
||||
String[] splitRelationFileId = new String[0];
|
||||
//获取关联表单模型id
|
||||
List<Map<String, Object>> fileElements;
|
||||
if(UtilString.isNotEmpty(relationFileId)){
|
||||
RowMap rerowMap= DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",relationFileId);
|
||||
|
||||
if(relationFileId.contains(",")){
|
||||
splitRelationFileId=relationFileId.split(",");
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]);
|
||||
|
||||
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_N T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.PUBLISHFILEID=T2.ID WHERE T1.BINDID=? AND T1.PUBLISHFILEID=? AND T2.ISPUBLISH=0",bindid,splitRelationFileId[0]);
|
||||
if(rowMap==null) {
|
||||
sb.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
|
||||
}else{
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(relationFileId);
|
||||
|
||||
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_N T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.PUBLISHFILEID=T2.ID WHERE T1.BINDID=? AND T1.PUBLISHFILEID=? AND T2.ISPUBLISH=0",bindid,relationFileId);
|
||||
if(rowMap==null) {
|
||||
sb.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
}
|
||||
|
||||
for (Map<String, Object> shape : fileElements) {
|
||||
String tempShapeId = shape.get("id").toString();
|
||||
|
||||
|
||||
UpFileDao dao = new UpFileDao();
|
||||
// 文件:根据relationFileId 和 文件类型 查询
|
||||
List<UpfileModel> list2;
|
||||
if(relationFileId.contains(",")){
|
||||
list2= dao.search(splitRelationFileId[0], tempShapeId, "s");
|
||||
}else{
|
||||
list2= dao.search(relationFileId, tempShapeId, "s");
|
||||
}
|
||||
|
||||
if(list2.size()==0){
|
||||
sb.append(rowData.getString("PUBLISHFILENAME")).append("关联模型名称:").append("【").append(shape.get("plName")).append("】").append("节点名称:").append("【"+shape.get("name")+"】").append("未上传附件,请检查!!!").append(",");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb1 = sb.deleteCharAt(sb.length() - 1);
|
||||
throw new BPMNError("0313", sb1.toString());
|
||||
}
|
||||
verifyPublish(publishfileid,rowData,bindid,sb,sb1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发布变更
|
||||
List<BO> gridCData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_C).bindId(param.getProcessInstance().getId()).list();
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
if (gridCData.size() > 0) {
|
||||
for (BO rowData : gridCData) {
|
||||
//下面一行示例代码,可以获取Ajax子表的每行记录的新建状态
|
||||
String publishfileid = String.valueOf(rowData.getString("CHANGEDFILEIDNEW"));//注意:isCreate并不是BO的一个字段,该字段是有接口上层赋值的
|
||||
|
||||
// 校验
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid);
|
||||
if (model == null) {
|
||||
throw new AWSException("没有找到文件:" + publishfileid);
|
||||
}
|
||||
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, "");
|
||||
if (oldPropertyList != null && oldPropertyList.size() > 0) {
|
||||
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
|
||||
|
||||
//获取文件属性中支持文件
|
||||
if(propertyModel.getPropertyId().equals("support_files")){
|
||||
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
|
||||
String[] splitRelationFileId = new String[0];
|
||||
//获取关联表单模型id
|
||||
List<Map<String, Object>> fileElements;
|
||||
if(UtilString.isNotEmpty(relationFileId)){
|
||||
RowMap rerowMap= DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",relationFileId);
|
||||
|
||||
if(relationFileId.contains(",")){
|
||||
splitRelationFileId=relationFileId.split(",");
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]);
|
||||
|
||||
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0",bindid,splitRelationFileId[0]);
|
||||
if(rowMap==null) {
|
||||
sb2.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
|
||||
}else{
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(relationFileId);
|
||||
|
||||
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0",bindid,relationFileId);
|
||||
if(rowMap==null) {
|
||||
sb2.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
}
|
||||
|
||||
for (Map<String, Object> shape : fileElements) {
|
||||
String tempShapeId = shape.get("id").toString();
|
||||
|
||||
|
||||
UpFileDao dao = new UpFileDao();
|
||||
// 文件:根据relationFileId 和 文件类型 查询
|
||||
List<UpfileModel> list2;
|
||||
if(relationFileId.contains(",")){
|
||||
list2= dao.search(splitRelationFileId[0], tempShapeId, "s");
|
||||
}else{
|
||||
list2= dao.search(relationFileId, tempShapeId, "s");
|
||||
}
|
||||
|
||||
if(list2.size()==0){
|
||||
sb2.append(rowData.getString("PUBLISHFILENAME")).append("关联模型名称:").append("【").append(shape.get("plName")).append("】").append("节点名称:").append("【"+shape.get("name")+"】").append("未上传附件,请检查!!!").append(",");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (sb2.length() > 0) {
|
||||
sb3 = sb2.deleteCharAt(sb2.length() - 1);
|
||||
throw new BPMNError("0313", sb3.toString());
|
||||
}
|
||||
verifyPublish(publishfileid,rowData,bindid,sb,sb1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void verifyPublish(String publishfileid,BO rowData,String bindid,StringBuffer sb,StringBuffer sb1){
|
||||
|
||||
// 校验
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid);
|
||||
if (model == null) {
|
||||
throw new AWSException("没有找到文件:" + publishfileid);
|
||||
}
|
||||
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, "");
|
||||
if (oldPropertyList != null && oldPropertyList.size() > 0) {
|
||||
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
|
||||
|
||||
//获取文件属性中支持文件
|
||||
if(propertyModel.getPropertyId().equals("support_files")){
|
||||
//获取关联模型id
|
||||
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
|
||||
//获取关联表单模型id
|
||||
List<Map<String, Object>> fileElements;
|
||||
if(UtilString.isNotEmpty(relationFileId)){
|
||||
|
||||
int len=relationFileId.split(",").length;
|
||||
|
||||
String[] splitRelationFileId=relationFileId.split(",");
|
||||
|
||||
//如果当前使用中并且已发布给与通过
|
||||
if(splitRelationFileId.length>0){
|
||||
|
||||
for(int i=0;i<splitRelationFileId.length;i++) {
|
||||
|
||||
|
||||
defineQualityCheck(splitRelationFileId[i]);
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[i]);
|
||||
|
||||
PALRepositoryModel onemodel = PALRepositoryCache.getCache().get(splitRelationFileId[i]);
|
||||
if(onemodel!=null) {
|
||||
boolean isUse = onemodel.isUse();
|
||||
boolean publish = onemodel.isPublish();
|
||||
//如果状态是未发布
|
||||
if (isUse == true && publish == false) {
|
||||
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(onemodel.getId());
|
||||
|
||||
RowMap publishNrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_N T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.PUBLISHFILEID=T2.ID WHERE T1.BINDID=? AND T1.PUBLISHFILEID=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
|
||||
RowMap publishCrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
|
||||
if (publishNrowMap == null && publishCrowMap == null) {
|
||||
sb.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(onemodel.getName()).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
//如果当前不是使用中查找使用中版本
|
||||
}else if(isUse==false && publish==true){
|
||||
|
||||
List<PALRepositoryModel> versions = PALRepositoryCache.getByVersionId(model.getVersionId());
|
||||
if(versions.size()>0) {
|
||||
for(int k=0;k<versions.size();k++) {
|
||||
|
||||
boolean isUseV=versions.get(k).isUse();
|
||||
boolean isPublishV=versions.get(k).isPublish();
|
||||
|
||||
if(isUseV==true && isPublishV==false) {
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(onemodel.getId());
|
||||
|
||||
RowMap publishCrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
|
||||
RowMap publishNrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_N T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.PUBLISHFILEID=T2.ID WHERE T1.BINDID=? AND T1.PUBLISHFILEID=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
if (publishNrowMap == null && publishCrowMap == null) {
|
||||
sb.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(onemodel.getName()).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(isUse==false && publish==false) {
|
||||
|
||||
List<PALRepositoryModel> versions = PALRepositoryCache.getByVersionId(model.getVersionId());
|
||||
if(versions.size()>0) {
|
||||
for(int k=0;k<versions.size();k++) {
|
||||
|
||||
boolean isUseV=versions.get(k).isUse();
|
||||
boolean isPublishV=versions.get(k).isPublish();
|
||||
|
||||
if(isUseV==true && isPublishV==false) {
|
||||
fileElements = CoeDesignerUtil.getShapeMessageJson4(onemodel.getId());
|
||||
|
||||
RowMap publishCrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
|
||||
RowMap publishNrowMap = DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_N T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.PUBLISHFILEID=T2.ID WHERE T1.BINDID=? AND T1.PUBLISHFILEID=? AND T2.ISPUBLISH=0", bindid, splitRelationFileId[0]);
|
||||
|
||||
if (publishNrowMap == null && publishCrowMap == null) {
|
||||
sb.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(onemodel.getName()).append("需进行选择发布!").append("</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Map<String, Object> shape : fileElements) {
|
||||
String tempShapeId = shape.get("id").toString();
|
||||
|
||||
UpFileDao dao = new UpFileDao();
|
||||
// 文件:根据relationFileId 和 文件类型 查询
|
||||
List<UpfileModel> list2;
|
||||
if(relationFileId.contains(",")){
|
||||
list2= dao.search(splitRelationFileId[0], tempShapeId, "s");
|
||||
}else{
|
||||
list2= dao.search(relationFileId, tempShapeId, "s");
|
||||
}
|
||||
|
||||
if(list2.size()==0){
|
||||
sb.append(rowData.getString("PUBLISHFILENAME")).append("关联模型名称:").append("</br>").append("【").append(shape.get("plName")).append("】").append("节点名称:").append("【"+shape.get("name")+"】").append("未上传附件,请检查!!!").append("</br>").append(",");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb1 = sb.deleteCharAt(sb.length() - 1);
|
||||
throw new BPMNError("0313", sb1.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断文件属性、数据属性校验
|
||||
* @param sid
|
||||
* @param uuid
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public void defineQualityCheck(String uuid){
|
||||
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid);
|
||||
/************************************文件属性校验************************************/
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
PALRepositoryModel m = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid);
|
||||
// 获取所有文件属性
|
||||
List<PALMethodAttributeModel> methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAttributeModels(m.getWsId(), m.getMethodId());
|
||||
Map<String, PALMethodAttributeModel> attributeModelMap = new HashMap<>();
|
||||
Map<String, Integer> sortAttrMap = new HashMap<>();
|
||||
if (methodAttrModels != null) {
|
||||
int index = 0;
|
||||
for (PALMethodAttributeModel attr : methodAttrModels) {
|
||||
attributeModelMap.put(attr.getKey(), attr);
|
||||
sortAttrMap.put(attr.getKey(), ++index);
|
||||
}
|
||||
}
|
||||
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(uuid, null);
|
||||
|
||||
|
||||
Boolean flag1=true;
|
||||
Boolean flag2=true;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sb1=new StringBuffer();
|
||||
StringBuffer sb2=new StringBuffer();
|
||||
StringBuffer sb3=new StringBuffer();
|
||||
StringBuffer sb4 = new StringBuffer();;
|
||||
sb.append("<span>质量校验<span><br/>");
|
||||
|
||||
/***************************************************文件属性校验*************************************************/
|
||||
|
||||
for (PALRepositoryPropertyModel property : propertys) {
|
||||
String id = property.getPropertyId();
|
||||
if (!attributeModelMap.containsKey(id) || !attributeModelMap.get(id).getUse()) {
|
||||
continue;
|
||||
}
|
||||
PALMethodAttributeModel attributeModel = attributeModelMap.get(id);
|
||||
|
||||
if (!attributeModel.getIsRequired()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("relation".equals(attributeModel.getType()) || "awsorg".equals(attributeModel.getType())) {
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey());
|
||||
if (list == null || list.isEmpty()) {
|
||||
flag1 = false;
|
||||
}
|
||||
} else {
|
||||
flag1 = UtilString.isNotEmpty(property.getPropertyValue());
|
||||
}
|
||||
if (!flag1) {// 校验不通过
|
||||
sb1.append("''"+attributeModel.getTitle()+"''").append(",");
|
||||
flag1 = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(sb1.length()>0){
|
||||
sb.append("<span>文件属性:<span><br/>");
|
||||
sb.append(sb1.substring(0, sb1.length()-1));
|
||||
sb.append("未填写,请检查!").append("</br>");
|
||||
}
|
||||
|
||||
|
||||
/***************************************************数据属性校验*************************************************/
|
||||
// 获取文件
|
||||
String prevDefinition = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, uuid);
|
||||
|
||||
Map<String, PALMethodAttributeModel> methodAttributeModelMap = new HashMap<>();
|
||||
// 校验形状
|
||||
List<JSONObject> elements = ShapeUtil.getShapeJsonToJsonObject(prevDefinition);
|
||||
List<JSONObject> resultList = new ArrayList<>();
|
||||
for (JSONObject o : elements) {
|
||||
String shapeId = o.getString("id");
|
||||
String shapeName = o.getString("name");
|
||||
String text = UtilString.isEmpty(o.getString("text")) ? o.getString("title") : o.getString("text");
|
||||
String shapeCategory = o.getString("category");
|
||||
JSONObject dataAttributes = o.getJSONObject("dataAttributes");
|
||||
JSONArray attributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
|
||||
for (int i = 0; i < attributesJsonArray.size(); i++) {
|
||||
|
||||
JSONObject attr = attributesJsonArray.getJSONObject(i);
|
||||
String attrId = attr.getString("id");
|
||||
String value = attr.getString("value");
|
||||
|
||||
if (!methodAttributeModelMap.containsKey(shapeName + "-" + attrId)) {
|
||||
List<PALMethodAttributeModel> methodAttributeModels = CoeDesignerShapeAPIManager.getInstance().getValidAndUseAttributeModels(model.getWsId(), shapeCategory.replace("_", "."), shapeName, model.getMethodId());
|
||||
for (PALMethodAttributeModel attributeModel : methodAttributeModels) {
|
||||
if (!methodAttributeModelMap.containsKey(shapeName + "-" + attributeModel.getKey())) {
|
||||
methodAttributeModelMap.put(shapeName + "-" + attributeModel.getKey(), attributeModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!methodAttributeModelMap.containsKey(shapeName + "-" + attrId)) {
|
||||
continue;// 没有配置到形状的属性,不处理
|
||||
}
|
||||
PALMethodAttributeModel attrModel = methodAttributeModelMap.get(shapeName + "-" + attrId);
|
||||
if (attrModel.getIsRequired()) {// 筛选必填
|
||||
String attrType = attrModel.getType();
|
||||
if ("relation".equals(attrType) || "awsorg".equals(attrType)) {
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(model.getId(), shapeId, attrId);
|
||||
if (list == null || list.isEmpty()) {
|
||||
flag2 = false;
|
||||
}
|
||||
} else {
|
||||
flag2 = UtilString.isNotEmpty(value);
|
||||
}
|
||||
if (!flag2) {
|
||||
sb2.append("<span>节点名称:<span>"+"【"+text+"】").append("''"+attrModel.getNewTitle()+"''").append("</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sb2.length()>0){
|
||||
sb.append("<span>数据属性:<span><br/>");
|
||||
sb.append(sb2.substring(0, sb2.length()-1));
|
||||
sb.append("未填写,请检查!");
|
||||
}
|
||||
|
||||
int index=sb.indexOf("未填写");
|
||||
if(index!=-1 ){
|
||||
ro.put("result","error");
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb1 = sb.deleteCharAt(sb.length() - 1);
|
||||
throw new BPMNError("0313", sb1.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ function initMobileData() {
|
||||
newHtml +='<tbody>';
|
||||
newHtml +='<tr class="form-grid-mobile-common-toolbar">';
|
||||
newHtml +='<td>';
|
||||
newHtml +='<div class="form-grid-mobile-common-toolbar"></div>';
|
||||
newHtml +='<div class="form-grid-mobile-common-toolbar">待发布文件</div>';
|
||||
newHtml +='</div>';
|
||||
newHtml +='</td>';
|
||||
newHtml +='</tr>';
|
||||
@ -75,7 +75,7 @@ function initMobileData() {
|
||||
changeHtml +='<tbody>';
|
||||
changeHtml +='<tr class="form-grid-mobile-common-toolbar">';
|
||||
changeHtml +='<td>';
|
||||
changeHtml +='<div class="form-grid-mobile-common-toolbar"></div>';
|
||||
changeHtml +='<div class="form-grid-mobile-common-toolbar">版本变更文件</div>';
|
||||
changeHtml +='</div>';
|
||||
changeHtml +='</td>';
|
||||
changeHtml +='</tr>';
|
||||
@ -237,12 +237,12 @@ function showlist(data, type, pageNumber, start){
|
||||
var outputName = getOutputName(curr.category, curr.methodId);
|
||||
html +='<tr>';
|
||||
html +='<td class="form-grid-mobile-common-row" width=100%>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openReportFile(\'' + curr.taskId +'\');return false" >' + fileName + "-" + outputName + '</span>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openReportFile(\'' + curr.taskId +'\');return false" >' +'文件预览 '+ fileName + "-" + outputName + '</span>';
|
||||
html +='</td>';
|
||||
html +='</tr>';
|
||||
html +='<tr>';
|
||||
html +='<td class="form-grid-mobile-common-row" width=100%>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openPortalPage(\'' + curr.publishFileId + '\', \'' + curr.taskId + '\')">' + fileName+'</span>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openPortalPage(\'' + curr.publishFileId + '\', \'' + curr.taskId + '\')">' +'模型预览 '+ fileName+'</span>';
|
||||
html +='</td>';
|
||||
html +='</tr>';
|
||||
}
|
||||
@ -271,11 +271,11 @@ function showlist(data, type, pageNumber, start){
|
||||
|
||||
html += '<tr>';
|
||||
html += '<td class="form-grid-mobile-common-row" width=100%>';
|
||||
html += '<span class="form-grid-mobile-common-tap" onclick="openReportFile(\'' + curr.taskId + '\');return false" >' + targetFileName + "-" + outputName + '</span>';
|
||||
html += '<span class="form-grid-mobile-common-tap" onclick="openReportFile(\'' + curr.taskId + '\');return false" >' +'文件预览 '+ targetFileName + "-" + outputName + '</span>';
|
||||
html += '</td>';
|
||||
html +='<tr>';
|
||||
html +='<td class="form-grid-mobile-common-row" width=100%>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openPortalPage(\'' + targetId + '\', \'' + curr.taskId + '\')">' + targetFileName+'</span>';
|
||||
html +='<span class="form-grid-mobile-common-tap" onclick="openPortalPage(\'' + targetId + '\', \'' + curr.taskId + '\')">' +'模型预览 '+ targetFileName+'</span>';
|
||||
html +='</td>';
|
||||
html +='</tr>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user