发布代码恢复

This commit is contained in:
zhal 2022-07-19 13:58:01 +08:00
parent 1316b12a24
commit 97fabd9b62
13 changed files with 6297 additions and 0 deletions

View File

@ -0,0 +1,340 @@
package com.actionsoft.apps.coe.pal.publisher.client.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
import com.actionsoft.bpms.commons.database.RowMapper;
import com.actionsoft.bpms.server.conf.server.AWSServerConf;
import com.actionsoft.bpms.util.DBSql;
public class PublisherClientDao {
/**
* 获取模型关联的模型Id
*
* @param id
* @return
* @author zhangming
*/
public List<Map<String, String>> getFileIdsByRelationFileId(String id) {
String sql = "SELECT DISTINCT(r.FILEID), pal.PLNAME, MODIFYDATE FROM APP_ACT_COE_PAL_SHAPE_RLAT r, APP_ACT_COE_PAL_REPOSITORY pal WHERE r.RELATIONFILEID in (" + id + ") AND r.FILEID = pal.ID AND pal.PLCATEGORY='process' ORDER BY MODIFYDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
return map;
}
});
return list;
}
/**
* 获取模型关联的模型Id(只有文件属性关联)
*
* @param id
* @return
* @author zhangming
*/
public List<Map<String, String>> getFileIdsByRelationFileId1(String id) {
String sql = "SELECT DISTINCT(r.FILEID), pal.PLNAME, MODIFYDATE FROM APP_ACT_COE_PAL_SHAPE_RLAT r, APP_ACT_COE_PAL_REPOSITORY pal WHERE r.RELATIONFILEID in (" + id + ") AND r.FILEID = pal.ID AND r.SHAPEID='' AND pal.PLCATEGORY='process' ORDER BY MODIFYDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
return map;
}
});
return list;
}
/**
* 获取管理标准技术标准和工作标准的Id
*
* @return
* @author zhangming
*/
public Map<String, String> getControlPolicyId(String wsId) {
Map<String, String> resultMap = new HashMap<String, String>();
String sql = "SELECT ID, PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME IN (?,?,?) AND WSID=? AND PLMETHODID='control.policy'";
List<Map<String, String>> listMap = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
map.put(rs.getString(2), rs.getString(1));
return map;
}
}, new Object[]{PublisherConstant.ORG_RELATION_MANAGEMENT_STANDARD, PublisherConstant.ORG_RELATION_TECHNICAL_STANDARD, PublisherConstant.ORG_RELATION_WORK_STANDARD, wsId});
for (Map<String, String> map : listMap) {
Set<String> set = map.keySet();
for (String key : set) {
resultMap.put(key, map.get(key));
}
}
return resultMap;
}
/**
* 获取某个范围内的关联模型Id
*
* @param relationFileIds
* @return
* @author zhangming
*/
public List<Map<String, String>> getFileIdsByRelation(String relationFileIds) {
if (relationFileIds == null || "".equals(relationFileIds)) {
return new ArrayList<Map<String, String>>();
}
String sql = "SELECT pal.ID, pal.PLNAME, p.PUBLISHDATE FROM APP_ACT_COE_PAL_REPOSITORY pal, ("
+ " SELECT r.FILEID, MAX(p.PUBLISHDATE) PUBLISHDATE"
+ " FROM APP_ACT_COE_PAL_SHAPE_RLAT r, APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl"
+ " WHERE r.FILEID = pl.PALREPOSITORYID AND r.RELATIONFILEID IN (" + relationFileIds + ") AND p.ID=pl.PID AND pl.ACTIONTYPE='N'"
+ " GROUP BY r.FILEID) p"
+ " WHERE pal.ID = p.FILEID and pal.ISPUBLISH=1"
+ " ORDER BY p.PUBLISHDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
if (rs.getString(1) == null) {
return null;
}
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
Timestamp publishDate = rs.getTimestamp(3);
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
map.put("publishDate", sdf.format(publishDate));
return map;
}
});
return list;
}
/**
* 获取某个范围内的关联模型Id(只有文件属性关联)
*
* @param relationFileIds
* @return
* @author zhangming
*/
public List<Map<String, String>> getFileIdsByRelation1(String relationFileIds) {
if (relationFileIds == null || "".equals(relationFileIds)) {
return new ArrayList<Map<String, String>>();
}
String sql = "SELECT pal.ID, pal.PLNAME, p.PUBLISHDATE FROM APP_ACT_COE_PAL_REPOSITORY pal, ("
+ " SELECT r.FILEID, MAX(p.PUBLISHDATE) PUBLISHDATE"
+ " FROM APP_ACT_COE_PAL_SHAPE_RLAT r, APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl"
+ " WHERE r.FILEID = pl.PALREPOSITORYID AND r.RELATIONFILEID IN (" + relationFileIds + ") AND r.SHAPEID='' AND p.ID=pl.PID AND pl.ACTIONTYPE='N'"
+ " GROUP BY r.FILEID) p"
+ " WHERE pal.ID = p.FILEID and pal.ISPUBLISH=1"
+ " ORDER BY p.PUBLISHDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
if (rs.getString(1) == null) {
return null;
}
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
Timestamp publishDate = rs.getTimestamp(3);
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
map.put("publishDate", sdf.format(publishDate));
return map;
}
});
return list;
}
/**
* 获取某个范围内的被关联模型Id
*
* @param fileIds
* @param relationFileIds
* @return
* @author zhangming
*/
public List<Map<String, String>> getRelationFileIds(String fileIds, String relationFileIds) {
if (fileIds == null || "".equals(fileIds) || relationFileIds == null || "".equals(relationFileIds)) {
return new ArrayList<Map<String, String>>();
}
String sql = "SELECT pal.ID, pal.PLNAME, p.PUBLISHDATE from APP_ACT_COE_PAL_REPOSITORY pal, ("
+ " SELECT r.RELATIONFILEID, MAX(p.PUBLISHDATE) PUBLISHDATE"
+ " FROM APP_ACT_COE_PAL_SHAPE_RLAT r, APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl"
+ " WHERE r.RELATIONFILEID = pl.PALREPOSITORYID AND r.FILEID IN (" + fileIds + ") AND r.RELATIONFILEID IN (" + relationFileIds + ") AND p.ID=pl.PID AND pl.ACTIONTYPE='N'"
+ " GROUP BY r.RELATIONFILEID) p"
+ " WHERE pal.ID=p.RELATIONFILEID and pal.ISPUBLISH=1"
+ " ORDER BY p.PUBLISHDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
if (rs.getString(1) == null) {
return null;
}
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
Timestamp publishDate = rs.getTimestamp(3);
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
map.put("publishDate", sdf.format(publishDate));
return map;
}
});
return list;
}
/**
* 发布历史
*
* @param ids
* @return
* @author zhangming
*/
public List<Map<String, String>> getPublishListData(String ids, String category, String wsId, String methodId) {
if (ids == null || "".equals(ids)) {
return new ArrayList<Map<String, String>>();
}
String sql = "SELECT r.ID, r.PLNAME, p.PUBLISHDATE from APP_ACT_COE_PAL_REPOSITORY r, ("
+ " SELECT pl.PALREPOSITORYID, MAX(p.PUBLISHDATE) publishdate "
+ " FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl"
+ " WHERE p.ID=pl.PID AND pl.PALREPOSITORYID IN (" + ids + ")"
+ " GROUP BY pl.PALREPOSITORYID ) p"
+ " WHERE r.ID = p.PALREPOSITORYID AND r.PLCATEGORY='" + category + "' AND r.PLMETHODID <> 'default' AND r.WSID='" + wsId + "'";
if (methodId != null && !"".equals(methodId)) {
sql += " AND r.PLMETHODID='" + methodId + "'";
}
sql += " ORDER BY p.PUBLISHDATE DESC";
List<Map<String, String>> list = DBSql.query(sql, new RowMapper<Map<String, String>>() {
@Override
public Map<String, String> mapRow(ResultSet rs, int arg1) throws SQLException {
Map<String, String> map = new HashMap<String, String>();
if (rs.getString(1) == null) {
return null;
}
map.put("id", rs.getString(1));
map.put("name", rs.getString(2));
Timestamp publishDate = rs.getTimestamp(3);
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
map.put("publishDate", sdf.format(publishDate));
return map;
}
});
return list;
}
/**
* 根据name获取未发布的流程文件
* @param name
* @param wsId
* @param methodId
* @return
*/
public List<PALRepositoryModel> getCoeProcessLevelByNamen(String name, String wsId, String methodId) {
String namelike = "";
if (StringUtil.containSpecialChar(name)) {
namelike = "'%" + StringUtil.replaceSqlStr(name, AWSServerConf.isMySQL()) + "%'" + (AWSServerConf.isMySQL() ? "ESCAPE '\\\\'" : " ESCAPE '\\'");
} else {
namelike = "'%" + name + "%'";
}
StringBuilder sql = new StringBuilder("select * from " + PALRepositoryModelImpl.DATABASE_ENTITY + " where " + PALRepositoryModelImpl.FIELD_WS_ID + "='" + wsId + "' and " + PALRepositoryModelImpl.FIELD_PL_NAME + " like " + namelike + " and ISPUBLISH = '0'");
if (methodId != null && !"".equals(methodId)) {
sql.append(" and PLMETHODID = '" + methodId + "' ");
}
sql.append(" ORDER BY " + PALRepositoryModelImpl.FIELD_PL_ORDERINDEX + " ASC");
return DBSql.query(sql.toString(), new PALRespositoryModelMapper());
}
/**
* 根据name获取有多个版本的流程文件
* @param name
* @param wsId
* @param methodId
* @return
*/
public List<PALRepositoryModel> getCoeProcessLevelByNamec(String name, String wsId, String methodId) {
String namelike = "";
if (StringUtil.containSpecialChar(name)) {
namelike = "'%" + StringUtil.replaceSqlStr(name, AWSServerConf.isMySQL()) + "%'" + (AWSServerConf.isMySQL() ? "ESCAPE '\\\\'" : " ESCAPE '\\'");
} else {
namelike = "'%" + name + "%'";
}
StringBuilder sql = new StringBuilder("select * from " + PALRepositoryModelImpl.DATABASE_ENTITY + " where " + PALRepositoryModelImpl.FIELD_WS_ID + "='" + wsId + "' and " + PALRepositoryModelImpl.FIELD_PL_NAME + " like " + namelike + " and ISPUBLISH = '1'");
String sqlcount = "select count(*) from " + PALRepositoryModelImpl.DATABASE_ENTITY + " where " + PALRepositoryModelImpl.FIELD_WS_ID + "='" + wsId + "' and " + PALRepositoryModelImpl.FIELD_PL_NAME + " like " + namelike + "";
if (methodId != null && !"".equals(methodId)) {
sql.append(" and PLMETHODID = '" + methodId + "' ");
}
sql.append(" ORDER BY " + PALRepositoryModelImpl.FIELD_PL_ORDERINDEX + " ASC");
sqlcount+=" ORDER BY " + PALRepositoryModelImpl.FIELD_PL_ORDERINDEX + " ASC";
String num = DBSql.getString(sqlcount);
int number = Integer.parseInt(num);
if(number <= 1) {
List<PALRepositoryModel> data = null;
return data;
}
return DBSql.query(sql.toString(), new PALRespositoryModelMapper());
}
/**
* 根据name获取停用的流程文件
* @param name
* @param wsId
* @param category
* @return
*/
public List<PALRepositoryModel> getCoeProcessLevelByNameAndCategorys(String name, String wsId, String category) {
String namelike = "";
if (StringUtil.containSpecialChar(name)) {
namelike = "'%" + StringUtil.replaceSqlStr(name, AWSServerConf.isMySQL()) + "%'" + (AWSServerConf.isMySQL() ? "ESCAPE '\\\\'" : " ESCAPE '\\'");
} else {
namelike = "'%" + name + "%'";
}
StringBuilder sql = new StringBuilder("select * from " + PALRepositoryModelImpl.DATABASE_ENTITY + " where " + PALRepositoryModelImpl.FIELD_WS_ID + "='" + wsId + "' and " + PALRepositoryModelImpl.FIELD_PL_NAME + " like " + namelike + " and " + PALRepositoryModelImpl.FIELD_IS_USE + "='1' and ISPUBLISH = '1'");
if (category != null && !"".equals(category)) {
sql.append(" and PLCATEGORY = '" + category + "' ");
}
sql.append(" ORDER BY " + PALRepositoryModelImpl.FIELD_PL_ORDERINDEX + " ASC");
return DBSql.query(sql.toString(), new PALRespositoryModelMapper());
}
private class PALRespositoryModelMapper implements RowMapper<PALRepositoryModel> {
PALRepository pal = new PALRepository();
public PALRepositoryModel mapRow(ResultSet rs, int arg1) throws SQLException {
return (PALRepositoryModel) pal.record2Model(rs);
}
}
/**
* 根据userId获取资源Id列表
* @param userId
* @return
*/
public List<String> getTeamUserPerms(String userId) {
String sql = " select distinct perm.RESOURCEID from APP_ACT_NETWORK_TEAM_MEMBER tm , APP_ACT_COE_TEAM_PERM perm " +
"where tm.TEAMID=perm.TEAMID and tm.MEMBERSTATUS='1' and tm.USERID=? ";
List<String> resourceIdList = DBSql.query(sql.toString(), new RowMapper<String>() {
@Override
public String mapRow(ResultSet rs, int arg1) throws SQLException {
return rs.getString(1);
}
}, new Object[] { userId });
if(resourceIdList == null) {
resourceIdList = new ArrayList<String>();
}
return resourceIdList;
}
}

