Merge remote-tracking branch 'origin/apps_dev' into apps_dev

This commit is contained in:
Mr-wang 2023-12-05 16:05:50 +08:00
commit 49092200d2
7 changed files with 186 additions and 8 deletions

View File

@ -14,6 +14,7 @@ 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.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
@ -37,6 +38,8 @@ import com.actionsoft.apps.coe.pal.processlist.util.ExportAPIManager;
import com.actionsoft.apps.coe.pal.processlist.util.ProcessListUtil;
import com.actionsoft.apps.coe.pal.util.SubUtil;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.bpmn.engine.cache.ProcessDefCache;
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.util.ConsolePrinter;
@ -1198,11 +1201,11 @@ public class PALRepositoryListWeb extends ActionWeb {
tempArr.add(obj);
}
ConsolePrinter.info("流程清单扩展列信息[" + tempArr.toJSONString() + "]");
ConsolePrinter.info("流程清单表头信息[" + tableHeadConfigArr.toJSONString() + "]");
// 获取符合条件数据的maxLevel
int maxLevel = getMaxLevelByList(palList);
// 获取Excel表头信息
List<String> excelTableHeadList = getExcelTableHeadData(wsId, palList, maxLevel, tempArr);
ConsolePrinter.info("流程清单表头信息 " + excelTableHeadList.toString().replaceAll("\n",""));
short column = columnIndex;
// 设置默认的两行 通栏
rowIndex = getExcelHeader(wb, sheet, rowIndex, column, excelTableHeadList, wsId);
@ -1217,6 +1220,8 @@ public class PALRepositoryListWeb extends ActionWeb {
sheet.setColumnWidth(column, 1500);
} else if (i == maxLevel + 1) {// 空列
sheet.setColumnWidth(column, 9200);
} else if (i == maxLevel + 2){ // 模型名称列
sheet.setColumnWidth(column, 8000);
} else {// 表格列
sheet.setColumnWidth(column, 4000);
}
@ -1303,6 +1308,28 @@ public class PALRepositoryListWeb extends ActionWeb {
columMap.put(count, map);
count++;
cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列
// 模型名称
HSSFCell modelNameCell = row.createCell(++cellIndex);
modelNameCell.setCellValue(model.getName());
// 版本号
String versionCellVar = VersionUtil.getVersionStrV(model.getVersion());
boolean isCorrelateBpms = PALRepositoryQueryAPIManager.getInstance().isCorrelateBpms(model.getId(), true);
if (isCorrelateBpms){
String processDefId = PALRepositoryQueryAPIManager.getInstance().queryBpmsProcessDefIdByPalId(model.getId(), true);
String appId = ProcessDefCache.getInstance().get(processDefId).getAppId();
List<ProcessDefinition> versionList = ProcessDefCache.getInstance().getListOfProcessVersion(appId, processDefId);
for (ProcessDefinition processDefinition : versionList) {
String plId = PALRepositoryQueryAPIManager.getInstance().queryPlIdByPlAwsId(processDefinition.getId());
if (UtilString.isEmpty(plId)) continue;
PALRepositoryModel m = PALRepositoryCache.getCache().get(plId);
if (!m.isUse()) continue;
versionCellVar = VersionUtil.getVersionStrV(processDefinition.getVersionNo());
}
}
HSSFCell versionCell = row.createCell(++cellIndex);
versionCell.setCellValue(versionCellVar);
long s5 = System.currentTimeMillis();
// 扩展属性
boolean extendAttr = false;
@ -1438,6 +1465,10 @@ public class PALRepositoryListWeb extends ActionWeb {
}
}
result.add("");// 空一列
// 伊利定制化需求23-11-21 空白列与扩展列之间增加 模型名称与版本号两列
result.add("模型名称");
result.add("版本号");
// excel表格扩展字段
for (int i = 0; i < tableHeadConfigArr.size(); i++) {
result.add(tableHeadConfigArr.getJSONObject(i).getString("name"));

View File

@ -585,14 +585,36 @@ public class OutputWordUtil {
//保存结果文档
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
} else if (suffix.equals("doc") || suffix.equals("docx")) {
document.insertTextFromFile(path + fileName, FileFormat.Docx_2013);
/*document.insertTextFromFile(path + fileName, FileFormat.Docx_2013);
//保存结果文档
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);*/
Document docs1 = new Document();
docs1.loadFromFile(outFile.getPath());
// 加载文档2
Document docs2 = new Document();
docs2.loadFromFile(path + fileName);
SectionCollection sections2 = docs2.getSections();
sections2.insert(0, docs1.getSections().get(1).deepClone());
sections2.insert(0, docs1.getSections().get(0).deepClone());
// 保存文档2
docs2.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
docs2.dispose();
} else if (suffix.equals("pptx")) {
isPPT = true;
}
if (isPPT == false) {
@ -703,13 +725,18 @@ public class OutputWordUtil {
//相关文件 R_relevant_flies
JSONArray relevant_flies = new JSONArray(); //组织职责Table
List<DesignerShapeRelationModel> relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "related_files");
relationList2.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText));
int count = 0;
if (relationList2.size() > 0) {
for (DesignerShapeRelationModel relation : relationList2) {
String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID
System.out.println("relationFileId============="+relationFileId);
PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId);
if (model != null) {
String name = null;
List<PALRepositoryModel> models = PALRepositoryCache.getByVersionId(relationFileId);
if (models != null && models.size() > 0) {
@ -726,6 +753,14 @@ public class OutputWordUtil {
tmp.put("desc", count);
relevant_flies.add(tmp);
}
if(relationFileId.equals("079c0c2e-fc24-4d92-a13f-6987492bfc5d")){
//String name = model.getName();
JSONObject tmp = new JSONObject();
tmp.put("name", "液奶产品无菌试验标准");
tmp.put("desc", 1);
relevant_flies.add(tmp);
}
}
CharacterFormat format = new CharacterFormat();
@ -927,6 +962,9 @@ public class OutputWordUtil {
//支持文件
JSONArray supportfiles = new JSONArray(); //组织职责Table
List<DesignerShapeRelationModel> relationList = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "support_files");
relationList.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText));
int index = 0;
if (relationList.size() > 0) {
for (DesignerShapeRelationModel relation : relationList) {

View File

@ -1593,7 +1593,7 @@ public class PALRepositoryQueryAPIManager {
List<PALRepositoryModel> newList = setNewPid(modelList);
Collections.sort(newList, new Comparator1());
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type));
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type, true));
i++;
}
return result;
@ -2014,7 +2014,7 @@ public class PALRepositoryQueryAPIManager {
removeIds.append(model.getId()).append(",");
}
}
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type));
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type, true));
return result;
}
@ -2250,6 +2250,115 @@ public class PALRepositoryQueryAPIManager {
return jsonArray;
}
private JSONArray list2Json(UserContext context, List<PALRepositoryModel> list, boolean isUsed, boolean isPublished, String removeIds, String param, boolean statusSuffix) {
JSONArray jsonArray = new JSONArray();
for (PALRepositoryModel model : list) {
JSONObject object = new JSONObject();
object.put("id", model.getId().trim());
object.put("pid", model.getNewParentId().trim());
if (removeIds != null && removeIds.contains(model.getId().trim())) {
object.put("nocheck", true);
} else {
object.put("nocheck", false);
}
object.put("plNo", CoeProcessLevelUtil.getProcessLevelNoByUUId(model.getId(), model.getWsId()).trim());
object.put("name", I18nRes.findValue(CoEConstant.APP_ID, context.getLanguage(), model.getName()).trim() + (statusSuffix && !"default".equals(model.getMethodId()) && !"process.framework".equals(model.getMethodId()) ? "" + getStatusLabel(model) + "" : ""));
object.put("wsId", model.getWsId());
PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(model.getMethodId());
if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类
object.put("title", object.get("name"));
} else {
object.put("title", object.get("name") + " " + VersionUtil.getVersionStrV(model.getVersion()).trim());
}
//三员管理文件密级校验
if (HighSecurityUtil.isON() && HighSecurityUtil.fileSecuritySwitch()) {
ResponseObject responseObject = new CoeProcessLevelWeb(DispatcherRequest.getUserContext()).checkFilePemission(model.getId());
if (responseObject.isErr() && (methodModel != null && !methodModel.isFolder())) {
object.put("nocheck", true);
}
}
object.put("drop", false);
object.put("isSystemFile", model.isSystemFile());
object.put("plMethodId", model.getMethodId().trim());
if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类
object.put("iconFont", "&#58930;");
} else {
object.put("iconFont", "&#59101;");
}
List<PALRepositoryModel> children = null;
if (isUsed) {
children = getUsedPalRepositoryModelsByPid(model.getWsId(), model.getId());
if ("designer".equals(param) && children != null && children.size() > 0) {// 过滤掉发布版本
List<PALRepositoryModel> tempChildren = new ArrayList<>();
for (PALRepositoryModel model2 : children) {
if (!model2.isPublish()) {
tempChildren.add(model2);
}
}
children = tempChildren;
}
} else if (isPublished) {
children = getPublishedPalRepositoryModelsByPid(model.getWsId(), model.getId());
}
if (children == null || children.size() == 0) {
object.put("isParent", false);
//String icon = object.getString("icon");
object.put("leaf", true);// 叶子节点
// object.put("icon", icon.replace("16.png", "16.leaf.png"));
} else {
object.put("isParent", true);
object.put("open", false);
}
object.put("plLevel", model.getLevel());
object.put("plOrdexIndex", model.getOrderIndex());
object.put("plDiagramUrl", model.getDiagramUrl());
object.put("isDrops", model.isSystemFile());
object.put("isPublish", model.isPublish());
object.put("isStop", model.isStop());
object.put("isApproval", model.isApproval());
object.put("ext1", model.getExt1());
object.put("ext2", model.getExt2());
object.put("ext3", model.getExt3());
object.put("ext4", model.getExt4());
object.put("isUse", model.isUse());
object.put("url", "./w?sid=" + context.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_portal_page&ruuid=" + model.getId() + "&type=1&wsid=" + model.getWsId());
object.put("plCategory", model.getMethodCategory());
object.put("versionId", model.getVersionId());
object.put("orderIndex", model.getOrderIndex());
object.put("isBottomLevel", model.isBottomLevel());
String dutyDeptId = model.getDutyDept();
object.put("dutyDeptId", dutyDeptId == null ? "" : dutyDeptId);
String plDutyDeptName = dutyDeptId;
if (!UtilString.isEmpty(dutyDeptId)) {
if (SDK.getORGAPI().getDepartmentById(dutyDeptId) != null) {
plDutyDeptName = SDK.getORGAPI().getDepartmentById(dutyDeptId).getName();
}
}
object.put("dutyDeptName", UtilString.isEmpty(dutyDeptId) ? "" : plDutyDeptName);
String plDutyPerson = model.getDutyUser();
object.put("dutyPersonId", model.getDutyUser() == null ? "" : model.getDutyUser());
object.put("dutyPersionName", UtilString.isEmpty(plDutyPerson) ? "" : SDK.getORGAPI().getUserAliasNames(plDutyPerson));
jsonArray.add(object);
}
return jsonArray;
}
private String getStatusLabel(PALRepositoryModel repositoryModel){
String statusLabel = "设计中";
if (repositoryModel.isApproval()){
statusLabel = "审批中";
}else if (repositoryModel.isStop()){
statusLabel = "已停用";
}else if (repositoryModel.isPublish()){
statusLabel = "已发布";
}else if (repositoryModel.isUse()){
statusLabel = "设计中";
}
return statusLabel;
}
/**
* 通过流程model列表获取流程树的json数组
*

View File

@ -195,9 +195,9 @@ public class Report1Gener {
prReportComment.getCommentContent(dataMap, repositoryModel); // 获取一些公共的数据(手册首页的手册岗位名称部门时间等)
ReportRepositoryCompare compare = new ReportRepositoryCompare();
/*ReportRepositoryCompare compare = new ReportRepositoryCompare();
JSONArray historyVersionModify = compare.getModifyVersionHistory(repositoryId);
dataMap.put("history_table", historyVersionModify);
dataMap.put("history_table", historyVersionModify);*/
// 修订记录
dataMap.put("version_history_table", getVersionHistoryTable(repositoryModel));