PAL提交
This commit is contained in:
parent
297c68760e
commit
e748b93f57
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,45 +1,26 @@
|
||||
package com.actionsoft.apps.coe.pal.pal.output.util;
|
||||
|
||||
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.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.RoleModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.server.DispatcherRequest;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||
import com.actionsoft.bpms.util.UtilFile;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sini.com.spire.doc.*;
|
||||
import com.sini.com.spire.doc.documents.*;
|
||||
import com.sini.com.spire.doc.fields.DocPicture;
|
||||
import com.sini.com.spire.doc.fields.TextRange;
|
||||
import com.sini.com.spire.doc.formatting.CharacterFormat;
|
||||
import com.sini.com.spire.doc.formatting.ParagraphFormat;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class OutputWordUtil {
|
||||
@ -166,7 +147,7 @@ public class OutputWordUtil {
|
||||
* @param tempName
|
||||
* @param docName
|
||||
*/
|
||||
public static void createDoc2(JSONObject dataMap, String tempPath, String tempName, String docName) {
|
||||
public static void createDoc2(com.alibaba.fastjson.JSONObject dataMap, String tempPath, String tempName, String docName) {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
|
||||
@ -205,623 +186,6 @@ public class OutputWordUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成word文件
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tempPath
|
||||
* @param tempName
|
||||
* @param docName
|
||||
*/
|
||||
public static void createZdDoc2(JSONObject dataMap, String tempPath, String tempName, String docName, JSONObject wizardJsonData, String repositoryId) throws FileNotFoundException {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
|
||||
// 设置模本装置方法和路径
|
||||
try {
|
||||
UtilFile temps = new UtilFile(tempPath);
|
||||
configuration.setDirectoryForTemplateLoading(temps);
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
Template t = null;
|
||||
try {
|
||||
t = configuration.getTemplate(tempName, "UTF-8");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 输出文档路径及名称
|
||||
File outFile = new File(docName);
|
||||
Writer out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8"));
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (t != null && out != null) {
|
||||
t.process(dataMap, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
} catch (TemplateException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
//***********************************************************使用spire 生成模板后复制文件****************************************************/
|
||||
List<Map<String, Object>> repositoryFileElements = CoeDesignerUtil.getShapeMessageJson4(repositoryId); //流程文件内容
|
||||
if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序
|
||||
OutputWordUtil.orderByNumber(repositoryFileElements);
|
||||
}
|
||||
|
||||
String controlShapeId = "";
|
||||
if (repositoryFileElements != null) {
|
||||
int index = 1;// 流程步骤序号
|
||||
int dangerIndex = 1;// 风险序号
|
||||
int regulateIndex = 1;// 控制序号
|
||||
for (Map<String, Object> shape : repositoryFileElements) {
|
||||
String type = shape.get("type").toString();
|
||||
if ("regulation".equals(type)) {
|
||||
controlShapeId = shape.get("id").toString();
|
||||
} else if ("I/O_L4".equals(type)) {
|
||||
controlShapeId = shape.get("id").toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UserContext userContext = DispatcherRequest.getUserContext();
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("listDef", "");
|
||||
result.put("content", "");
|
||||
if (UtilString.isEmpty(controlShapeId)) {
|
||||
|
||||
}
|
||||
PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
|
||||
if (repositoryModel == null) {
|
||||
|
||||
}
|
||||
String content = "";
|
||||
StringBuilder listStr = new StringBuilder();
|
||||
// 读取附件
|
||||
// 流程附件列表
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
List<UpfileModel> search = upFileDao.search(repositoryModel.getId(), controlShapeId, null);
|
||||
|
||||
DCContext dcContextpdf = null;
|
||||
File file = null;
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
|
||||
if (dcProfile != null) {
|
||||
dcContextpdf = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||
String path = dcContextpdf.getPath();
|
||||
String fileName = dcContextpdf.getFileName();
|
||||
|
||||
//创建 Document 类的对象并从磁盘加载 Word 文档
|
||||
Document document = new Document(outFile.getPath());
|
||||
|
||||
//将另一个文档插入当前文档
|
||||
document.insertTextFromFile(path + fileName, FileFormat.Docx_2013);
|
||||
// document.insertTextFromFile("/Users/sunlh/Downloads/手册格式问题测试文档(3)new.docx", FileFormat.Docx_2013);
|
||||
//保存结果文档
|
||||
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************插入支持文件、相关文件、附则等信息********************************************************/
|
||||
Document doc = new Document(outFile.getPath());
|
||||
//获取最后一节
|
||||
Section section = doc.getLastSection();
|
||||
|
||||
|
||||
//相关文件 R_relevant_flies
|
||||
JSONArray relevant_flies = new JSONArray(); //组织职责Table
|
||||
List<DesignerShapeRelationModel> relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "related_files");
|
||||
int count = 0;
|
||||
if (relationList2.size() > 0) {
|
||||
for (DesignerShapeRelationModel relation : relationList2) {
|
||||
String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId);
|
||||
if (model != null) {
|
||||
count++;
|
||||
String name = model.getName();
|
||||
JSONObject tmp = new JSONObject();
|
||||
tmp.put("name", name);
|
||||
tmp.put("desc", count);
|
||||
|
||||
relevant_flies.add(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
CharacterFormat format = new CharacterFormat();
|
||||
//创建字体格式
|
||||
format.setFontName("宋体");
|
||||
//添加段落,设置一级序列
|
||||
Paragraph paragraph = section.addParagraph();
|
||||
|
||||
ParagraphFormat paragraphFormat1 = paragraph.getFormat();
|
||||
paragraphFormat1.setHorizontalAlignment(HorizontalAlignment.Left);
|
||||
|
||||
TextRange tr = paragraph.appendText("相关文件");
|
||||
tr.getCharacterFormat().setBold(true);
|
||||
tr.getCharacterFormat().setFontName("宋体");
|
||||
//tr.applyCharacterFormat(format); //应用字体格式
|
||||
paragraph.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
|
||||
|
||||
|
||||
Section section2 = doc.addSection();
|
||||
|
||||
|
||||
//定义表格数据
|
||||
String[] header = {"序号", "文件名称"};
|
||||
|
||||
String[][] strArray2 = new String[relevant_flies.size()][];
|
||||
List<String[]> list = new LinkedList<>();
|
||||
for (int i = 0; i < relevant_flies.size(); i++) {
|
||||
JSONObject jsonObject = relevant_flies.getJSONObject(i);
|
||||
String[] strArray = new String[2];
|
||||
strArray[0] = jsonObject.getString("desc").toString();
|
||||
strArray[1] = jsonObject.getString("name").toString();
|
||||
list.add(strArray);
|
||||
strArray2[i] = strArray;
|
||||
}
|
||||
|
||||
String[][] data = strArray2;
|
||||
|
||||
//添加表格
|
||||
Table table = section.addTable(true);
|
||||
table.resetCells(data.length + 1, header.length);
|
||||
|
||||
TableRow row = table.getRows().get(0);
|
||||
row.isHeader(true);
|
||||
row.setHeight(20);
|
||||
row.setHeightType(TableRowHeightType.Exactly);
|
||||
for (int i = 0; i < header.length; i++) {
|
||||
row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
|
||||
Paragraph p = row.getCells().get(i).addParagraph();
|
||||
p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
|
||||
TextRange txtRange = p.appendText(header[i]);
|
||||
txtRange.getCharacterFormat().setBold(true);
|
||||
}
|
||||
|
||||
//将数据添加到其余行
|
||||
for (int r = 0; r < data.length; r++) {
|
||||
TableRow dataRow = table.getRows().get(r + 1);
|
||||
dataRow.setHeight(25);
|
||||
dataRow.setHeightType(TableRowHeightType.Exactly);
|
||||
dataRow.getRowFormat().setBackColor(Color.white);
|
||||
for (int c = 0; c < data[r].length; c++) {
|
||||
dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
|
||||
dataRow.getCells().get(c).addParagraph().appendText(data[r][c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//支持文件
|
||||
JSONArray supportfiles = new JSONArray(); //组织职责Table
|
||||
List<DesignerShapeRelationModel> relationList = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "support_files");
|
||||
int index = 0;
|
||||
if (relationList.size() > 0) {
|
||||
for (DesignerShapeRelationModel relation : relationList) {
|
||||
String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId);
|
||||
if (model != null) {
|
||||
index++;
|
||||
String name = model.getName();
|
||||
JSONObject tmp = new JSONObject();
|
||||
tmp.put("name", name);
|
||||
tmp.put("desc", index);
|
||||
supportfiles.add(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CharacterFormat format2 = new CharacterFormat();
|
||||
//创建字体格式
|
||||
format2.setFontName("宋体");
|
||||
//添加段落,设置一级序列
|
||||
Paragraph paragraph2 = section.addParagraph();
|
||||
ParagraphFormat paragraphFormat2 = paragraph2.getFormat();
|
||||
paragraphFormat2.setHorizontalAlignment(HorizontalAlignment.Left);
|
||||
TextRange tr2 = paragraph2.appendText("支持文件");
|
||||
tr2.getCharacterFormat().setBold(true);
|
||||
tr2.getCharacterFormat().setFontName("宋体");
|
||||
paragraph2.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
|
||||
|
||||
|
||||
//定义表格数据
|
||||
String[] header = {"序号", "文件名称"};
|
||||
String[][] strArray2 = new String[supportfiles.size()][];
|
||||
List<String[]> list = new LinkedList<>();
|
||||
for (int i = 0; i < supportfiles.size(); i++) {
|
||||
JSONObject jsonObject = supportfiles.getJSONObject(i);
|
||||
String[] strArray = new String[2];
|
||||
strArray[0] = jsonObject.getString("desc").toString();
|
||||
strArray[1] = jsonObject.getString("name").toString();
|
||||
list.add(strArray);
|
||||
strArray2[i] = strArray;
|
||||
}
|
||||
|
||||
String[][] data = strArray2;
|
||||
|
||||
//添加表格
|
||||
Table table = section.addTable(true);
|
||||
table.resetCells(data.length + 1, header.length);
|
||||
|
||||
TableRow row = table.getRows().get(0);
|
||||
row.isHeader(true);
|
||||
row.setHeight(20);
|
||||
row.setHeightType(TableRowHeightType.Exactly);
|
||||
for (int i = 0; i < header.length; i++) {
|
||||
row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
|
||||
Paragraph p = row.getCells().get(i).addParagraph();
|
||||
p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
|
||||
TextRange txtRange = p.appendText(header[i]);
|
||||
txtRange.getCharacterFormat().setBold(true);
|
||||
}
|
||||
|
||||
//将数据添加到其余行
|
||||
for (int r = 0; r < data.length; r++) {
|
||||
TableRow dataRow = table.getRows().get(r + 1);
|
||||
dataRow.setHeight(25);
|
||||
dataRow.setHeightType(TableRowHeightType.Exactly);
|
||||
dataRow.getRowFormat().setBackColor(Color.white);
|
||||
for (int c = 0; c < data[r].length; c++) {
|
||||
dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
|
||||
dataRow.getCells().get(c).addParagraph().appendText(data[r][c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*CharacterFormat format3=new CharacterFormat();
|
||||
//创建字体格式
|
||||
format3.setFontName("宋体");
|
||||
//添加段落,设置一级序列
|
||||
Paragraph paragraph3 = section.addParagraph();
|
||||
TextRange tr3 = paragraph3.appendText("7.附则");
|
||||
tr3.getCharacterFormat().setBold(true);
|
||||
tr3.getCharacterFormat().setFontName("宋体");
|
||||
paragraph3.applyStyle(BuiltinStyle.Heading_7); //应用标题1样式
|
||||
|
||||
//添加段落
|
||||
Paragraph paragraph5 = section.addParagraph();
|
||||
|
||||
// 附则处理
|
||||
List<String> T_supplementary_articles_table = new ArrayList<>();
|
||||
String [] tmp = dataMap.getString("pl_T_supplementary_articles").split("\n");
|
||||
for (int i = 0; i < tmp.length; i++) {
|
||||
if (UtilString.isNotEmpty(tmp[i])) {
|
||||
T_supplementary_articles_table.add(tmp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TextRange tr5 = paragraph5.appendText(T_supplementary_articles_table.toString());
|
||||
tr5.getCharacterFormat().setFontName("宋体");*/
|
||||
|
||||
|
||||
CharacterFormat format4 = new CharacterFormat();
|
||||
//创建字体格式
|
||||
format4.setFontName("宋体");
|
||||
//添加段落
|
||||
Paragraph paragraph4 = section.addParagraph();
|
||||
|
||||
ParagraphFormat paragraphFormat4 = paragraph4.getFormat();
|
||||
paragraphFormat4.setHorizontalAlignment(HorizontalAlignment.Left);
|
||||
|
||||
TextRange tr4 = paragraph4.appendText("附件");
|
||||
;
|
||||
|
||||
tr4.getCharacterFormat().setBold(true);
|
||||
tr4.getCharacterFormat().setFontName("宋体");
|
||||
paragraph4.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
|
||||
|
||||
//doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
|
||||
|
||||
//查询模型文件属性上传附件信息
|
||||
List<UpfileModel> search2 = upFileDao.searchByRepositoryIdGroupByFilename(repositoryModel.getId(), "f");
|
||||
|
||||
System.out.println("search2==================" + search2.toString());
|
||||
DCContext dcContextModel = null;
|
||||
|
||||
|
||||
// 排序
|
||||
Collections.sort(search2, new Comparator<UpfileModel>() {
|
||||
@Override
|
||||
public int compare(UpfileModel o1, UpfileModel o2) {
|
||||
String p1 = o1.getFileName();
|
||||
String p2 = o2.getFileName();
|
||||
if ((p1.substring(0, 2).equals("附件") && p2.substring(0, 2).equals("附件") && p1.indexOf(":") != -1 && p2.indexOf(":") != -1)) {
|
||||
return Integer.parseInt(p1.substring(2, p1.indexOf(":"))) - Integer.parseInt(p2.substring(2, p2.indexOf(":")));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//读取模型附件插入手册中文档对象
|
||||
if (search2 != null && search2.size() > 0) {
|
||||
for (UpfileModel upfileModel : search2) {
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
if (dcProfile != null) {
|
||||
|
||||
// 处理DocCenter
|
||||
dcContextModel = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||
//添加段落
|
||||
Paragraph paragraph5 = section.addParagraph();
|
||||
|
||||
//加载一个图片,它将作为外部文件的符号显示在Word文档中
|
||||
//获取最后一个.的位置
|
||||
int lastIndexOf = dcContextModel.getFileName().lastIndexOf(".");
|
||||
//获取文件的后缀名 .jpg
|
||||
String suffix = dcContextModel.getFileName().substring(lastIndexOf);
|
||||
|
||||
DocPicture pdfIcon = new DocPicture(doc);
|
||||
|
||||
InputStream stream1 = new FileInputStream(dcContextModel.getFilePath());
|
||||
DocPicture pic1 = new DocPicture(doc);
|
||||
|
||||
if (suffix.equals(".doc") || suffix.equals(".docx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/word.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".doc")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "doc");
|
||||
} else if (suffix.equals(".docx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "docx");
|
||||
}
|
||||
} else if (suffix.equals(".pdf")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/pdf.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
paragraph5.appendOleObject(stream1, pic1, "pdf");
|
||||
} else if (suffix.equals(".xls") || suffix.equals(".xlsx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/xls.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".xls")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "xls");
|
||||
} else if (suffix.equals(".xlsx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "xlsx");
|
||||
}
|
||||
} else if (suffix.equals(".png") || suffix.equals(".jgp")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/png.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".png")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "png");
|
||||
} else if (suffix.equals(".jpg")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "jpg");
|
||||
}
|
||||
} else if (suffix.equals(".zip") || suffix.equals(".rar")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/zip.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".zip")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "zip");
|
||||
} else if (suffix.equals(".rar")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "rar");
|
||||
}
|
||||
} else if (suffix.equals(".mp3") || suffix.equals(".mp4")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/mp3.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".mp3")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "mp3");
|
||||
} else if (suffix.equals(".mp4")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "mp4");
|
||||
}
|
||||
} else if (suffix.equals(".txt")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
paragraph5.appendOleObject(stream1, pic1, "txt");
|
||||
} else if (suffix.equals(".ppt") || suffix.equals(".pptx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/ppt.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".ppt")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "ppt");
|
||||
} else if (suffix.equals(".pptx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "pptx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成word文件
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tempPath
|
||||
* @param tempName
|
||||
* @param docName
|
||||
*/
|
||||
public static void createBdDoc2(JSONObject dataMap, String tempPath, String tempName, String docName, String repositoryId) throws FileNotFoundException {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
|
||||
// 设置模本装置方法和路径
|
||||
try {
|
||||
UtilFile temps = new UtilFile(tempPath);
|
||||
configuration.setDirectoryForTemplateLoading(temps);
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
Template t = null;
|
||||
try {
|
||||
t = configuration.getTemplate(tempName, "UTF-8");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 输出文档路径及名称
|
||||
File outFile = new File(docName);
|
||||
Writer out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8"));
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
if (t != null && out != null) {
|
||||
t.process(dataMap, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
} catch (TemplateException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**************************************************插入文件对象**********************************************************************/
|
||||
Document doc = new Document(outFile.getPath());
|
||||
//获取最后一节
|
||||
Section section = doc.getLastSection();
|
||||
|
||||
|
||||
CharacterFormat format4 = new CharacterFormat();
|
||||
//创建字体格式
|
||||
format4.setFontName("宋体");
|
||||
//添加段落
|
||||
Paragraph paragraph = section.addParagraph();
|
||||
|
||||
|
||||
ParagraphFormat paragraphFormat4 = paragraph.getFormat();
|
||||
paragraphFormat4.setHorizontalAlignment(HorizontalAlignment.Left);
|
||||
|
||||
TextRange tr4 = paragraph.appendText("表单/模板");
|
||||
|
||||
tr4.getCharacterFormat().setBold(true);
|
||||
tr4.getCharacterFormat().setFontName("宋体");
|
||||
paragraph.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
|
||||
|
||||
//doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
|
||||
|
||||
PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
|
||||
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
//查询模型文件属性上传附件信息
|
||||
List<UpfileModel> search = upFileDao.searchByRepositoryId(repositoryModel.getId(), "s");
|
||||
|
||||
|
||||
DCContext dcContextModel = null;
|
||||
UserContext userContext = DispatcherRequest.getUserContext();
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
|
||||
if (dcProfile != null) {
|
||||
dcContextModel = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||
String path = dcContextModel.getPath();
|
||||
String fileName = dcContextModel.getFileName();
|
||||
|
||||
|
||||
//添加段落
|
||||
Paragraph paragraph5 = section.addParagraph();
|
||||
|
||||
//加载一个图片,它将作为外部文件的符号显示在Word文档中
|
||||
//获取最后一个.的位置
|
||||
int lastIndexOf = dcContextModel.getFileName().lastIndexOf(".");
|
||||
//获取文件的后缀名 .jpg
|
||||
String suffix = dcContextModel.getFileName().substring(lastIndexOf);
|
||||
|
||||
DocPicture pdfIcon = new DocPicture(doc);
|
||||
|
||||
InputStream stream1 = new FileInputStream(dcContextModel.getFilePath());
|
||||
DocPicture pic1 = new DocPicture(doc);
|
||||
|
||||
if (suffix.equals(".doc") || suffix.equals(".docx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/word.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".doc")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "doc");
|
||||
} else if (suffix.equals(".docx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "docx");
|
||||
}
|
||||
} else if (suffix.equals(".pdf")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/pdf.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
paragraph5.appendOleObject(stream1, pic1, "pdf");
|
||||
} else if (suffix.equals(".xls") || suffix.equals(".xlsx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/xls.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".xls")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "xls");
|
||||
} else if (suffix.equals(".xlsx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "xlsx");
|
||||
}
|
||||
} else if (suffix.equals(".png") || suffix.equals(".jgp")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/png.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".png")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "png");
|
||||
} else if (suffix.equals(".jpg")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "jpg");
|
||||
}
|
||||
} else if (suffix.equals(".zip") || suffix.equals(".rar")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/zip.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".zip")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "zip");
|
||||
} else if (suffix.equals(".rar")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "rar");
|
||||
}
|
||||
} else if (suffix.equals(".mp3") || suffix.equals(".mp4")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/mp3.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".mp3")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "mp3");
|
||||
} else if (suffix.equals(".mp4")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "mp4");
|
||||
}
|
||||
} else if (suffix.equals(".txt")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
paragraph5.appendOleObject(stream1, pic1, "txt");
|
||||
} else if (suffix.equals(".ppt") || suffix.equals(".pptx")) {
|
||||
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/ppt.png");
|
||||
paragraph5.appendText(dcContextModel.getFileName());
|
||||
if (suffix.equals(".ppt")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "ppt");
|
||||
} else if (suffix.equals(".pptx")) {
|
||||
paragraph5.appendOleObject(stream1, pic1, "pptx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将文件的扩展属性设置默认值为空字符串(防止没有设置扩展属性而使得导出文件出错)
|
||||
*
|
||||
@ -1035,7 +399,7 @@ public class OutputWordUtil {
|
||||
|
||||
JSONObject dataAttributes = (JSONObject) element.get("attributes");
|
||||
if (dataAttributes != null) {
|
||||
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
|
||||
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
|
||||
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
|
||||
@ -1084,7 +448,7 @@ public class OutputWordUtil {
|
||||
* @param relationShapeIds
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setTableValue2(String repositoryId, JSONArray table, String relationShapeIds) {
|
||||
public static void setTableValue2(String repositoryId, com.alibaba.fastjson.JSONArray table, String relationShapeIds) {
|
||||
// 记录关联属性的流程节点,防止多次查询重复文件信息耗费时间
|
||||
Set<String> relationFileIds = new HashSet<>();
|
||||
List<Map<String, Object>> relationFileElements2 = new ArrayList<Map<String, Object>>();
|
||||
@ -1128,17 +492,17 @@ public class OutputWordUtil {
|
||||
for (Map<String, Object> element : relationFileElements2) {
|
||||
String id = (String) element.get("id");
|
||||
if (relationShapeId.equals(id)) {
|
||||
JSONObject _tr = new JSONObject();
|
||||
com.alibaba.fastjson.JSONObject _tr = new com.alibaba.fastjson.JSONObject();
|
||||
OutputWordUtil.setShapeDefaultValue2((String) element.get("pid"), _tr);
|
||||
String name = specialCharTransfer(element.get("text").toString());
|
||||
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", OutputWordUtil.WRAPSTRING));
|
||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
|
||||
|
||||
JSONObject dataAttributes = (JSONObject) element.get("attributes");
|
||||
com.alibaba.fastjson.JSONObject dataAttributes = (com.alibaba.fastjson.JSONObject) element.get("attributes");
|
||||
if (dataAttributes != null) {
|
||||
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
|
||||
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
|
||||
com.alibaba.fastjson.JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
|
||||
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
|
||||
continue;
|
||||
}
|
||||
@ -1151,7 +515,7 @@ public class OutputWordUtil {
|
||||
if (!"".equals(privateAttributeContentStr) && !"[]".equals(privateAttributeContentStr)) {
|
||||
String firstChart = privateAttributeContentStr.substring(0, 1);
|
||||
if ("{".equals(firstChart)) {
|
||||
JSONObject privateAttributeContent = dataAttributes.getJSONObject("privateAttributeContent");
|
||||
com.alibaba.fastjson.JSONObject privateAttributeContent = dataAttributes.getJSONObject("privateAttributeContent");
|
||||
for (String key : privateAttributeContent.keySet()) {
|
||||
_tr.put("shape_" + key, specialCharTransfer(privateAttributeContent.getString(key)));
|
||||
}
|
||||
@ -1199,6 +563,7 @@ public class OutputWordUtil {
|
||||
if (!shapeModelMap.containsKey(repositoryShape.getRelationShapeId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String relationFileId = repositoryShape.getRelationFileId();
|
||||
List<Map<String, Object>> relationFileElements = CoeDesignerUtil.getShapeMessageJson2(relationFileId); // 关联流程文件内容
|
||||
if (relationFileElements != null) {
|
||||
@ -1214,11 +579,11 @@ public class OutputWordUtil {
|
||||
sbRole.append(",");
|
||||
}
|
||||
|
||||
JSONObject dataAttributes = (JSONObject) element.get("attributes");
|
||||
com.alibaba.fastjson.JSONObject dataAttributes = (com.alibaba.fastjson.JSONObject) element.get("attributes");
|
||||
if (dataAttributes != null) {
|
||||
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
|
||||
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
|
||||
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
|
||||
com.alibaba.fastjson.JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
|
||||
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
|
||||
continue;
|
||||
}
|
||||
@ -1413,7 +778,7 @@ public class OutputWordUtil {
|
||||
* @param relationFileElements
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setRelationShapeValueByOrgAndRole(JSONObject _tr, JSONObject dataAttribute,
|
||||
public static void setRelationShapeValueByOrgAndRole(com.alibaba.fastjson.JSONObject _tr, com.alibaba.fastjson.JSONObject dataAttribute,
|
||||
Map<String, String> shapeModelMap, List<Map<String, Object>> relationFileElements, String shapeId, Set<String> relationFileIds) {
|
||||
String key = dataAttribute.getString("key");
|
||||
if ("organization".equals(dataAttribute.getString("groupPath")) && "relation".equals(dataAttribute.getString("type"))) {
|
||||
@ -1485,7 +850,7 @@ public class OutputWordUtil {
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setShapeValue2(JSONObject _tr, JSONObject dataAttribute, Map<String, String> shapeRelationModelMap) {
|
||||
public static void setShapeValue2(com.alibaba.fastjson.JSONObject _tr, com.alibaba.fastjson.JSONObject dataAttribute, Map<String, String> shapeRelationModelMap) {
|
||||
String result = "";
|
||||
String key = dataAttribute.getString("key");
|
||||
if ("string".equals(dataAttribute.getString("type")) || "textarea".equals(dataAttribute.getString("type"))) {
|
||||
@ -1599,8 +964,8 @@ public class OutputWordUtil {
|
||||
return dataJson.getJSONObject("privateAttributeContent").getString("number");
|
||||
}
|
||||
}
|
||||
if (json.get("attributes") instanceof JSONObject) {// fastJson
|
||||
JSONObject dataJson = (JSONObject) json.get("attributes");
|
||||
if (json.get("attributes") instanceof com.alibaba.fastjson.JSONObject) {// fastJson
|
||||
com.alibaba.fastjson.JSONObject dataJson = (com.alibaba.fastjson.JSONObject) json.get("attributes");
|
||||
if (dataJson.containsKey("privateAttributeContent") && dataJson.get("privateAttributeContent").getClass().getName().contains("JSONObject")) {
|
||||
return dataJson.getJSONObject("privateAttributeContent").getString("number");
|
||||
}
|
||||
|
||||
@ -1,49 +1,13 @@
|
||||
package com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.cache.model.TeamInfo;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.cache.model.UserInfo;
|
||||
import com.actionsoft.apps.coe.pal.pal.manage.publish.constant.PublishConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.cache.Cache;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile;
|
||||
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.commons.security.ac.cache.AccessControlCache;
|
||||
import com.actionsoft.bpms.commons.security.ac.constant.ACConst;
|
||||
import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
|
||||
import com.actionsoft.bpms.org.cache.CompanyCache;
|
||||
import com.actionsoft.bpms.org.cache.DepartmentCache;
|
||||
import com.actionsoft.bpms.org.cache.RoleCache;
|
||||
import com.actionsoft.bpms.org.cache.UserCache;
|
||||
import com.actionsoft.bpms.org.model.*;
|
||||
import com.actionsoft.bpms.org.web.CompanyWeb;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||
import com.actionsoft.bpms.util.*;
|
||||
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.PALMethodJsonModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
@ -51,11 +15,13 @@ 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;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerRelationShapeCacheManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeCopyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeFileRelationModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapePasteModel;
|
||||
@ -66,9 +32,32 @@ import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.StringHandleUtil;
|
||||
import com.actionsoft.apps.coe.pal.util.UtilMapSort;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.cache.Cache;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile;
|
||||
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.commons.security.ac.cache.AccessControlCache;
|
||||
import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
|
||||
import com.actionsoft.bpms.org.cache.DepartmentCache;
|
||||
import com.actionsoft.bpms.org.cache.RoleCache;
|
||||
import com.actionsoft.bpms.org.cache.UserCache;
|
||||
import com.actionsoft.bpms.org.model.CompanyModel;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.RoleModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.org.web.CompanyWeb;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.*;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.exception.AWSObjectNotFindException;
|
||||
import com.actionsoft.i18n.I18nRes;
|
||||
@ -77,7 +66,12 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.hssf.record.DVALRecord;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
private UserContext _uc;
|
||||
@ -946,13 +940,13 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
}
|
||||
macroLibraries.put("treeData", jsonArr_new.toString());
|
||||
} else if ("child_process".equals(attrId)){
|
||||
} else if ("child_process".equals(attrId)) {
|
||||
// 端到端功能 只保留文件夹 架构 process.epc process.flowchart
|
||||
objects = objects.stream()
|
||||
.filter(o -> !((JSONObject)o).containsKey("plMethodId") || "default".equals(((JSONObject)o).getString("plMethodId"))
|
||||
|| "process.framework".equals(((JSONObject)o).getString("plMethodId"))
|
||||
|| "process.epc".equals(((JSONObject)o).getString("plMethodId"))
|
||||
|| "process.flowchart".equals(((JSONObject)o).getString("plMethodId"))).collect(Collectors.toCollection(JSONArray::new));
|
||||
.filter(o -> !((JSONObject) o).containsKey("plMethodId") || "default".equals(((JSONObject) o).getString("plMethodId"))
|
||||
|| "process.framework".equals(((JSONObject) o).getString("plMethodId"))
|
||||
|| "process.epc".equals(((JSONObject) o).getString("plMethodId"))
|
||||
|| "process.flowchart".equals(((JSONObject) o).getString("plMethodId"))).collect(Collectors.toCollection(JSONArray::new));
|
||||
macroLibraries.put("treeData", objects.toString());
|
||||
} else {
|
||||
macroLibraries.put("treeData", treeJson);
|
||||
@ -1403,9 +1397,9 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
|
||||
// 端到端功能 只保留文件夹 架构 process.epc process.flowchart
|
||||
if ("child_process".equals(attrId)){
|
||||
if ("child_process".equals(attrId)) {
|
||||
String plMethodId = node.getString("plMethodId");
|
||||
if ("default".equals(plMethodId) || "process.framework".equals(plMethodId) || "process.epc".equals(plMethodId) || "process.flowchart".equals(plMethodId)){
|
||||
if ("default".equals(plMethodId) || "process.framework".equals(plMethodId) || "process.epc".equals(plMethodId) || "process.flowchart".equals(plMethodId)) {
|
||||
if (isParent.equals("true")) {
|
||||
node.put("nocheck", true);
|
||||
result.add(node);
|
||||
@ -4126,24 +4120,24 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
* @param methodId 模型类型
|
||||
* @return {@link String}
|
||||
*/
|
||||
public String checkUserFirstCreateModel(String methodId,String type) {
|
||||
public String checkUserFirstCreateModel(String methodId, String type) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
String sql = "SELECT COUNT(1) FROM APP_ACT_COE_PAL_REPOSITORY WHERE CREATEUSER=? AND PLMETHODID=? ";
|
||||
String uid = _uc.getUID();
|
||||
int anInt = DBSql.getInt(sql, new Object[]{uid, methodId});
|
||||
System.out.println("是否第一次新建模型>>>>>"+anInt);
|
||||
System.out.println("是否第一次新建模型>>>>>" + anInt);
|
||||
//只有一条记录的时候判断是否第一次创建对应模型
|
||||
if (type.equals("0")) {
|
||||
if (anInt == 1) {
|
||||
String getCreateDateSql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE CREATEUSER='" + uid + "' AND PLMETHODID='" + methodId + "'";
|
||||
String getID = DBSql.getString(getCreateDateSql);
|
||||
String isfirstSql = "SELECT ISFIRSTCREATE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+getID+"'";
|
||||
String isfirst= DBSql.getString(isfirstSql);
|
||||
System.out.println("isfirst>>>>>>>>"+isfirst);
|
||||
if (isfirst==null||isfirst==""){
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISFIRSTCREATE = 1 WHERE ID = '"+getID+"'");
|
||||
String isfirstSql = "SELECT ISFIRSTCREATE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + getID + "'";
|
||||
String isfirst = DBSql.getString(isfirstSql);
|
||||
System.out.println("isfirst>>>>>>>>" + isfirst);
|
||||
if (isfirst == null || isfirst == "") {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISFIRSTCREATE = 1 WHERE ID = '" + getID + "'");
|
||||
ro.put("isFirst", true);
|
||||
}else if (isfirst.equals("1")){
|
||||
} else if (isfirst.equals("1")) {
|
||||
ro.put("isFirst", false);
|
||||
}
|
||||
|
||||
@ -4152,11 +4146,12 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
} else {
|
||||
ro.put("isFirst", true);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
ro.put("isFirst", false);
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -129,18 +129,6 @@ public class UpFileDao {
|
||||
}
|
||||
|
||||
|
||||
public List<UpfileModel> searchBGroup(String sqlWhere) {
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("select ID,SHAPEID,FILETYPE,DOWNLOAD,PALREPOSITORYID,FILENAME from ").append(UpfileModel.DATABASE_ENTITY).append(" where 1 = 1 ").append(sqlWhere);
|
||||
try {
|
||||
return DBSql.query(sql.toString(), new UpfileModelMapper());
|
||||
} catch (AWSDataAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ArrayList<UpfileModel>();
|
||||
}
|
||||
|
||||
|
||||
private class UpfileModelMapper implements RowMapper<UpfileModel> {
|
||||
public UpfileModel mapRow(ResultSet rs, int arg1) throws SQLException {
|
||||
UpfileModel model = new UpfileModel();
|
||||
@ -210,21 +198,12 @@ public class UpFileDao {
|
||||
public List<UpfileModel> searchByRepositoryId(String repositoryId, String type) {
|
||||
StringBuffer sqlWhere = new StringBuffer();
|
||||
if (!UtilString.isEmpty(type)) {
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'").append(" ").append("order by FILENAME");
|
||||
}
|
||||
return search(sqlWhere.toString());
|
||||
}
|
||||
|
||||
|
||||
public List<UpfileModel> searchByRepositoryIdGroupByFilename(String repositoryId, String type) {
|
||||
StringBuffer sqlWhere = new StringBuffer();
|
||||
if (!UtilString.isEmpty(type)) {
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'").append("GROUP BY ID,SHAPEID,FILETYPE,DOWNLOAD,PALREPOSITORYID,FILENAME");
|
||||
}
|
||||
System.out.println("sqlWhere=============" + sqlWhere);
|
||||
return searchBGroup(sqlWhere.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照条件查询
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user