diff --git a/com.actionsoft.apps.coe.pal.batch/excel/模型结构模板.xlsx b/com.actionsoft.apps.coe.pal.batch/excel/模型结构模板.xlsx index 9a9aad9f..389f42ae 100644 Binary files a/com.actionsoft.apps.coe.pal.batch/excel/模型结构模板.xlsx and b/com.actionsoft.apps.coe.pal.batch/excel/模型结构模板.xlsx differ diff --git a/com.actionsoft.apps.coe.pal.batch/excel/清单模板.xlsx b/com.actionsoft.apps.coe.pal.batch/excel/清单模板.xlsx index 65436419..72e7e909 100644 Binary files a/com.actionsoft.apps.coe.pal.batch/excel/清单模板.xlsx and b/com.actionsoft.apps.coe.pal.batch/excel/清单模板.xlsx differ diff --git a/com.actionsoft.apps.coe.pal.batch/lib/com.actionsoft.apps.coe.pal.batch.jar b/com.actionsoft.apps.coe.pal.batch/lib/com.actionsoft.apps.coe.pal.batch.jar index c9071306..08e1f0f6 100644 Binary files a/com.actionsoft.apps.coe.pal.batch/lib/com.actionsoft.apps.coe.pal.batch.jar and b/com.actionsoft.apps.coe.pal.batch/lib/com.actionsoft.apps.coe.pal.batch.jar differ diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ImportProcessExcel.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ImportProcessExcel.java index de23c90d..2df169de 100644 --- a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ImportProcessExcel.java +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ImportProcessExcel.java @@ -326,6 +326,9 @@ public class ImportProcessExcel { model.setRelationShapeText(roleObj.toString()); relationList.add(model); } + } else if ("table".equals(type)) { + attrValue = cellData.getString("tableValue"); + property.setPropertyValue(attrValue); } else { attrValue = cellData.getString("value"); property.setPropertyValue(attrValue); @@ -537,6 +540,9 @@ public class ImportProcessExcel { model.setRelationShapeText(roleObj.toString()); relationList.add(model); } + } else if ("table".equals(type)) { + attrValue = cellData.getString("tableValue"); + property.setPropertyValue(attrValue); } else { attrValue = cellData.getString("value"); property.setPropertyValue(attrValue); diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ValidProcessExcel.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ValidProcessExcel.java index 542200b7..7939cfc6 100644 --- a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ValidProcessExcel.java +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/ValidProcessExcel.java @@ -9,8 +9,7 @@ import java.util.regex.Pattern; import com.actionsoft.apps.coe.pal.batch.util.BatchUtil; import com.actionsoft.apps.coe.pal.batch.web.create.process.model.ExcelRowModel; import com.actionsoft.apps.coe.pal.batch.web.create.process.model.RepositoryInfoModel; -import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type.ValidAwsOrg; -import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type.ValidSelect; +import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type.*; import com.actionsoft.apps.coe.pal.constant.CoEConstant; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; @@ -27,8 +26,6 @@ import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.Valid; import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.ValidName; import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.ValidNo; import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.ValidType; -import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type.ValidRelation; -import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type.ValidString; import com.actionsoft.apps.coe.pal.batch.util.POIUtil; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.util.UtilString; @@ -303,6 +300,8 @@ public class ValidProcessExcel { rowJson.add(JSONObject.parseObject(new Valid(new ValidAwsOrg()).execute(param).toString())); } else if ("select_m".equals(attrType) || "select".equals(attrType)) {// 单多选 rowJson.add(JSONObject.parseObject(new Valid(new ValidSelect()).execute(param).toString())); + } else if ("table".equals(attrType)) {// 表格 + rowJson.add(JSONObject.parseObject(new Valid(new ValidTable()).execute(param).toString())); } else {// 其他,按照string对待 rowJson.add(JSONObject.parseObject(new Valid(new ValidString()).execute(param).toString())); } diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/valid/impl/type/ValidTable.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/valid/impl/type/ValidTable.java new file mode 100644 index 00000000..23605ab4 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/process/valid/impl/type/ValidTable.java @@ -0,0 +1,96 @@ +package com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type; + +import com.actionsoft.apps.coe.pal.batch.util.BatchUtil; +import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.ValidCell; +import com.actionsoft.apps.coe.pal.batch.web.create.shape.ShapeConst; +import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.ValidShapeCell; +import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.bpms.util.UtilString; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.HashSet; +import java.util.Set; + +public class ValidTable implements ValidCell { + + @Override + public Object validTableCell(Object param) { + JSONObject paramObj = JSONObject.parseObject(param.toString()); + boolean isOk = true; + String msg = ""; + String value = paramObj.getString("value"); + String title = paramObj.getString("title"); + JSONObject attr = paramObj.getJSONObject("attr"); + JSONObject ref =attr.getJSONObject("ref"); + String firstColumn = ref.getString("firstColumn"); + String secondColumn = ref.getString("secondColumn"); + JSONArray valueArr = new JSONArray();// 存储解析后的值 + if (!UtilString.isEmpty(value)) { + if (BatchUtil.containHtmlEles(value)) { + isOk = false; + msg = BatchUtil.eleErrMsg; + } else { +// if (!value.contains("##")) { +// isOk = false; +// msg = "格式错误,按照name##desc$$name##desc格式来填写"; +// } + String [] tableRows = value.split("\\$\\$"); + for (int i = 0; i < tableRows.length; i++) { + String row = tableRows[i]; + if (UtilString.isEmpty(row)) { + continue; + } + String [] content = row.split("##"); + if (content.length != 2) { + isOk = false; + msg = "格式错误,请按照name##desc$$name##desc格式来填写"; + break; + } + JSONObject obj = new JSONObject(); + obj.put("name", content[0].replace("**", "\n")); + obj.put("desc", content[1].replace("**", "\n")); + obj.put("id", UUIDGener.getObjectId()); + valueArr.add(obj); + } + + } + } + JSONObject tableValue = new JSONObject(); + tableValue.put("name", title); + JSONArray tableArr = new JSONArray(); + // 添加表头 + JSONObject tableHeader = new JSONObject(); + tableHeader.put("id", "table_head"); + tableHeader.put("name", firstColumn); + tableHeader.put("desc", secondColumn); + tableArr.add(tableHeader); + // 添加内容 + tableArr.addAll(valueArr); + tableValue.put("table", tableArr); + + JSONObject result = new JSONObject(); + result.put("name", title); + result.put("name2", ShapeConst.EXTEND_PROP_PREFIX + title + ShapeConst.EXTEND_PROP_SUFFIX); + result.put("isOk", isOk); + result.put("msg", BatchUtil.specialCharTransfer(msg)); + result.put("value", BatchUtil.specialCharTransfer(value)); + result.put("tableValue", tableValue); + return result; + } + + /** + * 获取选择范围 + * @param scopeStr + * @return + */ + private Set getSelectScope(String scopeStr) { + Set result = new HashSet<>(); + String [] refArr = scopeStr.split(","); + for (int i = 0; i < refArr.length; i++) { + result.add(refArr[i]); + } + return result; + } + +} diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ImportShapeExcel.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ImportShapeExcel.java index c63a4fb2..41395729 100644 --- a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ImportShapeExcel.java +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ImportShapeExcel.java @@ -350,6 +350,9 @@ public class ImportShapeExcel { relationList.add(model); } updateAttrDataJson.put(attrId, object2); + } else if ("table".equals(type)) {// 表格类型 + object2.put("value", cellData.getJSONObject("tableValue")); + updateAttrDataJson.put(attrId, object2); } else {// 剩余的当作string处理 attrValue = cellData.getString("value"); if (UtilString.isEmpty(attrValue)) { @@ -628,6 +631,9 @@ public class ImportShapeExcel { relationList.add(model); } attributesJsonArray.add(object2); + } else if ("table".equals(type)) {// 表格类型 + object2.put("value", cellData.getJSONObject("tableValue")); + attributesJsonArray.add(object2); } else {// 剩余的当作string处理 attrValue = cellData.getString("value"); if (UtilString.isEmpty(attrValue)) { diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ValidShapeExcel.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ValidShapeExcel.java index cc4fa9d3..10f7be5b 100644 --- a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ValidShapeExcel.java +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/ValidShapeExcel.java @@ -11,7 +11,7 @@ import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.ValidName import com.actionsoft.apps.coe.pal.batch.web.create.shape.model.ExcelRepositoryModel; import com.actionsoft.apps.coe.pal.batch.web.create.shape.model.ExcelShapeModel; import com.actionsoft.apps.coe.pal.batch.web.create.shape.model.RepositoryShapeInfoModel; -import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type.ValidShapeSelect; +import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type.*; import com.actionsoft.apps.coe.pal.constant.CoEConstant; import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager; import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache; @@ -35,9 +35,6 @@ import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.ValidShape; import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.ValidShapeName; import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.ValidShapeNo; import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.ValidShapeType; -import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type.ValidShapeAwsOrg; -import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type.ValidShapeRelation; -import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type.ValidShapeString; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.util.UtilString; @@ -498,6 +495,8 @@ public class ValidShapeExcel { rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeAwsOrg()).execute(param).toString())); } else if ("select_m".equals(attrType) || "select".equals(attrType)) {// 单多选 rowJson.add(JSONObject.parseObject((new ValidShape(new ValidShapeSelect()).execute(param).toString()))); + } else if ("table".equals(attrType)) {// 表格 + rowJson.add(JSONObject.parseObject((new ValidShape(new ValidShapeTable()).execute(param).toString()))); } else {// 其他,按照string对待 rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeString()).execute(param).toString())); } diff --git a/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/valid/impl/type/ValidShapeTable.java b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/valid/impl/type/ValidShapeTable.java new file mode 100644 index 00000000..55db3597 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.batch/src/com/actionsoft/apps/coe/pal/batch/web/create/shape/valid/impl/type/ValidShapeTable.java @@ -0,0 +1,98 @@ +package com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type; + +import com.actionsoft.apps.coe.pal.batch.util.BatchUtil; +import com.actionsoft.apps.coe.pal.batch.web.create.shape.ShapeConst; +import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.ValidShapeCell; +import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.bpms.util.UtilString; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ValidShapeTable implements ValidShapeCell { + + @Override + public Object validTableCell(Object param) { + JSONObject paramObj = JSONObject.parseObject(param.toString()); + boolean isOk = true; + String msg = ""; + String value = paramObj.getString("value"); + String title = paramObj.getString("title"); + JSONObject attr = paramObj.getJSONObject("attr"); + JSONObject ref =attr.getJSONObject("ref"); + String firstColumn = ref.getString("firstColumn"); + String secondColumn = ref.getString("secondColumn"); + JSONArray valueArr = new JSONArray();// 存储解析后的值 + if (!UtilString.isEmpty(value)) { + if (BatchUtil.containHtmlEles(value)) { + isOk = false; + msg = BatchUtil.eleErrMsg; + } else { +// if (!value.contains("##")) { +// isOk = false; +// msg = "格式错误,按照name##desc$$name##desc格式来填写"; +// } + String [] tableRows = value.split("\\$\\$"); + for (int i = 0; i < tableRows.length; i++) { + String row = tableRows[i]; + if (UtilString.isEmpty(row)) { + continue; + } + String [] content = row.split("##"); + if (content.length != 2) { + isOk = false; + msg = "格式错误,请按照name##desc$$name##desc格式来填写"; + break; + } + JSONObject obj = new JSONObject(); + obj.put("name", content[0].replace("**", "\n")); + obj.put("desc", content[1].replace("**", "\n")); + obj.put("id", UUIDGener.getObjectId()); + valueArr.add(obj); + } + + } + } + JSONObject tableValue = new JSONObject(); + tableValue.put("name", title); + JSONArray tableArr = new JSONArray(); + // 添加表头 + JSONObject tableHeader = new JSONObject(); + tableHeader.put("id", "table_head"); + tableHeader.put("name", firstColumn); + tableHeader.put("desc", secondColumn); + tableArr.add(tableHeader); + // 添加内容 + tableArr.addAll(valueArr); + tableValue.put("table", tableArr); + + JSONObject result = new JSONObject(); + result.put("name", title); + result.put("name2", ShapeConst.EXTEND_PROP_PREFIX + title + ShapeConst.EXTEND_PROP_SUFFIX); + result.put("isOk", isOk); + result.put("msg", BatchUtil.specialCharTransfer(msg)); + result.put("value", BatchUtil.specialCharTransfer(value)); + result.put("tableValue", tableValue); + return result; + } + + /** + * 获取选择范围 + * @param scopeStr + * @return + */ + private Set getSelectScope(String scopeStr) { + Set result = new HashSet<>(); + String [] refArr = scopeStr.split(","); + for (int i = 0; i < refArr.length; i++) { + result.add(refArr[i]); + } + return result; + } + +}