校验部署

This commit is contained in:
zhal 2022-07-11 18:34:58 +08:00
parent f6052753d9
commit 5dec81dee9
2 changed files with 133 additions and 18 deletions

View File

@ -8306,6 +8306,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
graphTitle="绩效"; graphTitle="绩效";
} }
//先执行新建操作产生plid //先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
@ -8319,7 +8321,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
null, "admin", "admin", nowTime, null, uuid, null, "admin", "admin", nowTime, null, uuid,
null, null, null, null, null, null, null, 1); null, null, null, null, null, null, null, 1);
System.out.println(model.getId());
coeProcessLevel.insert(model); coeProcessLevel.insert(model);
@ -8333,6 +8334,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
JSONObject definition = JSONObject.parseObject(define); JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements"); JSONObject elements = definition.getJSONObject("elements");
//新建一个uuid //新建一个uuid
String shapeId = UUIDGener.getObjectId(); String shapeId = UUIDGener.getObjectId();
@ -8341,20 +8345,70 @@ public class CoeProcessLevelWeb extends ActionWeb {
shape.put("id", shapeId); shape.put("id", shapeId);
shape.put("text", graphTitle); shape.put("text", graphTitle);
JSONObject props = shape.getJSONObject("props");// 位置大小
props.put("zindex", 0);
props.put("x", Integer.parseInt("400")); JSONArray shapes = new JSONArray();
props.put("y", Integer.parseInt("106")); /************************************************数据属性*********************************************************/
props.put("w", Integer.parseInt("110"));
props.put("h", Integer.parseInt("50")); //图形的数据属性配置
props.put("zindex", 1); List<PALMethodAttributeModel> attributeModels = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels("6f4e292c-1b90-4dd2-8c20-7da159cb20a5", model.getMethodId());
elements.put(shapeId, shape); for (PALMethodAttributeModel attributeModel : attributeModels) {
//todo根据importProperty的类型获取具体保存数据值
JSONObject arributeObj = new JSONObject();
arributeObj.put("key", attributeModel.getKey());
arributeObj.put("isRequired", attributeModel.getIsRequired());
arributeObj.put("ref", attributeModel.getRef());
arributeObj.put("readonly", attributeModel.getReadonly());
arributeObj.put("scope", attributeModel.getScope());
arributeObj.put("name", attributeModel.getTitle());
arributeObj.put("id", attributeModel.getKey());
arributeObj.put("type", attributeModel.getType());
arributeObj.put("groupPath", attributeModel.getGroupPath());
arributeObj.put("desc", attributeModel.getDesc());
arributeObj.put("value", attributeModel.getValue());
JSONArray dataAttributes = shape.getJSONArray("dataAttributes");
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
for (Object attribute : dataAttributes) {
JSONObject obj = (JSONObject) attribute;
if (obj.containsKey("attributesJsonArray")) {
obj.getJSONArray("attributesJsonArray").add(arributeObj);
break;
}
}
}
}
/************************************************文件属性*********************************************************/
//图形的数据属性配置
List<PALMethodAttributeModel> attrLists=PALRepositoryAPIManager.getInstance().getValidAndUseAttributeModels("6f4e292c-1b90-4dd2-8c20-7da159cb20a5", methodId);
shapes.add(shape);
JSONArray newShapes = this.getMethodElementsJSONArray(shapes, 1);
JSONObject newElements = new JSONObject();
for (int i = 0; i < newShapes.size(); i++) {
JSONObject shapeObj = newShapes.getJSONObject(i);
newElements.put(shapeObj.getString("id"), shapeObj);
}
definition.put("elements", newElements);
// 设置画布大小 // 设置画布大小
DiagramsUtil.setDiagramHeightWidth(definition, elements); DiagramsUtil.setDiagramHeightWidth(definition, newElements);
defineModel.setDefinition(definition.toString()); defineModel.setDefinition(definition.toString());
// 保存文件 // 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作 CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
@ -8372,6 +8426,66 @@ public class CoeProcessLevelWeb extends ActionWeb {
} }
/**
* 创建具有合理位置的节点数据
*
* @param elements
* @param shapeRowCount
* @return
*/
private JSONArray getMethodElementsJSONArray(JSONArray elements, int shapeRowCount) {
JSONArray result = new JSONArray();
int zindex = 0;
int initX = 0;
int initY = 0;
int pageEdge = 100;
int count = 0;
initX += pageEdge;
initY += pageEdge;
for (int i = 0; i < elements.size(); i++) {
JSONObject shape = elements.getJSONObject(i);
count++;
if (count % (shapeRowCount + 1) == 0) {
count = 1;
initY += 130;
// 换行
initX = 0;
initX = pageEdge + initX;
}
zindex++;
if (shape.containsKey("dataAttributes")) {
JSONArray dataAttributes = JSONArray.parseArray(shape.getString("dataAttributes"));
for (int index = 0; index < dataAttributes.size(); index++) {
dataAttributes.getJSONObject(index).put("id", UUIDGener.getObjectId());
}
shape.put("dataAttributes", dataAttributes);
}
int totalWidth = 240;// 每个节点总宽度空白+节点+空白
int totalHeight = 200;// 每个节点总高度空白+节点+空白
int x = 0;
int y = 0;
int w = validateJson(shape.getJSONObject("props").getInteger("w"));
int h = validateJson(shape.getJSONObject("props").getInteger("h"));
int leftBlankWidth = (totalWidth - w) / 2;
int topBlankHeight = (totalHeight - h) / 2;
x = initX + leftBlankWidth;
initX = x + w + leftBlankWidth;
y = initY + topBlankHeight;
// y = pageEdge + initY;
// if (y < 0) {
// y = 100;
// }
JSONObject props = shape.getJSONObject("props");
props.put("x", x);
props.put("y", y);
props.put("zindex", zindex);
shape.put("props", props);
result.add(shape);
}
return result;
}
/** /**
* 查找关联角色/绩效数据 * 查找关联角色/绩效数据
* @param uuid * @param uuid
@ -8412,7 +8526,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
sortAttrMap.put(attr.getKey(), ++index); sortAttrMap.put(attr.getKey(), ++index);
} }
} }
PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(m.getMethodId());
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao(); PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(uuid, null); List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(uuid, null);
@ -8433,7 +8546,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
continue; continue;
} }
String inputValue = property.getPropertyValue();
if ("relation".equals(attributeModel.getType()) || "awsorg".equals(attributeModel.getType())) { if ("relation".equals(attributeModel.getType()) || "awsorg".equals(attributeModel.getType())) {
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey()); List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey());
if (list == null || list.isEmpty()) { if (list == null || list.isEmpty()) {
@ -8450,6 +8562,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
/***************************************************数据属性校验*************************************************/ /***************************************************数据属性校验*************************************************/
Map<String, PALMethodAttributeModel> methodAttributeModelMap = new HashMap<>(); Map<String, PALMethodAttributeModel> methodAttributeModelMap = new HashMap<>();
// 校验形状 // 校验形状
List<JSONObject> elements = ShapeUtil.getShapeJsonToJsonObject(obj); List<JSONObject> elements = ShapeUtil.getShapeJsonToJsonObject(obj);
@ -8488,8 +8601,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
flag2 = UtilString.isNotEmpty(value); flag2 = UtilString.isNotEmpty(value);
} }
if (!flag2) { if (!flag2) {
sb.append("''"+shapeName+"''").append(","); sb.append("''"+attrModel.getNewTitle()+"''").append(",");
flag2=false;
} }
} }
@ -8508,6 +8620,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
ro.put("result","error"); ro.put("result","error");
} }
ro.put("sb",sb1); ro.put("sb",sb1);
return ro.toString(); return ro.toString();

