模型形状批处理

This commit is contained in:
446052889@qq.com 2022-09-03 21:26:03 +08:00
parent 30a85dd65a
commit 72ad86fba2
28 changed files with 998 additions and 526 deletions

View File

@ -34,9 +34,9 @@ public class BatchController {
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.batch_create_download_template")
public String getDownloadTemplateUrl(UserContext uc, String type, String wsId, String versionIds, String methodCategory) {
public String getDownloadTemplateUrl(UserContext uc, String type, String wsId, String methodCategory) {
BatchWeb web = new BatchWeb(uc);
return web.getDownloadTemplateUrl(type, wsId, versionIds, methodCategory);
return web.getDownloadTemplateUrl(type, wsId, methodCategory);
}
/**

View File

@ -29,7 +29,7 @@ public class BatchConst {
public static final String TEMPLATE_FILE_PATH = AppsConst.APPS_ROOT + AppsConst.FOLDER_INSTALL + File.separator + APP_ID + File.separator + "excel" + File.separator;
// 模版文件名称
public static final String PROCESS_LIST_TEMPLATE_FILE_SUFFIX = "清单模板.xlsx";
public static final String SHAPE_LIST_TEMPLATE_FILE = "模型结构模板.xlsx";
public static final String SHAPE_LIST_TEMPLATE_FILE_SUFFIX = "模型结构模板.xlsx";
// 日志结束语
public static final String END_LOG = "**建议拷贝本次输出日志做备忘";

View File

@ -10,17 +10,12 @@ import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.*;
import com.actionsoft.bpms.util.UtilString;
@ -300,5 +295,46 @@ public class POIUtil {
}
return wb;
}
/**
* 解决下拉框过长不显示问题
* @param workbook
* @param deptList 下拉数据数组
* @param sheet
* @param firstRow 开始行
* @param endRow 结束行
* @param cellNum 下拉框所在的列
* @param sheetIndex 隐藏sheet的位置索引
* @param sheetName 新建的sheet名称
*/
public static void setLongXSSFValidation(XSSFWorkbook workbook, String[] deptList , XSSFSheet sheet , int firstRow, int endRow, int cellNum, int sheetIndex, String sheetName) {
String hiddenName = sheetName;
//1.创建隐藏的sheet页
XSSFSheet hidden = workbook.createSheet(hiddenName);
//2.循环赋值为了防止下拉框的行数与隐藏域的行数相对应将隐藏域加到结束行之后
for (int i = 0, length = deptList.length; i < length; i++) {
hidden.createRow(endRow + i).createCell(cellNum).setCellValue(deptList[i]);
}
Name category1Name = workbook.createName();
category1Name.setNameName(hiddenName);
//3 A1:A代表隐藏域创建第N列createCell(N)以A1列开始A行数据获取下拉数组
category1Name.setRefersToFormula(hiddenName + "!A1:A" + (deptList.length + endRow));
//
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = helper.createFormulaListConstraint(hiddenName);
CellRangeAddressList addressList = new CellRangeAddressList(firstRow, endRow, cellNum, cellNum);
DataValidation dataValidation = helper.createValidation(constraint, addressList);
if (dataValidation instanceof XSSFDataValidation) {
// 数据校验
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
} else {
dataValidation.setSuppressDropDownArrow(false);
}
// 作用在目标sheet上
sheet.addValidationData(dataValidation);
// 设置hiddenSheet隐藏不设置隐藏
workbook.setSheetHidden(sheetIndex, false);
}
}

View File

@ -88,12 +88,11 @@ public class BatchWeb extends ActionWeb {
/**
* 批量创建-获取下载模版地址
* @param type processList: 流程清单模版 shapeList:流程结构模版
* @param wsId
* @param versionIds 流程版本Id集合type为shapeList时有效
* @param wsId
* @param methodCategory 大类
* @return
*/
public String getDownloadTemplateUrl(String type, String wsId, String versionIds, String methodCategory) {
public String getDownloadTemplateUrl(String type, String wsId, String methodCategory) {
// 校验资产库
boolean isActive = PALRepositoryQueryAPIManager.getInstance().isActiveWorkSpace(wsId);
if (!isActive) {
@ -103,7 +102,7 @@ public class BatchWeb extends ActionWeb {
if (BatchConst.PROCESS_LIST.equals(type)) {
ro = new CreateProcessExcel().createProcessTemplate(uc, wsId, methodCategory);
} else if (BatchConst.SHAPE_LIST.equals(type)) {
ro = new CreateShapeExcel().createShapeTemplate(uc, wsId, versionIds);
ro = new CreateShapeExcel().createShapeTemplate(uc, wsId, methodCategory);
}
return ro.toString();
}
@ -285,7 +284,7 @@ public class BatchWeb extends ActionWeb {
return new ValidProcessExcel(uc).checkProcessList(file, wsId, methodCategory).toString();
}
if ("shapeList".equals(type)) {// 模型结构上传
return new ValidShapeExcel().checkShapeList(uc, file, wsId, teamId).toString();
return new ValidShapeExcel().checkShapeList(uc, file, wsId, teamId, methodCategory).toString();
}
return ResponseObject.newOkResponse().toString();
}

View File

@ -35,7 +35,7 @@ import com.actionsoft.bpms.util.UtilFile;
public class CreateProcessExcel {
public ResponseObject createProcessTemplate(UserContext uc, String wsId, String methodCategory) {
// 获取当前资产库流程下的所有类别
// 获取当前资产库模型下的所有类别
JSONObject methodObj = ProcessUtil.getCategoryMethods(methodCategory, true);
List<String> categorys = new ArrayList<>(methodObj.keySet());
Collections.sort(categorys);
@ -139,7 +139,7 @@ public class CreateProcessExcel {
}
}
// 增加说明页
File descFile = new File(BatchConst.TEMPLATE_FILE_PATH + excelName);
File descFile = new File(BatchConst.TEMPLATE_FILE_PATH + BatchConst.PROCESS_LIST_TEMPLATE_FILE_SUFFIX);
if (descFile.exists()) {
XSSFWorkbook descWb;
try {

View File

@ -90,90 +90,6 @@ public class ProcessUtil {
return list;
}
/**
* 获取流程下文件分类
* @return
*/
public static List<String> getProcessCategoryCategoryMehtodList() {
List<String> list = new ArrayList<String>();
List<PALMethodModel> methodModels = PALMethodManager.getInstance().getPALMethodModelListByMethod("process");
List<AppContext> listApps = AppsAPIManager.getInstance().getInstalledApps();
int size = listApps.size();
Map<String, String> map1 = new HashMap<String, String>();
for (int i = 0; i < size; i++) {
map1.put(listApps.get(i).getId(), listApps.get(i).getRuntimeState());
}
for (int i = 0, methodSize = methodModels.size(); i < methodSize; i++) {
PALMethodModel palMethodModel = methodModels.get(i);
String appId = palMethodModel.getId();
if (map1.containsKey("com.actionsoft.apps.coe.method." + appId)) {
String methodId1 = map1.get("com.actionsoft.apps.coe.method." + appId);
if (methodId1.equals(AppsConst.RUNTIME_STATE_STOPPED) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED) || methodId1.equals(AppsConst.RUNTIME_STATE_READY) || methodId1.equals(AppsConst.RUNTIME_STATE_STARTING) || methodId1.equals(AppsConst.RUNTIME_STATE_STOPPING) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLED) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLING) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED))
continue;
}
list.add(palMethodModel.getId());
}
return list;
}
/**
* 获取流程下文件分类
* @return
*/
@Deprecated
public static Map<String, String> getProcessCategoryMethod() {
Map<String, String> result = new HashMap<>();
result.put("文件夹", "default");
List<PALMethodModel> methodModels = PALMethodManager.getInstance().getPALMethodModelListByMethod("process");
List<AppContext> listApps = AppsAPIManager.getInstance().getInstalledApps();
int size = listApps.size();
Map<String, String> map1 = new HashMap<String, String>();
for (int i = 0; i < size; i++) {
map1.put(listApps.get(i).getId(), listApps.get(i).getRuntimeState());
}
for (int i = 0, methodSize = methodModels.size(); i < methodSize; i++) {
PALMethodModel palMethodModel = methodModels.get(i);
String appId = palMethodModel.getId();
if (map1.containsKey("com.actionsoft.apps.coe.method." + appId)) {
String methodId1 = map1.get("com.actionsoft.apps.coe.method." + appId);
if (methodId1.equals(AppsConst.RUNTIME_STATE_STOPPED) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED) || methodId1.equals(AppsConst.RUNTIME_STATE_READY) || methodId1.equals(AppsConst.RUNTIME_STATE_STARTING) || methodId1.equals(AppsConst.RUNTIME_STATE_STOPPING) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLED) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLING) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED))
continue;
}
result.put(I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()), palMethodModel.getId());
}
List<PALMethodModel> methodControlModels = PALMethodManager.getInstance().getPALMethodModelListByMethod("control");
Map<String, String> map2 = new HashMap<String, String>();
for (int i = 0; i < size; i++) {
map2.put(listApps.get(i).getId(), listApps.get(i).getRuntimeState());
}
for (int i = 0, methodSize = methodControlModels.size(); i < methodSize; i++) {
PALMethodModel palMethodModel = methodControlModels.get(i);
String appId = palMethodModel.getId();
if (map2.containsKey("com.actionsoft.apps.coe.method." + appId)) {
String methodId1 = map2.get("com.actionsoft.apps.coe.method." + appId);
if (methodId1.equals(AppsConst.RUNTIME_STATE_STOPPED) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED) || methodId1.equals(AppsConst.RUNTIME_STATE_READY) || methodId1.equals(AppsConst.RUNTIME_STATE_STARTING) || methodId1.equals(AppsConst.RUNTIME_STATE_STOPPING) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLED) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLING) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED))
continue;
}
result.put(I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()), palMethodModel.getId());
}
List<PALMethodModel> methodDataModels = PALMethodManager.getInstance().getPALMethodModelListByMethod("data");
Map<String, String> map3 = new HashMap<String, String>();
for (int i = 0; i < size; i++) {
map3.put(listApps.get(i).getId(), listApps.get(i).getRuntimeState());
}
for (int i = 0, methodSize = methodDataModels.size(); i < methodSize; i++) {
PALMethodModel palMethodModel = methodDataModels.get(i);
String appId = palMethodModel.getId();
if (map3.containsKey("com.actionsoft.apps.coe.method." + appId)) {
String methodId1 = map3.get("com.actionsoft.apps.coe.method." + appId);
if (methodId1.equals(AppsConst.RUNTIME_STATE_STOPPED) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED) || methodId1.equals(AppsConst.RUNTIME_STATE_READY) || methodId1.equals(AppsConst.RUNTIME_STATE_STARTING) || methodId1.equals(AppsConst.RUNTIME_STATE_STOPPING) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLED) || methodId1.equals(AppsConst.RUNTIME_STATE_UNINSTALLING) || methodId1.equals(AppsConst.RUNTIME_STATE_FAILED))
continue;
}
result.put(I18nRes.findValue(CoEConstant.APP_ID, palMethodModel.getId()), palMethodModel.getId());
}
return result;
}
/**
* 获取根目录下文件分类
* @param category

View File

@ -4,16 +4,16 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.*;
import com.actionsoft.apps.coe.pal.batch.web.create.process.ProcessConst;
import com.actionsoft.apps.coe.pal.batch.web.create.process.ProcessUtil;
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;
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONObject;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFCell;
@ -38,13 +38,17 @@ import com.actionsoft.bpms.util.UtilString;
public class CreateShapeExcel {
public ResponseObject createShapeTemplate(UserContext uc, String wsId, String versionIds) {
// 获取当前资产库流程下的所有类别
Map<String, List<String>> shapeTitleMap = ShapeUtil.getProcessShapeTitles();
// 获取流程名称并排序
Map<String, String> sheetNames = getSheetNames(versionIds);
public ResponseObject createShapeTemplate(UserContext uc, String wsId, String methodCategory) {
// 获取当前资产库模型下的所有类别
Map<String, List<String>> shapeTitleMap = ShapeUtil.getProcessShapeTitles(methodCategory);
List<String> methodNames = new ArrayList<>();// 建模方法分类
List<String> shapeNames = new ArrayList<>();// 形状类型名称
for (Map.Entry<String, List<String>> entry : shapeTitleMap.entrySet()) {
methodNames.add(I18nRes.findValue(CoEConstant.APP_ID, entry.getKey()));
shapeNames.addAll(entry.getValue());
}
ResponseObject ro = ResponseObject.newOkResponse();
ro.put("url", createExcelTemplate(uc, sheetNames, shapeTitleMap));
ro.put("url", createExcelTemplate(uc, methodCategory, methodNames, shapeNames));
return ro;
}
@ -90,8 +94,8 @@ public class CreateShapeExcel {
}
private String createExcelTemplate(UserContext uc, Map<String, String> sheetNames, Map<String, List<String>> shapeTitleMap) {
// 编号名称形状类型描述/定义扩展<xx>...
private String createExcelTemplate(UserContext uc, String methodCategory, List<String> methodNames, List<String> shapeNames) {
// 模型名称模型类型形状名称形状类型扩展<xx>...
String groupValue = "template";
String fileValue = UUIDGener.getUUID();
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(BatchConst.APP_ID, BatchConst.TMP);
@ -99,99 +103,102 @@ public class CreateShapeExcel {
UtilFile utilFile = new UtilFile(dcContext.getPath());
// 创建文件
utilFile.mkdirs();
File file = new File(utilFile + File.separator + BatchConst.SHAPE_LIST_TEMPLATE_FILE);
String excelName = I18nRes.findValue(CoEConstant.APP_ID, methodCategory) + BatchConst.SHAPE_LIST_TEMPLATE_FILE_SUFFIX;
File file = new File(utilFile + File.separator + excelName);
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
XSSFWorkbook wb = new XSSFWorkbook();// 创建Excel工作簿对象
// 单元格样式
XSSFCellStyle cellStyle = POIUtil.getMainCellStyle(wb);
XSSFCellStyle cellStyle2 = POIUtil.getExtendCellStyle(wb);
XSSFCellStyle commStyle = POIUtil.getTableCellStyle(wb);
sheetNames.forEach((k,v)->{
if (shapeTitleMap.containsKey(v)) {
XSSFSheet sheet = wb.createSheet(k);// 创建工作表对象
XSSFRow titleRow = sheet.createRow(0);
titleRow.setHeightInPoints(25);
List<XSSFCell> titleList = new ArrayList<>();
int index = 0;
titleList.add(titleRow.createCell((short)index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_NO);
sheet.setColumnWidth((short)index, 3000);// 设置当前列宽度
index++;
// 名称
titleList.add(titleRow.createCell((short)index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_NAME);
sheet.setColumnWidth((short)index, 13000);// 设置当前列宽度
index++;
// 形状类型
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_TYPE);
sheet.setColumnWidth((short)index, 6000);// 设置当前列宽度
// 设置下拉框
XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper(sheet);
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createExplicitListConstraint(shapeTitleMap.get(v).toArray(new String [shapeTitleMap.get(v).size()]));
CellRangeAddressList addressList = new CellRangeAddressList(1, 65536, 2, 2);
XSSFDataValidation validation =(XSSFDataValidation)dvHelper.createValidation(dvConstraint, addressList);
sheet.addValidationData(validation);
index++;
// 以下为扩展
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle2);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_EXTAND_EXAMPLE);
sheet.setColumnWidth((short)index, 6000);// 设置当前列宽度
index++;
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle2);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_EXTAND_EXAMPLE2);
sheet.setColumnWidth((short)index, 4000);// 设置当前列宽度
// 创建20行的表格
for (int i = 0; i < 20; i++) {
XSSFRow dataRow = sheet.createRow(i+1);
List<XSSFCell> dataList = new ArrayList<>();
for (int j = 0; j < index + 1; j++) {
dataList.add(dataRow.createCell(j));
dataList.get((short)j).setCellStyle(commStyle);
}
try {
XSSFWorkbook wb = new XSSFWorkbook();// 创建Excel工作簿对象
// 模型清单页签
XSSFSheet sheet = wb.createSheet(ShapeUtil.getModelShapeListName(methodCategory));// 创建工作表对象
XSSFRow titleRow = sheet.createRow(0);
titleRow.setHeightInPoints(25);
// 单元格样式
XSSFCellStyle cellStyle = POIUtil.getMainCellStyle(wb);
XSSFCellStyle cellStyle2 = POIUtil.getExtendCellStyle(wb);
XSSFCellStyle commStyle = POIUtil.getTableCellStyle(wb);
List<XSSFCell> titleList = new ArrayList<>();
int index = 0;
// 模型名称
titleList.add(titleRow.createCell((short)index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_REPOSITORY_NAME);
sheet.setColumnWidth((short)index, 13000);// 设置当前列宽度
index++;
// 模型类型
titleList.add(titleRow.createCell((short)index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_REPOSITORY_TYPE);
sheet.setColumnWidth((short)index, 6000);// 设置当前列宽度
// 设置下拉框
XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper(sheet);
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createExplicitListConstraint(methodNames.toArray(new String [methodNames.size()]));
CellRangeAddressList addressList = new CellRangeAddressList(1, 65536, 1, 1);
XSSFDataValidation validation =(XSSFDataValidation)dvHelper.createValidation(dvConstraint, addressList);
sheet.addValidationData(validation);
index++;
// 节点名称
titleList.add(titleRow.createCell((short)index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_SHAPE_NAME);
sheet.setColumnWidth((short)index, 13000);// 设置当前列宽度
index++;
// 节点类型
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_SHAPE_TYPE);
sheet.setColumnWidth((short)index, 6000);// 设置当前列宽度
// 设置下拉框
// 下拉框数量超过20个通过sheet页建立下拉框选择
// XSSFDataValidationHelper dvHelper2 = new XSSFDataValidationHelper(sheet);
// XSSFDataValidationConstraint dvConstraint2 = (XSSFDataValidationConstraint) dvHelper2.createExplicitListConstraint(shapeNames.toArray(new String [shapeNames.size()]));
// CellRangeAddressList addressList2 = new CellRangeAddressList(1, 65536, 3, 3);
// XSSFDataValidation validation2 =(XSSFDataValidation)dvHelper2.createValidation(dvConstraint2, addressList2);
// sheet.addValidationData(validation2);
index++;
// 以下为扩展
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle2);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_EXTAND_EXAMPLE);
sheet.setColumnWidth((short)index, 6000);// 设置当前列宽度
index++;
titleList.add(titleRow.createCell(index));
titleList.get((short)index).setCellStyle(cellStyle2);
titleList.get((short)index).setCellValue(ShapeConst.TABLE_EXTAND_EXAMPLE2);
sheet.setColumnWidth((short)index, 4000);// 设置当前列宽度
// 创建20行的表格
for (int i = 0; i < 20; i++) {
XSSFRow dataRow = sheet.createRow(i+1);
List<XSSFCell> dataList = new ArrayList<>();
for (int j = 0; j < index + 1; j++) {
dataList.add(dataRow.createCell(j));
dataList.get((short)j).setCellStyle(commStyle);
}
}
});
// 增加说明页
File descFile = new File(BatchConst.TEMPLATE_FILE_PATH + BatchConst.SHAPE_LIST_TEMPLATE_FILE);
if (descFile.exists()) {
// 增加说明页
File descFile = new File(BatchConst.TEMPLATE_FILE_PATH + BatchConst.SHAPE_LIST_TEMPLATE_FILE_SUFFIX);
if (descFile.exists()) {
XSSFWorkbook descWb;
try {
try {
descWb = new XSSFWorkbook(descFile);
XSSFSheet descSheet = descWb.getSheetAt(2);
if (descSheet != null) {
XSSFSheet sheet = wb.createSheet("说明");
POIUtil.copySheet(wb, descSheet, sheet, true);
}
} catch (IOException e) {
e.printStackTrace();
descWb = new XSSFWorkbook(descFile);
XSSFSheet descSheet = descWb.getSheetAt(1);
if (descSheet != null) {
XSSFSheet sheet2 = wb.createSheet(ProcessConst.SHEET_HELPER);
POIUtil.copySheet(wb, descSheet, sheet2, true);
}
} catch (InvalidFormatException e) {
e.printStackTrace();
}
}
try {
}
// 处理形状类型下拉框
POIUtil.setLongXSSFValidation(wb, shapeNames.toArray(new String [shapeNames.size()]), sheet, 1, 65536, 3, 2, "形状类型选项");
wb.write(new FileOutputStream(file));
} catch (FileNotFoundException e) {
e.printStackTrace();

View File

@ -677,20 +677,5 @@ public class ImportShapeExcel {
private int validateJson(Integer index) {
return index == null ? 0 : index;
}
private ResponseObject validImportExcel(UserContext uc, String wsId, String fileValue, String fileName, String teamId) {
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(BatchConst.APP_ID, BatchConst.TMP);
DCContext dc = new DCContext(uc, dcProfile, BatchConst.APP_ID, BatchConst.UPLOAD, fileValue, fileName);
File file = new File(dc.getFilePath());
ResponseObject ro = null;
if (!file.exists()) {
ro = ResponseObject.newErrResponse("上传文件不存在");
return ro;
} else if (!".xlsx".equals(fileName.substring(fileName.lastIndexOf(".")))) {
ro = ResponseObject.newErrResponse("上传文件格式不正确请上传xlsx文件");
return ro;
}
return new ValidShapeExcel().checkShapeList(uc, file, wsId, teamId);
}
}

View File

@ -3,7 +3,7 @@ package com.actionsoft.apps.coe.pal.batch.web.create.shape;
public class ShapeConst {
// Excel工作表sheet页名称
// public final static String SHEET_NAME = "流程清单";
public final static String SHEET_NAME_SUFFIX = "模型形状清单";
public final static String SHEET_HELPER = "说明";
// 扩展属性名称前后缀
@ -11,14 +11,16 @@ public class ShapeConst {
public static final String EXTEND_PROP_SUFFIX = ">";
// 表格表头
public final static String TABLE_NO = "编号";
public final static String TABLE_NAME = "名称";
public final static String TABLE_TYPE = "形状类型";
// public final static String TABLE_NO = "编号";
public final static String TABLE_REPOSITORY_NAME = "模型名称";
public final static String TABLE_REPOSITORY_TYPE = "模型类型";
public final static String TABLE_SHAPE_NAME = "形状名称";
public final static String TABLE_SHAPE_TYPE = "形状类型";
public final static String TABLE_EXTAND_EXAMPLE = "扩展<xxx>";
public final static String TABLE_EXTAND_EXAMPLE2 = "...";
// 表格表头
public final static String [] SHAPE_TITLE_ROW = new String [] {TABLE_NO, TABLE_NAME, TABLE_TYPE};
public final static String SHAPE_BASE_TITLE_ROW = "编号、名称、形状类型";
public final static String [] SHAPE_TITLE_ROW = new String [] {TABLE_REPOSITORY_NAME, TABLE_REPOSITORY_TYPE, TABLE_SHAPE_NAME, TABLE_SHAPE_TYPE};
public final static String SHAPE_BASE_TITLE_ROW = "模型名称、模型类型、形状名称、形状类型";
}

View File

@ -1,23 +1,25 @@
package com.actionsoft.apps.coe.pal.batch.web.create.shape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import com.actionsoft.apps.coe.pal.batch.web.create.process.ProcessUtil;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
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.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class ShapeUtil {
public static String getModelShapeListName(String methodCategory) {
return I18nRes .findValue(CoEConstant.APP_ID, methodCategory) + ShapeConst.SHEET_NAME_SUFFIX;
}
/**
* BPMN图并不全部使用给定范围
*/
@ -54,17 +56,21 @@ public class ShapeUtil {
// list.add("textAnnotation");// 注释
return list;
}
/**
* 获取流程类别下所有模型的形状title
* @return
*/
public static Map<String, List<String>> getProcessShapeTitles() {
Map<String, List<String>> result = new HashMap<>();
public static Map<String, List<String>> getProcessShapeTitles(String methodCategory) {
Map<String, List<String>> result = new LinkedHashMap<>();
// 获取流程类别下所有的模型分类
List<String> methods = ProcessUtil.getProcessCategoryCategoryMehtodList();
JSONObject methodObj = ProcessUtil.getCategoryMethods(methodCategory, false);
List<String> methods = new ArrayList<>(methodObj.keySet());
Collections.sort(methods);
for (String methodId : methods) {
if ("default".equals(methodId)) {
continue;
}
List<String> list = new ArrayList<>();
JSONArray shapes = CoeDesignerUtil.getShapeDefinition(methodId);
for (Object shape : shapes) {
@ -72,15 +78,16 @@ public class ShapeUtil {
if (shapeObj.containsKey("title")) {
if (methodId.contains("bpmn")) {
if (bpmnShapeScope().contains(shapeObj.getString("name"))) {
list.add(shapeObj.getString("title"));
list.add(shapeObj.getString("title"));
}
} else {
list.add(shapeObj.getString("title"));
list.add(shapeObj.getString("title"));
}
}
}
result.put(methodId, list);
}
result.remove("default");
return result;
}
@ -119,8 +126,22 @@ public class ShapeUtil {
}
return result;
}
public static Set<String> getShapeMethodAttrNames(String wsId, String methodCategory) {
Set<String> result = new HashSet<>();
List<PALMethodModel> methodIdList = PALMethodCache.getPALMethodModelListByMethod(methodCategory);
for (PALMethodModel methodModel : methodIdList) {
List<PALMethodAttributeModel> attributeModelList = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels(wsId, methodModel.getId());
for (PALMethodAttributeModel attributeModel : attributeModelList) {
result.add(attributeModel.getNewTitle());
}
}
return result;
}
public static Set<String> getProcessMethodAttrNames(String wsId, String methodId) {
Set<String> result = new HashSet<>();
List<PALMethodAttributeModel> attributeModelList = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels(wsId, methodId);
for (PALMethodAttributeModel attributeModel : attributeModelList) {

View File

@ -3,15 +3,25 @@ package com.actionsoft.apps.coe.pal.batch.web.create.shape;
import java.io.File;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import com.actionsoft.apps.coe.pal.batch.util.BatchUtil;
import com.actionsoft.apps.coe.pal.batch.web.create.process.ProcessConst;
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.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodModel;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@ -43,307 +53,564 @@ import com.alibaba.fastjson.JSONObject;
public class ValidShapeExcel {
private Map<String, Map<String, JSONObject>> methodAttrMap = new HashMap<>();
private Map<String, Set<String>> attributeNamesMap = new HashMap<>();
private Map<String, JSONArray> typesMap = new HashMap<>();
private String errMsg = "<font size=\"5\">校验失败</font><br><br>";
public ResponseObject checkShapeList(UserContext uc, File file, String wsId, String teamId) {
public ResponseObject checkShapeList(UserContext uc, File file, String wsId, String teamId, String methodCategory) {
XSSFWorkbook wb = POIUtil.getWorkbook(file);
if (wb == null) {
return ResponseObject.newErrResponse(errMsg + "获取上传文件失败");
}
// 校验工作表sheet页名称的流程权限是否存在是否有权限
// 1.获取所有sheet页
List<XSSFSheet> sheets = new ArrayList<>();
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
if (!ShapeConst.SHEET_HELPER.equals(wb.getSheetAt(i).getSheetName())) {
sheets.add(wb.getSheetAt(i));
}
String sheetName = ShapeUtil.getModelShapeListName(methodCategory);
XSSFSheet sheet = wb.getSheet(sheetName);
if (sheet == null) {
return ResponseObject.newErrResponse(errMsg + "上传文件中【" + sheetName + "】工作表不存在");
}
if (sheets.size() == 0) {
return ResponseObject.newErrResponse(errMsg + "上传文件中无数据");
List<String> titleList = new LinkedList<String>();
XSSFRow titleRow = sheet.getRow(0);
if (titleRow == null ) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表中首行为标题行,不能为空,请调整");
}
List<String> errSheetNameList = new ArrayList<>();
// 以sheet页名称判断是否有此流程和权限
for (XSSFSheet sheet : sheets) {
String name = sheet.getSheetName();
// 拆分编号名称版本
String [] nameArr = name.split("-");
if (nameArr.length != 3) {
errSheetNameList.add(name);
int cellNum = titleRow.getLastCellNum();
for (int i = 0; i < cellNum; i++) {
XSSFCell cell = titleRow.getCell(i);
String title = POIUtil.getCellValueByCell(cell);
if (UtilString.isEmpty(title)) {
break;
}
titleList.add(title);
}
if (errSheetNameList.size() > 0) {
return ResponseObject.newErrResponse(errMsg + "以下工作表名称错误,识别失败:<br>" + String.join("<br>", errSheetNameList));
if (titleList.size() == 0) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表中首行为标题行,不能为空,请调整");
}
Map <String, String> sheetMap = new HashMap<>();
// 校验名称及权限是否正确
for (XSSFSheet sheet : sheets) {
String sheetName = sheet.getSheetName();
String[] nameArr = sheetName.split("-");
// 编号
String no = nameArr[0];
String name = nameArr[1];
String version = nameArr[2];
// 校验编号格式
String regex = "^\\d+(\\.\\d+)*";
boolean isMatch = Pattern.matches(regex, no);
boolean noValid = false;
if (isMatch) {
noValid = true;
String[] levels = no.split("\\.");
for (int k = 0; k < levels.length; k++) {
if ("0".equals(levels[k])) {
noValid = false;
break;
}
}
}
if (!noValid) {
return ResponseObject.newErrResponse(errMsg + "工作表名称【" + sheetName + "】格式错误,编号解析失败");
}
// 校验版本
int ver = 0;
String verStr = version.substring(1, version.indexOf(".0"));
String regexVer = "^[1-9]\\d*$";
boolean isVerMatch = Pattern.matches(regexVer, verStr);
if (!isVerMatch) {
return ResponseObject.newErrResponse(errMsg + "工作表名称【" + sheetName + "】格式错误,流程版本号解析失败");
}
ver = Integer.parseInt(verStr);
// 校验名称与编号+名称+编号+版本是否存在是否存在
String[] noArr = no.split("\\.");
String pid = "process";
String plid = null;
for (int k = 1; k < noArr.length + 1; k++) {
int level = k;
List<PALRepositoryModel> list = PALRepositoryCache.getAllSubModelsByPid(wsId, pid);
if (list == null || list.size() == 0) {
break;
}
if (k == noArr.length) {// 找到了最后一层判断名称是否相等
for (PALRepositoryModel model : list) {
if (model.getLevel() == level && model.getOrderIndex() == Integer.parseInt(noArr[k - 1])
&& model.getVersion() == ver && name.equals(model.getName())) {
plid = model.getId();
break;
}
}
if (!UtilString.isEmpty(plid)) {
break;
}
} else {
for (PALRepositoryModel model : list) {
if (model.isUse()) {
if (model.getLevel() == level && model.getOrderIndex() == Integer.parseInt(noArr[k - 1])) {
pid = model.getId();
break;
}
}
}
}
}
if (UtilString.isEmpty(plid)) {
return ResponseObject.newErrResponse(errMsg + "工作表名称【" + sheetName + "】格式错误,流程不存在");
}
// 判断流程类别的应用是否安装
List<PALMethodModel> methodList = PALMethodCache.getPALMethodModelListByMethod(PALRepositoryCache.getCache().get(plid).getMethodCategory());
boolean appInstalled = false;
if (methodList != null && methodList.size() > 0) {
for (PALMethodModel methodModel: methodList) {
if (methodModel.getId().equals(PALRepositoryCache.getCache().get(plid).getMethodId())) {
String appId = methodModel.getApp().getId();
if (SDK.getAppAPI().isInstalled(appId) && SDK.getAppAPI().isActive(appId)) {
appInstalled = true;
}
break;
}
}
}
if (!appInstalled) {
return ResponseObject.newErrResponse(errMsg + "工作表【" + sheetName + "】校验失败,流程所属应用未安装或者已停用");
}
// 当前人是否有该流程写权限
if (!UtilString.isEmpty(teamId)) {
boolean permVaild = false;
if (CoeCooperationAPIManager.getInstance().havingWritePerm(teamId, uc.getUID())) {
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plid);
Set<String> permVerIds = BatchUtil.getPermVersionIds(wsId, teamId, uc.getUID());
if (permVerIds.contains(plModel.getVersionId())) {
permVaild = true;
}
}
if (!permVaild) {
return ResponseObject.newErrResponse(errMsg + "工作表名称【" + sheetName + "】流程操作无权限,请配置该流程的写权限");
}
}
sheetMap.put(sheetName, plid);
// 校验标题行
ResponseObject checkTitleRo = checkTitleRow(wsId, titleList, methodCategory);
if (!checkTitleRo.isOk()) {
return checkTitleRo;
}
// 构造Excel数据model
List<ExcelShapeModel> excelShapeModels = handleExcel2Model(sheet, titleList);
ResponseObject ro = ResponseObject.newOkResponse();
JSONArray result = new JSONArray();
// 校验每个工作表首行是否合规
for (XSSFSheet sheet : sheets) {
String sheetName = sheet.getSheetName();
String plid = sheetMap.get(sheetName);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plid);
// 校验文件是否为空
if (ProcessUtil.isView(plModel)) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表【" + sheetName + "】流程状态不可编辑,请检查当前流程是否为设计状态");
}
if (!ProcessUtil.isBlank(uc, plModel)) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表【" + sheetName + "】流程不为空,不能上传该流程");
}
// 获取该流程大类下的属性文件
String methodId = plModel.getMethodId();
// 校验标题行
List<String> titleList = new LinkedList<String>();
XSSFRow titleRow = sheet.getRow(0);
if (titleRow == null ) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表【" + sheetName + "】首行为标题行,不能为空,请调整");
}
int cellNum = titleRow.getLastCellNum();
for (int i = 0; i < cellNum; i++) {
String title = titleRow.getCell(i).getStringCellValue();
if (!UtilString.isEmpty(title)) {
titleList.add(title);
}
}
if (titleList.size() == 0) {
return ResponseObject.newErrResponse(errMsg + "上传文件工作表【" + sheetName + "】首行为标题行,不能为空,请调整");
}
ResponseObject checkTitleRo = checkTitleRow(wsId, sheetName, titleList, methodId);
if (!checkTitleRo.isOk()) {
return checkTitleRo;
}
}
for (XSSFSheet sheet : sheets) {
String sheetName = sheet.getSheetName();
String plid = sheetMap.get(sheetName);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plid);
// 获取该流程大类下的属性文件
String methodId = plModel.getMethodId();
List<String> titleList = new LinkedList<String>();
XSSFRow titleRow = sheet.getRow(0);
int cellNum = titleRow.getLastCellNum();
for (int i = 0; i < cellNum; i++) {
String title = titleRow.getCell(i).getStringCellValue();
if (!UtilString.isEmpty(title)) {
titleList.add(title);
}
}
// 校验数据
JSONObject object = new JSONObject();
object.put("sheetName", sheetName);
object.put("titleRow", titleList);
object.put("id", plid);
object.put("data", checkData(getDataList(sheet, titleList), titleList, wsId, methodId));
object.put("isOk", checkSheet(object.getJSONArray("data")));
result.add(object);
}
ro.setData(result);
// 获取所有数据
JSONObject result = new JSONObject();
result.put("titleRow", titleList);
result.put("data", checkData(wsId, teamId, methodCategory, uc, excelShapeModels, titleList));
ro.put("data", result);
return ro;
}
/**
* 根据校验的表格数据结果获取整个表格是否校验通过
* @param data
* Excel中数据转换为model处理
* @param sheet
* @param titleList
* @return
*/
private boolean checkSheet(JSONArray data) {
for (int i = 0; i < data.size(); i++) {
JSONArray rowArr = data.getJSONArray(i);
for (int j = 0; j < rowArr.size(); j++) {
JSONObject cell = rowArr.getJSONObject(j);
if (!cell.getBooleanValue("isOk")) {
return false;
private List<ExcelShapeModel> handleExcel2Model(XSSFSheet sheet, List<String> titleList) {
List<ExcelShapeModel> result = new ArrayList<>();
// 获取所有Excel数据
List<List<String>> dataList = getDataList(sheet, titleList);
// Excel内容转换为Model
int row = 1;
for (List<String> rowDataList : dataList) {
// 0模型名称
String repositoryName = rowDataList.get(0);
// 1模型类型
String repositoryType = rowDataList.get(1);
// 2形状名称
String shapeName = rowDataList.get(2);
// 3形状类型
String shapeType = rowDataList.get(3);
// 4扩展属性
List<String> shapeRowList = new ArrayList<>(rowDataList.stream().collect(Collectors.toList()));
ExcelShapeModel excelShapeModel = new ExcelShapeModel();
excelShapeModel.setRow(row++);
excelShapeModel.setRepositoryName(repositoryName);
excelShapeModel.setRepositoryType(repositoryType);
excelShapeModel.setShapeName(shapeName);
excelShapeModel.setShapeType(shapeType);
excelShapeModel.setRowData(shapeRowList);
result.add(excelShapeModel);
}
return result;
}
/**
* 校验数据
* @param wsId
* @param teamId
* @param methodCategory
* @param uc
* @param excelShapeModels
* @param titleList
* @return
*/
private JSONObject checkData(String wsId, String teamId, String methodCategory, UserContext uc, List<ExcelShapeModel> excelShapeModels, List<String> titleList) {
Iterator<ExcelShapeModel> iterator = excelShapeModels.iterator();
// 1. 过滤掉关键信息空白的数据(模型名称模型类型形状名称形状类型任一为空即满足过滤条件)
List<RepositoryShapeInfoModel> blankList = new ArrayList();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
// 校验模型名称模型类型形状名称形状类型任一为空
if (UtilString.isEmpty(repositoryName) || UtilString.isEmpty(repositoryType) || UtilString.isEmpty(shapeName) || UtilString.isEmpty(shapeType)) {
RepositoryShapeInfoModel blankModel = new RepositoryShapeInfoModel();
blankModel.setRepositoryName(repositoryName);
blankModel.setMethodName(repositoryType);
blankModel.setShapeName(shapeName);
blankModel.setShapeType(shapeType);
blankModel.setExcelShapeModel(row);
blankModel.setResult("blank");
blankModel.setRowOk(false);
blankModel.setRowMsg(ShapeConst.SHAPE_BASE_TITLE_ROW + "不允许为空");
blankList.add(blankModel);
iterator.remove();
}
}
// 2.过滤掉Excel中的重复数据记录(模型名称模型类型形状名称形状类型四项内容完全重复)
List<RepositoryShapeInfoModel> excelRepeatList = new ArrayList<>();
Map<String, Integer> tmpMap = new HashMap<>();
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|" + repositoryType + "|" + shapeName + "|" + shapeType;
if (tmpMap.containsKey(key)) {
RepositoryShapeInfoModel repeatModel = new RepositoryShapeInfoModel();
repeatModel.setRepositoryName(repositoryName);
repeatModel.setMethodName(repositoryType);
repeatModel.setShapeName(shapeName);
repeatModel.setShapeType(shapeType);
repeatModel.setExcelShapeModel(row);
repeatModel.setResult("repeat");
repeatModel.setRowOk(false);
repeatModel.setRowMsg("与第" + tmpMap.get(key) + "行重复");
excelRepeatList.add(repeatModel);
iterator.remove();
} else {
tmpMap.put(key, row.getRow());
}
}
// 获取PAL模型信息(多版本只取最新版本
List<PALRepositoryModel> recentRepositoryList = ProcessUtil.getRecentRepositoryList(wsId, methodCategory);
Map<String, String> repositoryMap = new HashMap<>();// 按照名称+建模分类名称记录对应id
Map<String, Integer> repeatNameCountMap = new HashMap<>();// 统计名称重复的
for (PALRepositoryModel model : recentRepositoryList) {
String key = model.getName() + "|||" + I18nRes.findValue(CoEConstant.APP_ID, model.getMethodId());
repositoryMap.put(key, model.getId());
if (!repeatNameCountMap.containsKey(key)) {
repeatNameCountMap.put(key, 0);
}
repeatNameCountMap.put(key, repeatNameCountMap.get(key) + 1);
}
// 3.模型没有匹配上
List<RepositoryShapeInfoModel> noMatchList = new ArrayList<>();
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
if (!repositoryMap.containsKey(key)) {
RepositoryShapeInfoModel noMatchModel = new RepositoryShapeInfoModel();
noMatchModel.setRepositoryName(repositoryName);
noMatchModel.setMethodName(repositoryType);
noMatchModel.setShapeName(shapeName);
noMatchModel.setShapeType(shapeType);
noMatchModel.setExcelShapeModel(row);
noMatchModel.setResult("noMatch");
noMatchModel.setRowOk(false);
noMatchModel.setRowMsg("PAL中不存在对应的模型");
noMatchList.add(noMatchModel);
iterator.remove();
}
}
// 4.模型没有写权限
List<RepositoryShapeInfoModel> noPermList = new ArrayList<>();
if (!UtilString.isEmpty(teamId)) {
iterator = excelShapeModels.iterator();
Set<String> permVerIds = BatchUtil.getPermVersionIds(wsId, teamId, uc.getUID());
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
if (!permVerIds.contains(plModel.getVersionId())) {
RepositoryShapeInfoModel noPermModel = new RepositoryShapeInfoModel();
noPermModel.setRepositoryName(repositoryName);
noPermModel.setMethodName(repositoryType);
noPermModel.setShapeName(shapeName);
noPermModel.setShapeType(shapeType);
noPermModel.setExcelShapeModel(row);
noPermModel.setResult("noPerm");
noPermModel.setRowOk(false);
noPermModel.setRowMsg("没有对应的数据编辑权限");
noPermList.add(noPermModel);
iterator.remove();
}
}
}
return true;
}
/**
* 校验表格数据
* @param dataList
* @param titleList
* @param wsId
*/
private JSONArray checkData(List<List<String>> dataList, List<String> titleList, String wsId, String methodId) {
JSONArray result = new JSONArray();
for (int i = 0; i < dataList.size(); i++) {
JSONObject typeObj = null;
List<String> rowDataList = dataList.get(i);
// 5.模型出现了多个匹配
List<RepositoryShapeInfoModel> moreMatchList = new ArrayList<>();
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
if (repeatNameCountMap.get(key) > 1) {
RepositoryShapeInfoModel moreMatchModel = new RepositoryShapeInfoModel();
moreMatchModel.setRepositoryId(palId);
moreMatchModel.setRepositoryName(repositoryName);
moreMatchModel.setMethodName(repositoryType);
moreMatchModel.setMethodId(plModel.getMethodId());
moreMatchModel.setShapeName(shapeName);
moreMatchModel.setShapeType(shapeType);
moreMatchModel.setExcelShapeModel(row);
moreMatchModel.setResult("moreMatch");
moreMatchModel.setRowOk(false);
moreMatchModel.setRowMsg("出现PAL多个符合条件的模型");
moreMatchList.add(moreMatchModel);
iterator.remove();
}
}
// 6.存在模型为只读的
List<RepositoryShapeInfoModel> readonlyList = new ArrayList<>();
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
if (plModel.isPublish() || plModel.isApproval() || plModel.isApproval()) {// 已发布审批中停用则记录不更新
String status = plModel.isPublish() ? "已发布" : plModel.isApproval() ? "审批中" : "已停用";
RepositoryShapeInfoModel readonlyModel = new RepositoryShapeInfoModel();
readonlyModel.setRepositoryId(palId);
readonlyModel.setRepositoryName(repositoryName);
readonlyModel.setMethodName(repositoryType);
readonlyModel.setMethodId(plModel.getMethodId());
readonlyModel.setShapeName(shapeName);
readonlyModel.setShapeType(shapeType);
readonlyModel.setExcelShapeModel(row);
readonlyModel.setResult("readonly");
readonlyModel.setRowOk(false);
readonlyModel.setRowMsg("模型" + status + "不可编辑");
readonlyList.add(readonlyModel);
iterator.remove();
}
}
// 查询一些形状定义
Map<String, List<JSONObject>> shapeObjMap = new HashMap<>();// 形状定义信息
Map<String, Map<String, String>> shapeMap = new HashMap<>();// 形状名称类型与id的映射关系
// 剩下的数据先获取下形状信息做进一步判断
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
List<JSONObject> shapeList = CoeDesignerUtil.getShapeMessageJson5(palId);
shapeObjMap.put(key, shapeList);
}
// 形状名称+类型的数量统计 key:key,value:key:shapeName+shapeType,value:count
Map<String, Map<String, Integer>> sameShapeMap = new HashMap<>();
for (Map.Entry<String, List<JSONObject>> entry : shapeObjMap.entrySet()) {
String key = entry.getKey();
List<JSONObject> shapeList = entry.getValue();
for (JSONObject shapeObj : shapeList) {
String shapeId = shapeObj.getString("id");
String shapeName = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("text")).replace(" ", "");
String shapeType = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("title")).replace(" ", "");
String shapeKey = shapeName + "|||" + shapeType;
// 形状名称+类型与对应的形状id映射记录
if (!shapeMap.containsKey(key)) {
shapeMap.put(key, new HashMap<>());
}
shapeMap.get(key).put(shapeKey, shapeId);
// 形状名称+类型的数量记录
if (!sameShapeMap.containsKey(key)) {
sameShapeMap.put(key, new HashMap<>());
}
if (!sameShapeMap.get(key).containsKey(shapeKey)) {
sameShapeMap.get(key).put(shapeKey, 0);
}
sameShapeMap.get(key).put(shapeKey, sameShapeMap.get(key).get(shapeKey) + 1);
}
}
// 7.模型形状存在但是出现了多个匹配
// 借用moreMatchList不再创建新的统一归为匹配出现多个类型
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
String shapeKey = shapeName + "|||" + shapeType;
if (sameShapeMap.containsKey(key) && sameShapeMap.get(key).containsKey(shapeKey) && sameShapeMap.get(key).get(shapeKey) > 1) {
RepositoryShapeInfoModel moreMatchModel = new RepositoryShapeInfoModel();
moreMatchModel.setRepositoryId(palId);
moreMatchModel.setRepositoryName(repositoryName);
moreMatchModel.setMethodName(repositoryType);
moreMatchModel.setMethodId(plModel.getMethodId());
moreMatchModel.setShapeName(shapeName);
moreMatchModel.setShapeType(shapeType);
moreMatchModel.setExcelShapeModel(row);
moreMatchModel.setResult("moreMatch");
moreMatchModel.setRowOk(false);
moreMatchModel.setRowMsg("出现PAL多个符合条件的模型形状");
moreMatchList.add(moreMatchModel);
iterator.remove();
}
}
// 剩下的都是基本信息校验通过的
List<RepositoryShapeInfoModel> matchShapeList = new ArrayList<>();
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
String shapeKey = shapeName + "|||" + shapeType;
// 8.模型形状需要新增
String result = "add";
String shapeId = "";
if (shapeMap.containsKey(key) && shapeMap.get(key).containsKey(shapeKey)) {
// 9.模型形状需要更新
shapeId = shapeMap.get(key).get(shapeKey);
result = "update";
}
RepositoryShapeInfoModel shapeModel = new RepositoryShapeInfoModel();
shapeModel.setRepositoryId(palId);
shapeModel.setRepositoryName(repositoryName);
shapeModel.setMethodName(repositoryType);
shapeModel.setMethodId(plModel.getMethodId());
shapeModel.setShapeId(shapeId);
shapeModel.setShapeName(shapeName);
shapeModel.setShapeType(shapeType);
shapeModel.setExcelShapeModel(row);
shapeModel.setResult(result);
shapeModel.setRowOk(true);
shapeModel.setRowMsg("");
matchShapeList.add(shapeModel);
}
// 10.校验属性
for (int i = 0; i < matchShapeList.size(); i++) {
RepositoryShapeInfoModel model = matchShapeList.get(i);
ExcelShapeModel row = model.getExcelShapeModel();
String repositoryName = model.getRepositoryName();
String methodId = model.getMethodId();
String shapeName = model.getShapeName();
String shapeType = model.getShapeType();
String shapeId = model.getShapeId();
String key = repositoryName + "|||" + methodId;
String palId = repositoryMap.get(key);
JSONArray rowJson = new JSONArray();
List<String> rowDataList = row.getRowData();
for (int j = 0; j < rowDataList.size(); j++) {
String title = titleList.get(j);
String cellValue = rowDataList.get(j);
if (ShapeConst.TABLE_NO.equals(title)) {
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeNo()).execute(cellValue).toString()));
} else if (ShapeConst.TABLE_NAME.equals(title)) {
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeName()).execute(cellValue).toString()));
} else if (ShapeConst.TABLE_TYPE.equals(title)) {
// ****这里面要把所有的列都写全不然界面的表格会出现列偏移****
if (ShapeConst.TABLE_REPOSITORY_NAME.equals(title)) {
JSONObject o = new JSONObject();
o.put("name", ShapeConst.TABLE_REPOSITORY_NAME);
o.put("name2", ShapeConst.TABLE_REPOSITORY_NAME);
o.put("value", BatchUtil.specialCharTransfer(cellValue));
o.put("isOk", true);
o.put("msg", "");
rowJson.add(o);
} else if (ShapeConst.TABLE_REPOSITORY_TYPE.equals(title)) {
JSONObject o = new JSONObject();
o.put("name", ShapeConst.TABLE_REPOSITORY_TYPE);
o.put("name2", ShapeConst.TABLE_REPOSITORY_TYPE);
o.put("value", BatchUtil.specialCharTransfer(cellValue));
o.put("isOk", true);
o.put("msg", "");
rowJson.add(o);
} else if (ShapeConst.TABLE_SHAPE_NAME.equals(title)) {
JSONObject param = new JSONObject();
param.put("value", cellValue);
param.put("methodId", methodId);
JSONArray typeArr;
if (typesMap.containsKey(methodId)) {
typeArr = typesMap.get(methodId);
} else {
typeArr = ShapeUtil.getProcessShapeTypeArr(methodId);
typesMap.put(methodId, typeArr);
}
param.put("typeArr", typeArr);
JSONObject object = JSONObject.parseObject(new ValidShape(new ValidShapeType()).execute(param).toString());
typeObj = object;
rowJson.add(object);
} else {// 扩展属性列
if (typeObj != null && typeObj.getBooleanValue("isOk")) {
// 部分虽然放入扩展属性但是是固定的属性的校验
String propertyName = title.substring(title.indexOf("扩展<") + 3, title.lastIndexOf(">"));
JSONObject methodAttrs = queryMethodAttrs(wsId, methodId, typeObj.getString("value"));
if (methodAttrs.containsKey(propertyName)) {
// 校验各种类型
JSONObject attr = methodAttrs.getJSONObject(propertyName);
String attrType = attr.getString("type");
JSONObject param = new JSONObject();
param.put("title", propertyName);
param.put("attr", attr);
param.put("value", cellValue);
param.put("wsId", wsId);
if ("string".equals(attrType) || "textarea".equals(attrType)) {// 文本
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeString()).execute(param).toString()));
} else if ("relation".equals(attrType)) {// 关联
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeRelation()).execute(param).toString()));
} else if ("awsorg".equals(attrType)) {// 关联AWS平台
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 {// 其他按照string对待
rowJson.add(JSONObject.parseObject(new Valid(new ValidString()).execute(param).toString()));
}
} else {
JSONObject param = new JSONObject();
param.put("title", propertyName);
param.put("attr", "tmp");
param.put("value", "");
param.put("wsId", wsId);
rowJson.add(JSONObject.parseObject(new Valid(new ValidString()).execute(param).toString()));
param.put("wsId", wsId);
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeName()).execute(param).toString()));
} else if (ShapeConst.TABLE_SHAPE_TYPE.equals(title)) {
JSONObject o = new JSONObject();
o.put("name", ShapeConst.TABLE_SHAPE_TYPE);
o.put("name2", ShapeConst.TABLE_SHAPE_TYPE);
o.put("value", BatchUtil.specialCharTransfer(cellValue));
o.put("isOk", true);
o.put("msg", "");
rowJson.add(o);
} else {// 扩展属性
String propertyName = title.substring(title.indexOf("扩展<") + 3, title.lastIndexOf(">"));
JSONObject methodAttrs = queryMethodAttrs(wsId, methodId, shapeType);
if (methodAttrs.containsKey(propertyName)) {
// 校验各种类型
JSONObject attr = methodAttrs.getJSONObject(propertyName);
String attrType = attr.getString("type");
JSONObject param = new JSONObject();
param.put("title", propertyName);
param.put("attr", attr);
param.put("value", cellValue);
param.put("wsId", wsId);
if ("string".equals(attrType) || "textarea".equals(attrType)) {// 文本
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeString()).execute(param).toString()));
} else if ("relation".equals(attrType)) {// 关联
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeRelation()).execute(param).toString()));
} else if ("awsorg".equals(attrType)) {// 关联AWS平台
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 {// 其他按照string对待
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeString()).execute(param).toString()));
}
} else {// 若文件类型不正确后续属性不校验不显示
} else {
JSONObject param = new JSONObject();
param.put("title", propertyName);
param.put("attr", "tmp");
param.put("value", "");
param.put("wsId", wsId);
rowJson.add(JSONObject.parseObject(new ValidShape(new ValidShapeString()).execute(param).toString()));
}
}
}
result.add(rowJson);
model.setCheckResult(rowJson);
}
// System.out.println(result);
// 排序
// result = sort(result);
return result;
// 整理最终结果
List<RepositoryShapeInfoModel> allDataList = new ArrayList<>();
allDataList.addAll(blankList);
allDataList.addAll(excelRepeatList);
allDataList.addAll(noMatchList);
allDataList.addAll(noPermList);
allDataList.addAll(moreMatchList);
allDataList.addAll(readonlyList);
allDataList.addAll(matchShapeList);
// 整体按照Excel表中顺序排序
allDataList.sort((a1, a2)-> {return a1.getExcelShapeModel().getRow() - a2.getExcelShapeModel().getRow();});
// 构造结果集返回给前端
int totalCount = allDataList.size();
int repeatCount = excelRepeatList.size();
int blankCount = blankList.size();
int noMatchCount = noMatchList.size();
int noPermCount = noPermList.size();
int moreMatchCount = moreMatchList.size();
int readonlyCount = readonlyList.size();
int okCount = 0;
int errCount = 0;
for (RepositoryShapeInfoModel model : matchShapeList) {
model.setRowOk(true);
JSONArray arr = model.getCheckResult();
for (int i = 0; i < arr.size(); i++) {
if (!arr.getJSONObject(i).getBooleanValue("isOk")) {
model.setRowOk(false);
}
}
if (model.isRowOk()) {
okCount++;
} else {
errCount++;
}
}
// 构造返回前端数据
JSONArray result = new JSONArray();
for (int i = 0; i < allDataList.size(); i++) {
RepositoryShapeInfoModel model = allDataList.get(i);
if ("blank".equals(model.getResult()) ||
"repeat".equals(model.getResult()) ||
"noMatch".equals(model.getResult()) ||
"noPerm".equals(model.getResult()) ||
"moreMatch".equals(model.getResult()) ||
"readonly".equals(model.getResult())) {
JSONArray row = new JSONArray();
List<String> list = model.getExcelShapeModel().getRowData();
for (int j = 0; j < list.size(); j++) {
String s = list.get(j);
JSONObject cell = new JSONObject();
cell.put("name", titleList.get(j));
cell.put("name2", ShapeConst.EXTEND_PROP_PREFIX + titleList.get(j) + ShapeConst.EXTEND_PROP_SUFFIX);
if (ShapeConst.TABLE_REPOSITORY_NAME.equals(titleList.get(j))) {
cell.put("isOk", false);
cell.put("msg", model.getRowMsg());
} else {
cell.put("isOk", true);
cell.put("msg", "");
}
cell.put("value", s);
row.add(cell);
}
JSONObject rowResult = new JSONObject();
rowResult.put("row", row);
rowResult.put("excelNo", model.getExcelShapeModel().getRow());// Excel中行
rowResult.put("isRowOk", model.isRowOk());
rowResult.put("result", model.getResult());
result.add(rowResult);
} else if ("add".equals(model.getResult()) || "update".equals(model.getResult())) {
JSONArray row = model.getCheckResult();
JSONObject rowResult = new JSONObject();
rowResult.put("row", row);
rowResult.put("excelNo", model.getExcelShapeModel().getRow());// Excel中行
rowResult.put("isRowOk", model.isRowOk());
rowResult.put("result", model.getResult());
rowResult.put("repositoryId", model.getRepositoryId());
rowResult.put("shapeId", model.getShapeId());
result.add(rowResult);
}
}
JSONObject ro = new JSONObject();
ro.put("result", result);
ro.put("totalCount", totalCount);
ro.put("repeatCount", repeatCount);
ro.put("blankCount", blankCount);
ro.put("noPermCount", noPermCount);
ro.put("moreMatchCount", moreMatchCount);
ro.put("readonlyCount", readonlyCount);
ro.put("noMatchCount", noMatchCount);
ro.put("okCount", okCount);
ro.put("errCount", errCount);
return ro;
}
/**
* 获取更多特性
* @param methodId
@ -420,11 +687,11 @@ public class ValidShapeExcel {
* 校验标题行
* @param titleRow
*/
public ResponseObject checkTitleRow(String wsId, String sheetName, List<String> titleRow, String methodId) {
public ResponseObject checkTitleRow(String wsId, List<String> titleRow, String methodCategory) {
// 标题固定行验证
if (titleRow.size() < ShapeConst.SHAPE_TITLE_ROW.length) {// 固定行列不够
StringBuilder msg = new StringBuilder();
msg.append("工作表【" + sheetName + "固定属性标题要求:").append(ShapeConst.SHAPE_BASE_TITLE_ROW).append("<br><br>");
msg.append("固定属性标题要求:").append(ShapeConst.SHAPE_BASE_TITLE_ROW).append("<br><br>");
msg.append("请按照以上固定属性内容及顺序调整工作表并重新上传Excel文件");
msg.insert(0, errMsg);
return ResponseObject.newErrResponse(msg.toString());
@ -440,7 +707,7 @@ public class ValidShapeExcel {
}
if (illegalBaseTitle.size() > 0) {
StringBuilder msg = new StringBuilder();
msg.append("工作表【" + sheetName + "固定属性标题要求:").append(ShapeConst.SHAPE_BASE_TITLE_ROW).append("<br><br>");
msg.append("固定属性标题要求:").append(ShapeConst.SHAPE_BASE_TITLE_ROW).append("<br><br>");
msg.append("不符合要求的属性标题范围:" + String.join("", illegalBaseTitle)).append("<br><br>");
msg.append("请按照以上固定属性内容及顺序调整工作表并重新上传Excel文件");
msg.insert(0, errMsg);
@ -450,13 +717,7 @@ public class ValidShapeExcel {
if (titleRow.size() > ShapeConst.SHAPE_TITLE_ROW.length) {// 有扩展属性
List<String> illegalAttrTitle = new ArrayList<>();
// 获取当前扩展属性
Set<String> attributeNames;
if (attributeNamesMap.containsKey(methodId)) {
attributeNames = attributeNamesMap.get(methodId);
} else {
attributeNames = ShapeUtil.getProcessMethodAttrNames(wsId, methodId);
attributeNamesMap.put(methodId, attributeNames);
}
Set<String> attributeNames = ShapeUtil.getShapeMethodAttrNames(wsId, methodCategory);
for (int i = ShapeConst.SHAPE_TITLE_ROW.length; i < titleRow.size(); i++) {
String title = titleRow.get(i);
int prefix = title.indexOf("扩展<");
@ -474,7 +735,7 @@ public class ValidShapeExcel {
List<String> list = new ArrayList<String>(attributeNames);
list.sort((name1, name2) -> name1.compareTo(name2));
StringBuilder msg = new StringBuilder();
msg.append("工作表【" + sheetName + "】扩展属性要求格式:扩展<xxx>;").append("<br><br>");
msg.append("扩展属性要求格式:扩展&ltxxx&gt;").append("<br><br>");
msg.append("标准扩展属性范围:" + String.join("", list)).append("<br><br>");
msg.append("不符合要求的属性标题范围:" + String.join("", illegalAttrTitle)).append("<br><br>");
msg.append("请按照以上格式及标准扩展属性范围调整工作表并重新上传Excel文件");
@ -496,7 +757,7 @@ public class ValidShapeExcel {
}
if (repeatTitle.size() > 0) {
StringBuilder msg = new StringBuilder();
msg.append("工作表【" + sheetName + "属性重复").append("<br><br>");
msg.append("属性重复").append("<br><br>");
msg.append("重复的属性标题:" + String.join("", repeatTitle)).append("<br><br>");
msg.append("请调整重复的属性并重新上传Excel文件");
msg.insert(0, errMsg);

View File

@ -0,0 +1,36 @@
package com.actionsoft.apps.coe.pal.batch.web.create.shape.model;
import java.util.List;
/**
* Excel模型model
*/
public class ExcelRepositoryModel {
private String repositoryName;
private String repositoryType;
private List<ExcelShapeModel> shapeList;
public String getRepositoryName() {
return repositoryName;
}
public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
public String getRepositoryType() {
return repositoryType;
}
public void setRepositoryType(String repositoryType) {
this.repositoryType = repositoryType;
}
public List<ExcelShapeModel> getShapeList() {
return shapeList;
}
public void setShapeList(List<ExcelShapeModel> shapeList) {
this.shapeList = shapeList;
}
}

View File

@ -0,0 +1,63 @@
package com.actionsoft.apps.coe.pal.batch.web.create.shape.model;
import java.util.List;
/**
* Excel形状model
*/
public class ExcelShapeModel {
private int row;// 当前行从1开始
private String repositoryName;
private String repositoryType;
private String shapeName;
private String shapeType;
private List<String> rowData;// 扩展属性内容
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
public String getShapeName() {
return shapeName;
}
public void setShapeName(String shapeName) {
this.shapeName = shapeName;
}
public String getShapeType() {
return shapeType;
}
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public List<String> getRowData() {
return rowData;
}
public void setRowData(List<String> rowData) {
this.rowData = rowData;
}
public String getRepositoryName() {
return repositoryName;
}
public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
public String getRepositoryType() {
return repositoryType;
}
public void setRepositoryType(String repositoryType) {
this.repositoryType = repositoryType;
}
}

View File

@ -0,0 +1,143 @@
package com.actionsoft.apps.coe.pal.batch.web.create.shape.model;
import com.actionsoft.apps.coe.pal.batch.web.create.process.model.ExcelRowModel;
import com.alibaba.fastjson.JSONArray;
import java.util.List;
public class RepositoryShapeInfoModel {
private String repositoryId;// 模型ID
private String repositoryName;// 模型名称
private String methodId;// 建模方法类型
private String methodName;// 建模方法类型与模型类型相同
private String shapeId;// 形状ID
private String shapeName;// 形状名称
private String shapeMethodId;// 形状所属建模方法类型
private String shapeType;// 形状类型
private boolean isPalShape;// 是否pal存在的形状用户判断是否需要新增形状还是更新形状
private ExcelShapeModel excelShapeModel;
private JSONArray checkResult;// 若匹配成功存储校验结果
private String result;// 结果标识 noPerm没权限小组条件下 blank关键信息空白repeatexcel信息重复noMatch未匹配上update匹配上需要更新add匹配上需要新增moreMatch出现了多个匹配结果readonly只读模型无法更新
private boolean isRowOk;// 行校验结果
private String rowMsg;// 行校验结果提示
public RepositoryShapeInfoModel() {
}
public String getRepositoryId() {
return repositoryId;
}
public void setRepositoryId(String repositoryId) {
this.repositoryId = repositoryId;
}
public String getRepositoryName() {
return repositoryName;
}
public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
public String getMethodId() {
return methodId;
}
public void setMethodId(String methodId) {
this.methodId = methodId;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getShapeId() {
return shapeId;
}
public void setShapeId(String shapeId) {
this.shapeId = shapeId;
}
public String getShapeName() {
return shapeName;
}
public void setShapeName(String shapeName) {
this.shapeName = shapeName;
}
public String getShapeMethodId() {
return shapeMethodId;
}
public void setShapeMethodId(String shapeMethodId) {
this.shapeMethodId = shapeMethodId;
}
public boolean isPalShape() {
return isPalShape;
}
public void setPalShape(boolean palShape) {
isPalShape = palShape;
}
public ExcelShapeModel getExcelShapeModel() {
return excelShapeModel;
}
public void setExcelShapeModel(ExcelShapeModel excelShapeModel) {
this.excelShapeModel = excelShapeModel;
}
public JSONArray getCheckResult() {
return checkResult;
}
public void setCheckResult(JSONArray checkResult) {
this.checkResult = checkResult;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public boolean isRowOk() {
return isRowOk;
}
public void setRowOk(boolean rowOk) {
isRowOk = rowOk;
}
public String getRowMsg() {
return rowMsg;
}
public void setRowMsg(String rowMsg) {
this.rowMsg = rowMsg;
}
public String getShapeType() {
return shapeType;
}
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
}

View File

@ -8,15 +8,15 @@ 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.UtilString;
import com.alibaba.fastjson.JSONObject;
public class ValidShapeName implements ValidShapeCell {
@Override
public Object validTableCell(Object param) {
String value = param.toString();
JSONObject paramObj = JSONObject.parseObject(param.toString());
String value = paramObj.getString("value");
JSONObject result = new JSONObject();
result.put("name", ShapeConst.TABLE_NAME);
result.put("name2", ShapeConst.TABLE_NAME);
result.put("name", ShapeConst.TABLE_SHAPE_NAME);
result.put("name2", ShapeConst.TABLE_SHAPE_NAME);
result.put("value", BatchUtil.specialCharTransfer(value));
boolean isOk = false;
String msg = "";

View File

@ -8,14 +8,17 @@ import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.ValidShapeCell;
import com.actionsoft.bpms.util.UtilString;
import com.alibaba.fastjson.JSONObject;
@Deprecated
public class ValidShapeNo implements ValidShapeCell {
@Override
public Object validTableCell(Object param) {
String no = param.toString();
JSONObject result = new JSONObject();
result.put("name", ShapeConst.TABLE_NO);
result.put("name2", ShapeConst.TABLE_NO);
// result.put("name", ShapeConst.TABLE_NO);
// result.put("name2", ShapeConst.TABLE_NO);
result.put("name", "");
result.put("name2", "");
result.put("value", BatchUtil.specialCharTransfer(no));
boolean isOk = false;
String msg = "";

View File

@ -8,6 +8,7 @@ import com.actionsoft.bpms.util.UtilString;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@Deprecated
public class ValidShapeType implements ValidShapeCell {
@Override
@ -27,8 +28,8 @@ public class ValidShapeType implements ValidShapeCell {
} else {
isOk = true;
}
result.put("name", ShapeConst.TABLE_TYPE);
result.put("name2", ShapeConst.TABLE_TYPE);
result.put("name", ShapeConst.TABLE_SHAPE_TYPE);
result.put("name2", ShapeConst.TABLE_SHAPE_TYPE);
result.put("value", BatchUtil.specialCharTransfer(value));
result.put("isOk", isOk);
result.put("msg", BatchUtil.specialCharTransfer(msg));

View File

@ -11,4 +11,4 @@
var shapeFileValue = '<#shapeFileValue>';
var palId = '<#palId>';// 流程id不为空则为设计器内单只流程形状属性替换
var wHref = "./w";
var jdHref = "./jd";</script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-0896b577.2aef31d9.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-50c3d3b2.1b3e36e5.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-d674f310.832a3f23.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-0896b577.93b0818d.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-2d224ef1.9043bb4b.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-3a9b7577.a1c1d3f9.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-50c3d3b2.e4e5a3c8.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-d674f310.2dd90041.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/app.f3fd84ae.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-vendors.53f73f21.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/app.6e5c170b.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-vendors.edec05de.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-vendors.53f73f21.css rel=stylesheet><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/app.f3fd84ae.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-vendors.edec05de.js></script><script src=../apps/com.actionsoft.apps.coe.pal.batch/main/js/app.6e5c170b.js></script></body></html>
var jdHref = "./jd";</script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-0896b577.2aef31d9.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-4b843604.9afc147d.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-d674f310.832a3f23.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-0896b577.93b0818d.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-2d224ef1.9043bb4b.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-3a9b7577.a1c1d3f9.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-4b843604.db9b2672.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-d674f310.2dd90041.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/app.f3fd84ae.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-vendors.53f73f21.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/app.1042fda7.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-vendors.edec05de.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/chunk-vendors.53f73f21.css rel=stylesheet><link href=../apps/com.actionsoft.apps.coe.pal.batch/main/css/app.f3fd84ae.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal.batch/main/js/chunk-vendors.edec05de.js></script><script src=../apps/com.actionsoft.apps.coe.pal.batch/main/js/app.1042fda7.js></script></body></html>

View File

@ -10,7 +10,6 @@
<cmd-bean name="com.actionsoft.apps.coe.pal.batch_create_download_template">
<param name="type"/>
<param name="wsId"/>
<param name="versionIds"/>
<param name="methodCategory"/>
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal.batch_create_repository_tree_data">

View File

@ -0,0 +1 @@
#mycode[data-v-64ad3307] .CodeMirror-lines{background-color:#2c2c2c;color:#58a0f0}#mycode[data-v-64ad3307] .CodeMirror{height:auto!important}#header[data-v-46c8d538] .el-step__title{font-size:14px}

View File

@ -1 +0,0 @@
#palRepositoryTree[data-v-9da10dd4] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#palRepositoryTree[data-v-9da10dd4] .el-input__inner{border-radius:0}#palRepositoryTree[data-v-9da10dd4] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#palRepositoryTree[data-v-9da10dd4] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}.tree[data-v-9da10dd4]{overflow:auto;width:458px;height:200px}#palRepositoryTree[data-v-9da10dd4] .el-tree{min-width:100%;display:inline-block!important}#mycode[data-v-64ad3307] .CodeMirror-lines{background-color:#2c2c2c;color:#58a0f0}#mycode[data-v-64ad3307] .CodeMirror{height:auto!important}#header[data-v-538e7c68] .el-step__title{font-size:14px}

File diff suppressed because one or more lines are too long