报告生成器增加新cmd,只保留doc格式文件,忽略其他格式文件

This commit is contained in:
zhaol 2025-02-24 17:33:47 +08:00
parent 95011aa704
commit c904a90762
4 changed files with 87 additions and 3 deletions

View File

@ -57,6 +57,41 @@ public class OutputDCFileProcessor extends AbstFileProcessor implements FileProc
return "";
}
/**
* 报告生成器下载压缩报告文件
*
* @param wsId 资产库id
* @param id 任务Id
* @param profileId 报告生成器扩展App的配置Id
* @throws Exception
*/
public static String getReportUtilDownloadURL(String wsId, String id, String profileId, UserContext _uc, String taskName) throws Exception {
UtilFile file = OutputAPIManager.getInstance().getFilePath(wsId, id, profileId);
if (file.exists()) {
//String josnStr = OutputAPIManager.getInstance().getWizardJsonData(wsId, id, profileId);
// JSONObject jsonObj = JSONObject.fromObject(josnStr);
DCContext dcContext = null;
DCUtil.getInstance();
dcContext = DCUtil.createTempFileContext("com.awspaas.user.apps.coe.pal.output.zd", "output", id, "zip");
dcContext.setFileName(taskName+ ".zip");
File ff = new File(dcContext.getFilePath());
// UtilFile.zipCompress(file.getPath(), ff, "doc");
// UtilFile.zipCompressExcludeName(file.getPath(), ff, "txt,**/*.log");
UtilFile.zipCompressExcludeName(file.getPath(), ff, "txt,**/*.log,**/*.xml,xmltodoc/");
dcContext.setSession(_uc);
// 操作行为日志记录
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_APPCENTER, CoEOpLogConst.OP_DOWNLOAD, CoEOpLogConst.INFO_OUTPUT_DOWNLOAD);
}
return dcContext.getDownloadURL();
}
return "";
}
/*
* 预览报告文件
* @param wsId 资产库id

View File

@ -69,6 +69,58 @@ public class ReportPrController {
return ro.toString();
}
/**
* 报告生成器报告下载
*
* @param me
* @param id
* @return
*/
@Mapping("com.awspaas.user.apps.coe.pal.output.zd_downloadreportutils")
public String downloadReportUtils(UserContext me, String id) {
OutputTaskModel model = new OutputTask().getTaskReportById(id);
ResponseObject ro = null;
JSONObject json = new JSONObject();
if (model != null) {
//三员管理步骤横表下载重新生成手册
if (HighSecurityUtil.isON()) {
//流程文件密级switch开启密级权限校验
if (HighSecurityUtil.fileSecuritySwitch()) {
ResponseObject securityPermission = PALRepositoryQueryAPIManager.getInstance().checkOutputSecurityPermission(me, model);
if (securityPermission.isErr()) {
return securityPermission.toString();
}
}
String taskName = model.getTaskName();
if ("步骤横表".equals(taskName)) {
// 重新设置生成id与用户id
String uuid = UUIDGener.getUUID();
model.setUserId(me.getUID());
// 重新生成手册文件
OutputAPIManager.getInstance().reGennerReport(me, model, uuid);
// 重新构建手册下载URL
id = uuid;
}
}
try {
ro = ResponseObject.newOkResponse();
json.put("url", OutputDCFileProcessor.getReportUtilDownloadURL(model.getWsId(), id, model.getProfileId(), me, model.getTaskName()));
ro.setData(json);
} catch (Exception e) {
ro = ResponseObject.newErrResponse();
e.printStackTrace();
}
}
return ro.toString();
}
/*
* 预览报告
* @param me

View File

@ -135,13 +135,10 @@ public class Report1Gener {
if (repositoryId == null || "".equals(repositoryId)) {
continue;
}
PALRepositoryModel repositoryModel1 = PALRepositoryCache.getCache().get(repositoryId);
if(repositoryModel1.getMethodId().equals("process.framework")){
continue;
}
PALRepositoryModel model = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
if (model != null) {
//获取文件扩展属性