View File

@ -0,0 +1,106 @@
package com.actionsoft.apps.coe.pal.publisher.client.dto;
/**
* 流程发布代办已办传输类
*
* @author 郝文豪(James)
* @date 2020/7/13 0013 上午 11:16
*/
public class ProcessPublishDTO {
/**
* 流程实例id
*/
private String processInstId;
/**
* 序号
*/
private int index;
/**
* 标题
*/
private String title;
/**
* 来自谁+部门
*/
private String fromUser;
/**
* 接收时间
*/
private String date;
/**
* 是否是自己发起填写的流程
*/
private boolean ownerProcess;
/**
* 任务实例id
*/
private String taskInstId;
/**
* 打开状态
*/
private String openState;
public String getProcessInstId() {
return processInstId;
}
public void setProcessInstId(String processInstId) {
this.processInstId = processInstId;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFromUser() {
return fromUser;
}
public void setFromUser(String fromUser) {
this.fromUser = fromUser;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public boolean isOwnerProcess() {
return ownerProcess;
}
public void setOwnerProcess(boolean ownerProcess) {
this.ownerProcess = ownerProcess;
}
public String getTaskInstId() {
return taskInstId;
}
public void setTaskInstId(String taskInstId) {
this.taskInstId = taskInstId;
}
public String getOpenState() {
return openState;
}
public void setOpenState(String openState) {
this.openState = openState;
}
}

View File

@ -0,0 +1,140 @@
package com.actionsoft.apps.coe.pal.publisher.client.dto;
import java.io.Serializable;
/**
* 流程发布的数据传输对象类
*
* @author 郝文豪(James)
* @date 2020/4/7 0007 下午 2:09
*/
public class ProcessPublishHistoryDTO implements Serializable {
/**
* 流程实例id
*/
private String processInstId;
/**
* 标题
*/
private String title;
/**
* 申请人
*/
private String createUser;
/**
* 申请时间
*/
private String createTime;
/**
* 类型
*/
private String type;
/**
* 审批状态
*/
private String approvalState;
/**
* 审批人
*/
private String approvalUser;
/**
* 审批人id
*/
private String approvalUserId;
/**
* 是否完成
*/
private Boolean end;
/**
* 任务实例id
*/
private String taskInstId;
public String getTaskInstId() {
return taskInstId;
}
public void setTaskInstId(String taskInstId) {
this.taskInstId = taskInstId;
}
public String getProcessInstId() {
return processInstId;
}
public void setProcessInstId(String processInstId) {
this.processInstId = processInstId;
}
public Boolean getEnd() {
return end;
}
public void setEnd(Boolean end) {
this.end = end;
}
public String getApprovalUserId() {
return approvalUserId;
}
public void setApprovalUserId(String approvalUserId) {
this.approvalUserId = approvalUserId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getApprovalState() {
return approvalState;
}
public void setApprovalState(String approvalState) {
this.approvalState = approvalState;
}
public String getApprovalUser() {
return approvalUser;
}
public void setApprovalUser(String approvalUser) {
this.approvalUser = approvalUser;
}
}

View File

@ -0,0 +1,32 @@
package com.actionsoft.apps.coe.pal.publisher.client.util;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import com.actionsoft.bpms.commons.database.RowMapper;
import com.actionsoft.bpms.commons.pagination.SQLPagination;
import com.actionsoft.bpms.util.DBSql;
/**
* 导航处理类
*
* @author ZZ
*
*/
public class PublisherSkinsDao {
public long getPrevLoginTime(String userId) {
long prevLoginTime = 0;
String sql = " select * from SYS_SESSION s where s.userid = '" + userId + "' order by s.STARTTIME desc ";
List<Long> list = DBSql.query(SQLPagination.getPaginitionSQL(sql, 0, 2), new RowMapper<Long>() {
public Long mapRow(ResultSet rs, int paramInt) throws SQLException {
return rs.getLong("starttime");
}
});
if (list != null && list.size() > 0) {
prevLoginTime = list.get(list.size() - 1);
}
return prevLoginTime;
}
}

View File

@ -0,0 +1,235 @@
package com.actionsoft.apps.coe.pal.publisher.conf;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
public final class PublisherConf {
public static final String APPID = "com.actionsoft.apps.coe.pal.publisher";
public static final String RELATION_SEARCH_ID = "com.actionsoft.apps.coe.pal.relationsearch";
public static final String RELATION_SEARCH_NAME = "关联查询";
public static final String PORTAL_TREE_ICON_FOLDER = "../apps/com.actionsoft.apps.coe.pal.publisher/img/tree-folder.png";
public static final String PORTAL_TREE_ICON_FOLDER1 = "../apps/com.actionsoft.apps.coe.pal.publisher/img/tree-folder1.png";
public static String PUBLISH_PORTAL_VERSION = "v1";
public static String XPAGES_ID = "";
public static JSONArray PORTAL_TABS = null;
/**
* 页底信息如客户流程管理部联系信息
*
* @return
*/
public static String getFotter() {
String value = SDK.getAppAPI().getProperty(APPID, "fotter");
if (UtilString.isEmpty(value)) {
value = "炎黄盈动";
}
return value;
}
public static void setFotter(String fotter) {
fotter = fotter == null ? "" : fotter;
SDK.getAppAPI().setProperty(APPID, "fotter", fotter);
}
/**
* 门户标题
*
* @return
*/
public static String getTitle() {
String value = SDK.getAppAPI().getProperty(APPID, "title");
if (UtilString.isEmpty(value)) {
value = "CoE Process Portal";
}
return value;
}
public static void setTitle(String title) {
title = title == null ? "" : title;
SDK.getAppAPI().setProperty(APPID, "title", title);
}
/**
* 流程发布流程版本Id
*
* @return
*/
public static String getPublishProcessId() {
String value = SDK.getAppAPI().getProperty(APPID, "publishProcessId");
return value;
}
/**
* 发布门户的浏览者是否整合AWS用户
*
* @return 整合返回true
*/
public static boolean isIntegrationAWSUser() {
String value = SDK.getAppAPI().getProperty(APPID, "isIntegrationAWSUser");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
/**
* 如果门户未整合AWS用户此处配置来自外部系统访问门户的统一访客账户该账户是AWS平台合法的账户
*
* @return
*/
public static String getGuest() {
String value = SDK.getAppAPI().getProperty(APPID, "guest");
return value;
}
/**
* 发布门户的内容允许复制
*
* @return 允许返回true
*/
public static boolean isCopy() {
String value = SDK.getAppAPI().getProperty(APPID, "isCopy");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
public static void setCopy(String isCopy) {
if (isCopy != null && isCopy.trim().equalsIgnoreCase("true")) {
isCopy = "true";
} else {
isCopy = "false";
}
SDK.getAppAPI().setProperty(APPID, "isCopy", isCopy);
}
/**
* 发布门户的内容允许打印
*
* @return 允许返回true
*/
public static boolean isPrint() {
String value = SDK.getAppAPI().getProperty(APPID, "isPrint");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
public static void setPrint(String isPrint) {
if (isPrint != null && isPrint.trim().equalsIgnoreCase("true")) {
isPrint = "true";
} else {
isPrint = "false";
}
SDK.getAppAPI().setProperty(APPID, "isPrint", isPrint);
}
/**
* 发布门户的内容允许留言
*
* @return 允许返回true
*/
public static boolean isComment() {
String value = SDK.getAppAPI().getProperty(APPID, "isComment");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
public static void setComment(String isComment) {
if (isComment != null && isComment.trim().equalsIgnoreCase("true")) {
isComment = "true";
} else {
isComment = "false";
}
SDK.getAppAPI().setProperty(APPID, "isComment", isComment);
}
/**
* 发布门户的内容允许查看属性
*
* @return 允许返回true
*/
public static boolean isViewAttribute() {
String value = SDK.getAppAPI().getProperty(APPID, "isViewAttribute");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
public static void setViewAttribute(String isViewAttribute) {
if (isViewAttribute != null && isViewAttribute.trim().equalsIgnoreCase("true")) {
isViewAttribute = "true";
} else {
isViewAttribute = "false";
}
SDK.getAppAPI().setProperty(APPID, "isViewAttribute", isViewAttribute);
}
/**
* 发布门户的内容允许查看历史发布记录
*
* @return 允许返回true
*/
public static boolean isViewHistory() {
String value = SDK.getAppAPI().getProperty(APPID, "isViewHistory");
return (value != null && value.trim().equalsIgnoreCase("true")) ? true : false;
}
public static void setViewHistory(String isViewHistory) {
if (isViewHistory != null && isViewHistory.trim().equalsIgnoreCase("true")) {
isViewHistory = "true";
} else {
isViewHistory = "false";
}
SDK.getAppAPI().setProperty(APPID, "isViewHistory", isViewHistory);
}
/**
* 流程管理门户xpage
* @param type common常用流程frequency高频流程systemMap系统地图processMap流程地图notification发布动态
* @return
*/
public static String getXpagesContent(String type) {
StringBuffer content = new StringBuffer();
switch (type) {
case "common":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.common.js'></script>");
break;
case "frequency":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.frequency.js'></script>");
break;
case "systemMap":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.systemmap.js'></script>");
break;
case "dataMap":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.datamap.js'></script>");
break;
case "controlMap":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.controlmap.js'></script>");
break;
case "orgMap":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.orgmap.js'></script>");
break;
case "processMap":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.processmap.js'></script>");
break;
case "notification":
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.notification.js'></script>");
break;
case "banner":// 横幅轮播图
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.banner.js'></script>");
break;
case "participant":// 我参与的
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.participant.js'></script>");
break;
case "responsible":// 我负责的
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.responsible.js'></script>");
break;
case "postresponsibility":// 岗位职责
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.postresponsibility.js'></script>");
break;
case "rcaimatrix":// rcai矩阵
content.append("<script src='../apps/com.actionsoft.apps.coe.pal.publisher/js/publish.xpages.rcaimatrix.js'></script>");
break;
default:
break;
}
return content.toString();
}
}

View File

@ -0,0 +1,67 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.listener.AppListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.util.Base64;
import com.actionsoft.exception.AWSException;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
public class AppInstallListener implements AppListener {
@SuppressWarnings("resource")
@Override
public void after(AppContext app) {
// 流程管理门户xpages文件同步到xpages应用中
try {
String path = AppsConst.APPS_ROOT + AppsConst.FOLDER_INSTALL + File.separator + app.getId() + File.separator + "xpages" + File.separator;
File fileDir = new File(path);
if (fileDir.exists()) {
File [] files = fileDir.listFiles();
for (File file : files) {
InputStream input = null;
ByteArrayOutputStream arrayOutputStream = null;
input = new FileInputStream(file);
arrayOutputStream = new ByteArrayOutputStream();
byte [] buf = new byte[1024];
int len = 0;
while ((len = input.read(buf)) != -1) {
arrayOutputStream.write(buf, 0, len);
}
byte [] bytedata = arrayOutputStream.toByteArray();
String content = new String(Base64.encode(bytedata));
// 调用App
String sourceAppId = app.getId();
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.xpages/createTemplateByContent";
// 参数定义列表
Map<String, Object> params = new HashMap<>();
//内容,必填
params.put("content", content);
//0,覆盖 1不覆盖,非必填
params.put("overWriteFlag", "0");
AppAPI appAPI = SDK.getAppAPI();
//根据一个xpages文件的内容创建一个xpages模板记录
appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new AWSException("流程管理门户xpages文件解析错误");
}
}
@Override
public boolean before(AppContext arg0) {
return true;
}
}

View File

@ -0,0 +1,44 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import com.actionsoft.apps.coe.pal.publisher.conf.PublisherConf;
import com.actionsoft.apps.listener.AppListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.exception.AWSException;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
public class AppStartListener implements AppListener{
@Override
public void after(AppContext arg0) {
// 初始化门户版本
String value = SDK.getAppAPI().getProperty(PublisherConf.APPID, "portalVersion");
PublisherConf.PUBLISH_PORTAL_VERSION = value;
if (value.equals("v3")) {
// 初始化门户配置
String xpagesId = SDK.getAppAPI().getProperty(PublisherConf.APPID, "portalTemplateId_xpages");
if ("".equals(xpagesId.trim())) {
throw new AWSException("PAL门户默认xpages模版配置参数不允许为空");
}
PublisherConf.XPAGES_ID = xpagesId;
String portalTabs = SDK.getAppAPI().getProperty(PublisherConf.APPID, "portalTabs");
if (!"".equals(portalTabs.trim())) {
try {
JSONArray array = JSON.parseArray(portalTabs.trim());
PublisherConf.PORTAL_TABS = array;
} catch (Exception e) {
throw new AWSException("PAL门户Tab标签配置参数解析出错请检查参数格式是否正确");
}
} else {
PublisherConf.PORTAL_TABS = new JSONArray();
}
}
}
@Override
public boolean before(AppContext arg0) {
return true;
}
}

View File

@ -0,0 +1,57 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.lifecycle.log.AppsLogger;
import com.actionsoft.apps.listener.AppListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.util.ConsolePrinter;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import com.alibaba.fastjson.JSONObject;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class AppUnInstallListener implements AppListener {
@Override
public void after(AppContext app) {
// TODO Auto-generated method stub
ConsolePrinter.info("publish app custom uninstall");
System.out.print("publish app custom uninstall");
ResponseObject ro = ResponseObject.newOkResponse();
AppAPI appAPI = SDK.getAppAPI();
String sourceAppId = app.getId();
String xpagesid = "com.actionsoft.apps.addons.xpages";
AppContext xpagesApp = appAPI.getAppContext(xpagesid);
AppContext publishApp = appAPI.getAppContext(sourceAppId);
if (xpagesApp != null && SDK.getAppAPI().isActive(xpagesApp.getId())) {
// 服务地址
String aslp = "aslp://com.actionsoft.apps.addons.xpages/deleteTemplate";
Map<String, Object> params = new HashMap<String, Object>();
try {
// 参数定义列表
String templateId = "30267ab3-aeb6-4371-88e0-ecc13cef94a6";
params.put("templateId", templateId);
appAPI.callASLP(publishApp, aslp, params);
if (ro.isErr()) {
AppsLogger.err(publishApp, ro.getMsg());
}
ConsolePrinter.info(ro.toString());
} catch (Exception e) {
e.printStackTrace();
ro.err(e.getMessage());
}
}
}
@Override
public boolean before(AppContext arg0) {
return true;
}
}

View File

@ -0,0 +1,120 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.lifecycle.dist.DistContext;
import com.actionsoft.apps.lifecycle.event.AppCustomActionInterface;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.util.Base64;
import com.actionsoft.bpms.util.ConsolePrinter;
import com.actionsoft.exception.AWSException;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
public class PublishAppCustomAction implements AppCustomActionInterface {
@Override
public void dist(AppContext app, DistContext distCtx) {
// TODO Auto-generated method stub
}
@Override
public void install(AppContext app) {
ConsolePrinter.info("publish app custom install");
System.out.print("publish app custom install");
// 流程管理门户xpages文件同步到xpages应用中
handleXPagesTemplate(app,"0");
}
public void uninstall(AppContext app) {
// TODO Auto-generated method stub
ConsolePrinter.info("publish app custom uninstall");
System.out.print("publish app custom uninstall");
//根据publish应用下的模板路径对应删除掉xpages模板
String path = AppsConst.APPS_ROOT + AppsConst.FOLDER_INSTALL + File.separator + app.getId() + File.separator + "xpages" + File.separator;
ConsolePrinter.info(path);
File fileDir = new File(path);
if (fileDir.exists()) {
File [] files = fileDir.listFiles();
for (File file : files) {
String sourceAppId = app.getId();
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.xpages/deleteTemplate";
// 参数定义列表
Map<String, Object> params = new HashMap<>();
String fileName = file.getName();
String templateId ="";
int dotindex = fileName.lastIndexOf(".");
if (dotindex != -1) {
templateId = fileName.substring(0, dotindex);
}
System.out.print(templateId);
ConsolePrinter.info(templateId);
params.put("templateId", templateId);
AppAPI appAPI = SDK.getAppAPI();
appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
}
}
}
@Override
public void upgrade(AppContext app) {
// TODO Auto-generated method stub
handleXPagesTemplate(app,"0");
}
/**
* 操作xpages模板
* @param app
* @param overWriteFlag
*/
private void handleXPagesTemplate(AppContext app,String overWriteFlag){
// 流程管理门户xpages文件同步到xpages应用中
try {
String path = AppsConst.APPS_ROOT + AppsConst.FOLDER_INSTALL + File.separator + app.getId() + File.separator + "xpages" + File.separator;
ConsolePrinter.info(path);
File fileDir = new File(path);
if (fileDir.exists()) {
File [] files = fileDir.listFiles();
for (File file : files) {
InputStream input = null;
ByteArrayOutputStream arrayOutputStream = null;
input = new FileInputStream(file);
arrayOutputStream = new ByteArrayOutputStream();
byte [] buf = new byte[1024];
int len = 0;
while ((len = input.read(buf)) != -1) {
arrayOutputStream.write(buf, 0, len);
}
byte [] bytedata = arrayOutputStream.toByteArray();
String content = new String(Base64.encode(bytedata));
// 调用App
String sourceAppId = app.getId();
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.xpages/createTemplateByContent";
// 参数定义列表
Map<String, Object> params = new HashMap<>();
//内容,必填
params.put("content", content);
//0,覆盖 1不覆盖,非必填
params.put("overWriteFlag", overWriteFlag);
AppAPI appAPI = SDK.getAppAPI();
//根据一个xpages文件的内容创建一个xpages模板记录
appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new AWSException("流程管理门户xpages文件解析错误");
}
}
}

View File

@ -0,0 +1,244 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import com.actionsoft.apps.coe.pal.pal.manage.publish.dao.PublishHistory;
import com.actionsoft.apps.coe.pal.pal.manage.publish.model.PublishHistoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
public class PublishInstanceAfterReactivateLIstener extends ExecuteListener{
@Override
public String getDescription() {
return "流程复活后进行相关数据还原处理";
}
@Override
public String getProvider() {
return "aws-coe";
}
@Override
public String getVersion() {
return "V6.3";
}
@Override
public void execute(ProcessExecutionContext ctx) throws Exception {
String processInstId = ctx.getProcessInstance().getId();
ProcessInstance processInstance = ctx.getProcessInstance();
SDK.getLogAPI().consoleInfo("-----------执行流程复活后事件-------------");
SDK.getLogAPI().consoleInfo("流程实例标题:" + processInstance.getTitle() + "[processInstId=" + processInstId + "]");
// 获取相关的流程数据
List<BO> bolistN = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(processInstId).list();
List<BO> bolistC = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_C).bindId(processInstId).list();
List<BO> bolistS = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_S).bindId(processInstId).list();
List<PALRepositoryModel> pList = new ArrayList<>();
if (bolistN != null) {
for (BO boN : bolistN) {
String publishFileId = boN.get("PUBLISHFILEID").toString();
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(publishFileId);
if (palModel != null && palModel.isPublish()) {// 若当前为非已发布状态则不进行处理
// 若当前流程model.getPalRepositoryId()除此次发布以外存在发布过变更过废止过则退回至停用状态否则退回至设计状态
// List<PublishListHistoryModel> allPublishData = listDao.query("PALREPOSITORYID = ?", publishFileId).list();
List<RowMap> allPublishData = DBSql.getMaps("SELECT ID FROM SYS_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID = ?", new Object[] {publishFileId});
if (allPublishData != null) {
boolean isPublish = false;
boolean isStop = false;
boolean isApproval = false;
if (allPublishData.size() > 1) {
// 退回至停用状态
isStop = true;
} else {
// 退回至设计状态
}
createResultMap(palModel.getName(), palModel.getId(), isPublish, isStop, isApproval, pList);
}
}
}
}
if (bolistC != null) {
for (BO boC : bolistC) {
String changefileId = boC.get("CHANGEFILEID").toString();// 变更文件id
String changedFileIdNew = boC.get("CHANGEDFILEIDNEW").toString();// 变更后文件id
PALRepositoryModel changeModel = PALRepositoryCache.getCache().get(changefileId);
PALRepositoryModel changeNewModel = PALRepositoryCache.getCache().get(changedFileIdNew);
// 符合该条件可进行复活状态值不符合则暂时不处理
if (changeModel != null && changeNewModel != null && changeModel.isStop() && changeNewModel.isPublish()) {
// changeModel退回至已发布状态
boolean isPublish = true;
boolean isStop = false;
boolean isApproval = false;
createResultMap(changeModel.getName(), changefileId, isPublish, isStop, isApproval, pList);
// List<PublishListHistoryModel> allchangeData = listDao.query("PALREPOSITORYID = ?", changedFileIdNew).list();
List<RowMap> allchangeData = DBSql.getMaps("SELECT ID FROM SYS_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID = ?", new Object[] {changedFileIdNew});
if (allchangeData != null) {
isPublish = false;
isStop = false;
isApproval = false;
if (allchangeData.size() > 1) {
// changeNewModel退回至停用状态
isStop = true;
} else {
// changeNewModel退回至设计状态
}
createResultMap(changeNewModel.getName(), changedFileIdNew, isPublish, isStop, isApproval, pList);
}
}
}
}
if (bolistS != null) {
for (BO boS : bolistS) {
String stopFileId = boS.get("STOPFILEID").toString();
PALRepositoryModel stopModel = PALRepositoryCache.getCache().get(stopFileId);
// 已停用且该流程版本下所有流程没有在发布状态的进行退回保证退回之后该流程所有版本中只有一条为已发布状态
if (stopModel != null && stopModel.isStop()) {
List<PALRepositoryModel> stopList = PALRepositoryCache.getByVersionId(stopModel.getVersionId());
boolean flag = false;
for (PALRepositoryModel model : stopList) {
if (model.isPublish()) {
flag = true;
break;
}
}
if (!flag) {
// 退回至已发布状态
boolean isPublish = true;
boolean isStop = false;
boolean isApproval = false;
createResultMap(stopModel.getName(), stopFileId, isPublish, isStop, isApproval, pList);
}
}
}
}
if (pList.size() > 0) {
restoreData(pList, processInstId);
}
}
/**
* 还原数据
* @param pList
* @param processInstId
*/
private void restoreData(List<PALRepositoryModel> pList, String processInstId) {
// 批量处理回退数据
boolean flag = batchHandleRepositoryData(pList);
int r = 0;
if (flag) {
// 删除SYS_COE_PAL_PUBLISH和SYS_COE_PAL_PUBLISH_LIST表数据
PublishHistory dao = new PublishHistory();// 发布结果主表
PublishHistoryModel history = dao.queryBy("PROCESSINSTID = ?", processInstId);
if (history != null) {
r = dao.delete(history.getId());
}
SDK.getLogAPI().consoleInfo("流程状态还原,变更数据[" + pList.size() + "]条");
for (PALRepositoryModel model : pList) {
SDK.getLogAPI().consoleInfo("流程名称:" + model.getName() + "[id=" + model.getId() + ",isPublish=" + model.isPublish() + ",isStop=" + model.isStop() + "]");
}
if (r > 0) {
SDK.getLogAPI().consoleInfo("删除发布结果数据成功[processInstId=" + processInstId + "]");
}
}
}
/**
* 流程数据库状态还原
* @param pList
* @return
*/
private boolean batchHandleRepositoryData(List<PALRepositoryModel> pList) {
boolean completeSuccess = false;
Connection conn = DBSql.open();
PreparedStatement ps = null;
java.sql.ResultSet rset = null;
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
try {
conn.setAutoCommit(false);
String sql = "UPDATE " + PALRepositoryModelImpl.DATABASE_ENTITY + " SET "
+ PALRepositoryModelImpl.FIELD_PL_ISPUBLISH + " =?, "
+ PALRepositoryModelImpl.FIELD_PL_ISSTOP + "= ?,"
+ PALRepositoryModelImpl.FIELD_PL_MODIFYDATE + " = ? WHERE "
+ PALRepositoryModelImpl.FIELD_UUID + "=?";
ps = conn.prepareStatement(sql);
for (int i = 0; i < pList.size(); i++) {
String id = pList.get(i).getId();
int isPublish = pList.get(i).isPublish() ? 1 : 0;
int isStop = pList.get(i).isStop() ? 1 : 0;
ps.setInt(1, isPublish);
ps.setInt(2, isStop);
ps.setTimestamp(3, nowTime);
ps.setString(4, id);
ps.addBatch();
}
int[] results = ps.executeBatch();
for (int i = 0; i < results.length; i++) {
if ((results[i] >= 0) || (results[i] == PreparedStatement.SUCCESS_NO_INFO)) {
completeSuccess = true;
}
}
if (completeSuccess) {
conn.commit();
PALRepository dao = new PALRepository();
for (PALRepositoryModel model : pList) {
PALRepositoryModel model2 = dao.getInstance(model.getId());
if (model2 != null) {
PALRepositoryCache.getCache().put(model2.getId(), model2);
}
}
} else {
conn.rollback();
PALRepositoryCache.getCache().reload();
}
} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
e.printStackTrace();
} finally {
DBSql.close(conn, ps, rset);
}
return completeSuccess;
}
/**
* 结果集用于批量处理数据源
* @param id
* @param isPublish
* @param isStop
* @param isApproval
*/
private void createResultMap(String name, String id, boolean isPublish, boolean isStop, boolean isApproval, List<PALRepositoryModel> pList) {
PALRepositoryModelImpl modelImpl = new PALRepositoryModelImpl();
modelImpl.setId(id);
modelImpl.setName(name);
modelImpl.setPublish(isPublish);
modelImpl.setStop(isStop);
// modelImpl.setApproval(isApproval);// 不处理
pList.add(modelImpl);
}
}

View File

@ -0,0 +1,50 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.sdk.local.SDK;
import java.util.List;
public class PublishProcessAfterDeleteListener extends ExecuteListener {
@Override
public String getDescription() {
return "流程实例删除后更改模型文件的状态信息";
}
@Override
public String getProvider() {
return "aws-coe";
}
@Override
public void execute(ProcessExecutionContext param) throws Exception {
String processInstId = param.getProcessInstance().getId();
// 发布的
List<BO> bolistN = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(processInstId).list();
PALRepository repositoryDao = new PALRepository();
if (bolistN != null) {
for (BO boN : bolistN) {
repositoryDao.updateIsApproval(0,boN.get("PUBLISHFILEID").toString());
}
}
// 变更的
List<BO> bolistC = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_C).bindId(processInstId).list();
if (bolistC != null) {
for (BO boC : bolistC) {
repositoryDao.updateIsApproval(0,boC.get("CHANGEDFILEIDNEW").toString());
}
}
// 停用的
List<BO> bolistS = SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_S).bindId(processInstId).list();
if (bolistS != null) {
for (BO boS : bolistS) {
repositoryDao.updateIsApproval(0,boS.get("STOPFILEID").toString());
}
}
}
}

View File

@ -0,0 +1,71 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import java.util.List;
import com.actionsoft.bpms.bo.design.model.BOItemModel;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.FormGridFilterListener;
import com.actionsoft.bpms.bpmn.engine.listener.FormGridRowLookAndFeel;
import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst;
import com.actionsoft.bpms.form.design.model.FormItemModel;
public class SubFormGridFilterListener extends FormGridFilterListener {
@Override
public FormGridRowLookAndFeel acceptRowData(ProcessExecutionContext context, List<BOItemModel> boItemList, BO boData) {
String tableName = context.getParameterOfString(ListenerConst.FORM_EVENT_PARAM_BONAME);
if (tableName.equals("BO_ACT_COE_PUBLISH_N")) {
//创建一个对象
FormGridRowLookAndFeel diyLookAndFeel = new FormGridRowLookAndFeel();
String fileName = boData.getString("PUBLISHFILENAME");
if (fileName != null) {
boData.set("PUBLISHFILENAME", "<a style=\"cursor: pointer; color: rgb(51, 131, 218);\" onclick=\"openModel(\'" + boData.getString("PUBLISHFILEID") + "\')\">" + fileName + "</a>");// 重新设定一个字段的值
}
boData.set("字段子表字段名", "|");
//处理好之后将该对象返回
return diyLookAndFeel;
} else if (tableName.equals("BO_ACT_COE_PUBLISH_C")) {
//创建一个对象
FormGridRowLookAndFeel diyLookAndFeel = new FormGridRowLookAndFeel();
String fileName1 = boData.getString("CHANGEFILENAME");
if (fileName1 != null) {
boData.set("CHANGEFILENAME", "<a style=\"cursor: pointer; color: rgb(51, 131, 218);\" onclick=\"openModel(\'" + boData.getString("CHANGEFILEID") + "\')\">" + fileName1 + "</a>");// 重新设定一个字段的值
}
String fileName2 = boData.getString("CHANGEDFILENAMENEW");
if (fileName2 != null) {
boData.set("CHANGEDFILENAMENEW", "<a style=\"cursor: pointer; color: rgb(51, 131, 218);\" onclick=\"openModel(\'" + boData.getString("CHANGEDFILEIDNEW") + "\')\">" + fileName2 + "</a>");// 重新设定一个字段的值
}
boData.set("字段子表字段名", "|");
//处理好之后将该对象返回
return diyLookAndFeel;
} else if (tableName.equals("BO_ACT_COE_PUBLISH_S")) {
//创建一个对象
FormGridRowLookAndFeel diyLookAndFeel = new FormGridRowLookAndFeel();
String fileName = boData.getString("STOPFILENAME");
if (fileName != null) {
boData.set("STOPFILENAME", "<a style=\"cursor: pointer; color: rgb(51, 131, 218);\" onclick=\"openModel(\'" + boData.getString("STOPFILEID") + "\')\">" + fileName + "</a>");// 重新设定一个字段的值
}
boData.set("字段子表字段名", "|");
//处理好之后将该对象返回
return diyLookAndFeel;
}
return null;
}
@Override
public String getCustomeTableHeaderHtml(ProcessExecutionContext arg0, FormItemModel arg1, List<String> arg2) {
return null;
}
@Override
public String orderByStatement(ProcessExecutionContext arg0) {
return null;
}
}