手册生成代码修改

This commit is contained in:
zhal 2023-07-31 21:16:58 +08:00
parent 24ff9f2764
commit 85f8cee2ce
5 changed files with 1869 additions and 1927 deletions

View File

@ -2607,19 +2607,18 @@ public class CoEPALController {
/**
* 流程手册预览
*
* 流程手册预览+excel下载
* @param me
* @param taskId
* @return
*/
// @Mapping("COE_PAL_OUTPUTREPORT_OUTPUT_PROCESS_PREVIEW")
@Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_ppt_preview")
public String COEPALOUTPUTREPORTOutputProcessPPTPreview(UserContext me, String taskId) {
return PALRepositoryQueryAPIManager.getInstance().outputReportPPTPreview(me, taskId);
@Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown")
public String previewByExceldown(UserContext me, String taskId) {
return PALRepositoryQueryAPIManager.getInstance().previewByExceldown(me, taskId);
}
/**
* 流程阅览 流程手册下载
*
@ -3757,19 +3756,4 @@ public class CoEPALController {
return web.createOutputPrReportsByEstimatePPTFile(me, fileId);
}
/**
* 判断附件
*
* @param me
* @param uuids
* @param teamId
* @param wsId
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.publisher_output_pr_downloadExcelFile")
public String createOutputPrReportsByDownloadExcelFile(UserContext me, String taskIds) {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
return web.createOutputPrReportsByDownloadExcelFile(taskIds);
}
}

View File

@ -3547,6 +3547,83 @@ public class PALRepositoryQueryAPIManager {
}
public String previewByExceldown(UserContext _uc, String taskId) {
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
ResponseObject result = ResponseObject.newOkResponse();
if (model != null) {
try {
UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId());
if (file.exists()) {
File[] fileList = file.listFiles();
if (fileList.length > 0) {
File docFile = null;
for (File file2 : fileList) {
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;
}
}
if (docFile == null) {
return ResponseObject.newErrResponse("没有找到文件").toString();
}
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);
String downUrl = SDK.getConfAPI().getPortalUrl() + "/r/"
+ sourceDc.getDownloadURL().replace("./", "");
result.put("url", downUrl);
}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("没有可预览文件");
}
} catch (Exception e) {
e.printStackTrace();
return ResponseObject.newErrResponse().toString();
}
}
return result.toString();
}
public String outputReportPPTPreview(UserContext _uc, String taskId) {
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
ResponseObject result = ResponseObject.newOkResponse();

View File

@ -4220,153 +4220,31 @@ function outputReport() {
fileId: ruuid
},
success: function (r) {
debugger;
if (r.result == "ok") {
if (methodId == "data.form") {
$.simpleAlert('正在打开', 'loading');
setTimeout(function () {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal.publisher_output_pr_estimateFile",
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown",
data: {
fileId: ruuid
taskId: r.data.taskId
},
success: function (rep) {
if (rep.data.result == "existExcel") {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal.publisher_output_pr_downloadExcelFile",
data: {
taskIds: r.data.taskId
},
success: function (msg) {
if (msg.result == "ok") {
window.open(msg.data.url);
$.simpleAlert("close");
} else {
$.simpleAlert("close");
}
}
});
} else {
$.simpleAlert('正在打开', 'loading');
setTimeout(function () {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_preview",
data: {
taskId: r.data.taskId
},
success: function (msg) {
if (msg.result == "ok") {
$.simpleAlert("close");
if (msg['data']) {
var url = msg['data']['url'];
window.open(url);
}
} else {
$.simpleAlert("close");
$.simpleAlert(msg['msg'], 'info');
}
}
});
}, 2000);
}
}
});
} else if (methodId == 'control.policy') {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal.publisher_output_pr_estimatePPTFile",
data: {
fileId: ruuid
},
success: function (rep) {
debugger;
if (rep.data.result == "existPPT") {
setTimeout(function () {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_ppt_preview",
data: {
taskId: r.data.taskId
},
success: function (msg) {
if (msg.result == "ok") {
$.simpleAlert("close");
if (msg['data']) {
var url = msg['data']['url'];
window.open(url);
}
} else {
$.simpleAlert("close");
$.simpleAlert(msg['msg'], 'info');
}
}
});
}, 2000);
} else {
$.simpleAlert('正在打开', 'loading');
setTimeout(function () {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_preview",
data: {
taskId: r.data.taskId
},
success: function (msg) {
if (msg.result == "ok") {
$.simpleAlert("close");
if (msg['data']) {
var url = msg['data']['url'];
window.open(url);
}
} else {
$.simpleAlert("close");
$.simpleAlert(msg['msg'], 'info');
}
}
});
}, 2000);
}
}
});
} else {
$.simpleAlert('正在打开', 'loading');
setTimeout(function () {
$.ajax({
type: "POST",
url: "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_preview",
data: {
taskId: r.data.taskId
},
success: function (msg) {
if (msg.result == "ok") {
$.simpleAlert("close");
if (msg['data']) {
var url = msg['data']['url'];
window.open(url);
}
} else {
$.simpleAlert("close");
$.simpleAlert(msg['msg'], 'info');
success: function (msg) {
if (msg.result == "ok") {
$.simpleAlert("close");
if (msg['data']) {
var url = msg['data']['url'];
window.open(url);
}
} else {
$.simpleAlert("close");
$.simpleAlert(msg['msg'], 'info');
}
});
}, 2000);
}
}
});
}, 2000);
} else {
if (methodId == 'data.form') {
$.simpleAlert('表单手册创建失败', 'error');