手册提交
This commit is contained in:
parent
feef39e96b
commit
d22e6e5158
Binary file not shown.
@ -3712,6 +3712,20 @@ public class CoEPALController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重新生成手册
|
||||
*
|
||||
* @param me
|
||||
* @param plId
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.actionsoft.apps.coe.pal.publisher_publish_Refresh_Manual")
|
||||
public String RefreshManual(UserContext me, String processInstId, String type) {
|
||||
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
|
||||
return web.RefreshManual(processInstId, type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断表单模型是否存在excel文件
|
||||
*
|
||||
|
||||
@ -410,7 +410,6 @@ public class OutputWordUtil {
|
||||
|
||||
|
||||
if (isPPT == false) {
|
||||
// document.insertTextFromFile("/Users/sunlh/Downloads/手册格式问题测试文档(3)new.docx", FileFormat.Docx_2013);
|
||||
try {
|
||||
//保存结果文档
|
||||
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
@ -490,7 +489,6 @@ public class OutputWordUtil {
|
||||
DocumentObject obj = sourceFooter.getChildObjects().get(j).deepClone();
|
||||
targetFooter.getChildObjects().add(obj);
|
||||
}
|
||||
|
||||
}
|
||||
doc2.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||
|
||||
@ -527,6 +525,9 @@ public class OutputWordUtil {
|
||||
//paragraph.appendBreak(BreakType.Page_Break);
|
||||
//Section section2 = doc.addSection();
|
||||
|
||||
|
||||
|
||||
|
||||
//相关文件 R_relevant_flies
|
||||
JSONArray relevant_flies = new JSONArray(); //组织职责Table
|
||||
List<DesignerShapeRelationModel> relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "related_files");
|
||||
@ -552,10 +553,6 @@ public class OutputWordUtil {
|
||||
//添加段落,设置一级序列
|
||||
Paragraph paragraph1 = section.addParagraph();
|
||||
|
||||
|
||||
//paragraph1.appendBreak(BreakType.Page_Break);
|
||||
|
||||
|
||||
ParagraphFormat paragraphFormat1 = paragraph1.getFormat();
|
||||
paragraphFormat1.setHorizontalAlignment(Left);
|
||||
|
||||
@ -620,8 +617,6 @@ public class OutputWordUtil {
|
||||
dataRow.getCells().get(1).setWidth(500);
|
||||
dataRow.getCells().get(c).addParagraph().appendText(data[r][c]);
|
||||
|
||||
// cell.getCellFormat().setFitText(true); // 设置内容
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
@ -3474,7 +3475,7 @@ public class PALRepositoryQueryAPIManager {
|
||||
if (fileList.length > 0) {
|
||||
File docFile = null;
|
||||
for (File file2 : fileList) {
|
||||
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1))) || file2.isFile() && "pptx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1))) || "xlsx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1))) ||"xls".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
docFile = file2;
|
||||
break;
|
||||
}
|
||||
@ -3482,36 +3483,57 @@ public class PALRepositoryQueryAPIManager {
|
||||
if (docFile == null) {
|
||||
return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
if (SDK.getAppAPI().isActive("com.actionsoft.apps.addons.onlinedoc")) {
|
||||
|
||||
if ("xls".equals((docFile.getName().substring(docFile.getName().lastIndexOf(".") + 1))) || "xlsx".equals((docFile.getName().substring(docFile.getName().lastIndexOf(".") + 1)))) {
|
||||
OutputAppProfile appFile = OutputAppManager.getProfile(model.getProfileId());
|
||||
String sourceAppId = appFile.getAppContext().getId();
|
||||
String filename = docFile.getName();
|
||||
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename);
|
||||
Map<String, Object> aslpParams = new HashMap<String, Object>();
|
||||
|
||||
aslpParams.put("sid", _uc.getSessionId());
|
||||
aslpParams.put("fileNameOriginal", filename);
|
||||
aslpParams.put("sourceDc", sourceDc);
|
||||
aslpParams.put("isShowDefaultToolbar", true);
|
||||
aslpParams.put("isShowBackbtn", false);
|
||||
aslpParams.put("isEncrypt", true);
|
||||
aslpParams.put("isCopy", true);
|
||||
aslpParams.put("isPrint", true);
|
||||
aslpParams.put("isDownload", true);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
ResponseObject responseObject = appAPI.callASLP(appAPI.getAppContext(sourceAppId), "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview", aslpParams);
|
||||
if (responseObject != null) {
|
||||
if (responseObject.isOk()) {
|
||||
String url = responseObject.get("url").toString();
|
||||
result.put("url", url);
|
||||
result.put("filename", filename);
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
String dcPath = sourceDc.getDownloadURL();
|
||||
if (!UtilString.isEmpty(dcPath)) {
|
||||
dcPath = dcPath.substring(1, dcPath.length());
|
||||
String portalUrl = SDK.getAppAPI().getProperty("com.actionsoft.apps.addons.onlinedoc", "portalurl");
|
||||
if (portalUrl.isEmpty()) {
|
||||
portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
}
|
||||
String p = portalUrl + "/r" + dcPath;
|
||||
String url ="https://view.officeapps.live.com/op/view.aspx?src=" + URLEncoder.encode(p, "UTF-8");
|
||||
result.put("url", url);
|
||||
result.put("filename", filename);
|
||||
|
||||
}
|
||||
}else{
|
||||
if (SDK.getAppAPI().isActive("com.actionsoft.apps.addons.onlinedoc")) {
|
||||
OutputAppProfile appFile = OutputAppManager.getProfile(model.getProfileId());
|
||||
String sourceAppId = appFile.getAppContext().getId();
|
||||
String filename = docFile.getName();
|
||||
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename);
|
||||
Map<String, Object> aslpParams = new HashMap<String, Object>();
|
||||
aslpParams.put("sid", _uc.getSessionId());
|
||||
aslpParams.put("fileNameOriginal", filename);
|
||||
aslpParams.put("sourceDc", sourceDc);
|
||||
aslpParams.put("isShowDefaultToolbar", true);
|
||||
aslpParams.put("isShowBackbtn", false);
|
||||
aslpParams.put("isEncrypt", true);
|
||||
aslpParams.put("isCopy", true);
|
||||
aslpParams.put("isPrint", true);
|
||||
aslpParams.put("isDownload", true);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
ResponseObject responseObject = appAPI.callASLP(appAPI.getAppContext(sourceAppId), "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview", aslpParams);
|
||||
if (responseObject != null) {
|
||||
if (responseObject.isOk()) {
|
||||
String url = responseObject.get("url").toString();
|
||||
result.put("url", url);
|
||||
result.put("filename", filename);
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("没有可预览文件");
|
||||
|
||||
@ -64,10 +64,12 @@ 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.Quota;
|
||||
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.exception.AWSDataAccessException;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.exception.AWSObjectNotFindException;
|
||||
import com.actionsoft.i18n.I18nRes;
|
||||
@ -4248,6 +4250,41 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建手册
|
||||
*
|
||||
* @param model
|
||||
* @param wsId
|
||||
* @param userId
|
||||
* @param teamId
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
public String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
|
||||
String taskId = "";
|
||||
if (model.getMethodId().contains("process.")) {
|
||||
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
|
||||
JSONObject object = JSONObject.parseObject(taskId);
|
||||
if ("ok".equals(object.getString("result")))
|
||||
taskId = object.getJSONObject("data").getString("taskId");
|
||||
} else if ("data.form".equals(model.getMethodId())) {
|
||||
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, userId, teamId, uuid);
|
||||
JSONObject object = JSONObject.parseObject(taskId);
|
||||
if ("ok".equals(object.getString("result")))
|
||||
taskId = object.getJSONObject("data").getString("taskId");
|
||||
} else if ("control.policy".equals(model.getMethodId())) {
|
||||
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
|
||||
JSONObject object = JSONObject.parseObject(taskId);
|
||||
if ("ok".equals(object.getString("result")))
|
||||
taskId = object.getJSONObject("data").getString("taskId");
|
||||
}
|
||||
return taskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为第一个节点为excel
|
||||
*
|
||||
@ -4344,7 +4381,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
if (fileList.length > 0) {
|
||||
File docFile = null;
|
||||
for (File file2 : fileList) {
|
||||
if (file2.isFile() && "xlsx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
if (file2.isFile() && "xlsx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1))) || file2.isFile() && "xls".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
docFile = file2;
|
||||
break;
|
||||
}
|
||||
@ -4371,4 +4408,150 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryMaPublishGetWsId() {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
String wsId = null;
|
||||
boolean dev = Quota.isDEV();
|
||||
if (dev == true) {
|
||||
wsId = "0285ff6a-e418-4d8b-a5b1-22240296f769";
|
||||
}
|
||||
boolean prd = Quota.isPRD();
|
||||
if (prd == true) {
|
||||
wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||
}
|
||||
boolean qas = Quota.isQAS();
|
||||
if (qas == true) {
|
||||
wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||
}
|
||||
ro.put("wsId", wsId);
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新生成手册
|
||||
*
|
||||
* @param plId
|
||||
* @return
|
||||
*/
|
||||
public String RefreshManual(String processInstId, String type) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
|
||||
try {
|
||||
if (type.equals("1")) {
|
||||
//发布新文件
|
||||
List<BO> publishNBO = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").bindId(processInstId).list();
|
||||
|
||||
if (publishNBO.size() > 0) {
|
||||
for (BO onePublishN : publishNBO) {
|
||||
|
||||
if (onePublishN.getString("TASKID").equals("submit_create")) {
|
||||
return ResponseObject.newWarnResponse("请先创建手册!!").toString();
|
||||
}
|
||||
String plId = onePublishN.getString("PUBLISHFILEID");
|
||||
int count = 0;
|
||||
// 重新生成手册
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
|
||||
String wsIdro = queryMaPublishGetWsId();
|
||||
JSONObject wsIdJson = JSONObject.parseObject(wsIdro);
|
||||
String taskId = createOutputReport(model, wsIdJson.getJSONObject("data").get("wsId").toString(), "admin", "", plId);
|
||||
// 刷新预览加载的表
|
||||
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
|
||||
DBSql.update(sqlr);
|
||||
String sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
|
||||
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
|
||||
if (UtilString.isNotEmpty(DBSql.getString(sql1))) {
|
||||
count = DBSql.update(
|
||||
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
|
||||
}
|
||||
if (count != 0) {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else if (type.equals("2")) {
|
||||
//发布变更文件
|
||||
List<BO> publishCBO = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").bindId(processInstId).list();
|
||||
|
||||
if (publishCBO.size() > 0) {
|
||||
|
||||
for (BO onePublishC : publishCBO) {
|
||||
|
||||
if (onePublishC.getString("TASKID") == "submit_create") {
|
||||
return ResponseObject.newWarnResponse("请先创建手册!!").toString();
|
||||
}
|
||||
|
||||
String plId = onePublishC.getString("CHANGEDFILEIDNEW");
|
||||
int count = 0;
|
||||
// 重新生成手册
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
|
||||
String wsIdro = queryMaPublishGetWsId();
|
||||
JSONObject wsIdJson = JSONObject.parseObject(wsIdro);
|
||||
String taskId = createOutputReport(model, wsIdJson.getJSONObject("data").get("wsId").toString(), "admin", "", plId);
|
||||
// 刷新预览加载的表
|
||||
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
|
||||
DBSql.update(sqlr);
|
||||
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
|
||||
|
||||
if (UtilString.isNotEmpty(DBSql.getString(sql2))) {
|
||||
count = DBSql.update(
|
||||
"UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + taskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
|
||||
}
|
||||
if (count != 0) {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else if (type.equals("3")) {
|
||||
//发布变更文件
|
||||
List<BO> publishSBO = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").bindId(processInstId).list();
|
||||
|
||||
if (publishSBO.size() > 0) {
|
||||
|
||||
for (BO onePublishS : publishSBO) {
|
||||
|
||||
/* if(onePublishC.getString("TASKID")=="submit_create"){
|
||||
return ResponseObject.newWarnResponse("请先创建手册!!").toString();
|
||||
}*/
|
||||
|
||||
String plId = onePublishS.getString("STOPFILEID");
|
||||
int count = 0;
|
||||
// 重新生成手册
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
|
||||
String wsIdro = queryMaPublishGetWsId();
|
||||
JSONObject wsIdJson = JSONObject.parseObject(wsIdro);
|
||||
String taskId = createOutputReport(model, wsIdJson.getJSONObject("data").get("wsId").toString(), "admin", "", plId);
|
||||
// 刷新预览加载的表
|
||||
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
|
||||
DBSql.update(sqlr);
|
||||
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_S WHERE STOPFILEID = '" + plId + "'";
|
||||
|
||||
if (UtilString.isNotEmpty(DBSql.getString(sql2))) {
|
||||
count = DBSql.update(
|
||||
"UPDATE BO_ACT_COE_PUBLISH_S SET TASKID='" + taskId + "'WHERE STOPFILEID ='" + plId + "'");
|
||||
}
|
||||
if (count != 0) {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (AWSDataAccessException e) {
|
||||
ro.put("result", "创建手册失败!!!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ro.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user