View File

@ -99,7 +99,7 @@ $(function() {
define: awsui.encode(obj), define: awsui.encode(obj),
}, },
success: function (msg, textStatus, jqXHR) { success: function (msg, textStatus, jqXHR) {
if(msg.result == "ok") { /*if(msg.result == "ok") {*/
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "./jd", url: "./jd",
@ -154,7 +154,7 @@ $(function() {
$.simpleAlert('保存失败', 'error', 1500); $.simpleAlert('保存失败', 'error', 1500);
} }
}); });
} else { /*} else {
$.simpleAlert("close"); $.simpleAlert("close");
var result = msg.data; var result = msg.data;
var resultMsg = []; var resultMsg = [];
@ -164,7 +164,7 @@ $(function() {
} }
$.simpleAlert(resultMsg.join('<br>'), 'error'); $.simpleAlert(resultMsg.join('<br>'), 'error');
// $.simpleAlert(ro.msg, 'error'); // $.simpleAlert(ro.msg, 'error');
} }*/
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
$.simpleAlert("close"); $.simpleAlert("close");
@ -214,7 +214,9 @@ $(function() {
intervalRefresh(); intervalRefresh();
} }
/**
* 质量校验
*/
$("#QualityInspection").off("click").on("click", function () { $("#QualityInspection").off("click").on("click", function () {
$.simpleAlert("正在校验", "loading"); $.simpleAlert("正在校验", "loading");
debugger; debugger;