流程清单 增加历史导出记录功能

This commit is contained in:
qinoy 2023-11-09 18:32:19 +08:00
parent dc4bf5aac0
commit 195c8f7ff2
42 changed files with 3508 additions and 197 deletions

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT NOT NULL,PROGRESS NUMERIC(6) NOT NULL,ERRINFO NVARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME NVARCHAR(36) NOT NULL,CREATETIME TIMESTAMP NOT NULL,UPDATETIME TIMESTAMP NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS NUMBER NOT NULL,PROGRESS NUMBER NOT NULL,ERRINFO VARCHAR2(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR2(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT NOT NULL,PROGRESS INT NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATETIME YEAR TO SECOND NOT NULL,UPDATETIME DATETIME YEAR TO SECOND NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT(1) NOT NULL,PROGRESS INT NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS NUMBER(1) NOT NULL,PROGRESS NUMBER(10) NOT NULL,ERRINFO VARCHAR2(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR2(36) NOT NULL,CREATETIME TIMESTAMP NOT NULL,UPDATETIME TIMESTAMP NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS DECIMAL(1) NOT NULL,PROGRESS DECIMAL(12) NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATE NOT NULL,UPDATETIME DATE NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT(1) NOT NULL,PROGRESS NUMERIC(12) NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT NOT NULL,PROGRESS INT NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME TIMESTAMP NOT NULL,UPDATETIME TIMESTAMP NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT NOT NULL,PROGRESS INT NOT NULL,ERRINFO NVARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME NVARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT NOT NULL,PROGRESS NUMERIC(12) NOT NULL,ERRINFO NVARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME NVARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT(1) NOT NULL,PROGRESS NUMERIC(12) NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -0,0 +1 @@
CREATE TABLE APP_ACT_COE_PAL_PRL_EXPORT (ID CHAR(36) NOT NULL,WSID CHAR(36) NOT NULL,STATUS SMALLINT(1) NOT NULL,PROGRESS NUMERIC(12) NOT NULL,ERRINFO VARCHAR(36) DEFAULT NULL,USERID CHAR(36) NOT NULL,FILENAME VARCHAR(36) NOT NULL,CREATETIME DATETIME NOT NULL,UPDATETIME DATETIME NOT NULL,CONSTRAINT APP_ACT_COE_PAL_PRL_EXPORT_PK PRIMARY KEY (ID));

View File

@ -21,7 +21,7 @@
<upgradeDate>2016-06-02 16:18:25</upgradeDate>
<installListener/>
<pluginListener>com.actionsoft.apps.coe.pal.processlist.plugin.Plugins</pluginListener>
<startListener/>
<startListener>com.actionsoft.apps.coe.pal.processlist.plugin.StartListener</startListener>
<stopListener/>
<upgradeListener/>
<uninstallListener/>

View File

@ -83,4 +83,29 @@ public class CoEProcessListController {
return web.processListExportExcel(wsId, teamId, searchInput, levelValue, tableFilter, customFilter);
}
/**
* 获取流程清单导出记录
* @param uc
* @param wsId
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.processlist_export_log_data")
public String getProcessListExportLog(UserContext uc, String wsId){
PALRepositoryListWeb web = new PALRepositoryListWeb(uc);
return web.getProcessListExportLog(wsId);
}
/**
* 获取执行中的状态数据
* @param uc
* @param wsId
* @param exportIds
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.processlist_export_executing_status_get")
public String handleExportExecutingStatusInfo(UserContext uc, String wsId, String exportIds){
PALRepositoryListWeb web = new PALRepositoryListWeb(uc);
return web.getExportExecutingStatusList(wsId, exportIds);
}
}

View File

@ -0,0 +1,41 @@
package com.actionsoft.apps.coe.pal.processlist.cache;
import com.actionsoft.apps.coe.pal.processlist.constant.ProcessListConstant;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.apps.coe.pal.processlist.util.ExportAPIManager;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheManager;
import com.actionsoft.bpms.util.ConsolePrinter;
import com.actionsoft.sdk.local.SDK;
import java.util.Iterator;
import java.util.List;
/**
* @author oYang
* @Description 流程清单导出记录数据缓存
* @createTime 2023年11月08日 16:51:00
*/
public class ExportLogDataCache extends Cache<String, ProcessListExportModel> {
public ExportLogDataCache(CachePluginProfile configuration) {
super(configuration);
registeIndex(ExportLogDataCacheIndex1.class, new ExportLogDataCacheIndex1()); // wsId_userId
}
public static ExportLogDataCache getCache(){
return CacheManager.getCache(ExportLogDataCache.class);
}
@Override
protected void load() {
List<ProcessListExportModel> exportModelList = ExportAPIManager.getInstance().loadAll();
exportModelList.forEach(exportModel -> getCache().put(exportModel.getId(), exportModel));
ConsolePrinter.info("[" + SDK.getAppAPI().getAppContext(ProcessListConstant.PROCESSLIST).getNameI18N() + "]Cache加载流程清单导出记录对象 [" + getCache().size() + "个]");
}
public static Iterator<ProcessListExportModel> getByWsIdAndUserId(String wsId, String userId){
return getCache().getByIndex(ExportLogDataCacheIndex1.class, wsId + "_" + userId);
}
}

View File

@ -0,0 +1,16 @@
package com.actionsoft.apps.coe.pal.processlist.cache;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
/**
* @author oYang
* @Description TODO
* @createTime 2023年11月08日 17:18:00
*/
public class ExportLogDataCacheIndex1 extends ListValueIndex<String, ProcessListExportModel> {
@Override
public String key(ProcessListExportModel exportModel) {
return exportModel.getWsId() + "_" + exportModel.getUserId();
}
}

View File

@ -31,4 +31,19 @@ public interface ProcessListConstant {
* 标题
*/
public static final String PROCESSLIST_PAGE_TITLE =AppsAPIManager.getInstance().getAppContext(PROCESSLIST).getName();
/**
* 导出状态--执行中
*/
public static final Integer EXPORT_EXECUTING_STATUS_CODE = 0;
/**
* 导出状态--已完成
*/
public static final Integer EXPORT_COMPLATE_STATUS_CODE = 1;
/**
* 导出状态--错误
*/
public static final Integer EXPORT_ERR_STATUS_CODE = 2;
public static final String EXPORT_DC_REPOSITORY_NAME = "process";
}

View File

@ -0,0 +1,23 @@
package com.actionsoft.apps.coe.pal.processlist.constant.db;
/**
* @author oYang
* @Description TODO
* @createTime 2023年11月08日 11:17:00
*/
public interface ProcessListExportDbConst {
String TABLE_NAME = "APP_ACT_COE_PAL_PRL_EXPORT";
String ID = "ID";
String WSID = "WSID";
String STATUE = "STATUS";
String PROGRESS = "PROGRESS";
String ERRINFO = "ERRINFO";
String USERID = "USERID";
String FILENAME = "FILENAME";
String CREATETIME = "CREATETIME";
String UPDATETIME = "UPDATETIME";
String ALL_FIELD_JOIN = "ID,WSID,STATUS,PROGRESS,ERRINFO,USERID,FILENAME,CREATETIME,UPDATETIME";
}

View File

@ -0,0 +1,145 @@
package com.actionsoft.apps.coe.pal.processlist.dao;
import com.actionsoft.apps.coe.pal.processlist.cache.ExportLogDataCache;
import com.actionsoft.apps.coe.pal.processlist.constant.ProcessListConstant;
import com.actionsoft.apps.coe.pal.processlist.constant.db.ProcessListExportDbConst;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.bpms.commons.database.RowMapper;
import com.actionsoft.bpms.commons.mvc.dao.DaoObject;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSDataAccessException;
import com.actionsoft.exception.AWSException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.actionsoft.apps.coe.pal.processlist.constant.db.ProcessListExportDbConst.*;
/**
* @author oYang
* @Description 导出记录表
* @createTime 2023年11月08日 11:15:00
*/
public class ProcessListExportDao extends DaoObject<ProcessListExportModel> {
private static final Logger LOGGER = LoggerFactory.getLogger(ProcessListExportDao.class);
@Override
public int insert(ProcessListExportModel exportModel) throws AWSDataAccessException {
Map<String, Object> paramsMap = this.getModelParamsMap(exportModel);
String sql = DBSql.getInsertStatement(entityName(), paramsMap);
int update = DBSql.update(sql, paramsMap);
return update;
}
@Override
public int update(ProcessListExportModel processListExportModel) throws AWSDataAccessException {
if (UtilString.isEmpty(processListExportModel.getId())) {
throw new AWSDataAccessException("PmiBoardModel ID字段不允许为空");
}
return update(processListExportModel.getId(), this.getModelParamsMap(processListExportModel));
}
public void updateExportStatus(String exportId, int status, Timestamp updateTime) {
String sql = "UPDATE " + entityName() + " SET " + STATUE + "=:status, " + UPDATETIME + "=:updateTime WHERE " + ID + "=:exportId";
Map<String, Object> param = new HashMap<>();
param.put("status", status);
param.put("updateTime", updateTime);
param.put("exportId", exportId);
DBSql.update(sql, param);
}
public void updateExportStatusAndProgress(String exportId, int status, int progress, Timestamp updateTime) {
String sql = "UPDATE " + entityName() + " SET " + STATUE + "=:status, " + PROGRESS + "=:progress, " + UPDATETIME + "=:updateTime WHERE " + ID + "=:exportId";
Map<String, Object> param = new HashMap<>();
param.put("status", status);
param.put("progress", progress);
param.put("updateTime", updateTime);
param.put("exportId", exportId);
DBSql.update(sql, param);
}
public void updateExportStatusAndErrInfo(String exportId, int status, String errInfo, Timestamp updateTime) {
String sql = "UPDATE " + entityName() + " SET " + STATUE + "=:status, "+ ERRINFO + "=:errInfo, " + UPDATETIME + "=:updateTime WHERE " + ID + "=:exportId";
Map<String, Object> param = new HashMap<>();
param.put("status", status);
param.put("errInfo", errInfo);
param.put("updateTime", updateTime);
param.put("exportId", exportId);
DBSql.update(sql, param);
}
public void updateExportProgress(String exportId, int progress, Timestamp updateTime) {
String sql = "UPDATE " + entityName() + " SET " + PROGRESS + "=:progress, " + UPDATETIME + "=:updateTime WHERE " + ID + "=:exportId";
Map<String, Object> param = new HashMap<>();
param.put("progress", progress);
param.put("updateTime", updateTime);
param.put("exportId", exportId);
DBSql.update(sql, param);
}
public void updateExportStatusBatch(List<ProcessListExportModel> exportModels) throws AWSException {
String sql = "UPDATE " + entityName() + " SET " + STATUE + "=:status, " + PROGRESS + "=:progress, " + UPDATETIME + "=:updateTime WHERE " + ID + "=:exportId";
List<Map<String, ?>> paramList = new ArrayList<>();
for (ProcessListExportModel exportModel : exportModels) {
Map<String, Object> paraMap = new HashMap<>();
paraMap.put("status", exportModel.getStatus());
paraMap.put("progress", exportModel.getProgress());
paraMap.put("updateTime", exportModel.getUpdateTime());
paraMap.put("exportId", exportModel.getId());
paramList.add(paraMap);
}
DBSql.batchUpdate(sql, paramList);
}
@Override
public String entityName() {
return TABLE_NAME;
}
@Override
public RowMapper<ProcessListExportModel> rowMapper() {
return ((resultSet, i) -> {
ProcessListExportModel exportModel = new ProcessListExportModel();
try {
exportModel.setId(resultSet.getString(ID));
exportModel.setWsId(resultSet.getString(WSID));
exportModel.setStatus(resultSet.getInt(STATUE));
exportModel.setProgress(resultSet.getInt(PROGRESS));
exportModel.setErrInfo(resultSet.getString(ERRINFO));
exportModel.setUserId(resultSet.getString(USERID));
exportModel.setFileName(resultSet.getString(FILENAME));
exportModel.setCreateTime(resultSet.getTimestamp(CREATETIME));
exportModel.setUpdateTime(resultSet.getTimestamp(UPDATETIME));
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
return exportModel;
});
}
private Map<String, Object> getModelParamsMap(ProcessListExportModel exportModel) {
Map<String, Object> paramsMap = new HashMap<>();
if (UtilString.isEmpty(exportModel.getId())) {
exportModel.setId(UUIDGener.getUUID());
}
paramsMap.put(ID, exportModel.getId());
paramsMap.put(WSID, exportModel.getWsId());
paramsMap.put(STATUE, exportModel.getStatus());
paramsMap.put(PROGRESS, exportModel.getProgress());
paramsMap.put(ERRINFO, exportModel.getErrInfo());
paramsMap.put(USERID, exportModel.getUserId());
paramsMap.put(FILENAME, exportModel.getFileName());
paramsMap.put(CREATETIME, exportModel.getCreateTime());
paramsMap.put(UPDATETIME, exportModel.getUpdateTime());
return paramsMap;
}
}

View File

@ -0,0 +1,133 @@
package com.actionsoft.apps.coe.pal.processlist.model;
import com.actionsoft.bpms.commons.mvc.model.ModelBean;
import java.sql.Timestamp;
/**
* @author oYang
* @Description 导出记录模型信息
* @createTime 2023年11月08日 10:40:00
*/
public class ProcessListExportModel extends ModelBean {
private String id; // 导出记录主键 可用作导出文档存储路径的一部分
private String wsId; // 资产库信息
private Integer status; // 导出状态
private Integer progress; // 导出进度
private String errInfo; // 错误信息
private String userId; // 用户信息
private String fileName; // 文件名称
private Timestamp createTime; // 创建时间
private Timestamp updateTime; // 更新时间
public ProcessListExportModel() {
}
public ProcessListExportModel(String id, String wsId, Integer status, Integer progress, String errInfo, String userId, String fileName, Timestamp createTime, Timestamp updateTime) {
this.id = id;
this.wsId = wsId;
this.status = status;
this.progress = progress;
this.errInfo = errInfo;
this.userId = userId;
this.fileName = fileName;
this.createTime = createTime;
this.updateTime = updateTime;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getProgress() {
return progress;
}
public void setProgress(Integer progress) {
this.progress = progress;
}
public String getErrInfo() {
return errInfo;
}
public void setErrInfo(String errInfo) {
this.errInfo = errInfo;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public Timestamp getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Timestamp updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "ProcessListExportModel{" +
"id='" + id + '\'' +
", wsId='" + wsId + '\'' +
", status=" + status +
", progress=" + progress +
", errInfo='" + errInfo + '\'' +
", userId='" + userId + '\'' +
", fileName='" + fileName + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

View File

@ -0,0 +1,108 @@
package com.actionsoft.apps.coe.pal.processlist.model.vo;
import java.io.Serializable;
/**
* @author oYang
* @Description TODO
* @createTime 2023年11月08日 17:28:00
*/
public class ExportLogVo implements Serializable {
private static final long serialVersionUID = 123456789L;
private String id;
private String fileName;
private Integer status;
private String statusText;
private Integer progress;
private String errInfo;
private String downloadUrl;
private String createTime;
private String updateTime;
public ExportLogVo() {
}
public ExportLogVo(String id, String fileName, Integer status, String statusText, Integer progress, String errInfo, String downloadUrl, String createTime, String updateTime) {
this.id = id;
this.fileName = fileName;
this.status = status;
this.statusText = statusText;
this.progress = progress;
this.errInfo = errInfo;
this.downloadUrl = downloadUrl;
this.createTime = createTime;
this.updateTime = updateTime;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getStatusText() {
return statusText;
}
public void setStatusText(String statusText) {
this.statusText = statusText;
}
public Integer getProgress() {
return progress;
}
public void setProgress(Integer progress) {
this.progress = progress;
}
public String getErrInfo() {
return errInfo;
}
public void setErrInfo(String errInfo) {
this.errInfo = errInfo;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -7,7 +7,9 @@ import java.util.Map;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.CoeFileProcessor;
import com.actionsoft.apps.coe.pal.processlist.aslp.GetCountByProcessList;
import com.actionsoft.apps.coe.pal.processlist.cache.ExportLogDataCache;
import com.actionsoft.apps.coe.pal.processlist.cache.ProcessListConfigCache;
import com.actionsoft.apps.coe.pal.processlist.constant.ProcessListConstant;
import com.actionsoft.apps.coe.pal.processlist.util.ProcessListFileProcessor;
import com.actionsoft.apps.coe.pal.processlist.web.PALRepositoryListWeb;
import com.actionsoft.apps.listener.PluginListener;
@ -23,6 +25,7 @@ public class Plugins implements PluginListener {
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
// cache
list.add(new CachePluginProfile(ProcessListConfigCache.class));
list.add(new CachePluginProfile(ExportLogDataCache.class));
// PAL应用扩展点
Map<String, Object> params0 = new HashMap<String, Object>();
params0.put("title", "流程清单");
@ -39,7 +42,7 @@ public class Plugins implements PluginListener {
list.add(new AppExtensionProfile("PAL小组->流程清单", "aslp://com.actionsoft.apps.coe.pal.cooperation/registerApp", params1));
list.add(new ASLPPluginProfile("GetCountByProcessList", GetCountByProcessList.class.getName(), "获取流程相关的个数", new HttpASLP(HttpASLP.AUTH_RSA, null)));
list.add(new DCPluginProfile("tmp", ProcessListFileProcessor.class.getName(), "存放临时文件", false));
list.add(new DCPluginProfile(ProcessListConstant.EXPORT_DC_REPOSITORY_NAME, ProcessListFileProcessor.class.getName(), "存放导出的流程清单文件", false));
return list;
}

View File

@ -0,0 +1,34 @@
package com.actionsoft.apps.coe.pal.processlist.plugin;
import com.actionsoft.apps.coe.pal.processlist.cache.ExportLogDataCache;
import com.actionsoft.apps.coe.pal.processlist.constant.ProcessListConstant;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.apps.coe.pal.processlist.util.ExportAPIManager;
import com.actionsoft.apps.listener.AppListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.util.ConsolePrinter;
import com.actionsoft.sdk.local.SDK;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author oYang
* @Description TODO
* @createTime 2023年11月09日 09:36:00
*/
public class StartListener implements AppListener {
@Override
public boolean before(AppContext appContext) {
return true;
}
@Override
public void after(AppContext appContext) {
try {
ExportAPIManager.getInstance().handleAppStartEvent();
} catch (Exception e) {
ConsolePrinter.warn("[" + SDK.getAppAPI().getAppContext(ProcessListConstant.PROCESSLIST).getNameI18N() + "]应用启动更新导出记录异常状态对象失败 " + e.getMessage());
}
}
}

View File

@ -0,0 +1,216 @@
package com.actionsoft.apps.coe.pal.processlist.util;
import com.actionsoft.apps.coe.pal.processlist.cache.ExportLogDataCache;
import com.actionsoft.apps.coe.pal.processlist.constant.ProcessListConstant;
import com.actionsoft.apps.coe.pal.processlist.dao.ProcessListExportDao;
import com.actionsoft.apps.coe.pal.processlist.dao.factory.ProcessListDaoFactory;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
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.UUIDGener;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.exception.AWSDataAccessException;
import com.actionsoft.i18n.I18nRes;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author oYang
* @Description 流程清单导出API
* @createTime 2023年11月08日 12:15:00
*/
public class ExportAPIManager {
private final Logger logger = LoggerFactory.getLogger(ExportAPIManager.class);
private final ProcessListExportDao exportDao = ProcessListDaoFactory.createExportDao();
/**
* 保存导出记录初始化信息
* @param wsId
* @param userId
* @param fileName
* @return
*/
public ProcessListExportModel saveExportInitInfo(String wsId, String userId, String fileName, Timestamp createTime) {
logger.debug("保存导出记录初始信息参数wsId {}参数userId {}", wsId, userId);
ProcessListExportModel exportModel =
new ProcessListExportModel(UUIDGener.getUUID(), wsId, ProcessListConstant.EXPORT_EXECUTING_STATUS_CODE, 0, "", userId, fileName, createTime, createTime);
try {
exportDao.insert(exportModel);
} catch (AWSDataAccessException e) {
return null;
}
// 加入缓存
ExportLogDataCache.getCache().put(exportModel.getId(), exportModel);
return exportModel;
}
/**
* 更新导出记录的状态信息
* @param exportId
* @param status
*/
public void updateExportStatusInfo(String exportId, int status){
logger.debug("更新导出记录的状态信息参数exportId {}参数status {}", exportId, status);
Timestamp updateTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
exportDao.updateExportStatus(exportId, status, updateTime);
ProcessListExportModel exportModel = ExportLogDataCache.getCache().get(exportId);
exportModel.setStatus(status);
exportModel.setUpdateTime(updateTime);
ExportLogDataCache.getCache().put(exportId, exportModel);
}
/**
* 更新导出进度信息
* @param exportId
* @param progress
*/
public void updateProgressInfo(String exportId, int progress){
logger.debug("构建导出清单文件存储的DC参数 exportId {}progress {}", exportId, progress);
Timestamp updateTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
exportDao.updateExportProgress(exportId, progress, updateTime);
ProcessListExportModel exportModel = ExportLogDataCache.getCache().get(exportId);
exportModel.setProgress(progress);
exportModel.setUpdateTime(updateTime);
ExportLogDataCache.getCache().put(exportId, exportModel);
}
/**
* 更新导出进度与状态信息
* @param exportId
* @param status
* @param progress
*/
public void updateExportStatusAndProgressInfo(String exportId, int status, int progress){
Timestamp updateTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
exportDao.updateExportStatusAndProgress(exportId, status, progress, updateTime);
ProcessListExportModel exportModel = ExportLogDataCache.getCache().get(exportId);
exportModel.setStatus(status);
exportModel.setProgress(progress);
exportModel.setUpdateTime(updateTime);
ExportLogDataCache.getCache().put(exportId, exportModel);
}
/**
* 更新导出记录的状态信息与错误信息
* @param exportId
* @param status
* @param errInfo
*/
public void updateExportStatusAndErrInfo(String exportId, int status, String errInfo){
logger.debug("更新导出记录的状态信息与错误信息参数exportId {}status {}errInfo {}", exportId, status, errInfo);
Timestamp updateTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
exportDao.updateExportStatusAndErrInfo(exportId, status, errInfo, updateTime);
ProcessListExportModel exportModel = ExportLogDataCache.getCache().get(exportId);
exportModel.setErrInfo(errInfo);
exportModel.setStatus(status);
exportModel.setUpdateTime(updateTime);
ExportLogDataCache.getCache().put(exportId, exportModel);
}
/**
* 构建导出清单文件存储的DC
* @param _uc
* @param exportId
* @param fileName
* @return
*/
public DCContext buildExportDCContext(UserContext _uc, String exportId, String fileName){
logger.debug("构建导出清单文件存储的DC参数 exportId {}fileName {}", exportId, fileName);
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(ProcessListConstant.PROCESSLIST, ProcessListConstant.EXPORT_DC_REPOSITORY_NAME);
DCContext dcContext = new DCContext(_uc, dcProfile, ProcessListConstant.PROCESSLIST, exportId, "Sheet", fileName);
dcContext.setSession(_uc);
return dcContext;
}
/**
* 构建导出清单文件名称
* @param _uc
* @param createTime
* @return
*/
public String buildFileName(UserContext _uc, Timestamp createTime){
String fileName = I18nRes.findValue(ProcessListConstant.PROCESSLIST, ("流程清单")) + "_" + _uc.getUID() + "_" + UtilDate.datetimeFormat(createTime, "yyMMdd_hhmmss") + ".xls";
return fileName;
}
/**
* 流程清单导出完成后 写入DC
* @param _uc
* @param exportModel
* @param wb
*/
public void exportComplateAfter(UserContext _uc, ProcessListExportModel exportModel, HSSFWorkbook wb){
DCContext dcContext = buildExportDCContext(_uc, exportModel.getId(), exportModel.getFileName());
FileOutputStream out = null;
String fn = dcContext.getFilePath();
try {
File file = new File(dcContext.getPath());
if (!file.exists()) {
file.mkdirs();
}
out = new FileOutputStream(fn);
wb.write(out);
} catch (Exception e) {
e.printStackTrace(System.err);
} finally {
try {
out.close();
} catch (Exception e2) {
}
}
}
/**
* 缓存加载导出记录数据
* @return
*/
public List<ProcessListExportModel> loadAll(){
List<ProcessListExportModel> exportModels = exportDao.query().list();
return exportModels;
}
/**
* 应用启动处理
*/
public void handleAppStartEvent(){
// 获取历史导出记录中状态为执行中的数据
List<ProcessListExportModel> exportModelList =
ExportLogDataCache.getCache().stream().filter(exportModel -> exportModel.getStatus() == ProcessListConstant.EXPORT_EXECUTING_STATUS_CODE).collect(Collectors.toList());
Timestamp updateTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
exportModelList.forEach(exportModel -> {
exportModel.setStatus(ProcessListConstant.EXPORT_ERR_STATUS_CODE);
exportModel.setErrInfo("应用关闭导致清单导出中断");
exportModel.setUpdateTime(updateTime);
});
if (exportModelList.size() > 0){
exportDao.updateExportStatusBatch(exportModelList);
// 处理缓存
exportModelList.forEach(exportModel -> ExportLogDataCache.getCache().put(exportModel.getId(), exportModel));
}
}
private static class Inner{
private static final ExportAPIManager exportAPIManager = new ExportAPIManager();
}
public static ExportAPIManager getInstance(){
return Inner.exportAPIManager;
}
}

View File

@ -2,6 +2,7 @@ package com.actionsoft.apps.coe.pal.processlist.web;
import java.io.File;
import java.io.FileOutputStream;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -27,8 +28,12 @@ import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.coe.pal.pal.ws.dao.CoeWorkSpaceDaoFactory;
import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel;
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
import com.actionsoft.apps.coe.pal.processlist.cache.ExportLogDataCache;
import com.actionsoft.apps.coe.pal.processlist.cache.ProcessListConfigCache;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListConfigModel;
import com.actionsoft.apps.coe.pal.processlist.model.ProcessListExportModel;
import com.actionsoft.apps.coe.pal.processlist.model.vo.ExportLogVo;
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;
@ -1030,6 +1035,68 @@ public class PALRepositoryListWeb extends ActionWeb {
return ro.toString();
}
/**
* 获取导出记录信息
* @param wsId
* @return
*/
public String getProcessListExportLog(String wsId){
List<ExportLogVo> result = new ArrayList<>();
Iterator<ProcessListExportModel> iterator = ExportLogDataCache.getByWsIdAndUserId(wsId, _uc.getUID());
while (iterator.hasNext()){
ProcessListExportModel exportModel = iterator.next();
ExportLogVo exportLogVo = transformModelToVo(exportModel);
result.add(exportLogVo);
}
result = result.stream().sorted(Comparator.comparing(ExportLogVo::getUpdateTime, Comparator.reverseOrder())).collect(Collectors.toList());
boolean isAllComplate = result.stream().allMatch(exportLogVo -> exportLogVo.getStatus() == ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE);
List<String> executeIdList = result.stream().filter(exportLogVo -> exportLogVo.getStatus() == ProcessListConstant.EXPORT_EXECUTING_STATUS_CODE).map(exportLogVo -> exportLogVo.getId()).collect(Collectors.toList());
ResponseObject ro = ResponseObject.newOkResponse();
ro.put("isAllComplate", isAllComplate);
ro.put("exportList", result);
ro.put("executeIdList", executeIdList);
return ro.toString();
}
public String getExportExecutingStatusList(String wsId, String exportIds){
if (UtilString.isEmpty(exportIds) || UtilString.isEmpty(wsId)){
return ResponseObject.newErrResponse("参数异常").toString();
}
JSONArray exportIdArr = JSONArray.parseArray(exportIds);
List<ExportLogVo> result = exportIdArr.stream()
.map(exportId -> {
ProcessListExportModel exportModel = ExportLogDataCache.getCache().get(exportId.toString());
ExportLogVo exportLogVo = transformModelToVo(exportModel);
return exportLogVo;
}).collect(Collectors.toList());
result = result.stream().sorted(Comparator.comparing(ExportLogVo::getUpdateTime, Comparator.reverseOrder())).collect(Collectors.toList());
boolean isAllComplate = result.stream().allMatch(exportLogVo -> exportLogVo.getStatus() == ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE);
List<String> executeIdList = result.stream().filter(exportLogVo -> exportLogVo.getStatus() == ProcessListConstant.EXPORT_EXECUTING_STATUS_CODE).map(exportLogVo -> exportLogVo.getId()).collect(Collectors.toList());
ResponseObject ro = ResponseObject.newOkResponse();
ro.put("isAllComplate", isAllComplate);
ro.put("exportList", result);
ro.put("executeIdList", executeIdList);
return ro.toString();
}
private ExportLogVo transformModelToVo(ProcessListExportModel exportModel){
String statusText = "";
String downloadUrl = "";
if (exportModel.getStatus() == ProcessListConstant.EXPORT_EXECUTING_STATUS_CODE){
statusText = "生成中";
} else if (exportModel.getStatus() == ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE) {
statusText = "已完成";
DCContext dcContext = ExportAPIManager.getInstance().buildExportDCContext(_uc, exportModel.getId(), exportModel.getFileName());
dcContext.setSession(_uc);
downloadUrl = dcContext.getDownloadURL();
}else {
statusText = "失败";
}
ExportLogVo exportLogVo =
new ExportLogVo(exportModel.getId(), exportModel.getFileName(), exportModel.getStatus() ,statusText, exportModel.getProgress(), exportModel.getErrInfo(), downloadUrl ,UtilDate.dateFormat(exportModel.getCreateTime()), UtilDate.datetimeFormat2(exportModel.getUpdateTime()));
return exportLogVo;
}
/**
* 导出流程清单Excel
* @param wsId
@ -1048,32 +1115,23 @@ public class PALRepositoryListWeb extends ActionWeb {
HSSFSheet sheet = wb.createSheet(I18nRes.findValue(ProcessListConstant.PROCESSLIST, ("流程清单")));
// 模板标题
short rowIndex = 0;
exportSheetData2(wb, sheet, rowIndex, (short) 0, wsId, teamId, conditions);
DCUtil.getInstance();
// DCContext dcContext = DCUtil.createTempFileContext(AppsConst.SYS_APP_PLATFORM, "Form", "Sheet", "xls");
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(ProcessListConstant.PROCESSLIST, "tmp");
String fileName = I18nRes.findValue(ProcessListConstant.PROCESSLIST, ("流程清单")) + "_" + _uc.getUID() + "_" + UtilDate.datetimeFormat(new Date(), "yyMMdd_hhmmss") + ".xls";
DCContext dcContext = new DCContext(_uc, dcProfile, ProcessListConstant.PROCESSLIST, "Form", "Sheet", fileName);
FileOutputStream out = null;
String fn = dcContext.getFilePath();
ExportAPIManager exportAPIManager = ExportAPIManager.getInstance();
ProcessListExportModel exportModel = null;
Timestamp createTime = UtilDate.parseTsFromDateTime(UtilDate.datetimeFormat(new Date()));
try {
File file = new File(dcContext.getPath());
if (!file.exists()) {
file.mkdirs();
}
out = new FileOutputStream(fn);
wb.write(out);
String fileName = exportAPIManager.buildFileName(_uc, createTime); // 构建文件名称
exportModel = exportAPIManager.saveExportInitInfo(wsId, _uc.getUID(), fileName, createTime); // 初始保存导出记录信息
ProcessListExportModel tempModel = exportModel;
new Thread(() -> {
exportSheetData2(wb, sheet, rowIndex, (short) 0, wsId, teamId, conditions, tempModel);
}).start();
} catch (Exception e) {
e.printStackTrace(System.err);
} finally {
try {
out.close();
} catch (Exception e2) {
if (exportModel == null){
return ResponseObject.newErrResponse("导出记录数据初始化失败").toString();
}
}
dcContext.setSession(getContext());
String fileURL = dcContext.getDownloadURL();
ResponseObject ro = ResponseObject.newOkResponse(fileURL);
ResponseObject ro = ResponseObject.newOkResponse("文档生成中,后续可以在历史记录中查看");
return ro.toString();
}
@ -1088,7 +1146,7 @@ public class PALRepositoryListWeb extends ActionWeb {
* @param wsId
* @param conditions
*/
private void exportSheetData2(HSSFWorkbook wb, HSSFSheet sheet, int rowIndex, short columnIndex, String wsId, String teamId, JSONObject conditions) {
private void exportSheetData2(HSSFWorkbook wb, HSSFSheet sheet, int rowIndex, short columnIndex, String wsId, String teamId, JSONObject conditions, ProcessListExportModel exportModel) {
long s1 = System.currentTimeMillis();
HSSFFont font = wb.createFont();
HSSFCellStyle styleHead = wb.createCellStyle();
@ -1184,138 +1242,165 @@ public class PALRepositoryListWeb extends ActionWeb {
List<PALRepositoryPropertyModel> propertyModelList = propertyDao.queryByWsId(wsId);
long s3 = System.currentTimeMillis();
List<Long> tempLongList = new ArrayList<>();
for (int i = 0; i < palList.size(); i++) {
PALRepositoryModel model = palList.get(i);
rowIndex++;
row = sheet.createRow(rowIndex);
// 数据记录
short col = getExcelColor(model.getColor());
if (col > 0) {
styleData.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleData.setFillForegroundColor(col);//
}
// 获取文件属性
// 第0个固定分类
// 第1到maxLevel个固定级别
// 第maxLevel+1个空白列
// 后面是更多特性列
int cellIndex = 0;
// 文件类型
HSSFCell cell = row.createCell(cellIndex);
String cellValue = getDefaultFixedValueById("type", model.getId());
cell.setCellValue(I18nRes.findValue(ProcessListConstant.PROCESSLIST, cellValue.trim()));
// 名称
int level = model.getLevel();
HSSFCell levelCell = row.createCell(level);
String levelCellValue = "";
if (level <= 1) {
levelCellValue = model.getName();
} else {
levelCellValue = getDefaultFixedValueById("no", model.getId()) + " " + model.getName();
}
levelCell.setCellValue(levelCellValue);
// 记录合并列
Map<Integer, Integer> map = new HashMap<>();
map.put(0, rowIndex);
map.put(1, levelCell.getColumnIndex());
map.put(2, maxLevel + 1);
columMap.put(count, map);
count++;
cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列
long s5 = System.currentTimeMillis();
// 扩展属性
boolean extendAttr = false;
for (int j = 0; j < tempArr.size(); j++) {
JSONObject object = tempArr.getJSONObject(j);
if ("extendAttr".equals(object.getString("columnType"))) {
extendAttr = true;
int size = palList.size();
int stage1DataCount = (int) (size * 0.05); // 第一个阶段的数据量
int stage2DataCount = (int) (size * 0.1); // 第二个阶段的数据量
int stage3DataCount = (int) (size * 0.3); // 第三个阶段的数据量
int stage4DataCount = (int) (size * 0.7); // 第四个阶段的数据量
Map<Integer, Integer> progressStageMap = new HashMap<>();
progressStageMap.put(stage1DataCount, 5);
progressStageMap.put(stage2DataCount, 10);
progressStageMap.put(stage3DataCount, 30);
progressStageMap.put(stage4DataCount, 70);
try {
for (int i = 0; i < palList.size(); i++) {
Thread.sleep(600);
// 更新进度
if (progressStageMap.containsKey(i)){
ExportAPIManager.getInstance().updateProgressInfo(exportModel.getId(), progressStageMap.get(i));
ConsolePrinter.info("流程清单导出当前进度 " + progressStageMap.get(i)+"%");
}
}
// 获取所有扩展属性的值
JSONObject extendAttrValObj = new JSONObject();
List<PALRepositoryPropertyModel> props = propertyModelList.stream().filter(prop -> {return prop.getPlId().equals(model.getId());}).collect(Collectors.toList());
if (extendAttr) {// 如果表格中没有更多特性则不查询节省时间
if(null!=model) {
try {
extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props);
} catch (Exception e) {
System.err.println("清单无法导出的模型ID"+model.getId());
// TODO: handle exception
PALRepositoryModel model = palList.get(i);
rowIndex++;
row = sheet.createRow(rowIndex);
// 数据记录
short col = getExcelColor(model.getColor());
if (col > 0) {
styleData.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleData.setFillForegroundColor(col);//
}
// 获取文件属性
// 第0个固定分类
// 第1到maxLevel个固定级别
// 第maxLevel+1个空白列
// 后面是更多特性列
int cellIndex = 0;
// 文件类型
HSSFCell cell = row.createCell(cellIndex);
String cellValue = getDefaultFixedValueById("type", model.getId());
cell.setCellValue(I18nRes.findValue(ProcessListConstant.PROCESSLIST, cellValue.trim()));
// 名称
int level = model.getLevel();
HSSFCell levelCell = row.createCell(level);
String levelCellValue = "";
if (level <= 1) {
levelCellValue = model.getName();
} else {
levelCellValue = getDefaultFixedValueById("no", model.getId()) + " " + model.getName();
}
levelCell.setCellValue(levelCellValue);
// 记录合并列
Map<Integer, Integer> map = new HashMap<>();
map.put(0, rowIndex);
map.put(1, levelCell.getColumnIndex());
map.put(2, maxLevel + 1);
columMap.put(count, map);
count++;
cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列
long s5 = System.currentTimeMillis();
// 扩展属性
boolean extendAttr = false;
for (int j = 0; j < tempArr.size(); j++) {
JSONObject object = tempArr.getJSONObject(j);
if ("extendAttr".equals(object.getString("columnType"))) {
extendAttr = true;
}
}
// 获取所有扩展属性的值
JSONObject extendAttrValObj = new JSONObject();
List<PALRepositoryPropertyModel> props = propertyModelList.stream().filter(prop -> {return prop.getPlId().equals(model.getId());}).collect(Collectors.toList());
if (extendAttr) {// 如果表格中没有更多特性则不查询节省时间
if(null!=model) {
try {
extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props);
} catch (Exception e) {
System.err.println("清单无法导出的模型ID"+model.getId());
// TODO: handle exception
}
}
}
Iterator iter = extendAttrValObj.entrySet().iterator();
JSONObject object = new JSONObject();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
JSONObject valueObj = JSONObject.parseObject(entry.getValue().toString());
object.put(valueObj.getString("key"), valueObj.getString("value"));
}
extendAttrValObj = object;
int parentNameCellIndex = 0;
for (int j = 0; j < tempArr.size(); j++) {
HSSFCell attrCell = row.createCell(++cellIndex);
String attrCellValue = "";
JSONObject config = tempArr.getJSONObject(j);
String propId = config.getString("id");
// 伊利定制化需求23-01-05
if ("status".equals(propId)){
parentNameCellIndex = ++cellIndex;
}
// 标准列
if ("default".equals(config.getString("columnType"))) {
attrCellValue = getDefaultFixedValueById(propId, model.getId());
Iterator iter = extendAttrValObj.entrySet().iterator();
JSONObject object = new JSONObject();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
JSONObject valueObj = JSONObject.parseObject(entry.getValue().toString());
object.put(valueObj.getString("key"), valueObj.getString("value"));
}
// 扩展列
if ("extendAttr".equals(config.getString("columnType"))) {
if (extendAttrValObj.containsKey(propId)) {
attrCellValue = extendAttrValObj.getString(propId);
extendAttrValObj = object;
int parentNameCellIndex = 0;
for (int j = 0; j < tempArr.size(); j++) {
HSSFCell attrCell = row.createCell(++cellIndex);
String attrCellValue = "";
JSONObject config = tempArr.getJSONObject(j);
String propId = config.getString("id");
// 伊利定制化需求23-01-05
if ("status".equals(propId)){
parentNameCellIndex = ++cellIndex;
}
// 标准列
if ("default".equals(config.getString("columnType"))) {
attrCellValue = getDefaultFixedValueById(propId, model.getId());
}
// 扩展列
if ("extendAttr".equals(config.getString("columnType"))) {
if (extendAttrValObj.containsKey(propId)) {
attrCellValue = extendAttrValObj.getString(propId);
}
}
attrCell.setCellValue(attrCellValue);
}
long e5 = System.currentTimeMillis();
tempLongList.add(e5 - s5);
HSSFCell attrCell = row.createCell(parentNameCellIndex);
String parentName = model.getParentId().length() < 36 ? I18nRes.findValue(CoEConstant.APP_ID,model.getParentId()) : PALRepositoryCache.getCache().get(model.getParentId()).getName();
attrCell.setCellValue(parentName);
for (int j = 0; j <= cellIndex; j++) {
HSSFCell tempCell = row.getCell(j);
if (tempCell == null) {
tempCell = row.createCell(j);
}
tempCell.setCellStyle(styleData);
}
}
ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));
long e3 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--非合并时间: " + (e3 - s3));
long s4 = System.currentTimeMillis();
// 将已经存在的数据进行合并单元格
if (columMap.size() > 0) {
for (int i = 0; i < columMap.size(); i++) {
Map data = (Map) columMap.get(i);
if (data.size() > 0) {
int rowindex = (Integer) data.get(0);
int fromColumnIndex = (Integer) data.get(1);
int toColumnIndex = (Integer) data.get(2);
if (rowindex >= 0){
CellRangeAddress region = new CellRangeAddress((short) rowindex, (short) rowindex, (short) fromColumnIndex, (short) toColumnIndex);// 合并从第rowFrom行columnFrom列
sheet.addMergedRegion(region);// 到rowTo行columnTo的区域
}
}
}
attrCell.setCellValue(attrCellValue);
}
long e5 = System.currentTimeMillis();
tempLongList.add(e5 - s5);
HSSFCell attrCell = row.createCell(parentNameCellIndex);
String parentName = model.getParentId().length() < 36 ? I18nRes.findValue(CoEConstant.APP_ID,model.getParentId()) : PALRepositoryCache.getCache().get(model.getParentId()).getName();
attrCell.setCellValue(parentName);
long e4 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--合并时间 " + (e4 - s4));
for (int j = 0; j <= cellIndex; j++) {
HSSFCell tempCell = row.getCell(j);
if (tempCell == null) {
tempCell = row.createCell(j);
}
tempCell.setCellStyle(styleData);
}
ExportAPIManager.getInstance().updateExportStatusAndProgressInfo(exportModel.getId(), ProcessListConstant.EXPORT_COMPLATE_STATUS_CODE, 100);
ConsolePrinter.info("流程清单导出当前进度 100%");
ExportAPIManager.getInstance().exportComplateAfter(_uc, exportModel, wb);
} catch (Exception e) {
ConsolePrinter.info("流程清单导出文档生成中异常信息 " + e.getMessage());
ExportAPIManager.getInstance().updateExportStatusAndErrInfo(exportModel.getId(), ProcessListConstant.EXPORT_ERR_STATUS_CODE, "数据异常");
}
ConsolePrinter.info("扩展属性处理时长详细: " + tempLongList.toString());
ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));
long e3 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--非合并时间: " + (e3 - s3));
long s4 = System.currentTimeMillis();
// 将已经存在的数据进行合并单元格
if (columMap.size() > 0) {
for (int i = 0; i < columMap.size(); i++) {
Map data = (Map) columMap.get(i);
if (data.size() > 0) {
int rowindex = (Integer) data.get(0);
int fromColumnIndex = (Integer) data.get(1);
int toColumnIndex = (Integer) data.get(2);
if (rowindex >= 0){
CellRangeAddress region = new CellRangeAddress((short) rowindex, (short) rowindex, (short) fromColumnIndex, (short) toColumnIndex);// 合并从第rowFrom行columnFrom列
sheet.addMergedRegion(region);// 到rowTo行columnTo的区域
}
}
}
}
long e4 = System.currentTimeMillis();
ConsolePrinter.info("处理模型数据--合并时间 " + (e4 - s4));
}
/**

View File

@ -4,4 +4,4 @@
var teamId = "<#teamId>";
var levelSelect = <#levelSelect>;
var defaultSelectVal = <#defaultSelectVal>;
var wHref = "./w";</script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/chunk-203da88e.3e3aba47.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-2004eb4d.47f80d5d.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-203da88e.4207b479.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-2d224ef1.f27d8dfa.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/app.fba1b030.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/app.5c1ffedb.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-vendors.dfef4ec2.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/app.fba1b030.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-vendors.dfef4ec2.js></script><script src=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/app.5c1ffedb.js></script></body></html>
var wHref = "./w";</script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/chunk-95e5ba7a.1ad16f45.css rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-2d224ef1.a46b8fcf.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-3a9b7577.9d1f1636.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-95e5ba7a.fa11addd.js rel=prefetch><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/app.adff2e36.css rel=preload as=style><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/app.d3eeef95.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-vendors.4fca975c.js rel=preload as=script><link href=../apps/com.actionsoft.apps.coe.pal.processlist/main/css/app.adff2e36.css rel=stylesheet></head><body style=margin:0;><div id=app></div><script src=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/chunk-vendors.4fca975c.js></script><script src=../apps/com.actionsoft.apps.coe.pal.processlist/main/js/app.d3eeef95.js></script></body></html>

View File

@ -35,4 +35,11 @@
<param name="tableFilter"/>
<param name="customFilter"/>
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal.processlist_export_log_data">
<param name="wsId"/>
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal.processlist_export_executing_status_get">
<param name="wsId"/>
<param name="exportIds"/>
</cmd-bean>
</aws-actions>

View File

@ -1 +1 @@
#palRelationAddress[data-v-3b59fe57] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#palRelationAddress[data-v-3b59fe57] .el-input__inner{border-radius:0}#palRelationAddress[data-v-3b59fe57] .el-tree{min-width:100%;display:inline-block!important}.checkbox-item[data-v-3b59fe57],.redio-item[data-v-3b59fe57]{margin:10px 0;display:block}.div-left[data-v-3b59fe57]{float:left;width:249px;height:400px;border-right:1px dashed #f2f2f2}.div-middle[data-v-3b59fe57]{float:left;width:248px;height:400px;border-right:1px dashed #f2f2f2}.div-right[data-v-3b59fe57]{float:right;width:249px;height:400px;background-color:#2a85a0}#palRelationAddress[data-v-3b59fe57] .el-table__row .icon-delete-display{display:none}#palRelationAddress[data-v-3b59fe57] .el-table__row:hover .icon-delete-display{display:inline}#palRelationAddress[data-v-3b59fe57] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#palRelationAddress[data-v-3b59fe57] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}#palRepositoryTree[data-v-6527f53c] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#palRepositoryTree[data-v-6527f53c] .el-input__inner{border-radius:0}#palRepositoryTree[data-v-6527f53c] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#palRepositoryTree[data-v-6527f53c] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}.tree[data-v-6527f53c]{overflow:auto;width:458px;height:300px}#palRepositoryTree[data-v-6527f53c] .el-tree{min-width:100%;display:inline-block!important}#bpmOrgAddress[data-v-6de64a47] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#bpmOrgAddress[data-v-6de64a47] .el-input__inner{border-radius:0}#bpmOrgAddress[data-v-6de64a47] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#bpmOrgAddress[data-v-6de64a47] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}.tree[data-v-6de64a47]{overflow:auto;width:458px;height:300px}#bpmOrgAddress[data-v-6de64a47] .el-tree{min-width:100%;display:inline-block!important}.el-select--medium{float:left}a,button,div,i,input,span{outline:none}.grid-content[data-v-478a61d9]{border-radius:4px;min-height:36px}.custom_table_dlg_icon[data-v-478a61d9]{color:#4e7ff9;font-size:20px;cursor:pointer;position:relative;top:5px}.custom-table-dlg-li[data-v-478a61d9]{text-align:left;padding-left:20px;height:30px;line-height:30px;vertical-align:middle;cursor:move}.custom-table-dlg-li[data-v-478a61d9]:hover{background-color:#f5f7fa}.custom-table-dlg-li-item[data-v-478a61d9]{display:inline-block;width:88%}.custom-table-dlg-li-item-icon[data-v-478a61d9]{width:10%;text-align:center}.icon-display[data-v-478a61d9]{display:none}.custom-table-dlg-li:hover .icon-display[data-v-478a61d9]{display:inline-block}.custom-table-dlg-footer[data-v-478a61d9]{height:40px;text-align:right;padding:10px}.draggable-title[data-v-478a61d9]{text-align:left;padding-left:20px;height:30px;line-height:30px;font-size:12px;color:#95a2b2}.head-title[data-v-478a61d9]{display:inline-block}.button_fixed_width[data-v-478a61d9]{width:80px}#customTableDlg[data-v-478a61d9] .awsui-sidebar__header{padding:10px 10px 10px 20px}#processlistMain[data-v-478a61d9] .el-table__row:hover .processlist-title,#processlistMain[data-v-478a61d9] .el-table__row:hover .processlist-title-version{color:#4e7ff9!important}.processlist-title-version[data-v-478a61d9]{display:inline-block;-webkit-transform:scale(.9);font-size:12px;color:#aaa}.btn-more-data[data-v-478a61d9]:hover{color:#4e7ff9}.btn-more-data[data-v-478a61d9]{cursor:pointer}
#palRelationAddress[data-v-3b59fe57] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#palRelationAddress[data-v-3b59fe57] .el-input__inner{border-radius:0}#palRelationAddress[data-v-3b59fe57] .el-tree{min-width:100%;display:inline-block!important}.checkbox-item[data-v-3b59fe57],.redio-item[data-v-3b59fe57]{margin:10px 0;display:block}.div-left[data-v-3b59fe57]{float:left;width:249px;height:400px;border-right:1px dashed #f2f2f2}.div-middle[data-v-3b59fe57]{float:left;width:248px;height:400px;border-right:1px dashed #f2f2f2}.div-right[data-v-3b59fe57]{float:right;width:249px;height:400px;background-color:#2a85a0}#palRelationAddress[data-v-3b59fe57] .el-table__row .icon-delete-display{display:none}#palRelationAddress[data-v-3b59fe57] .el-table__row:hover .icon-delete-display{display:inline}#palRelationAddress[data-v-3b59fe57] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#palRelationAddress[data-v-3b59fe57] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}#palRepositoryTree[data-v-6527f53c] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#palRepositoryTree[data-v-6527f53c] .el-input__inner{border-radius:0}#palRepositoryTree[data-v-6527f53c] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#palRepositoryTree[data-v-6527f53c] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}.tree[data-v-6527f53c]{overflow:auto;width:458px;height:300px}#palRepositoryTree[data-v-6527f53c] .el-tree{min-width:100%;display:inline-block!important}#bpmOrgAddress[data-v-6de64a47] .el-dialog__body{padding:10px 20px;color:#606266;font-size:14px;word-break:break-all}#bpmOrgAddress[data-v-6de64a47] .el-input__inner{border-radius:0}#bpmOrgAddress[data-v-6de64a47] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#f5f7fa;color:#4e7ff9}#bpmOrgAddress[data-v-6de64a47] .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont{color:#4e7ff9!important}.tree[data-v-6de64a47]{overflow:auto;width:458px;height:300px}#bpmOrgAddress[data-v-6de64a47] .el-tree{min-width:100%;display:inline-block!important}.el-select--medium{float:left}a,button,div,i,input,span{outline:none}.grid-content[data-v-54328c3a]{border-radius:4px;min-height:36px}.custom_table_dlg_icon[data-v-54328c3a]{color:#4e7ff9;font-size:20px;cursor:pointer;position:relative;top:5px}.custom-table-dlg-li[data-v-54328c3a]{text-align:left;padding-left:20px;height:30px;line-height:30px;vertical-align:middle;cursor:move}.custom-table-dlg-li[data-v-54328c3a]:hover{background-color:#f5f7fa}.custom-table-dlg-li-item[data-v-54328c3a]{display:inline-block;width:88%}.custom-table-dlg-li-item-icon[data-v-54328c3a]{width:10%;text-align:center}.icon-display[data-v-54328c3a]{display:none}.custom-table-dlg-li:hover .icon-display[data-v-54328c3a]{display:inline-block}.custom-table-dlg-footer[data-v-54328c3a]{height:40px;text-align:right;padding:10px}.draggable-title[data-v-54328c3a]{text-align:left;padding-left:20px;height:30px;line-height:30px;font-size:12px;color:#95a2b2}.head-title[data-v-54328c3a]{display:inline-block}.button_fixed_width[data-v-54328c3a]{width:80px}#customTableDlg[data-v-54328c3a] .awsui-sidebar__header{padding:10px 10px 10px 20px}#processlistMain[data-v-54328c3a] .el-table__row:hover .processlist-title,#processlistMain[data-v-54328c3a] .el-table__row:hover .processlist-title-version{color:#4e7ff9!important}.processlist-title-version[data-v-54328c3a]{display:inline-block;-webkit-transform:scale(.9);font-size:12px;color:#aaa}.btn-more-data[data-v-54328c3a]:hover{color:#4e7ff9}.btn-more-data[data-v-54328c3a]{cursor:pointer}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d224ef1"],{e1f5:function(e,s,t){"use strict";t.r(s);var n=function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",{staticClass:"devGetSession"},[e._v(" 正在获取session ")])},a=[],o=t("a18c"),d=t("0f08"),i=t("4360");d["a"].post({url:"jd",data:{userid:devUserInfo.userid,pwd:devUserInfo.pwd,lang:"cn",cmd:"com.actionsoft.apps.getsession.get",deviceType:"pc"}}).then((function(e){"error"==e.result?alert("获取session错误"+e.msg):(i["a"].commit("edit",{sessionId:e.data.sid}),o["a"].replace("/"))}));var c={data:function(){return{dwList:[]}},methods:{},mounted:function(){}},r=c,u=t("2877"),l=Object(u["a"])(r,n,a,!1,null,null,null);s["default"]=l.exports}}]);

View File

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d224ef1"],{e1f5:function(e,s,t){"use strict";t.r(s);var n=function(){var e=this,s=e._self._c;return s("div",{staticClass:"devGetSession"},[e._v(" 正在获取session ")])},a=[],d=t("a18c"),o=t("0f08"),i=t("4360");o["a"].post({url:"jd",data:{userid:devUserInfo.userid,pwd:devUserInfo.pwd,lang:"cn",cmd:"com.actionsoft.apps.getsession.get",deviceType:"pc"}}).then((function(e){"error"==e.result?alert("获取session错误"+e.msg):(i["a"].commit("edit",{sessionId:e.data.sid}),d["a"].replace("/"))}));var r={data(){return{dwList:[]}},methods:{},mounted(){}},c=r,u=t("0b56"),l=Object(u["a"])(c,n,a,!1,null,null,null);s["default"]=l.exports}}]);