diff --git a/com.actionsoft.apps.coe.pal.cooperation/web/com.actionsoft.apps.coe.pal.cooperation/main/img/iconfont.ce1b01d3.ce1b01d3.svg b/com.actionsoft.apps.coe.pal.cooperation/web/com.actionsoft.apps.coe.pal.cooperation/main/img/iconfont.ce1b01d3.ce1b01d3.svg
deleted file mode 100644
index c8bbdca4..00000000
--- a/com.actionsoft.apps.coe.pal.cooperation/web/com.actionsoft.apps.coe.pal.cooperation/main/img/iconfont.ce1b01d3.ce1b01d3.svg
+++ /dev/null
@@ -1,2447 +0,0 @@
-
-
-
-
diff --git a/com.actionsoft.apps.coe.pal.mappingmanagement/web/com.actionsoft.apps.coe.pal.mappingmanagement/main/img/iconfont.ce1b01d3.ce1b01d3.svg b/com.actionsoft.apps.coe.pal.mappingmanagement/web/com.actionsoft.apps.coe.pal.mappingmanagement/main/img/iconfont.ce1b01d3.ce1b01d3.svg
deleted file mode 100644
index c8bbdca4..00000000
--- a/com.actionsoft.apps.coe.pal.mappingmanagement/web/com.actionsoft.apps.coe.pal.mappingmanagement/main/img/iconfont.ce1b01d3.ce1b01d3.svg
+++ /dev/null
@@ -1,2447 +0,0 @@
-
-
-
-
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/AfterInstallationEvent.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/AfterInstallationEvent.java
new file mode 100644
index 00000000..64b868ea
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/AfterInstallationEvent.java
@@ -0,0 +1,47 @@
+package com.actionsoft.apps.kms;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+
+import com.actionsoft.apps.kms.model.VersionModel;
+import com.actionsoft.apps.listener.AppListener;
+import com.actionsoft.apps.resource.AppContext;
+import com.actionsoft.bpms.commons.database.BatchPreparedStatementSetter;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.bpms.util.UUIDGener;
+
+public class AfterInstallationEvent implements AppListener {
+
+ @Override
+ public void after(AppContext appContext) {
+ // 如果版本号表(APP_ACT_KMS_VERSION)为空,则从1.0到10.0初始化10条版本号
+ long count = DBSql.getLong("SELECT COUNT(*) AS C FROM " + KMSConstant.ENTITY_NAME_VERSION, "C");
+ if (count == 0L) {
+ final String[] versionNOArr = new String[] { "1.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0" };
+ String sql = "INSERT INTO " + KMSConstant.ENTITY_NAME_VERSION + " (" + VersionModel.ID + "," + VersionModel.VERSIONNO + "," + VersionModel.CREATETIME + "," + VersionModel.CREATEUSER + "," + VersionModel.MEMO + ") VALUES (?,?,?,?,?)";
+ DBSql.batch(sql, new BatchPreparedStatementSetter() {
+ @Override
+ public void setValues(PreparedStatement pstmt, int index) throws SQLException {
+ String versionNO = versionNOArr[index];
+ pstmt.setString(1, UUIDGener.getObjectId());
+ pstmt.setString(2, versionNO);
+ pstmt.setTimestamp(3, new Timestamp(System.currentTimeMillis()));
+ pstmt.setString(4, "admin");
+ pstmt.setString(5, "系统初始化");
+ }
+
+ @Override
+ public int getBatchSize() {
+ return versionNOArr.length;
+ }
+ });
+ }
+ }
+
+ @Override
+ public boolean before(AppContext appContext) {
+ return true;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSConstant.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSConstant.java
new file mode 100644
index 00000000..90d0e626
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSConstant.java
@@ -0,0 +1,134 @@
+package com.actionsoft.apps.kms;
+
+/**
+ * @author wangshibao
+ */
+public class KMSConstant {
+ /** 导航菜单ID */
+ public static final String NAV_ID_KNWL_CENTER = "obj_21d0b756a48946ccb5d38668f32943b2";
+ public static final String NAV_ID_KNWL_SEARCH = "obj_9db6edd0ccf5433f82fe0af6fd67b7cc";
+ public static final String NAV_ID_DIMENSION_MGR = "obj_4f48f895966349beb2bd3e01bda46b69";
+ public static final String NAV_ID_META_MGR = "obj_9acae9a8b50142daac7d98efda6d13d6";
+ public static final String NAV_ID_VALIDDATE_MGR = "obj_28b304cc5bad4636adfa780f45317033";
+ public static final String NAV_ID_SYSTEM_MGR = "obj_50e47d2f2cac4738b4b819bf68dc1f81";
+
+ /** 应用ID */
+ public static final String APP_ID = "com.actionsoft.apps.kms";
+ /** doccenter目录 */
+ public static final String DOC_REPOSITORY_NAME = "-doc-";
+ // public static final String ONLINEDOC_REPOSITORY_NAME = "onlinedoc"; //替换为onlinedoc之后无需再解密
+ public static final String DOC_REPOSITORY_HOTSPOT = "hotspot";
+ /** 全文检索目录 */
+ public static final String FULLSEARCH_REPOSITORY_NAME = "kmsDoc";
+ public static final String APP_KMS_FULLSEARCH_INDEX="com.actionsoft.apps.kms_kmsdoc";
+ public static final String APP_KMS_FULLSEARCH_TYPE="kmsdoc";
+ public static final String APP_KMS_FULLSEARCH_INDEX_CARD = "com.actionsoft.apps.kms_kmsdoc_card";
+ public static final String APP_KMS_FULLSEARCH_TYPE_CARD = "kmsdoc_card";
+ public static final String APP_FULLSEARCH = "com.actionsoft.apps.addons.es";// 全文检索
+ /** 知识参数-manifest文件使用 */
+ public static final String SYSTEM_PARAM_KEY = "systemParam";
+ /** 表名 */
+ public static final String ENTITY_NAME_DIMENSION = "APP_ACT_KMS_DIMENSION";
+ public static final String ENTITY_NAME_CARD = "APP_ACT_KMS_CARD";
+ public static final String ENTITY_NAME_OPT = "APP_ACT_KMS_OPT";
+ public static final String ENTITY_NAME_FILE = "APP_ACT_KMS_FILE";
+ public static final String ENTITY_NAME_HOTSPOT_DEF = "APP_ACT_KMS_HOTSPOT_DEF";
+ public static final String ENTITY_NAME_HOTSPOT = "APP_ACT_KMS_HOTSPOT";
+ public static final String ENTITY_NAME_LOG = "APP_ACT_KMS_LOG";
+ public static final String ENTITY_NAME_PUBLISH = "APP_ACT_KMS_PUBLISH";
+ public static final String ENTITY_NAME_VERSION = "APP_ACT_KMS_VERSION";
+ public static final String ENTITY_NAME_META_SCHEMA = "APP_ACT_KMS_META_SCHEMA";
+ public static final String ENTITY_NAME_META_ATTR = "APP_ACT_KMS_META_ATTR";
+ public static final String ENTITY_NAME_META_DATA = "APP_ACT_KMS_META_DATA";
+ public static final String ENTITY_NAME_COLLECTION = "APP_ACT_KMS_COLLECTION";
+
+ /** BO表名 */
+ public static final String BO_ENTITY_NAME_BORROW = "BO_ACT_KMS_BORROW";
+ public static final String BO_ENTITY_NAME_PUBLISH = "BO_ACT_KMS_PUBLISH";
+ public static final String BO_ENTITY_NAME_CANCEL_PUBLISH = "BO_ACT_KMS_CANCEL_PUBLISH";
+
+ /** 维度类型 */
+ public static final int SHOWTYPE_CATEGORY = 2;// 仅做分类(不允许发布知识)
+ public static final int SHOWTYPE_DIMENSION = 1;// 普通维度(知识列表)
+ public static final int SHOWTYPE_HOTSPOT = 0;// 知识地图
+
+ /** 启用 不启用 */
+ public static final int ENABLED = 1;
+ public static final int UNABLED = 0;
+
+ /** 发布 未发布 */
+ public static final int PUBLISHED = 1;
+ public static final int UNPUBLISHED = 0;
+
+ /** 审批 不审批 */
+ public static final int EXAMINE = 1;
+ public static final int UNEXAMINE = 0;
+
+ /** 标签分隔符(数据库中varchar类型) */
+ public static final String TAG_SEPRATOR = "@`@";
+
+ /** 知识管理员AC类型 */
+ public static final String AC_RESOURCE_TYPE_KNWL_MGR = "kms.knwlmgr";
+ public static final String AC_RESOURCE_TYPE_XPAGE_MGR = "kms.xpagemgr";
+ /** 知识管理员资源ID */
+ public static final String AC_RESOURCE_ID_KNWL_MGR = "kms.knwlmgr.id";
+
+ /** 二级知识管理员AC类型 */
+ public static final String AC_RESOURCE_TYPE_DIMENSION_MGR = "kms.dimensionmgr";
+
+ /** 知识访问AC类型 */
+ public static final String AC_RESOURCE_TYPE_CARD = "kms.card";
+
+ /** 元数据发布访问AC类型 */
+ public static final String AC_RESOURCE_TYPE_META_SCHEMA = "kms.metaSchema";
+
+ /** 借阅流程的定义ID */
+ public static final String BORROW_PROCESS_DEF_ID = "obj_bcf0034b766f4a3d9cda8e0288e1c8c6";
+ /** 借阅流程开始事件的ID */
+ public static final String BORROW_START_EVENT_ID = "obj_c71e56d36b2000011759a1271e0057e0";
+
+ /** 发布流程的定义ID */
+ public static final String PUBLISH_PROCESS_DEF_ID = "obj_073f4f28416946e39db3d9f3fb981021";
+ /** 发布流程开始事件的ID */
+ public static final String PUBLISH_START_EVENT_ID = "obj_c71fa098cae00001d2e9a78ff250c020";
+
+ /** 取消发布流程的定义ID */
+ public static final String CANCEL_PUBLISH_PROCESS_DEF_ID = "obj_65be24aea7284f07a693e37c8c8deef3";
+ /** 取消发布流程开始事件的ID */
+ public static final String CANCEL_PUBLISH_START_EVENT_ID = "obj_c7329417b7600001be6d139b2db09490";
+
+ /** KMS OPT 类型 1、评论 2、评分 3、反馈 */
+ public static final int OPT_TYPE_COMMENT = 1;
+ /** KMS OPT 类型 1、评论 2、评分 3、反馈 */
+ public static final int OPT_TYPE_RATE = 2;
+ /** KMS OPT 类型 1、评论 2、评分 3、反馈 */
+ public static final int OPT_TYPE_REPORT = 3;
+
+ /** 我的收藏-KMS的分类名称 */
+ public static final String FAVORITE_CATEGORY_KMS = "KMS";
+
+ public static final String FILE_SUFFIX_DOC = "doc";
+ public static final String FILE_SUFFIX_PICTURE = "picture";
+ public static final String FILE_SUFFIX_AUDIO = "audio";
+ public static final String FILE_SUFFIX_VIDEO = "video";
+
+ public static final int LOG_ACCESS_CARD = 0;// 访问知识卡片
+ public static final int LOG_DOWNLOAD_FILE = 1;// 下载文件
+ public static final int LOG_ACCESS_FILE = 2;// 在线浏览文件
+ public static final int LOG_ACCESS_OTHER = 3;// 在线浏览文件
+ public static final String NOTIFICATION_SYSTEM_NAME = "知识阅读邀请";
+ public static final String REPORT_SYSTEM_NAME = "知识反馈";
+
+ public static final String DOC_GROUP_HOTSPOT = "grouphotspot";
+ public static final String DOC_FILE_HOTSPOT = "filehotspot";
+
+// 调用积分接口参数
+ public final static String POINT_DOWN_LOAD = "KMS下载文件";
+ public final static String POINT_LOOK_ATCART = "KMS阅读知识卡片";
+ public final static String POINT_LOOK_ATFILE= "KMS预览文件";
+ public final static String POINT_PUBLSH = "KMS发布知识";
+ public final static int POINT_COUNT = 1;//0为加积分,1为扣积分
+ public final static String POINT_ISADD_POINT = "1";//参数控制为1即调用aslp,0不调用
+ public final static String POINTS_APPID = "com.actionsoft.apps.points";
+ public static final String DOC_CARDCONTENT_REPOSITORY_NAME = "-doccardcontent-";
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSLogUtil.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSLogUtil.java
new file mode 100644
index 00000000..c1f67cba
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSLogUtil.java
@@ -0,0 +1,84 @@
+package com.actionsoft.apps.kms;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import com.actionsoft.apps.kms.model.LogModel;
+import com.actionsoft.apps.lifecycle.log.AppsLogger;
+import com.actionsoft.bpms.commons.database.BatchPreparedStatementSetter;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.bpms.util.UUIDGener;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * 记录KMS日志(采用线程池,提高性能)
+ *
+ * @author wangshibao
+ *
+ */
+public class KMSLogUtil {
+
+ private static ExecutorService logExecutorService = Executors.newCachedThreadPool();
+
+ /**
+ * 记录日志入口方法
+ *
+ * @param logModels
+ * @author wangshibao
+ */
+ public static void log(final LogModel... logModels) {
+ logExecutorService.execute(new Runnable() {
+ @Override
+ public void run() {
+ insertLogs(logModels);
+ }
+ });
+ }
+
+ /**
+ * 插入数据库
+ *
+ * @param logModels
+ * @author wangshibao
+ */
+ private static void insertLogs(final LogModel... logModels) {
+ try {
+ if (logModels == null || logModels.length == 0) {
+ return;
+ }
+ String sql = "INSERT INTO " + KMSConstant.ENTITY_NAME_LOG + " (" + LogModel.ID + "," + LogModel.CARDID + "," + LogModel.FILEID + "," + LogModel.ACCESSUSER + "," + LogModel.ACCESSTIME + "," + LogModel.IPADDRESS + "," + LogModel.LOGTYPE + "," + LogModel.LOGINFO + ") VALUES (?,?,?,?,?,?,?,?)";
+ DBSql.batch(sql, new BatchPreparedStatementSetter() {
+
+ @Override
+ public void setValues(PreparedStatement pstmt, int index) throws SQLException {
+ LogModel logModel = logModels[index];
+ pstmt.setString(1, UUIDGener.getObjectId());
+ pstmt.setString(2, logModel.getCardId());
+
+ if (logModel.getFileId() == null) {
+ pstmt.setNull(3, Types.VARCHAR);
+ } else {
+ pstmt.setString(3, logModel.getFileId());
+ }
+
+ pstmt.setString(4, logModel.getAccessUser());
+ pstmt.setTimestamp(5, logModel.getAccessTime());
+ pstmt.setString(6, logModel.getIpAddress());
+ pstmt.setInt(7, logModel.getLogType());
+ pstmt.setString(8, logModel.getLogInfo());
+ }
+
+ @Override
+ public int getBatchSize() {
+ return logModels.length;
+ }
+ });
+ } catch (Exception e) {
+ AppsLogger.err(SDK.getAppAPI().getAppContext(KMSConstant.APP_ID), "记录KMS日志出错:" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSUtil.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSUtil.java
new file mode 100644
index 00000000..1548cf38
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/KMSUtil.java
@@ -0,0 +1,1378 @@
+package com.actionsoft.apps.kms;
+
+import java.security.MessageDigest;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import com.actionsoft.apps.AppsConst;
+import com.actionsoft.apps.kms.ac.CardACCM;
+import com.actionsoft.apps.kms.ac.DimensionMgrACCM;
+import com.actionsoft.apps.kms.ac.KnwlMgrACCM;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.cache.CardPermCache;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.cache.DimensionPermCache;
+import com.actionsoft.apps.kms.cache.FileCache;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.cache.VersionCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.apps.kms.model.FileModel;
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.apps.kms.model.VersionModel;
+import com.actionsoft.apps.kms.service.DimensionService;
+import com.actionsoft.bpms.bo.engine.BO;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst;
+import com.actionsoft.bpms.commons.login.constant.LoginConst;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
+import com.actionsoft.bpms.commons.security.basic.PermAPIManager;
+import com.actionsoft.bpms.commons.security.basic.constant.AWFDocumentLayerUnit;
+import com.actionsoft.bpms.commons.security.high.HighSecurity;
+import com.actionsoft.bpms.commons.security.high.constant.SecurityLevelConst;
+import com.actionsoft.bpms.commons.security.high.model.HighSecurityModel;
+import com.actionsoft.bpms.commons.security.mgtgrade.util.GradeSecurityUtil;
+import com.actionsoft.bpms.org.cache.CompanyCache;
+import com.actionsoft.bpms.org.cache.DepartmentCache;
+import com.actionsoft.bpms.org.cache.TeamMemberCache;
+import com.actionsoft.bpms.org.cache.UserCache;
+import com.actionsoft.bpms.org.cache.UserMapCache;
+import com.actionsoft.bpms.org.model.CompanyModel;
+import com.actionsoft.bpms.org.model.DepartmentModel;
+import com.actionsoft.bpms.org.model.TeamMemberModel;
+import com.actionsoft.bpms.org.model.UserMapModel;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.DispatcherRequest;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.AES;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.bpms.util.UtilString;
+import com.actionsoft.i18n.I18nRes;
+import com.actionsoft.sdk.local.SDK;
+import com.actionsoft.sdk.local.api.AppAPI;
+import com.alibaba.fastjson.JSONObject;
+
+public class KMSUtil {
+
+ /**
+ * 直接取消发布知识OR启动流程
+ *
+ * @param dimensionId 维度Id
+ * @param uid 操作人
+ * @return
+ * @author wangshibao
+ */
+ public static boolean canCancelPublishCard(String dimensionId, String uid) {
+ return canPublishCard(dimensionId, uid);
+ }
+
+ /**
+ * 直接发布知识OR启动流程
+ *
+ * @param dimensionId 维度ID
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean canPublishCard(String dimensionId, String uid) {
+ // 维度审批
+ DimensionModel dimensionModel = DimensionCache.getCache().get(dimensionId);
+ if (dimensionModel.getIsExamine() == 0) {// 无需审批
+ return true;
+ }
+ // 维度管理员
+ boolean hasDimensionMgrPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ if (hasDimensionMgrPerm) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 检查是否维度管理员(严格ac)
+ *
+ * @param dimensionId 维度ID
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean isDimensionManager(String dimensionId, String uid) {
+ // 维度管理员
+ return SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ }
+
+ /**
+ * 是否能访问维度(非严格ac)
+ *
+ * @param dimensionId
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+
+ public static boolean canAccessDimension(String dimensionId, String uid, List acList) {
+ List list = new ArrayList();
+ Map accessModeMap = new HashMap();
+ for (Iterator it = acList.iterator(); it.hasNext(); ) {
+ AccessControlModel ac = it.next();
+ if (ac != null) {
+ if (dimensionId.equals(ac._resourceId) && KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR.equals(ac._resourceType)) {
+ list.add(ac);
+ if (ac._accessModel == DimensionMgrACCM.ACCESS.getType()) {
+ if (accessModeMap.containsKey(DimensionMgrACCM.ACCESS.getType())) {
+ accessModeMap.put(DimensionMgrACCM.ACCESS.getType(), accessModeMap.get(DimensionMgrACCM.ACCESS.getType()) + 1);
+ } else {
+ accessModeMap.put(DimensionMgrACCM.ACCESS.getType(), 1);
+ }
+ }
+ if (ac._accessModel == DimensionMgrACCM.BORROW.getType()) {
+ if (accessModeMap.containsKey(DimensionMgrACCM.BORROW.getType())) {
+ accessModeMap.put(DimensionMgrACCM.BORROW.getType(), accessModeMap.get(DimensionMgrACCM.BORROW.getType()) + 1);
+ } else {
+ accessModeMap.put(DimensionMgrACCM.BORROW.getType(), 1);
+ }
+ }
+ if (ac._accessModel == DimensionMgrACCM.DIMENSION_MGR.getType()) {
+ if (accessModeMap.containsKey(DimensionMgrACCM.DIMENSION_MGR.getType())) {
+ accessModeMap.put(DimensionMgrACCM.DIMENSION_MGR.getType(), accessModeMap.get(DimensionMgrACCM.DIMENSION_MGR.getType()) + 1);
+ } else {
+ accessModeMap.put(DimensionMgrACCM.DIMENSION_MGR.getType(), 1);
+ }
+ }
+ }
+ }
+ }
+ String dimensionPermRule = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, "dimensionPermRule");
+ if ("0".equals(dimensionPermRule)) {
+ boolean hasDimensionAccessPerm = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.ACCESS.getType(), true, list, accessModeMap);
+ if (hasDimensionAccessPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ } else {
+ boolean hasDimensionAccessPerm = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.ACCESS.getType(), false, list, accessModeMap);
+ if (hasDimensionAccessPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ }
+ // 维度借阅(借阅权限优于访问权限,否则用户无法借阅)
+ boolean hasDimensionBorrowPerm = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.BORROW.getType(), true, list, accessModeMap);
+ if (hasDimensionBorrowPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+
+ //维度管理员
+ boolean hasDimensionMgrPerm = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true, list, accessModeMap);
+ if (hasDimensionMgrPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ DimensionPermCache.put(dimensionId, uid, false);
+ return false;
+ }
+
+ public static boolean canAccessDimension(String dimensionId, String uid) {
+ String dimensionPermRule = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, "dimensionPermRule");
+ if ("0".equals(dimensionPermRule)) {
+ // 维度访问
+ boolean hasDimensionAccessPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.ACCESS.getType(), true);
+ if (hasDimensionAccessPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ } else {
+ // 维度访问
+ boolean hasDimensionAccessPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.ACCESS.getType(), false);
+ if (hasDimensionAccessPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ }
+ // 维度借阅(借阅权限优于访问权限,否则用户无法借阅)
+ boolean hasDimensionBorrowPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.BORROW.getType(), true);
+ if (hasDimensionBorrowPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+
+ //维度管理员
+ boolean hasDimensionMgrPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ if (hasDimensionMgrPerm) {
+ DimensionPermCache.put(dimensionId, uid, true);
+ return true;
+ }
+ DimensionPermCache.put(dimensionId, uid, false);
+ return false;
+ }
+
+ /**
+ * 维度是否能发布知识
+ *
+ * @param dimensionId
+ * @param uid
+ * @return
+ */
+ public static boolean canPublishDimension(String dimensionId, String uid) {
+ // 发布权限
+ boolean hasDimensionPublishPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.PUBLISH.getType(), false);
+ if (hasDimensionPublishPerm) {
+ return true;
+ }
+ //维度管理员
+ boolean hasDimensionMgrPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ if (hasDimensionMgrPerm) {
+ return true;
+ }
+ return false;
+ }
+ /**
+ * 是否能访问知识(非严格ac)
+ *
+ * 与维度无关,用户无论通过哪种途径能看到该知识均可访问
+ *
+ * @param cardId
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean canAccessKnwl(String cardId, String uid, boolean isKnwlMgr) {
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ if (cardModel.getCreateUser().equals(uid)) {
+ return true;
+ }
+
+ if (cardModel.getIsPublished() == KMSConstant.UNPUBLISHED) {
+ return false;
+ }
+
+ if (!checkCardAC(cardId, uid)) {
+ return false;
+ }
+
+ // 过滤有效期
+ if (cardModel.getValidDate() != null && (cardModel.getValidDate().getTime() + 24 * 60 * 60 * 1000) - System.currentTimeMillis() < 0) {// 已过期
+ return false;
+ }
+ // 过滤密级控制
+ if (!checkSecurity(uid, cardModel)) {
+ return false;
+ }
+
+ // 知识管理员
+ if (isKnwlMgr) {
+ return true;
+ }
+
+ Iterator publishIterator = PublishCache.getCache().iterator();
+ while (publishIterator.hasNext()) {
+ try {
+ PublishModel publishModel = publishIterator.next();
+ if (cardId.equals(publishModel.getCardId())) {
+ // 发布状态过滤:申请中、审批中、不同意
+ if (!UtilString.isEmpty(publishModel.getExamineInfo())) {
+ if (!publishModel.getExamineInfo().contains("\"同意\"")) {
+ continue;
+ }
+ }
+
+ // 维度管理员
+ boolean hasDimensionMgrPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, publishModel.getDimensionId(), DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ if (hasDimensionMgrPerm) {
+ return true;
+ }
+ // 维度借阅(借阅权限优于访问权限,否则用户无法借阅)
+ boolean hasDimensionBorrowPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, publishModel.getDimensionId(), DimensionMgrACCM.BORROW.getType(), true);
+ if (hasDimensionBorrowPerm) {
+ continue;
+ }
+ // 维度访问
+ boolean hasDimensionAccessPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, publishModel.getDimensionId(), DimensionMgrACCM.ACCESS.getType(), false);
+ if (hasDimensionAccessPerm) {
+ return true;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 是否需要借阅
+ *
+ * @param dimensionId
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean isNeedBorrow(String dimensionId, String uid, List acList) {
+ // 维度管理员
+ List list = new ArrayList();
+ Map accessModeMap = new HashMap();
+ for (Iterator it = acList.iterator(); it.hasNext(); ) {
+ AccessControlModel ac = it.next();
+ if (ac._resourceId.equals(dimensionId) && ac._resourceType.equals(KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR)) {
+ list.add(ac);
+ if (ac._accessModel == DimensionMgrACCM.BORROW.getType()) {
+ if (accessModeMap.containsKey(DimensionMgrACCM.BORROW.getType())) {
+ accessModeMap.put(DimensionMgrACCM.BORROW.getType(), accessModeMap.get(DimensionMgrACCM.BORROW.getType()) + 1);
+ } else {
+ accessModeMap.put(DimensionMgrACCM.BORROW.getType(), 1);
+ }
+ }
+ if (ac._accessModel == DimensionMgrACCM.DIMENSION_MGR.getType()) {
+ if (accessModeMap.containsKey(DimensionMgrACCM.DIMENSION_MGR.getType())) {
+ accessModeMap.put(DimensionMgrACCM.DIMENSION_MGR.getType(), accessModeMap.get(DimensionMgrACCM.DIMENSION_MGR.getType()) + 1);
+ } else {
+ accessModeMap.put(DimensionMgrACCM.DIMENSION_MGR.getType(), 1);
+ }
+ }
+ }
+ }
+ boolean hasDimensionMgrPerm = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true, list, accessModeMap);
+ return !hasDimensionMgrPerm && havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.BORROW.getType(), true, list, accessModeMap);
+ }
+
+ public static boolean isNeedBorrow(String dimensionId, String uid) {
+ // 维度管理员
+ boolean hasDimensionMgrPerm = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.DIMENSION_MGR.getType(), true);
+ return !hasDimensionMgrPerm && SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR, dimensionId, DimensionMgrACCM.BORROW.getType(), true);
+ }
+
+ /**
+ * 补充权限外的但是必须显示的(返回维度DimensionMode的isPerm为false)
+ *
+ * @param dimensionModels
+ * @return
+ * @todo取名1,待重构后删掉getNoPermParentDimensions
+ * @author wangshibao
+ */
+ public static List getNoPermParentDimensions(List dimensionModels, String uid) {
+ //获取可能有权限维度的后代维度
+ List hasPermDimensionList = new ArrayList<>();
+ //递归检查后代维度是否有权限,如果有,立即return
+ for (DimensionModel dimensionModel : dimensionModels) {
+ getNoPermRecur(uid, hasPermDimensionList, dimensionModel);
+ }
+ List returnDimensionList = new ArrayList<>();
+ //根据后代维度计算出返回维度
+ for (DimensionModel dimensionModel : hasPermDimensionList) {
+ getReturnDimension(dimensionModels, returnDimensionList, dimensionModel);
+ }
+ return returnDimensionList;
+ }
+
+ /**
+ * 补充发布权限外的但是必须显示的(返回维度DimensionMode的isPerm为false)
+ *
+ * @param dimensionModels
+ * @return
+ * @todo取名1,待重构后删掉getNoPermParentDimensions
+ * @author wangshibao
+ */
+ public static List getNoPublishPermParentDimensions(List dimensionModels, String uid) {
+ //获取可能有权限维度的后代维度
+ List hasPermDimensionList = new ArrayList<>();
+ //递归检查后代维度是否有权限,如果有,立即return
+ for (DimensionModel dimensionModel : dimensionModels) {
+ getNoPublishPermRecur(uid, hasPermDimensionList, dimensionModel);
+ }
+ List returnDimensionList = new ArrayList<>();
+ //根据后代维度计算出返回维度
+ for (DimensionModel dimensionModel : hasPermDimensionList) {
+ getReturnDimension(dimensionModels, returnDimensionList, dimensionModel);
+ }
+ return returnDimensionList;
+ }
+
+ private static void getReturnDimension(List dimensionModels, List returnDimensionList, DimensionModel dimensionModel) {
+ boolean isGoon = true;
+ for (DimensionModel returnDimensionModel : dimensionModels) {
+ if (!UtilString.isEmpty(dimensionModel.getParentId())) {
+ if (dimensionModel.getParentId().equals(returnDimensionModel.getId())) {
+ DimensionModel clone = returnDimensionModel.clone();
+ clone.setHasPerm(false);
+ returnDimensionList.add(clone);
+ isGoon = false;
+ break;
+ }
+ }
+ }
+ if (isGoon) {
+ DimensionModel dimensionModel1 = DimensionCache.getCache().get(dimensionModel.getParentId());
+ if (dimensionModel1 != null) {
+ getReturnDimension(dimensionModels, returnDimensionList, dimensionModel1);
+ }
+ }
+ }
+
+ private static void getNoPublishPermRecur(String uid, List hasPermDimensionList, DimensionModel parentDimensionModel) {
+ List dimensionListOfParent = DimensionCache.getCache().getDimensionListOfParent(parentDimensionModel.getId());
+ boolean isGoon = true;//是否继续递归
+ for (DimensionModel dimensionModel : dimensionListOfParent) {
+ boolean ac = true;
+ ac = KMSUtil.canPublishDimension(dimensionModel.getId(), uid);
+ if (ac) {
+ hasPermDimensionList.add(dimensionModel);
+ isGoon = false;
+ break;
+ }
+ }
+ if (isGoon) {
+ for (DimensionModel dimensionModel : dimensionListOfParent) {
+ getNoPermRecur(uid, hasPermDimensionList, dimensionModel);
+ }
+ }
+ }
+ private static void getNoPermRecur(String uid, List hasPermDimensionList, DimensionModel parentDimensionModel) {
+ List dimensionListOfParent = DimensionCache.getCache().getDimensionListOfParent(parentDimensionModel.getId());
+ boolean isGoon = true;//是否继续递归
+ for (DimensionModel dimensionModel : dimensionListOfParent) {
+ boolean ac = true;
+ if (DimensionPermCache.hasCacheByUID(dimensionModel.getId(), uid)) {
+ ac = DimensionPermCache.getPermByUID(dimensionModel.getId(), uid);
+ } else {
+ ac = KMSUtil.canAccessDimension(dimensionModel.getId(), uid);
+ }
+ if (ac) {
+ hasPermDimensionList.add(dimensionModel);
+ isGoon = false;
+ break;
+ }
+ }
+ if (isGoon) {
+ for (DimensionModel dimensionModel : dimensionListOfParent) {
+ getNoPermRecur(uid, hasPermDimensionList, dimensionModel);
+ }
+ }
+ }
+
+ /**
+ * 根据维度模型List获取 Map<维度Id,维度模型>
+ *
+ * @param dimensionModels
+ * @return
+ * @author wangshibao
+ */
+ private static Map getDimensionMap(List dimensionModels) {
+ Map dimensionMap = new HashMap();
+ if (dimensionModels != null && dimensionModels.size() != 0) {
+ for (DimensionModel dimensionModel : dimensionModels) {
+ dimensionMap.put(dimensionModel.getId(), dimensionModel);
+ }
+ }
+ return dimensionMap;
+ }
+
+ /**
+ * 是否知识管理员
+ *
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean isKnwlManager(String uid) {
+ // 知识管理员
+ return SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_KNWL_MGR, KMSConstant.AC_RESOURCE_ID_KNWL_MGR, KnwlMgrACCM.KNWLMGR.getType(), true);
+ }
+
+ /**
+ * 获取文件的版本号
+ *
+ * @param cardId 知识ID
+ * @param fileName 文件名
+ * @return
+ * @author wangshibao
+ */
+ public static String getNextFileVersion(String cardId, String fileName) {
+ FileCache fileCache = FileCache.getCache();
+ Iterator fileIterator = fileCache.iterator();
+ FileModel currentFileModel = null;
+ // 1、寻找最新文件的版本
+ while (fileIterator.hasNext()) {
+ FileModel fileModel = fileIterator.next();
+ if (cardId.equals(fileModel.getCardId()) && fileName.equals(fileModel.getFileName()) && fileModel.getFileState() == 1) {
+ currentFileModel = fileModel;
+ break;
+ }
+ }
+ final String currentVersion = currentFileModel == null ? null : currentFileModel.getFileVer();
+ // 2、根据最新文件(或null)计算下一个版本号
+ VersionCache versionCache = VersionCache.getCache();
+ Iterator versionIterator = versionCache.iteratorSorted(new Comparator() {
+ @Override
+ public int compare(VersionModel o1, VersionModel o2) {
+ double result = Double.parseDouble(o1.getVersionNo()) - Double.parseDouble(o2.getVersionNo());
+ if (result > 0) {
+ return 1;
+ } else if (result < 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+ });
+ if (UtilString.isEmpty(currentVersion)) {// 没有重名文件
+ String minVersion = null;
+ if (versionIterator.hasNext()) {
+ minVersion = versionIterator.next().getVersionNo();
+ }
+ return UtilString.isEmpty(minVersion) ? "1.0" : minVersion;
+ } else {// 有重名文件
+ final VersionModel tmpVersionModel = new VersionModel();
+ while (versionIterator.hasNext()) {
+ String nextNo1 = versionIterator.next().getVersionNo();
+ if (Double.parseDouble(currentVersion) < Double.parseDouble(nextNo1)) {
+ tmpVersionModel.setVersionNo(nextNo1);
+ break;
+ } else if (Double.parseDouble(currentVersion) == Double.parseDouble(nextNo1)) {
+ if (versionIterator.hasNext()) {
+ tmpVersionModel.setVersionNo(versionIterator.next().getVersionNo());
+ break;
+ }
+
+ }
+ }
+ if (UtilString.isEmpty(tmpVersionModel.getVersionNo())) {
+ String nextVersion = "";
+ if (currentVersion.indexOf(".") > 0) {
+ String tmp = currentVersion.substring(currentVersion.length() - 1, currentVersion.length());
+ int lastVersion = 0;
+ try {
+ lastVersion = Integer.parseInt(tmp);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ lastVersion += 1;
+ nextVersion = currentVersion.substring(0, currentVersion.length() - 1) + lastVersion;
+ } else {
+ nextVersion = currentVersion + ".1";
+ }
+ return nextVersion;
+ } else {
+ return tmpVersionModel.getVersionNo();
+ }
+ }
+ }
+
+ /**
+ * 获取重名文件的版本号别名
+ *
+ * @param fileName 文件名
+ * @param fileVersion 版本号,比如1.2,3.3
+ * @return
+ * @author wangshibao
+ */
+ public static String getFileNameOfVersion(String fileName, String fileVersion) {
+ if (fileName.indexOf(".") == -1) {// 如果文件名没有后缀
+ return fileName + "_v" + fileVersion;
+ } else {
+ return fileName.substring(0, fileName.lastIndexOf(".")) + "_v" + fileVersion + "." + fileName.substring(fileName.lastIndexOf(".") + 1);
+ }
+ }
+
+ /**
+ * 获取文件后缀
+ *
+ * @param fileName
+ * @return
+ * @author wangshibao
+ */
+ public static String getFileSuffix(String fileName) {
+ try {
+ if (fileName.indexOf(".") == -1) {// 如果文件名没有后缀
+ return "";
+ } else {
+ return fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+ /**
+ * 获取文件后缀对应的图标名
+ *
+ * @param fileName
+ * @return
+ * @author wangshibao
+ */
+ public static String getFileIconName(String fileName) {
+ String fileSuffix = getFileSuffix(fileName);
+ String docs = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, KMSConstant.FILE_SUFFIX_DOC);
+ List docList = Arrays.asList(docs.split(","));
+ if (docList.contains(fileSuffix)) {
+ return fileSuffix;
+ }
+ String pictures = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, KMSConstant.FILE_SUFFIX_PICTURE);
+ List pictureList = Arrays.asList(pictures.split(","));
+ if (pictureList.contains(fileSuffix)) {
+ return KMSConstant.FILE_SUFFIX_PICTURE;
+ }
+ String audios = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, KMSConstant.FILE_SUFFIX_AUDIO);
+ List audioList = Arrays.asList(audios.split(","));
+ if (audioList.contains(fileSuffix)) {
+ return KMSConstant.FILE_SUFFIX_AUDIO;
+ }
+ String videos = SDK.getAppAPI().getProperty(KMSConstant.APP_ID, KMSConstant.FILE_SUFFIX_VIDEO);
+ List videoList = Arrays.asList(videos.split(","));
+ if (videoList.contains(fileSuffix)) {
+ return KMSConstant.FILE_SUFFIX_VIDEO;
+ }
+ return "";
+ }
+ // /**因为文件名可能存在歧义,比如没有后缀,或后缀为数字,则无法正确解析,所以此方法先作废,直接显示原名称
+ // * 获取文件名的版本号别名(将abc_v2.3.txt转换为abc.txt v2.3)
+ // *
+ // * @param fileName
+ // * @return
+ // * @author wangshibao
+ // */
+ // public static String getFileNameOfVersion(String fileName) {
+ // int vStart = fileName.lastIndexOf("_v");
+ // int vEnd = fileName.indexOf(".", fromIndex)
+ // return "";
+ // }
+
+ /**
+ * 过滤掉不可用的维度
+ *
+ * @param dimensionModels
+ * @return
+ * @author wangshibao
+ */
+ public static List filterDisabledDimension(List dimensionModels) {
+ if (dimensionModels != null && dimensionModels.size() != 0) {
+ List newDimensionModels = new ArrayList<>();
+ for (DimensionModel dimensionModel : dimensionModels) {
+ if (dimensionModel.getIsEnabled() == 1) {
+ newDimensionModels.add(dimensionModel);
+ }
+ }
+ return newDimensionModels;
+ } else {
+ return dimensionModels;
+ }
+ }
+
+ /**
+ * 判断是否有密级权限
+ *
+ * @param uid
+ * @param cardModel
+ * @return
+ * @author wangshibao
+ */
+ public static boolean checkSecurity(String uid, CardModel cardModel) {
+ boolean tmpFlag = false;
+ if (cardModel == null) {
+ return tmpFlag;
+ }
+ if (cardModel.getCreateUser().equals(uid)) {
+ tmpFlag = true;
+ } else {
+ if (HighSecurity.isSecurityLevel()) {//使用三元的保密级别
+ UserModel userModel = UserCache.getModel(uid);
+ tmpFlag = userModel.getSecurityLevel() >= cardModel.getSecurityLevel();
+ } else {//使用权限组的保密级别
+ if (cardModel.getSecurityLevel() == SecurityLevelConst.LAYER_0) {
+ tmpFlag = true;
+ } else if (cardModel.getSecurityLevel() == SecurityLevelConst.LAYER_1) {
+ tmpFlag = PermAPIManager.getInstance().havingDocumentLayerPermission(uid, AWFDocumentLayerUnit.SECURITY2) || PermAPIManager.getInstance().havingDocumentLayerPermission(uid, AWFDocumentLayerUnit.SECURITY3);
+ } else if (cardModel.getSecurityLevel() == SecurityLevelConst.LAYER_2) {
+ tmpFlag = PermAPIManager.getInstance().havingDocumentLayerPermission(uid, AWFDocumentLayerUnit.SECURITY3);
+ } else if (cardModel.getSecurityLevel() == SecurityLevelConst.LAYER_3) {
+ tmpFlag = PermAPIManager.getInstance().havingDocumentLayerPermission(uid, AWFDocumentLayerUnit.SECURITY4);
+ }
+ }
+ }
+ return tmpFlag;
+ }
+
+ public static Iterator cardACList;
+ /**
+ * 是否有知识访问权限(非严格AC)
+ *
+ * @param cardId
+ * @param uid
+ * @return
+ * @author wangshibao
+ */
+ public static boolean checkCardAC(String cardId, String uid, List acList) {
+ try {
+ if (CardCache.getCache().get(cardId) != null && CardCache.getCache().get(cardId).getCreateUser().equals(uid)) {
+ CardPermCache.put(cardId, uid, true);
+ return true;
+ }
+ List list = new ArrayList();
+ Map accessModeMap = new HashMap();
+ for (Iterator it = acList.iterator(); it.hasNext(); ) {
+ AccessControlModel ac = it.next();
+ if (ac != null) {
+ if (cardId.equals(ac._resourceId) && KMSConstant.AC_RESOURCE_TYPE_CARD.equals(ac._resourceType)) {
+ list.add(ac);
+ if (ac._accessModel == CardACCM.CARD.getType()) {
+ if (accessModeMap.containsKey(CardACCM.CARD.getType())) {
+ accessModeMap.put(CardACCM.CARD.getType(), accessModeMap.get(CardACCM.CARD.getType()) + 1);
+ } else {
+ accessModeMap.put(CardACCM.CARD.getType(), 1);
+ }
+ }
+ }
+ }
+ }
+ boolean flag = havingPermission(uid, KMSConstant.AC_RESOURCE_TYPE_CARD, cardId, CardACCM.CARD.getType(), false, list, accessModeMap);
+ CardPermCache.put(cardId, uid, flag);
+ return flag;
+ } catch (Exception e) {
+ e.printStackTrace();
+ CardPermCache.put(cardId, uid, false);
+ return false;
+ }
+ }
+
+ public static boolean checkCardAC(String cardId, String uid) {
+ try {
+ if (CardCache.getCache().get(cardId) != null && CardCache.getCache().get(cardId).getCreateUser().equals(uid)) {
+ CardPermCache.put(cardId, uid, true);
+ return true;
+ }
+ boolean flag = SDK.getPermAPI().havingACPermission(uid, KMSConstant.AC_RESOURCE_TYPE_CARD, cardId, CardACCM.CARD.getType(), false);
+ CardPermCache.put(cardId, uid, flag);
+ return flag;
+ } catch (Exception e) {
+ e.printStackTrace();
+ CardPermCache.put(cardId, uid, false);
+ return false;
+ }
+ }
+ /**
+ * 通用表单加载后方法,向表单注入申请人和知识路径、管理员
+ *
+ * @param pec
+ * @author wangshibao
+ */
+ public static void commonFormAfterLoad(ProcessExecutionContext pec) {
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ String pubUserInfo = "";
+ String dimPath = "";
+ String dimensionAdmin = "";
+ if (bo != null) {
+ String pubUser = bo.getString("APPLYUSER");
+ pubUserInfo = pubUser;
+ UserModel pubUM = UserCache.getModel(pubUser);
+ if (pubUM != null) {
+ pubUserInfo = pubUM.getUserName() + "/" + SDK.getORGAPI().getDepartmentByUser(pubUser).getName();
+ }
+ DimensionService dimService = new DimensionService();
+ String dimId = bo.getString("DIMENSIONID");
+ if (UtilString.isNotEmpty(dimId)) {
+ dimPath = dimService.getDimensionPath(dimId, " > ");
+ dimensionAdmin = SDK.getORGAPI().getUserNames(dimService.getDimensionAdmin(dimId));
+ }
+ }
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+ macroLibraries.put("APPLYUSERNAME", pubUserInfo);
+ macroLibraries.put("DIMENSIONNAME", dimPath);
+ macroLibraries.put("DIMENSIONADMIN", dimensionAdmin);
+ macroLibraries.put("today", UtilDate.dateFormat(new Date(System.currentTimeMillis())));
+
+ }
+
+ /**
+ * 浏览知识的表单加载后方法
+ *
+ * @param pec
+ * @author wangshibao
+ */
+ public static void browseFormAfterLoad(ProcessExecutionContext pec) {
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+ macroLibraries.put("sid", pec.getUserContext().getSessionId());
+ String mePhoto = SDK.getPortalAPI().getUserPhoto(pec.getUserContext(), pec.getUserContext().getUID());
+ macroLibraries.put("mePhoto", mePhoto);
+ if (SDK.getAppAPI().isActive(SDK.getAppAPI().getAppContext("com.actionsoft.apps.favorite"))) {
+ macroLibraries.put("isFavoriteAppActive", true);
+ } else {
+ macroLibraries.put("isFavoriteAppActive", false);
+ }
+ if (SDK.getAppAPI().isActive(SDK.getAppAPI().getAppContext("com.actionsoft.apps.addons.wpsonline"))) {
+ macroLibraries.put("isOnlinedocAppActive", true);
+ } else {
+ macroLibraries.put("isOnlinedocAppActive", false);
+ }
+ if (SDK.getAppAPI().isActive(SDK.getAppAPI().getAppContext("com.actionsoft.apps.network"))) {
+ macroLibraries.put("isNetworkAppActive", true);
+ } else {
+ macroLibraries.put("isNetworkAppActive", false);
+ }
+ String canPreviewType = KMSUtil.getCanPreviewType(pec.getUserContext().getSessionId());
+ macroLibraries.put("canPreviewType", canPreviewType);
+
+ JSONObject systemParamJO = JSONObject.parseObject(SDK.getAppAPI().getProperty(KMSConstant.APP_ID, KMSConstant.SYSTEM_PARAM_KEY));
+ macroLibraries.put("browserPreview", systemParamJO.getString("browserPreview"));
+ macroLibraries.put("maxFileSize", systemParamJO.getInteger("maxFileSize"));
+ macroLibraries.put("blackFileList", systemParamJO.getString("blackFileList"));
+
+ macroLibraries.put("today", UtilDate.dateFormat(new Date(System.currentTimeMillis())));
+ }
+
+ /**
+ * 获取文档预览支持的后缀
+ *
+ * @param sid
+ * @return
+ */
+ public static String getCanPreviewType(String sid) {
+ String supportType = "";
+ try {
+ String aslp = "aslp://com.actionsoft.apps.addons.wpsonline/getSupportType";
+ Map params = new HashMap();
+ params.put("sid", sid);
+ AppAPI appAPI = SDK.getAppAPI();
+ //文档预览支持的文件类型
+ ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(KMSConstant.APP_ID), aslp, params);
+ supportType = (String) ro.get("pc_suffix");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return supportType;
+ }
+
+ public static boolean havingPermission(String uid, String resourceType, String resourceId, int accessMode, boolean restrict, List acList, Map accessModelMap) {
+ if (GradeSecurityUtil.isSuperMaster(uid) || GradeSecurityUtil.isSystemMaster(uid)) {
+ return true;
+ }
+
+ if (restrict) {// 严格模式
+ boolean check = havingPermission(uid, resourceType, resourceId, accessMode, acList);
+ return check;
+ } else {// 非严格模式
+ if (!accessModelMap.containsKey(accessMode)) {
+ return true;
+ } else {
+ boolean check = havingPermission(uid, resourceType, resourceId, accessMode, acList);
+ return check;
+ }
+ }
+ }
+
+ /**
+ * 查看某人是否拥有对某个资源的访问权限
+ *
+ * @param uid
+ * @param resourceType
+ * @param resourceId
+ * @param accessMode
+ * @return
+ */
+ public static boolean havingPermission(String uid, String resourceType, String resourceId, int accessMode, List acList) {
+ UserModel user = UserCache.getModel(uid);
+ if (user == null) {
+ return false;
+ }
+ boolean isAccess = false;
+ Iterator h = acList.iterator();
+ // 优化到循环外
+ DepartmentModel departmentModel = DepartmentCache.getModel(user.getDepartmentId());
+ if (departmentModel == null) {
+ return false;
+ }
+ CompanyModel companyModel = CompanyCache.getModel(departmentModel.getCompanyId());
+ if (companyModel == null) {
+ return false;
+ }
+ while (h.hasNext()) {
+ AccessControlModel model = h.next();
+ isAccess = havingPermission(user, model, accessMode, departmentModel, companyModel);
+ if (isAccess) {
+ break;// 退出大循环,匹配成功
+ }
+ }
+ return isAccess;
+ }
+
+ private static boolean havingPermission(UserModel user, AccessControlModel model, int accessMode, DepartmentModel departmentModel, CompanyModel companyModel) {
+ boolean isAccess = false;
+ if (model._assignmentType.equals("company")) {
+ if (model._assignmentId.equals(companyModel.getId())) {
+ isAccess = model._accessModel == accessMode;
+ }
+ // 检查兼任职位
+ if (!isAccess) {
+ List mapList = UserMapCache.getMapListOfUser(user.getUID());
+ if (mapList != null && mapList.size() > 0) {
+ for (int ii = 0; ii < mapList.size(); ii++) {
+ UserMapModel mapModel = mapList.get(Integer.valueOf(ii));
+ DepartmentModel mapDeptModel = DepartmentCache.getModel(mapModel.getDepartmentId());
+ if (mapDeptModel != null) {
+ CompanyModel mapCompanyModel = CompanyCache.getModel(mapDeptModel.getCompanyId());
+ if (mapCompanyModel != null && model._assignmentId.equals(mapCompanyModel.getId())) {
+ isAccess = model._accessModel == accessMode;
+ if (isAccess)
+ break;
+ }
+ }
+ }
+ }
+ }
+ } else if (model._assignmentType.equals("department")) {
+ DepartmentModel dModel = DepartmentCache.getModel(model._assignmentId);// SubDepartmentUtil.isSubDepartment
+ if (departmentModel.getId().equals(model._assignmentId) || (putDepartmentTree(dModel, departmentModel.getId()))) {
+ isAccess = model._accessModel == accessMode;
+ }
+ // 检查兼任职位
+ if (!isAccess) {
+ List mapList = UserMapCache.getMapListOfUser(user.getUID());
+ if (mapList != null && mapList.size() > 0) {
+ for (int ii = 0; ii < mapList.size(); ii++) {
+ UserMapModel mapModel = mapList.get(Integer.valueOf(ii));
+ DepartmentModel mapDeptModel = DepartmentCache.getModel(mapModel.getDepartmentId());
+ if (mapDeptModel != null) {
+ if (mapDeptModel.getId().equals(model._assignmentId) || (putDepartmentTree(dModel, mapDeptModel.getId()))) {
+ isAccess = model._accessModel == accessMode;
+ }
+ }
+ if (isAccess)
+ break;
+ }
+ }
+ }
+ } else if (model._assignmentType.equals("role")) {
+ if (model._assignmentId.equals(user.getRoleId())) {
+ isAccess = model._accessModel == accessMode;
+ }
+ if (!isAccess) {
+ // 检查兼任职位
+ List mapList = UserMapCache.getMapListOfUser(user.getUID());
+ if (mapList != null && mapList.size() > 0) {
+ for (int ii = 0; ii < mapList.size(); ii++) {
+ UserMapModel mapModel = mapList.get(Integer.valueOf(ii));
+ if (mapModel != null && model._assignmentId.equals(mapModel.getRoleId())) {
+ isAccess = model._accessModel == accessMode;
+ if (isAccess)
+ break;
+ }
+ }
+ }
+ }
+ } else if (model._assignmentType.equals("team")) {
+ Iterator tH = TeamMemberCache.getListOfMember(model._assignmentId);
+ while (tH.hasNext()) {
+ TeamMemberModel uModel = tH.next();
+ if (user.getUID() != null && user.getUID().equals(uModel.getUserId())) {
+ isAccess = model._accessModel == accessMode;
+ if (isAccess)
+ break;
+ }
+ }
+ } else if (model._assignmentType.equals("user") && model._assignmentId.equals(user.getUID())) {
+ isAccess = model._accessModel == accessMode;
+ }
+ return isAccess;
+ }
+
+ /**
+ * @param rootModel
+ * @param currentDepartmentId
+ * @return
+ */
+ private static boolean putDepartmentTree(DepartmentModel rootModel, String currentDepartmentId) {
+ String departmentFullId = "/" + DepartmentCache.getFullID(currentDepartmentId);
+ if (rootModel != null) {
+ String sourceDepartmentId = "/" + rootModel.getId() + "/";
+ if (departmentFullId.indexOf(sourceDepartmentId) != -1) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public static String toDigestUTF8(String src) {
+ return toDigest(src, AES.CHARTSET);
+ }
+
+ /**
+ * 重载方法:获得一个哈西摘要串
+ *
+ * @param src 原文字符串
+ * @param charset 编码
+ * @return 摘要串
+ */
+ public static String toDigest(String src, String charset) {
+ // return DigestUtils.md5Hex(src);速度慢
+ try {
+ MessageDigest messageDigest = MessageDigest.getInstance("MD5");
+ messageDigest.update(src.getBytes(charset));
+ return getFormattedText(messageDigest.digest());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static String getFormattedText(byte[] bytes) {
+ int len = bytes.length;
+ StringBuilder buf = new StringBuilder(len * 2);
+ // 把密文转换成十六进制的字符串形式
+ for (int j = 0; j < len; j++) {
+ buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+ buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+ }
+ return buf.toString();
+ }
+
+ /**
+ * 过滤引号
+ *
+ * @param contextStr
+ * @return
+ */
+ public static String replaceText(String contextStr) {
+ contextStr = contextStr.replaceAll("\"", "");
+ contextStr = contextStr.replaceAll("\'", "");
+ contextStr = contextStr.replaceAll("“", "");
+ contextStr = contextStr.replaceAll("”", "");
+ contextStr = contextStr.replaceAll("‘", "");
+ contextStr = contextStr.replaceAll("’", "");
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < contextStr.length(); i++) {
+ char c = contextStr.charAt(i);
+ switch (c) {
+ case '\"':
+ sb.append("\\\"");
+ break;
+ case '\\':
+ sb.append("\\\\");
+ break;
+ case '/':
+ sb.append("\\/");
+ break;
+ case '\b':
+ sb.append("\\b");
+ break;
+ case '\f':
+ sb.append("\\f");
+ break;
+ case '\n':
+ sb.append("\\n");
+ break;
+ case '\r':
+ sb.append("\\r");
+ break;
+ case '\t':
+ sb.append("\\t");
+ break;
+ default:
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ public static String getPlainText(String htmlStr) {
+ String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
+ String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
+ String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
+ Pattern p_script;
+ java.util.regex.Matcher m_script;
+ Pattern p_style;
+ java.util.regex.Matcher m_style;
+ Pattern p_html;
+ java.util.regex.Matcher m_html;
+ p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
+ m_script = p_script.matcher(htmlStr);
+ htmlStr = m_script.replaceAll(""); // 过滤script标签
+
+ p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
+ m_style = p_style.matcher(htmlStr);
+ htmlStr = m_style.replaceAll(""); // 过滤style标签
+
+ p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
+ m_html = p_html.matcher(htmlStr);
+ htmlStr = m_html.replaceAll(""); // 过滤html标签
+
+ /*htmlStr = htmlStr.replaceAll("(?m)^\\s*$(\\n|\\r\\n)", "");
+ htmlStr = htmlStr.replaceAll("\\s*", "");
+ htmlStr = htmlStr.replaceAll(" ", ""); */
+ return htmlStr;
+ }
+ private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ public static String getSecurityLevelLabel(int securityLevel) {
+ String label = "";
+ HighSecurityModel highSecurityMod = HighSecurity.getSecModel();
+ List> formSecurityList = highSecurityMod.getFormSecurityList();
+ for (List list1 : formSecurityList) {
+ if (list1.size() == 2 && securityLevel == (Integer.parseInt(list1.get(0).toString()))) {
+ label = list1.get(1).toString();
+ break;
+ }
+ }
+ return label;
+ }
+
+ /**
+ * 获得指定日期与当前日期比较后的别名,精确到天
+ *
+ * @param timestamp
+ * @return text 返回指定日期与当前日期比较后的别名,精确到天;1小时内显示“刚刚”,大于1小时显示格式为时:分,其余显示如:昨天、去年3月8日
+ */
+ public static String getAliasDate(Timestamp timestamp) {
+ long compare = timestamp.getTime();// getTimes(timestamp.toString());
+ long now = System.currentTimeMillis();// getTimes(dateFormat(new Date()));
+ Timestamp timestampNow = new Timestamp(now);
+ double difOfHour = (compare - now) / (1000d * 60d * 60d);// 几个小时
+ double difOfMin = (compare - now) / (1000d * 60d);// 几分钟
+
+ int compareDay = getDay(timestamp);
+ int currentDay = getDay(timestampNow);
+
+ int compareYear = getYear(timestamp);
+ int currentYear = getYear(timestampNow);
+
+ int compareMonth = getMonth(timestamp);
+ int currentMonth = getMonth(timestampNow);
+
+ Date compareDate = new Date(timestamp.getTime());
+
+ // 国际化内容
+ String appId = AppsConst.SYS_APP_PORTAL;
+ String lang = LoginConst.DEFAULT_LANG;
+ try {
+ lang = DispatcherRequest.getUserContext().getLanguage();
+ } catch (Exception e) {
+
+ }
+
+ String result = "";
+ // 重新构造算法,zhanghf 2016.2.17
+ if (compareYear == currentYear) {// 两个时间处于同一年
+ if (compareMonth == currentMonth) {// 两个时间处于同一月
+ if (compareDay == currentDay) {// 两个时间处于同一天
+ if (Math.abs(difOfMin) <= 5) {// 小于1小时的显示“刚刚”
+ result = I18nRes.findValue(appId, "刚刚");
+ } else if (Math.abs(difOfMin) > 5 && Math.abs(difOfMin) <= 10) {
+ result = "5分钟前";
+ } else if (Math.abs(difOfMin) > 10 && Math.abs(difOfMin) <= 20) {
+ result = "10分钟前";
+ } else if (Math.abs(difOfMin) > 20 && Math.abs(difOfMin) <= 30) {
+ result = "20分钟前";
+ } else if (Math.abs(difOfMin) > 30 && Math.abs(difOfMin) <= 60) {
+ result = "半个小时前";
+ }
+ /*
+ else if (Math.abs(difOfHour)>0.5 && Math.abs(difOfHour) <= 1) {
+ result = I18nRes.findValue(appId, "一个小时前");
+ }else if (Math.abs(difOfHour)>1 && Math.abs(difOfHour) <= 3) {
+ result = I18nRes.findValue(appId, "二个小时前");
+ }
+ */
+ else {// 大于1小时的,显示具体时间
+ result = timeFormat(timestamp, "HH:mm");//
+ if (result.equals("00:00")) {
+ result = I18nRes.findValue(appId, "今天");
+ }
+ }
+ } else {
+ long difOfDay = compareDay - currentDay;
+ if (difOfDay == -1) {
+ result = I18nRes.findValue(appId, "昨天");
+ } else if (difOfDay == -2) {
+ result = I18nRes.findValue(appId, "前天");
+ } else if (difOfDay == 1) {
+ result = I18nRes.findValue(appId, "明天");
+ } else {
+ if (lang.equals("en")) {
+ result = datetimeFormat(compareDate, "MMM,d", Locale.US);
+ } else {
+ result = datetimeFormat(compareDate, "M月d日");// 同一年里只显示只显示月日
+ }
+ }
+ }
+ } else {// 两个时间大于一个月
+ if (lang.equals("en")) {
+ result = datetimeFormat(compareDate, "MMM,d", Locale.US);
+ } else {
+ result = datetimeFormat(compareDate, "M月d日");// 同一年里只显示只显示月日
+ }
+ }
+ } else {// 两个时间大于一年
+ // 英语环境下,使用英式日期格式
+ if (lang.equals("en")) {
+ result = datetimeFormat(compareDate, "MMM,d", Locale.US);
+ } else {
+ int difOfYear = compareYear - currentYear;
+ if (difOfYear == -1) {
+ result = datetimeFormat(compareDate, "去年M月d日");
+ } else if (difOfYear == -2) {
+ result = datetimeFormat(compareDate, "前年M月d日");
+ } else if (difOfYear == 1) {
+ result = datetimeFormat(compareDate, "明年M月d日");
+ } else {
+ result = datetimeFormat(compareDate, "yyyy年M月d日");
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 使用当前默认的语言环境获得日期时间
+ *
+ * @param date
+ * @param format
+ * @return 日期格式yyyy-MM-dd HH:mm:ss(old:yyyy-MM-dd hh:mm:ss a)
+ */
+ public static String datetimeFormat(Date date, String format) {
+ return UtilDate.datetimeFormat(date, format, Locale.CHINA);
+ }
+
+ /**
+ * 获得日期时间
+ *
+ * @param date
+ * @param format
+ * @param locale 针对指定的语言环境处理
+ * @return 日期格式yyyy-MM-dd HH:mm:ss(old:yyyy-MM-dd hh:mm:ss a)
+ */
+ public static String datetimeFormat(Date date, String format, Locale locale) {
+ if (date == null) {
+ return "";
+ }
+ return UtilDate.datetimeFormat(date, format, locale);
+
+ }
+
+ /**
+ * 得到指定日期的年份
+ *
+ * @param date
+ * @return
+ */
+ public static int getYear(Date date) {
+ Calendar gregorianCalendar = GregorianCalendar.getInstance();
+ gregorianCalendar.setTime(date);
+ return gregorianCalendar.get(Calendar.YEAR);
+ }
+
+ /**
+ * 得到指定日期的小时
+ *
+ * @param date
+ * @return
+ */
+ public static int getHour(Date date) {
+ Calendar gregorianCalendar = GregorianCalendar.getInstance();
+ gregorianCalendar.setTime(date);
+ // gregorianCalendar.setGregorianChange(date);
+ return gregorianCalendar.get(Calendar.HOUR_OF_DAY);
+ }
+
+ /**
+ * 得到指定日期的月份
+ *
+ * @param date
+ * @return
+ */
+ public static int getMonth(Date date) {
+ Calendar gregorianCalendar = GregorianCalendar.getInstance();
+ gregorianCalendar.setTime(date);
+ return gregorianCalendar.get(Calendar.MONTH) + 1;
+ }
+
+ /**
+ * 得到指定日期的天
+ *
+ * @param date
+ * @return
+ */
+ public static int getDay(Date date) {
+ Calendar gregorianCalendar = GregorianCalendar.getInstance();
+ gregorianCalendar.setTime(date);
+ return gregorianCalendar.get(Calendar.DAY_OF_MONTH);
+ }
+
+ /**
+ * 获得日期
+ *
+ * @param date
+ * @return 格式HH:mm:ss
+ */
+ public static String timeFormat(Date date) {
+ return UtilDate.timeFormat(date);
+ }
+
+ /**
+ * 获得参数指定日期
+ *
+ * @param date
+ * @param format
+ * @return 指定格式的时间串
+ */
+ public static String timeFormat(Date date, String format) {
+ if (date == null) {
+ return "";
+ }
+ return UtilDate.timeFormat(date, format);
+ }
+
+ /**
+ * 获取当前登陆用户密级
+ * @param userContext
+ * @return
+ */
+ public static String getUserSecurityLevelLabel(UserContext userContext){
+ int securityLevel = userContext.getUserModel().getSecurityLevel();
+ HighSecurityModel highSecurityMod = HighSecurity.getSecModel();
+ List> userSecurityList = highSecurityMod.getFormSecurityList();
+ StringBuffer html =new StringBuffer();
+ for(List list : userSecurityList){
+ int security = Integer.valueOf(list.get(0).toString());
+ String securityname = list.get(1).toString();
+ if(security<=securityLevel){
+ html.append("");
+ html.append("\n");
+ }
+ }
+ return html.toString();
+ }
+
+
+ /**
+ * 根据密级获取中文名称
+ */
+
+ public static String getUserSecurityName(int SecurityLevel){
+ HighSecurityModel highSecurityMod = HighSecurity.getSecModel();
+
+ List> userSecurityList = highSecurityMod.getFormSecurityList();
+ String securityname="";
+ for(List list : userSecurityList){
+ int security = Integer.valueOf(list.get(0).toString());
+ if(SecurityLevel == security){
+ securityname = list.get(1).toString();
+ break;
+ }
+ }
+ return securityname;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/Plugins.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/Plugins.java
new file mode 100644
index 00000000..f032eaae
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/Plugins.java
@@ -0,0 +1,198 @@
+package com.actionsoft.apps.kms;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.ac.CardACCM;
+import com.actionsoft.apps.kms.ac.DimensionMgrACCM;
+import com.actionsoft.apps.kms.ac.KnwlMgrACCM;
+import com.actionsoft.apps.kms.ac.MetaSchemaACCM;
+import com.actionsoft.apps.kms.ac.XpageMgrACCM;
+import com.actionsoft.apps.kms.aslp.CreateDimension;
+import com.actionsoft.apps.kms.aslp.CreateFile;
+import com.actionsoft.apps.kms.aslp.CreateFileByInputStream;
+import com.actionsoft.apps.kms.aslp.CreateFormLink;
+import com.actionsoft.apps.kms.aslp.CreateKnwl;
+import com.actionsoft.apps.kms.aslp.FullSearch;
+import com.actionsoft.apps.kms.aslp.GetDimension;
+import com.actionsoft.apps.kms.aslp.GetFile;
+import com.actionsoft.apps.kms.aslp.GetKnwl;
+import com.actionsoft.apps.kms.aslp.PublishKnwl;
+import com.actionsoft.apps.kms.aslp.SearchDimensionList;
+import com.actionsoft.apps.kms.aslp.SearchFileList;
+import com.actionsoft.apps.kms.aslp.SearchKnwlList;
+import com.actionsoft.apps.kms.aslp.UpdateDimension;
+import com.actionsoft.apps.kms.aslp.UpdateKnwl;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.cache.CardPermCache;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.cache.DimensionPermCache;
+import com.actionsoft.apps.kms.cache.DimensionTreeCache;
+import com.actionsoft.apps.kms.cache.FileCache;
+import com.actionsoft.apps.kms.cache.HotspotCache;
+import com.actionsoft.apps.kms.cache.MetaAttrCache;
+import com.actionsoft.apps.kms.cache.MetaDataCache;
+import com.actionsoft.apps.kms.cache.MetaSchemaCache;
+import com.actionsoft.apps.kms.cache.OptCache;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.cache.VersionCache;
+import com.actionsoft.apps.kms.dc.DocCardContentProcessor;
+import com.actionsoft.apps.kms.dc.DocFileProcessor;
+import com.actionsoft.apps.kms.dc.HotspotFileProcessor;
+import com.actionsoft.apps.kms.dc.TmpFileProcessor;
+import com.actionsoft.apps.kms.formatter.KMSNotificationFormatter;
+import com.actionsoft.apps.kms.formatter.KMSReportFormatter;
+import com.actionsoft.apps.kms.service.PermChangeByOrgSync;
+import com.actionsoft.apps.kms.ui.FormUIComponentKnwlImpl;
+import com.actionsoft.apps.kms.web.FavoriteWeb;
+import com.actionsoft.apps.listener.PluginListener;
+import com.actionsoft.apps.resource.AppContext;
+import com.actionsoft.apps.resource.plugin.profile.ACPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.ASLPPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.AppExtensionProfile;
+import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.FormUIPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.FullSearchPluginProfile;
+import com.actionsoft.apps.resource.plugin.profile.HttpASLP;
+import com.actionsoft.apps.resource.plugin.profile.OrgSyncPluginProfile;
+import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
+
+/**
+ * @author wangshibao
+ */
+public class Plugins implements PluginListener {
+
+ @Override
+ public List register(AppContext appContext) {
+ List awsPluginProfiles = new ArrayList();
+ // 缓存
+ awsPluginProfiles.add(new CachePluginProfile(DimensionCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(CardCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(PublishCache.class));// publish是card和dimension的中间表,应在两者之后加载cache
+ awsPluginProfiles.add(new CachePluginProfile(FileCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(OptCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(VersionCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(HotspotCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(MetaSchemaCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(MetaAttrCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(MetaDataCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(CardPermCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(DimensionPermCache.class));
+ awsPluginProfiles.add(new CachePluginProfile(DimensionTreeCache.class));
+ // aslp
+ awsPluginProfiles.add(new ASLPPluginProfile("createDimension", CreateDimension.class.getName(), "创建维度", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("updateDimension", UpdateDimension.class.getName(), "修改维度", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("searchDimensionList", SearchDimensionList.class.getName(), "查询维度列表", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("GetDimension", GetDimension.class.getName(), "查询单个维度", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("CreateKnwl", CreateKnwl.class.getName(), "创建知识", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("UpdateKnwl", UpdateKnwl.class.getName(), "修改知识", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("SearchKnwlList", SearchKnwlList.class.getName(), "查询知识(多个参数之间是AND关系,单个参数内部是OR关系)", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("GetKnwl", GetKnwl.class.getName(), "查询单个知识", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("GetFile", GetFile.class.getName(), "查询单个文件", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("CreateFile", CreateFile.class.getName(), "创建文件", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("CreateFileByInputStream", CreateFileByInputStream.class.getName(), "通过流创建文件", null));
+ awsPluginProfiles.add(new ASLPPluginProfile("CreateFormLink", CreateFormLink.class.getName(), "创建表单链接类文件", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("SearchFileList", SearchFileList.class.getName(), "查询文件", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("FullSearch", FullSearch.class.getName(), "全文检索(由于KMS的权限限制,返回结果可能大于rowsPerPage条)", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+ awsPluginProfiles.add(new ASLPPluginProfile("PublishKnwl", PublishKnwl.class.getName(), "发布知识", new HttpASLP(HttpASLP.AUTH_RSA, null)));
+
+ // ac
+ KnwlMgrACCM knwlMgrACCM = new KnwlMgrACCM();
+ //awsPluginProfiles.add(new ACPluginProfile(KnwlMgrACCM.resourceType, knwlMgrACCM.getResourceName(), null, knwlMgrACCM.getAccessModes(), false, true));// 知识管理员
+ awsPluginProfiles.add(new ACPluginProfile(knwlMgrACCM));// 知识管理员
+ XpageMgrACCM xpageMgrACCM = new XpageMgrACCM();
+ //awsPluginProfiles.add(new ACPluginProfile(KnwlMgrACCM.resourceType, knwlMgrACCM.getResourceName(), null, knwlMgrACCM.getAccessModes(), false, true));// 知识管理员
+ awsPluginProfiles.add(new ACPluginProfile(xpageMgrACCM));// XPAGE内容管理员
+
+ DimensionMgrACCM dimensionMgrACCM = new DimensionMgrACCM();
+ //awsPluginProfiles.add(new ACPluginProfile(DimensionMgrACCM.resourceType, dimensionMgrACCM.getResourceName(), null, dimensionMgrACCM.getAccessModes(), false, true));// 维度管理员
+ awsPluginProfiles.add(new ACPluginProfile(dimensionMgrACCM));// 维度管理员
+
+ MetaSchemaACCM metaSchemaACCM = new MetaSchemaACCM();
+ awsPluginProfiles.add(new ACPluginProfile(MetaSchemaACCM.resourceType, metaSchemaACCM.getResourceName(), null, metaSchemaACCM.getAccessModes(), false, true));
+
+ CardACCM cardACCM = new CardACCM();
+ //awsPluginProfiles.add(new ACPluginProfile(CardACCM.resourceType, cardACCM.getResourceName(), null, cardACCM.getAccessModes(), false, true));
+ awsPluginProfiles.add(new ACPluginProfile(cardACCM));
+ // dc
+ awsPluginProfiles.add(new DCPluginProfile(KMSConstant.DOC_REPOSITORY_NAME, DocFileProcessor.class.getName(), "普通文档,文档存放到该应用的doc目录下", false, true));
+ awsPluginProfiles.add(new DCPluginProfile(KMSConstant.DOC_CARDCONTENT_REPOSITORY_NAME, DocCardContentProcessor.class.getName(), "卡片正文", false));
+ awsPluginProfiles.add(new DCPluginProfile("tmp", TmpFileProcessor.class.getName(), "知识地图临时图片", false, false));
+ // awsPluginProfiles.add(new DCPluginProfile(KMSConstant.ONLINEDOC_REPOSITORY_NAME, OnlinedocFileProcessor.class.getName(), "onlinedoc生成图片和pdf到该目录下", false));
+ awsPluginProfiles.add(new DCPluginProfile(KMSConstant.DOC_REPOSITORY_HOTSPOT, HotspotFileProcessor.class.getName(), "用户上传的知识地图目录", false, false));
+ // 全文检索
+ awsPluginProfiles.add(new FullSearchPluginProfile(KMSConstant.FULLSEARCH_REPOSITORY_NAME, false, "KMS全文检索"));
+ // 注册应用扩展点-收藏
+ Map params1 = new HashMap();
+ params1.put("categoryName", KMSConstant.FAVORITE_CATEGORY_KMS);
+ params1.put("mainClass", FavoriteWeb.class.getName());
+ awsPluginProfiles.add(new AppExtensionProfile("我的收藏->KMS", "aslp://com.actionsoft.apps.favorite/registerApp", params1));
+ // 注册应用扩展点-通知-阅读邀请
+ Map params2 = new HashMap();
+ params2.put("systemName", KMSConstant.NOTIFICATION_SYSTEM_NAME);
+ params2.put("icon", "");
+ params2.put("formatter", KMSNotificationFormatter.class.getName());
+ awsPluginProfiles.add(new AppExtensionProfile("通知中心->浏览知识", "aslp://com.actionsoft.apps.notification/registerApp", params2));
+ // 注册应用扩展点-通知-知识反馈
+ Map params3 = new HashMap();
+ params3.put("systemName", KMSConstant.REPORT_SYSTEM_NAME);
+ params3.put("icon", "");
+ params3.put("formatter", KMSReportFormatter.class.getName());
+ awsPluginProfiles.add(new AppExtensionProfile("通知中心->知识反馈", "aslp://com.actionsoft.apps.notification/registerApp", params3));
+ //表单UI组件
+ FormUIPluginProfile formUIPluginProfile = new FormUIPluginProfile("高级组件", "AWSUI.KnwlPortal", FormUIComponentKnwlImpl.class.getName(), "知识门户", "有访问权限的知识列表", false, true, false, false, false, true, true, false, false);
+ Class clazz = formUIPluginProfile.getClass();
+ try {
+ Method setIconFont = clazz.getDeclaredMethod("setIconFont", String.class, String.class, String.class);
+ setIconFont.invoke(formUIPluginProfile, "awsui-iconfont", "", "#0c6e9f");
+ } catch (Exception e) {
+ }
+
+ awsPluginProfiles.add(formUIPluginProfile);
+
+ // addons页面
+
+ // awsPluginProfiles.add(new AddOnsPluginProfile(AddonsWeb.class.getName()));
+ //注册全文检索
+ Map params4 = new HashMap();
+ params4.put("name", "知识");
+ params4.put("url", "./w?cmd=com.actionsoft.apps.kms_es_search&sid=$sid&q=$q");
+ params4.put("placeholder", "请输入要查询的内容...");
+ params4.put("orderIndex", 45);
+ awsPluginProfiles.add(new AppExtensionProfile("知识", "aslp://com.actionsoft.apps.addons.es/registerApp", params4));
+
+ //注册xpages
+ String contextAll5 = HtmlPageTemplate.merge(KMSConstant.APP_ID, "kms.latest.xPageRegister.htm", null);
+ Map params5 = new HashMap();
+ params5.put("systemName", "最新KMS知识");
+ params5.put("type", "3");
+ params5.put("functionPre", "kmslatest");
+ params5.put("urlIdentifier", "com.actionsoft.apps.kms_xpages");
+ params5.put("xpagesContent", contextAll5);
+ awsPluginProfiles.add(new AppExtensionProfile("最新KMS知识", "aslp://com.actionsoft.apps.addons.xpages/registerApp", params5));
+ String contextAll = HtmlPageTemplate.merge(KMSConstant.APP_ID, "kms.directory.xPageRegister.htm", null);
+ Map params6 = new HashMap();
+ params6.put("systemName", "KMS目录");
+ params6.put("type", "3");
+ params6.put("functionPre", "kmsdirectory");
+ params6.put("urlIdentifier", "com.actionsoft.apps.kms_xpage_opencardbydirctory");
+ params6.put("xpagesContent", contextAll);
+ awsPluginProfiles.add(new AppExtensionProfile("KMS目录", "aslp://com.actionsoft.apps.addons.xpages/registerApp", params6));
+ String contextAll7 = HtmlPageTemplate.merge(KMSConstant.APP_ID, "kms.card.xPageRegister.htm", null);
+ Map params7 = new HashMap();
+ params7.put("systemName", "KMS知识");
+ params7.put("type", "3");
+ params7.put("xpagesContent", contextAll7);
+ params7.put("urlIdentifier", "com.actionsoft.apps.kms_xpage_openfastcard");
+ params7.put("functionPre", "kmscard");
+ awsPluginProfiles.add(new AppExtensionProfile("KMS知识", "aslp://com.actionsoft.apps.addons.xpages/registerApp", params7));
+ awsPluginProfiles.add(new OrgSyncPluginProfile(PermChangeByOrgSync.class.getName(), "组织结构变化同步维度知识权限"));
+ return awsPluginProfiles;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/CardACCM.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/CardACCM.java
new file mode 100644
index 00000000..444a0642
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/CardACCM.java
@@ -0,0 +1,63 @@
+package com.actionsoft.apps.kms.ac;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.CardPermCache;
+import com.actionsoft.apps.kms.cache.DimensionTreeCache;
+import com.actionsoft.bpms.commons.security.ac.model.ACAccessMode;
+import com.actionsoft.bpms.commons.security.ac.model.ACCM;
+import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
+
+/**
+ * 知识访问ac
+ *
+ * @author wangshibao
+ */
+public class CardACCM extends ACCM {
+ public static ACAccessMode CARD = new ACAccessMode("知识访问", 0);
+ public static String resourceType = KMSConstant.AC_RESOURCE_TYPE_CARD;
+ public String resourceName = "知识访问";
+ private String[] assignmentTypes;
+ private static ACAccessMode[] accessModes = new ACAccessMode[] { CARD };
+ private boolean isolationCompany;
+ private boolean orgAdminSecurity = true;
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public String[] getAssignmentTypes() {
+ return assignmentTypes;
+ }
+
+ @Override
+ public ACAccessMode[] getAccessModes() {
+ return accessModes;
+ }
+
+ @Override
+ public boolean isIsolationCompany() {
+ return isolationCompany;
+ }
+
+ @Override
+ public boolean isOrgAdminSecurity() {
+ return orgAdminSecurity;
+ }
+
+ @Override
+ public void callBack(List acModelList) {
+ DimensionTreeCache.getCache().destroy(true);
+ for (AccessControlModel accessControlModel : acModelList) {
+ CardPermCache.getCache().remove(accessControlModel._resourceId);
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/DimensionMgrACCM.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/DimensionMgrACCM.java
new file mode 100644
index 00000000..ad0607ca
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/DimensionMgrACCM.java
@@ -0,0 +1,67 @@
+package com.actionsoft.apps.kms.ac;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.DimensionPermCache;
+import com.actionsoft.apps.kms.cache.DimensionTreeCache;
+import com.actionsoft.bpms.commons.security.ac.model.ACAccessMode;
+import com.actionsoft.bpms.commons.security.ac.model.ACCM;
+import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
+
+/**
+ * 二级知识管理员ac(或者叫维度管理员ac,区别于知识管理员)
+ *
+ * @author wangshibao
+ */
+public class DimensionMgrACCM extends ACCM {
+ public static ACAccessMode PUBLISH = new ACAccessMode("发布", 3);
+ public static ACAccessMode ACCESS = new ACAccessMode("访问", 0);
+ public static ACAccessMode BORROW = new ACAccessMode("借阅", 1);
+ public static ACAccessMode DIMENSION_MGR = new ACAccessMode("维度管理员", 2);
+ public static String resourceType = KMSConstant.AC_RESOURCE_TYPE_DIMENSION_MGR;
+ public String resourceName = "维度管理员";
+ private String[] assignmentTypes;
+ private static ACAccessMode[] accessModes = new ACAccessMode[] { PUBLISH, ACCESS, BORROW, DIMENSION_MGR };
+ private boolean isolationCompany;
+ private boolean orgAdminSecurity = true;
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public String[] getAssignmentTypes() {
+ return assignmentTypes;
+ }
+
+ @Override
+ public ACAccessMode[] getAccessModes() {
+ return accessModes;
+ }
+
+ @Override
+ public boolean isIsolationCompany() {
+ return isolationCompany;
+ }
+
+ @Override
+ public boolean isOrgAdminSecurity() {
+ return orgAdminSecurity;
+ }
+
+ @Override
+ public void callBack(List acModelList) {
+ DimensionTreeCache.getCache().destroy(true);
+ for (AccessControlModel accessControlModel : acModelList) {
+ DimensionPermCache.getCache().remove(accessControlModel._resourceId);
+ DimensionTreeCache.getCache().destroy(true);
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/KnwlMgrACCM.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/KnwlMgrACCM.java
new file mode 100644
index 00000000..3ffd9361
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/KnwlMgrACCM.java
@@ -0,0 +1,63 @@
+package com.actionsoft.apps.kms.ac;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.CardPermCache;
+import com.actionsoft.apps.kms.cache.DimensionPermCache;
+import com.actionsoft.apps.kms.cache.DimensionTreeCache;
+import com.actionsoft.bpms.commons.security.ac.model.ACAccessMode;
+import com.actionsoft.bpms.commons.security.ac.model.ACCM;
+import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
+
+/**
+ * 知识管理员ac
+ *
+ * @author wangshibao
+ */
+public class KnwlMgrACCM extends ACCM {
+ public static ACAccessMode KNWLMGR = new ACAccessMode("知识管理员", 0);
+ public static String resourceType = KMSConstant.AC_RESOURCE_TYPE_KNWL_MGR;
+ public String resourceName = "知识管理员";
+ private String[] assignmentTypes;
+ private static ACAccessMode[] accessModes = new ACAccessMode[] { KNWLMGR };
+ private boolean isolationCompany;
+ private boolean orgAdminSecurity = true;
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public String[] getAssignmentTypes() {
+ return assignmentTypes;
+ }
+
+ @Override
+ public ACAccessMode[] getAccessModes() {
+ return accessModes;
+ }
+
+ @Override
+ public boolean isIsolationCompany() {
+ return isolationCompany;
+ }
+
+ @Override
+ public boolean isOrgAdminSecurity() {
+ return orgAdminSecurity;
+ }
+
+ @Override
+ public void callBack(List acModelList) {
+ DimensionTreeCache.getCache().destroy(true);
+ DimensionPermCache.getCache().destroy(true);
+ CardPermCache.getCache().destroy(true);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/MetaSchemaACCM.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/MetaSchemaACCM.java
new file mode 100644
index 00000000..74f5e31f
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/MetaSchemaACCM.java
@@ -0,0 +1,52 @@
+package com.actionsoft.apps.kms.ac;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.commons.security.ac.model.ACAccessMode;
+import com.actionsoft.bpms.commons.security.ac.model.ACCM;
+
+/**
+ * 元数据ac(发布和访问)
+ *
+ * @author wangshibao
+ */
+public class MetaSchemaACCM extends ACCM {
+ public static ACAccessMode PUBLISH = new ACAccessMode("发布", 0);
+ public static ACAccessMode READ = new ACAccessMode("访问", 1);
+ public static String resourceType = KMSConstant.AC_RESOURCE_TYPE_META_SCHEMA;
+ public String resourceName = "元数据发布访问权限";
+ private String[] assignmentTypes;
+ private static ACAccessMode[] accessModes = new ACAccessMode[] { PUBLISH, READ };
+ private boolean isolationCompany;
+ private boolean orgAdminSecurity = true;
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public String[] getAssignmentTypes() {
+ return assignmentTypes;
+ }
+
+ @Override
+ public ACAccessMode[] getAccessModes() {
+ return accessModes;
+ }
+
+ @Override
+ public boolean isIsolationCompany() {
+ return isolationCompany;
+ }
+
+ @Override
+ public boolean isOrgAdminSecurity() {
+ return orgAdminSecurity;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/XpageMgrACCM.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/XpageMgrACCM.java
new file mode 100644
index 00000000..fe49c4e0
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/ac/XpageMgrACCM.java
@@ -0,0 +1,51 @@
+package com.actionsoft.apps.kms.ac;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.commons.security.ac.model.ACAccessMode;
+import com.actionsoft.bpms.commons.security.ac.model.ACCM;
+
+/**
+ * xpage内容管理员ac
+ *
+ * @author wangshibao
+ */
+public class XpageMgrACCM extends ACCM {
+ public static ACAccessMode XPAGEMGR = new ACAccessMode("xpage内容管理员", 0);
+ public static String resourceType = KMSConstant.AC_RESOURCE_TYPE_XPAGE_MGR;
+ public String resourceName = "xpage内容管理员";
+ private String[] assignmentTypes;
+ private static ACAccessMode[] accessModes = new ACAccessMode[] { XPAGEMGR };
+ private boolean isolationCompany;
+ private boolean orgAdminSecurity = true;
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public String[] getAssignmentTypes() {
+ return assignmentTypes;
+ }
+
+ @Override
+ public ACAccessMode[] getAccessModes() {
+ return accessModes;
+ }
+
+ @Override
+ public boolean isIsolationCompany() {
+ return isolationCompany;
+ }
+
+ @Override
+ public boolean isOrgAdminSecurity() {
+ return orgAdminSecurity;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateDimension.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateDimension.java
new file mode 100644
index 00000000..bb5df473
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateDimension.java
@@ -0,0 +1,83 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.apps.kms.service.DimensionService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UtilString;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class CreateDimension implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'dimensionName', required: true, desc: '维度名称'", "name: 'parentId', required: true, desc: '父维度Id:\"\"表示根维度'", "name: 'showType', required: true, desc: '维度类型,1:允许发布知识 2:不允许发布知识'", "name: 'isExamine', required: true, desc: '发布是否需要审批,默认false'", "name: 'memo', required: false, desc: '维度描述'", "name: 'isEnabled', required: true, desc: '是否启用,默认启用'", "name: 'createUser', required: false, desc: '创建人'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String dimensionName = (String) params.get("dimensionName");
+ if (UtilString.isEmpty(dimensionName) || UtilString.isEmpty(dimensionName.trim())) {
+ ro = ResponseObject.newErrResponse("维度名称不允许为空");
+ return ro;
+ }
+
+ String parentId = (String) params.get("parentId");
+ if (!parentId.equals("")) {
+ DimensionModel dimensionModel = DimensionCache.getCache().get(parentId);
+ if (dimensionModel == null) {
+ ro = ResponseObject.newErrResponse("父维度Id不存在");
+ return ro;
+ }
+ }
+
+ Integer showTypeI = Integer.valueOf(params.get("showType").toString());
+ if (showTypeI != null) {
+ int showType = showTypeI.intValue();
+ if (showType != KMSConstant.SHOWTYPE_CATEGORY && showType != KMSConstant.SHOWTYPE_DIMENSION) {
+ ro = ResponseObject.newErrResponse("维度类型不正确");
+ return ro;
+ }
+ }
+
+ String createUser = UserContext.fromSessionId(sid).getUID();
+ if (params.containsKey("createUser")) {
+ createUser = (String) params.get("createUser");
+ }
+ UserModel createUserModel = SDK.getORGAPI().getUser(createUser);
+ if (createUserModel == null || createUserModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("创建人UID不存在或已注销");
+ return ro;
+ }
+ boolean isExamine = Boolean.valueOf(params.get("isExamine").toString());
+ String memo = (String) params.get("memo");
+ boolean isEnabled = Boolean.valueOf(params.get("isEnabled").toString());
+
+ DimensionService dimensionService = new DimensionService();
+ String dimensionId = dimensionService.createDimension(dimensionName, parentId, showTypeI.intValue(), isExamine, memo, createUser, "", isEnabled);
+
+ ro = ResponseObject.newOkResponse("创建成功").put("dimensionId", dimensionId);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFile.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFile.java
new file mode 100644
index 00000000..48620d52
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFile.java
@@ -0,0 +1,60 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+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.server.fs.dc.DCUtil;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class CreateFile implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'cardId', required: true, desc: '知识ID'", "name: 'dc', required: true, desc: 'DCContext对象'", "name: 'extParams',required:false,desc:'扩展信息,JSON字符串'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String cardId = (String) params.get("cardId");
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ if (cardModel == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+
+ DCContext dcContext = (DCContext) params.get("dc");
+
+ String fileVersion = KMSUtil.getNextFileVersion(cardId, dcContext.getFileName());
+ DCContext newDCContext = new DCContext(UserContext.fromSessionId(sid), DCProfileManager.getDCProfile(KMSConstant.APP_ID, KMSConstant.DOC_REPOSITORY_NAME), KMSConstant.APP_ID, cardModel.getCreateUser(), cardId, dcContext.getFileName());
+ boolean result = DCUtil.copyDCFile(dcContext, newDCContext);
+ if (result) {
+ ro = ResponseObject.newOkResponse("创建成功").put("fileId", (String) newDCContext.getDCMessage().getAttrs().get("fileId"));
+ } else {
+ ro = ResponseObject.newErrResponse("创建失败,复制DC失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFileByInputStream.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFileByInputStream.java
new file mode 100644
index 00000000..5fcb37d5
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFileByInputStream.java
@@ -0,0 +1,72 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.io.InputStream;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+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.server.fs.file.WriteDCFile;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class CreateFileByInputStream implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'cardId', required: true, desc: '知识ID'", "name: 'in', required: true, desc: 'inputstream对象'", "name: 'fileName', required: true, desc: '文件名称'", "name: 'extParams',required:false,desc:'扩展信息,JSON字符串'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String cardId = (String) params.get("cardId");
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ if (cardModel == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+
+ InputStream inputStream = (InputStream) params.get("in");
+ String fileName = (String) params.get("fileName");
+ String fileVersion = KMSUtil.getNextFileVersion(cardId, fileName);
+ DCContext newDCContext = new DCContext(UserContext.fromSessionId(sid), DCProfileManager.getDCProfile(KMSConstant.APP_ID, KMSConstant.DOC_REPOSITORY_NAME), KMSConstant.APP_ID, cardModel.getCreateUser(), cardId, fileName);
+ boolean result = copyDCFile(inputStream, newDCContext);
+ if (result) {
+ ro = ResponseObject.newOkResponse("创建成功").put("fileId", (String) newDCContext.getDCMessage().getAttrs().get("fileId"));
+ } else {
+ ro = ResponseObject.newErrResponse("创建失败,复制DC失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+ public boolean copyDCFile(InputStream sourceFileByte, DCContext targetContext) {
+ try {
+ return WriteDCFile.getInstance().write(sourceFileByte, targetContext);
+ } finally {
+ try {
+ sourceFileByte.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFormLink.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFormLink.java
new file mode 100644
index 00000000..3a190f85
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateFormLink.java
@@ -0,0 +1,89 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.sql.Timestamp;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.dao.FileDao;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.kms.model.FileModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UUIDGener;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class CreateFormLink implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'cardId', required: true, desc: '知识ID'", "name: 'formJSON', required: true, desc: '表单链接所需的JSON信息,格式:{"processInstId":"xxx","taskInstId":"xxx","formName":"xxx"}'", "name: 'createUser', required: false, desc: '表单链接创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String cardId = (String) params.get("cardId");
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ if (cardModel == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+
+ String createUser;
+ String createUserParam = (String) params.get("createUser");
+ if (createUserParam == null) {
+ createUser = UserContext.fromSessionId(sid).getUID();
+ } else {
+ createUser = createUserParam;
+ }
+ UserModel createUserModel = SDK.getORGAPI().getUser(createUser);
+ if (createUserModel == null || createUserModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("创建人UID不存在或已注销");
+ return ro;
+ }
+
+ String formJSON = (String) params.get("formJSON");
+ JSONObject formJO = JSONObject.parseObject(formJSON);
+ if (!formJO.containsKey("processInstId") || !formJO.containsKey("taskInstId") || !formJO.containsKey("formName")) {
+ ro = ResponseObject.newErrResponse("[表单链接所需的JSON信息]格式错误");
+ return ro;
+ }
+
+ FileModel fileModel = new FileModel();
+ fileModel.setCardId(cardId);
+ fileModel.setCreateTime(new Timestamp(System.currentTimeMillis()));
+ fileModel.setCreateUser(createUser);
+ fileModel.setFileName(formJSON);
+ fileModel.setFileSize(-1);
+ fileModel.setFileVer("-1");
+ String fileId = UUIDGener.getObjectId();
+ fileModel.setId(fileId);
+ fileModel.setFileState(2);//2代表表单链接
+ fileModel.setIsFullsearch(2);//2代表无需全文检索
+
+ FileDao fileDao = new FileDao();
+ int result = fileDao.insert(fileModel);
+ if (result == 1) {
+ ro = ResponseObject.newOkResponse("创建成功").put("fileId", fileId);
+ } else {
+ ro = ResponseObject.newErrResponse("创建失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateKnwl.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateKnwl.java
new file mode 100644
index 00000000..be75c2e0
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/CreateKnwl.java
@@ -0,0 +1,99 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Date;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.service.CardService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UUIDGener;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.bpms.util.UtilString;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class CreateKnwl implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: false, desc: 'sid,如果为空,则需要传createUser参数'", "name: 'knwlName', required: true, desc: '知识名称'", "name: 'createUser', required: false, desc: '知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户'", "name: 'validDate', required: false, desc: '有效期:yyyy-MM-dd'", "name: 'onlineLevel', required: true, desc: '只读控制,1:在线阅读和下载 0:在线阅读'", "name: 'securityLevel', required: true, desc: '保密级别, 0: 普通 1:秘密 2:机密'", "name: 'isComment', required: true, desc: '是否可以评论'", "name: 'isRate', required: true, desc: '是否可以评分'",
+ "name:'cardContext',required:false,desc:'知识内容'", "name: 'externalUrl',required:false,desc:'外部知识链接,可以展示外部知识的链接'", "name: 'extParams',required:false,desc:'扩展信息,JSON字符串'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (UtilString.isNotEmpty(sid) && !SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String knwlName = (String) params.get("knwlName");
+ if (UtilString.isEmpty(knwlName) || UtilString.isEmpty(knwlName.trim())) {
+ ro = ResponseObject.newErrResponse("知识名称不允许为空");
+ return ro;
+ }
+
+ Date validDate = params.get("validDate") == null ? null : UtilDate.parse(params.get("validDate").toString());
+
+ Integer onlineLevel = (Integer) params.get("onlineLevel");
+ if (onlineLevel.intValue() != 1 && onlineLevel.intValue() != 0) {
+ ro = ResponseObject.newErrResponse("只读控制值不正确");
+ return ro;
+ }
+
+ Integer securityLevel = (Integer) params.get("securityLevel");
+ if (securityLevel.intValue() != 0 && securityLevel.intValue() != 1 && securityLevel.intValue() != 2) {
+ ro = ResponseObject.newErrResponse("保密级别值不正确");
+ return ro;
+ }
+
+ Boolean isComment = (Boolean) params.get("isComment");
+
+ Boolean isRate = (Boolean) params.get("isRate");
+
+ String url = (String) params.get("externalUrl");
+
+ String extParams = (String) params.get("extParams");
+
+ String createUser;
+ String createUserParam = (String) params.get("createUser");
+ if (createUserParam == null) {
+ if (UtilString.isEmpty(sid)) {
+ ro = ResponseObject.newErrResponse("sid和createUser不能都为空值");
+ return ro;
+ }
+ createUser = UserContext.fromSessionId(sid).getUID();
+ } else {
+ createUser = createUserParam;
+ }
+ UserModel createUserModel = SDK.getORGAPI().getUser(createUser);
+ if (createUserModel == null || createUserModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("创建人UID不存在或已注销");
+ return ro;
+ }
+
+ CardService cardService = new CardService();
+ String cardId = UUIDGener.getObjectId();
+ String cardContext = "";
+ if (params.containsKey("cardContext")) {
+ cardContext = (String) params.get("cardContext");
+ }
+ boolean result = cardService.insertCard(createUser, cardId, knwlName, validDate == null ? null : new java.sql.Date(validDate.getTime()), onlineLevel, securityLevel, 0, isComment == true ? 1 : 0, isRate == true ? 1 : 0, cardContext, url, extParams);
+
+ if (result) {
+ ro = ResponseObject.newOkResponse("创建成功").put("cardId", cardId);
+ } else {
+ ro = ResponseObject.newOkResponse("创建失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/FullSearch.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/FullSearch.java
new file mode 100644
index 00000000..dc3c8a6a
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/FullSearch.java
@@ -0,0 +1,62 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.service.SearchService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+
+/**
+ * @author wangshibao
+ */
+public class FullSearch implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'curPage', required: true, desc: '当前页码,从0开始'", "name: 'rowsPerPage', required: true, desc: '每页的条数'", "name: 'searchText', required: true, desc: '查询的关键词'", "name: 'docTypes', required: false, desc: '文档类型,JSON数组,格式:["pdf","doc","ppt","xls","txt"]'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String uid = UserContext.fromSessionId(sid).getUID();
+ UserModel userModel = SDK.getORGAPI().getUser(uid);
+ if (userModel == null || userModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("查询者UID不存在或已注销");
+ return ro;
+ }
+
+ Integer curPage = Integer.valueOf(params.get("curPage").toString());
+
+ Integer rowsPerPage = Integer.valueOf(params.get("rowsPerPage").toString());
+
+ String searchText = (String) params.get("searchText");
+
+ String docTypes = (String) params.get("docTypes");
+ List docTypeList = new ArrayList<>();
+ if (docTypes != null) {
+ docTypeList = JSONArray.parseArray(docTypes, String.class);
+ }
+ String result = new SearchService().fullSearchWrap(UserContext.fromSessionId(sid), curPage, rowsPerPage, searchText, docTypeList, "1");
+ ResponseObject resultRO = ResponseObject.parse(result);
+ if (resultRO.isOk()) {
+ ro = resultRO.msg("查询成功");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetDimension.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetDimension.java
new file mode 100644
index 00000000..eec0ec41
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetDimension.java
@@ -0,0 +1,61 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.cache.UserCache;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class GetDimension implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'dimensionId', required: true, desc: '维度ID'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String dimensionId = (String) params.get("dimensionId");
+
+ DimensionModel dimensionModel = DimensionCache.getCache().get(dimensionId);
+ if (dimensionModel == null) {
+ ro = ResponseObject.newErrResponse("维度不存在");
+ return ro;
+ }
+
+ JSONObject dimensionJO = new JSONObject();
+ dimensionJO.put("id", dimensionModel.getId());
+ dimensionJO.put("dimensionName", dimensionModel.getDimensionName());
+ dimensionJO.put("showType", dimensionModel.getShowType());
+ dimensionJO.put("isExamine", dimensionModel.getIsExamine() == 1 ? true : false);
+ dimensionJO.put("memo", dimensionModel.getMemo());
+ dimensionJO.put("createUsername", UserCache.getModel(dimensionModel.getCreateUser()) == null ? dimensionModel.getCreateUser() : UserCache.getModel(dimensionModel.getCreateUser()).getUserName());
+ dimensionJO.put("createTime", UtilDate.datetimeFormat(dimensionModel.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+ dimensionJO.put("isEnabled", dimensionModel.getIsEnabled() == 1 ? true : false);
+ dimensionJO.put("hotspotDefId", dimensionModel.getHotspotDefId());
+ dimensionJO.put("orderIndex", dimensionModel.getOrderIndex());
+
+ ro = ResponseObject.newOkResponse("查询成功").put("dimension", dimensionJO);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetFile.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetFile.java
new file mode 100644
index 00000000..7e435b9d
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetFile.java
@@ -0,0 +1,77 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.cache.FileCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.kms.model.FileModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+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.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class GetFile implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'fileId', required: true, desc: '文件ID'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String fileId = (String) params.get("fileId");
+
+ FileModel fileModel = FileCache.getCache().get(fileId);
+ if (fileModel == null) {
+ ro = ResponseObject.newErrResponse("文件不存在");
+ return ro;
+ }
+
+ JSONObject fileJO = new JSONObject();
+ fileJO.put("fileId", fileModel.getId());
+ fileJO.put("cardId", fileModel.getCardId());
+ fileJO.put("fileName", fileModel.getFileName());
+ fileJO.put("fileVer", fileModel.getFileVer());
+ fileJO.put("fileSize", fileModel.getFileSize());
+ fileJO.put("fileState", fileModel.getFileState());
+ fileJO.put("createTime", UtilDate.datetimeFormat24(fileModel.getCreateTime()));
+ fileJO.put("createUser", fileModel.getCreateUser());
+ String knwlId=fileModel.getCardId();
+ fileJO.put("isFullsearch", fileModel.getIsFullsearch());
+ String fileName = fileModel.getFileName();
+ CardCache cardCache = CardCache.getCache();
+ CardModel cardModel = cardCache.get(fileModel.getCardId());
+ DCContext dcContext = new DCContext(UserContext.fromSessionId(sid), DCProfileManager.getDCProfile(KMSConstant.APP_ID, KMSConstant.DOC_REPOSITORY_NAME), KMSConstant.APP_ID, cardModel.getCreateUser(), knwlId, KMSUtil.getFileNameOfVersion(fileName, fileModel.getFileVer()));
+ dcContext.setFileNameShow(fileName);
+ fileJO.put("fileDownloadURL", dcContext.getDownloadURL());
+ fileJO.put("repositoryName", KMSConstant.DOC_REPOSITORY_NAME);
+ fileJO.put("groupValue", cardModel.getCreateUser());
+ fileJO.put("fileValue", knwlId);
+ fileJO.put("fileName", KMSUtil.getFileNameOfVersion(fileName, fileModel.getFileVer()));
+ fileJO.put("extParams", "{}");
+ ro = ResponseObject.newOkResponse("查询成功").put("file", fileJO);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetKnwl.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetKnwl.java
new file mode 100644
index 00000000..aa0c07fc
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/GetKnwl.java
@@ -0,0 +1,68 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class GetKnwl implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'knwlId', required: true, desc: '知识ID'", "name: 'isPage', required: false, desc: '是否是独立页面(非侧边栏打开)'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String knwlId = (String) params.get("knwlId");
+
+ CardModel cardModel = CardCache.getCache().get(knwlId);
+ if (cardModel == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+ boolean isPage = false;
+ if (params.containsKey("isPage")) {
+ isPage = Boolean.valueOf(params.get("isPage").toString());
+ }
+
+ JSONObject cardJO = new JSONObject();
+ cardJO.put("knwlId", cardModel.getId());
+ cardJO.put("knwlName", cardModel.getCardName());
+ cardJO.put("createUser", cardModel.getCreateUser());
+ cardJO.put("createTime", UtilDate.datetimeFormat24(cardModel.getCreateTime()));
+ cardJO.put("lastUpdate", UtilDate.datetimeFormat24(cardModel.getLastUpdate()));
+ cardJO.put("onlineLevel", cardModel.getOnlineLevel());
+ cardJO.put("securityLevel", cardModel.getSecurityLevel());
+ cardJO.put("readCount", cardModel.getReadCount());
+ cardJO.put("isPublished", cardModel.getIsPublished() == 1 ? true : false);
+ cardJO.put("validDate", UtilDate.dateFormat(cardModel.getValidDate()));
+ cardJO.put("isComment", cardModel.getIsComment() == 1 ? true : false);
+ cardJO.put("isRate", cardModel.getIsRate() == 1 ? true : false);
+ cardJO.put("accessURL", "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + knwlId + "&isPage=" + isPage);
+ cardJO.put("externalUrl", cardModel.getExternalUrl());
+ cardJO.put("extParams", cardModel.getExtParams());
+ ro = ResponseObject.newOkResponse("查询成功").put("knwl", cardJO);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/PublishKnwl.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/PublishKnwl.java
new file mode 100644
index 00000000..43ff7337
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/PublishKnwl.java
@@ -0,0 +1,90 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.service.CardService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class PublishKnwl implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'knwlIDArray', required: true, desc: '要发布的知识ID的JSON数组字符串'", "name: 'dimensionIDArray', required: true, desc: '要发布到的维度ID的JSON数组字符串'",
+ "name: 'schemaMetaDataObject', required: false, desc: '元数据,格式:{"2":[{"metaValue":"类型为文本框的值","schemaId":"元数据ID"}],"01":[{"attrId":"属性ID","schemaId":"元数据ID"}]}'", "name: 'tagArray', required: false, desc: '标签的JSON数组字符串'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+ String uid = UserContext.fromSessionId(sid).getUID();
+ UserModel userModel = SDK.getORGAPI().getUser(uid);
+ if (userModel == null || userModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("查询者UID不存在或已注销");
+ return ro;
+ }
+
+ JSONArray publishKnwlIDArray = JSONArray.parseArray(params.get("knwlIDArray").toString());
+ for (int i = 0; i < publishKnwlIDArray.size(); i++) {
+ String knwlId = publishKnwlIDArray.getString(i);
+ if (CardCache.getCache().get(knwlId) == null) {
+ ro = ResponseObject.newErrResponse("知识不存在:" + knwlId);
+ return ro;
+ }
+ }
+
+ JSONArray publishDimensionIDArray = JSONArray.parseArray(params.get("dimensionIDArray").toString());
+ for (int i = 0; i < publishDimensionIDArray.size(); i++) {
+ String dimensionId = publishDimensionIDArray.getString(i);
+ if (DimensionCache.getCache().get(dimensionId) == null) {
+ ro = ResponseObject.newErrResponse("维度不存在:" + dimensionId);
+ return ro;
+ }
+ }
+
+ JSONObject schemaMetaDataJO = null;
+ if (params.get("schemaMetaDataObject") == null) {
+ schemaMetaDataJO = new JSONObject();
+ schemaMetaDataJO.put("01", new JSONArray());
+ schemaMetaDataJO.put("2", new JSONArray());
+ } else {
+ schemaMetaDataJO = JSONObject.parseObject(params.get("schemaMetaDataObject").toString());
+ }
+
+ JSONArray tagArray = new JSONArray();
+ if (params.get("tagArray") != null) {
+ tagArray = JSONArray.parseArray(params.get("tagArray").toString());
+ }
+ String join = "";
+ if (tagArray != null) {
+ join = StringUtils.join(tagArray.toArray(new String[0]), KMSConstant.TAG_SEPRATOR);
+ }
+ CardService cardService = new CardService();
+ cardService.publishCard(UserContext.fromSessionId(sid), publishKnwlIDArray, publishDimensionIDArray, schemaMetaDataJO, join, null);
+ ro = ResponseObject.newOkResponse("发布成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchDimensionList.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchDimensionList.java
new file mode 100644
index 00000000..7d64a3c0
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchDimensionList.java
@@ -0,0 +1,107 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.apps.kms.service.DimensionService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.cache.UserCache;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.bpms.util.UtilString;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class SearchDimensionList implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'parentId', required: true, desc: '父维度ID'", "name: 'permType', required: false, desc: '维度的权限类型,值:manage、access,分别代表管理权限、访问权限,默认是管理权限'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String parentId = (String) params.get("parentId");
+ if (!UtilString.isEmpty(parentId)) {
+ DimensionModel dimensionModel = DimensionCache.getCache().get(parentId);
+ if (dimensionModel == null) {
+ ro = ResponseObject.newErrResponse("父维度Id不存在");
+ return ro;
+ }
+ }
+ String permType = "manage";
+ if (params.containsKey("permType")) {
+ permType = (String) params.get("permType");
+ }
+ if (!permType.equals("manage") && !permType.equals("access") && !permType.equals("all") && !permType.equals("allenable")) {
+ ro = ResponseObject.newErrResponse("权限类型错误");
+ return ro;
+ }
+ if ("root".equals(parentId)) {
+ parentId = "";
+ }
+ JSONArray dimensionJA = new JSONArray();
+ DimensionService dimensionService = new DimensionService();
+ List dimensionModels = new ArrayList<>();
+ if (permType.equals("manage")) {
+ dimensionModels = dimensionService.queryListMgrDimensionsByParentId(parentId, UserContext.fromSessionId(sid).getUID());
+ } else if (permType.equals("access")) {
+ String uid = UserContext.fromSessionId(sid).getUID();
+ dimensionModels = dimensionService.queryTreeAccessDimensionsByParentId(parentId, uid, KMSUtil.isKnwlManager(uid));
+ } else if (permType.equals("all")) {
+ dimensionModels = dimensionService.queryListMgrDimensionsByParentId(parentId);
+ } else if (permType.equals("allenable")) {
+ dimensionModels = dimensionService.queryTreeEnabledDimensionsByParentId(parentId);
+ }
+ for (DimensionModel dimensionModel : dimensionModels) {
+ if (!hasRepeatDimension(dimensionJA, dimensionModel)) {
+ JSONObject dimensionJO = new JSONObject();
+ dimensionJO.put("id", dimensionModel.getId());
+ dimensionJO.put("dimensionName", dimensionModel.getDimensionName());
+ dimensionJO.put("showType", dimensionModel.getShowType());
+ dimensionJO.put("isExamine", dimensionModel.getIsExamine() == 1 ? true : false);
+ dimensionJO.put("memo", dimensionModel.getMemo());
+ dimensionJO.put("createUsername", UserCache.getModel(dimensionModel.getCreateUser()) == null ? dimensionModel.getCreateUser() : UserCache.getModel(dimensionModel.getCreateUser()).getUserName());
+ dimensionJO.put("createTime", UtilDate.datetimeFormat(dimensionModel.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+ dimensionJO.put("isEnabled", dimensionModel.getIsEnabled() == 1 ? true : false);
+ dimensionJO.put("hotspotDefId", dimensionModel.getHotspotDefId());
+ dimensionJO.put("orderIndex", dimensionModel.getOrderIndex());
+ dimensionJO.put("hasPerm", dimensionModel.isHasPerm());
+
+ dimensionJA.add(dimensionJO);
+ }
+ }
+ ro = ResponseObject.newOkResponse("查询成功").put("list", dimensionJA);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+ public boolean hasRepeatDimension(JSONArray dimensions, DimensionModel dimensionModel) {
+ for (int i = 0; i < dimensions.size(); i++) {
+ JSONObject dimensionJO = dimensions.getJSONObject(i);
+ if (dimensionModel.getId().equals(dimensionJO.getString("id"))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchFileList.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchFileList.java
new file mode 100644
index 00000000..a42165e5
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchFileList.java
@@ -0,0 +1,92 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.kms.model.FileModel;
+import com.actionsoft.apps.kms.service.FileService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+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.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class SearchFileList implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'knwlId', required: true, desc: '知识ID'", "name: 'isLatestVersion', required: false, desc: '是否只返回最新版的文件,默认false'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String uid = UserContext.fromSessionId(sid).getUID();
+ UserModel userModel = SDK.getORGAPI().getUser(uid);
+ if (userModel == null || userModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("查询者UID不存在或已注销");
+ return ro;
+ }
+
+ String knwlId = (String) params.get("knwlId");
+ if (CardCache.getCache().get(knwlId) == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+
+ Boolean isLatestVersion = (Boolean) params.get("isLatestVersion");
+ List fileModels = new ArrayList<>();
+ if (isLatestVersion != null && isLatestVersion == true) {
+ fileModels = new FileService().queryLatestFiles(knwlId);
+ } else {
+ fileModels = new FileService().queryFiles(knwlId);
+ }
+ JSONArray dataJson = new JSONArray();
+ CardCache cardCache = CardCache.getCache();
+ for (FileModel fileModel : fileModels) {
+ JSONObject fileJO = new JSONObject();
+
+ String fileName = fileModel.getFileName();
+ CardModel cardModel = cardCache.get(fileModel.getCardId());
+ DCContext dcContext = new DCContext(UserContext.fromSessionId(sid), DCProfileManager.getDCProfile(KMSConstant.APP_ID, KMSConstant.DOC_REPOSITORY_NAME), KMSConstant.APP_ID, cardModel.getCreateUser(), knwlId, KMSUtil.getFileNameOfVersion(fileName, fileModel.getFileVer()));
+ dcContext.setFileNameShow(fileName);
+
+ fileJO.put("fileDownloadURL", dcContext.getDownloadURL());
+ fileJO.put("id", fileModel.getId());
+ fileJO.put("fileName", fileName);
+ fileJO.put("versionFileName", KMSUtil.getFileNameOfVersion(fileName, fileModel.getFileVer()));
+ fileJO.put("fileVer", fileModel.getFileVer());
+ fileJO.put("fileSize", fileModel.getFileSize());
+ fileJO.put("createTime", UtilDate.datetimeFormat(fileModel.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+ fileJO.put("createUser", fileModel.getCreateUser());
+ fileJO.put("fileState", fileModel.getFileState());
+ fileJO.put("extParams", "{}");
+ dataJson.add(fileJO);
+ }
+ ro = ResponseObject.newOkResponse("查询成功").put("searchResult", dataJson);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchKnwlList.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchKnwlList.java
new file mode 100644
index 00000000..d096a2e8
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/SearchKnwlList.java
@@ -0,0 +1,135 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.apps.kms.service.DimensionService;
+import com.actionsoft.apps.kms.service.SearchService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.cache.UserCache;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author wangshibao
+ */
+public class SearchKnwlList implements ASLP {
+
+ // 元数据,格式:Html.encodeForHTML("{\"2\":[{\"metaValue\":\"类型为文本框的值\",\"schemaId\":\"元数据ID\"}],\"01\":[{\"attrId\":\"属性ID\",\"schemaId\":\"元数据ID\"}]}");
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'curPage', required: true, desc: '当前页码'", "name: 'rowsPerPage', required: true, desc: '每页的条数'", "name: 'sortIndx', required: true, desc: '排序字段,READCOUNT : 阅读次数、CARDNAME : 知识名称、PUBLISHTIME : 发布时间、COMMENTCOUNT : 评论次数'", "name: 'sortDir', required: true, desc: '顺序,up : 升序,down : 降序'", "name: 'dimensionIdArray', required: false, desc: '维度ID的JSON数组字符串'",
+ "name: 'schemaMetaDataObject', required: false, desc: '元数据,格式:{"2":[{"metaValue":"类型为文本框的值","schemaId":"元数据ID"}],"01":[{"attrId":"属性ID","schemaId":"元数据ID"}]}'", "name: 'knwlName', required: false, desc: '知识名称'",
+ "name: 'publishStartDate', required: false, desc: '发布开始时间 : yyyy-MM-dd'", "name: 'publishEndDate', required: false, desc: '发布结束时间 : yyyy-MM-dd'", "name: 'publishUsers', required: false, desc: '发布人UID的JSON数组字符串'", "name: 'tag', required: false, desc: '标签'", "name: 'lastPublishId', required: false, desc: '上一页最后一个publishId,用于增强查询性能'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String uid = UserContext.fromSessionId(sid).getUID();
+ UserModel userModel = SDK.getORGAPI().getUser(uid);
+ if (userModel == null || userModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("查询者UID不存在或已注销");
+ return ro;
+ }
+
+ Integer curPage = Integer.valueOf(params.get("curPage").toString());
+
+ Integer rowsPerPage = Integer.valueOf(params.get("rowsPerPage").toString());
+
+ String sortIndx = (String) params.get("sortIndx");
+ if (!sortIndx.equals("READCOUNT") && !sortIndx.equals("CARDNAME") && !sortIndx.equals("PUBLISHTIME") && !sortIndx.equals("COMMENTCOUNT")) {
+ ro = ResponseObject.newErrResponse("排序字段值不正确");
+ return ro;
+ }
+
+ String sortDir = (String) params.get("sortDir");
+ if (!sortDir.equals("up") && !sortDir.equals("down")) {
+ ro = ResponseObject.newErrResponse("顺序值不正确");
+ return ro;
+ }
+
+ List dimensionIdList = params.get("dimensionIdArray") == null ? new ArrayList() : JSONArray.parseArray(params.get("dimensionIdArray").toString(), String.class);
+
+ JSONObject schemaMetaDataJO = null;
+ if (params.get("schemaMetaDataObject") == null) {
+ schemaMetaDataJO = new JSONObject();
+ schemaMetaDataJO.put("01", new JSONArray());
+ schemaMetaDataJO.put("2", new JSONArray());
+ } else {
+ schemaMetaDataJO = JSONObject.parseObject(params.get("schemaMetaDataObject").toString());
+ }
+
+ String cardName = (String) params.get("knwlName");
+
+ Timestamp publishStartDate = params.get("publishStartDate") == null ? null : UtilDate.parseTsFromDate(params.get("publishStartDate").toString());
+
+ Timestamp publishEndDate = params.get("publishEndDate") == null ? null : UtilDate.parseTsFromDate(params.get("publishEndDate").toString());
+
+ List publishUsers = params.get("publishUsers") == null ? new ArrayList() : JSONArray.parseArray(params.get("publishUsers").toString(), String.class);
+
+ List tagList = new ArrayList<>();
+ if (params.get("tag") != null) {
+ tagList.add(params.get("tag").toString());
+ }
+ String lastPublishId = params.get("lastPublishId") == null ? "" : params.get("lastPublishId").toString();
+ DimensionService dimensionService = new DimensionService();
+ SearchService searchService = new SearchService();
+ List publishModels = searchService.attrSearchCard(curPage, rowsPerPage, sortIndx, sortDir, uid, dimensionIdList, schemaMetaDataJO, cardName, publishStartDate, publishEndDate, publishUsers, tagList, lastPublishId, "","");
+ JSONObject dataJson = new JSONObject();
+ if (publishModels.size() < rowsPerPage + 1L) {
+ dataJson.put("totalRecords", (curPage - 1) * rowsPerPage + publishModels.size());
+ } else {
+ dataJson.put("totalRecords", searchService.totalRecords);
+ if (publishModels.size() > 0) {
+ publishModels.remove(publishModels.size() - 1);//移除最后一条
+ }
+ }
+ JSONArray cardJA = new JSONArray();
+ for (PublishModel publishModel : publishModels) {
+ JSONObject cardJO = new JSONObject();
+ cardJO.put("cardId", publishModel.getCardModel().getId());
+ cardJO.put("cardName", publishModel.getCardModel().getCardName());
+ cardJO.put("cardType", publishModel.getCardModel().getCardType());
+ cardJO.put("onlineLevel", publishModel.getCardModel().getOnlineLevel());
+ cardJO.put("securityLevel", publishModel.getCardModel().getSecurityLevel());
+ // cardJO.put("lastUpdate", publishModel.getCardModel().getLastUpdate());
+ cardJO.put("readCount", publishModel.getCardModel().getReadCount());
+ cardJO.put("commentCount", publishModel.getCardModel().getCommentCount());
+ cardJO.put("isPublished", publishModel.getCardModel().getIsPublished());
+ cardJO.put("validDate", UtilDate.dateFormat(publishModel.getCardModel().getValidDate()));
+ UserModel publishUserModel = UserCache.getModel(publishModel.getPublishUser());
+ cardJO.put("publishUsername", publishUserModel == null ? publishModel.getPublishUser() : publishUserModel.getUserName());
+ cardJO.put("publishTime", UtilDate.datetimeFormat(publishModel.getPublishTime(), "yyyy-MM-dd HH:mm:ss"));
+ cardJO.put("dimensionId", publishModel.getDimensionId());
+ cardJO.put("dimensionPath", dimensionService.getDimensionPath(publishModel.getDimensionId(), " > "));
+ cardJO.put("externalUrl", "https://www.awspaas.com");
+ cardJO.put("extParams", "{}");
+ cardJA.add(cardJO);
+ }
+
+ dataJson.put("data", cardJA);
+ dataJson.put("curPage", curPage);
+
+ ro = ResponseObject.newOkResponse("查询成功").put("searchResult", dataJson);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateDimension.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateDimension.java
new file mode 100644
index 00000000..4079bce5
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateDimension.java
@@ -0,0 +1,101 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.apps.kms.service.DimensionService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class UpdateDimension implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'dimensionId', required: true, desc: '维度ID'", "name: 'dimensionName', required: false, desc: '维度名称'", "name: 'parentId', required: false, desc: '父维度Id:\"\"表示根维度'", "name: 'showType', required: false, desc: '维度类型,1:允许发布知识 2:不允许发布知识'", "name: 'isExamine', required: false, desc: '发布是否需要审批,默认false'", "name: 'memo', required: false, desc: '维度描述'", "name: 'isEnabled', required: false, desc: '是否启用,默认启用'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String dimensionId = (String) params.get("dimensionId");
+ DimensionModel dimensionModel = DimensionCache.getCache().get(dimensionId);
+ if (dimensionId == null || dimensionModel == null) {
+ ro = ResponseObject.newErrResponse("维度不存在");
+ return ro;
+ }
+
+ String dimensionName = (String) params.get("dimensionName");
+ if (dimensionName == null) {
+ dimensionName = dimensionModel.getDimensionName();
+ } else if (dimensionName.trim().equals("")) {
+ ro = ResponseObject.newErrResponse("维度名称不允许为空");
+ return ro;
+ }
+
+ String parentId = (String) params.get("parentId");
+ if (parentId == null) {
+ parentId = dimensionModel.getParentId();
+ } else if (parentId.equals("")) {
+
+ } else {
+ DimensionModel parentDimensionModel = DimensionCache.getCache().get(parentId);
+ if (parentDimensionModel == null) {
+ ro = ResponseObject.newErrResponse("父维度不存在");
+ return ro;
+ }
+ }
+
+ Integer showTypeI = params.get("showType") == null ? null : Integer.valueOf(params.get("showType").toString());
+ if (showTypeI == null) {
+ showTypeI = dimensionModel.getShowType();
+ } else {
+ int showType = showTypeI.intValue();
+ if (showType != KMSConstant.SHOWTYPE_CATEGORY && showType != KMSConstant.SHOWTYPE_DIMENSION) {
+ ro = ResponseObject.newErrResponse("维度类型不正确");
+ return ro;
+ }
+ }
+
+ Boolean isExamine = params.get("isExamine") == null ? null : Boolean.valueOf(params.get("isExamine").toString());
+ if (isExamine == null) {
+ isExamine = dimensionModel.getIsExamine() == KMSConstant.EXAMINE;
+ }
+
+ String memo = (String) params.get("memo");
+ if (memo == null) {
+ memo = dimensionModel.getMemo();
+ }
+
+ Boolean isEnabled = params.get("isEnabled") == null ? null : Boolean.valueOf(params.get("isEnabled").toString());
+ if (isEnabled == null) {
+ isEnabled = dimensionModel.getIsEnabled() == KMSConstant.ENABLED;
+ }
+
+ DimensionService dimensionService = new DimensionService();
+ int result = dimensionService.updateDimension(dimensionId, dimensionName, showTypeI, isExamine, memo, "", isEnabled);
+
+ if (result == 1) {
+ ro = ResponseObject.newOkResponse("修改成功");
+ } else {
+ ro = ResponseObject.newErrResponse("修改失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateKnwl.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateKnwl.java
new file mode 100644
index 00000000..2d3cc13c
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/aslp/UpdateKnwl.java
@@ -0,0 +1,95 @@
+package com.actionsoft.apps.kms.aslp;
+
+import java.util.Date;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.apps.kms.service.CardService;
+import com.actionsoft.apps.resource.interop.aslp.ASLP;
+import com.actionsoft.apps.resource.interop.aslp.Meta;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.model.UserModel;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * @author wangshibao
+ */
+public class UpdateKnwl implements ASLP {
+
+ @Override
+ @Meta(parameter = { "name: 'sid', required: true, desc: 'sid'", "name: 'knwlId', required: true, desc: '知识ID'", "name: 'knwlName', required: false, desc: '知识名称'", "name: 'validDate', required: false, desc: '有效期:yyyy-MM-dd,如果为null则表示长期有效'", "name: 'onlineLevel', required: false, desc: '只读控制,1:在线阅读和下载 0:在线阅读'", "name: 'securityLevel', required: false, desc: '保密级别, 0: 普通 1:秘密 2:机密'", "name: 'isComment', required: false, desc: '是否可以评论'", "name: 'isRate', required: false, desc: '是否可以评分'", "name:'cardContext',required:false,desc:'知识内容'",
+ "name: 'externalUrl',required:false,desc:'外部知识链接,可以展示外部知识的链接'", "name: 'extParams',required:false,desc:'扩展信息,JSON字符串'" })
+ public ResponseObject call(Map params) {
+ ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
+ try {
+ // 校验参数
+ String sid = (String) params.get("sid");
+ if (!SDK.getPortalAPI().checkSession(sid)) {
+ ro = ResponseObject.newErrResponse("sid无效");
+ return ro;
+ }
+
+ String knwlId = (String) params.get("knwlId");
+ CardModel cardModel = CardCache.getCache().get(knwlId);
+ if (cardModel == null) {
+ ro = ResponseObject.newErrResponse("知识不存在");
+ return ro;
+ }
+
+ String knwlName = (String) params.get("knwlName");
+ if (knwlName == null) {
+ knwlName = cardModel.getCardName();
+ }
+
+ Date validDate = params.get("validDate") == null ? null : UtilDate.parse(params.get("validDate").toString());
+
+ Integer onlineLevel = params.get("onlineLevel") == null ? cardModel.getOnlineLevel() : Integer.parseInt(params.get("onlineLevel").toString());
+ if (params.get("onlineLevel") != null) {
+ if (onlineLevel.intValue() != 1 && onlineLevel.intValue() != 0) {
+ ro = ResponseObject.newErrResponse("只读控制值不正确");
+ return ro;
+ }
+ }
+
+ Integer securityLevel = params.get("securityLevel") == null ? cardModel.getSecurityLevel() : Integer.parseInt(params.get("securityLevel").toString());
+ if (params.get("securityLevel") != null) {
+ if (securityLevel.intValue() != 0 && securityLevel.intValue() != 1 && securityLevel.intValue() != 2) {
+ ro = ResponseObject.newErrResponse("保密级别值不正确");
+ return ro;
+ }
+ }
+
+ Boolean isComment = params.get("isComment") == null ? (cardModel.getIsComment() == 1 ? true : false) : Boolean.parseBoolean(params.get("isComment").toString());
+
+ Boolean isRate = params.get("isRate") == null ? (cardModel.getIsRate() == 1 ? true : false) : Boolean.parseBoolean(params.get("isRate").toString());
+
+ String createUser = UserContext.fromSessionId(sid).getUID();
+ UserModel createUserModel = SDK.getORGAPI().getUser(createUser);
+ if (createUserModel == null || createUserModel.isClosed()) {
+ ro = ResponseObject.newErrResponse("创建人UID不存在或已注销");
+ return ro;
+ }
+ String cardContext = (String) params.get("cardContext");
+ if (cardContext == null) {
+ cardContext = "";
+ }
+ CardService cardService = new CardService();
+ boolean result = cardService.updateCard(createUser, knwlId, knwlName, validDate == null ? null : new java.sql.Date(validDate.getTime()), onlineLevel, securityLevel, 0, isComment == true ? 1 : 0, isRate == true ? 1 : 0, cardContext);
+
+ if (result) {
+ ro = ResponseObject.newOkResponse("修改成功");
+ } else {
+ ro = ResponseObject.newOkResponse("创建失败");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro = ResponseObject.newErrResponse(e.getMessage());
+ }
+ return ro;
+
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardCache.java
new file mode 100644
index 00000000..82cefe92
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardCache.java
@@ -0,0 +1,37 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.CardDao;
+import com.actionsoft.apps.kms.model.CardModel;
+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.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 知识缓存
+ *
+ * @author wangshibao
+ */
+public class CardCache extends Cache {
+
+ public CardCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ CardDao cardDao = new CardDao();
+ IDaoQuery iDaoQuery = cardDao.query();
+ List cardModels = iDaoQuery.list();
+ for (CardModel cardModel : cardModels) {
+ put(cardModel.getId(), cardModel, false);
+ }
+ }
+
+ public static CardCache getCache() {
+ return CacheManager.getCache(CardCache.class);
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardPermCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardPermCache.java
new file mode 100644
index 00000000..31c191c6
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/CardPermCache.java
@@ -0,0 +1,58 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.HashMap;
+
+import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
+import com.actionsoft.bpms.commons.cache.Cache;
+import com.actionsoft.bpms.commons.cache.CacheManager;
+
+/**
+ * 知识缓存
+ *
+ * @author wangshibao
+ */
+public class CardPermCache extends Cache> {
+
+ public CardPermCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+
+ }
+
+ public static CardPermCache getCache() {
+ return CacheManager.getCache(CardPermCache.class);
+ }
+
+ public static void put(String cardId, String uid, boolean isPerm) {
+ HashMap uidMap = getCache().get(cardId);
+ if (uidMap != null) {
+ if (!uidMap.containsKey(uid)) {
+ uidMap.put(uid, isPerm);
+ getCache().put(cardId, uidMap);
+ }
+ } else {
+ uidMap = new HashMap();
+ uidMap.put(uid, isPerm);
+ getCache().put(cardId, uidMap);
+ }
+ }
+
+ public static boolean getPermByUID(String cardId, String uid) {
+ HashMap uidMap = getCache().get(cardId);
+ if (uidMap == null) {
+ return false;
+ }
+ return uidMap.get(uid);
+ }
+
+ public static boolean hasCacheByUID(String cardId, String uid) {
+ HashMap uidMap = getCache().get(cardId);
+ if (uidMap == null) {
+ return false;
+ }
+ return uidMap.containsKey(uid);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionCache.java
new file mode 100644
index 00000000..e2f75c68
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionCache.java
@@ -0,0 +1,51 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.DimensionDao;
+import com.actionsoft.apps.kms.model.DimensionModel;
+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.commons.cache.ListValueIndex;
+import com.actionsoft.bpms.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 维度缓存
+ *
+ * @author wangshibao
+ */
+public class DimensionCache extends Cache {
+
+ public DimensionCache(CachePluginProfile configuration) {
+ super(configuration);
+ registeIndex(DimensionParentIndex.class, new DimensionParentIndex());
+ }
+
+ public List getDimensionListOfParent(String parentDimensionId) {
+ List list = iteratorToList(getCache().getByIndex(DimensionParentIndex.class, parentDimensionId));
+ return list;
+ }
+
+ @Override
+ protected void load() {
+ DimensionDao dimensionDao = new DimensionDao();
+ IDaoQuery iDaoQuery = dimensionDao.query();
+ List dimensionModels = iDaoQuery.list();
+ for (DimensionModel dimensionModel : dimensionModels) {
+ put(dimensionModel.getId(), dimensionModel, false);
+ }
+ }
+
+ public static DimensionCache getCache() {
+ return CacheManager.getCache(DimensionCache.class);
+ }
+
+ class DimensionParentIndex extends ListValueIndex {
+
+ @Override
+ public String key(DimensionModel t) {
+ return t.getParentId();
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionPermCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionPermCache.java
new file mode 100644
index 00000000..4c96e3df
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionPermCache.java
@@ -0,0 +1,58 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.HashMap;
+
+import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
+import com.actionsoft.bpms.commons.cache.Cache;
+import com.actionsoft.bpms.commons.cache.CacheManager;
+
+/**
+ * 维度缓存
+ *
+ * @author wangshibao
+ */
+public class DimensionPermCache extends Cache> {
+
+ public DimensionPermCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+
+ }
+
+ public static DimensionPermCache getCache() {
+ return CacheManager.getCache(DimensionPermCache.class);
+ }
+
+ public static void put(String dimensionId, String uid, boolean isPerm) {
+ HashMap uidMap = getCache().get(dimensionId);
+ if (uidMap != null) {
+ if (!uidMap.containsKey(uid)) {
+ uidMap.put(uid, isPerm);
+ getCache().put(dimensionId, uidMap);
+ }
+ } else {
+ uidMap = new HashMap();
+ uidMap.put(uid, isPerm);
+ getCache().put(dimensionId, uidMap);
+ }
+ }
+
+ public static boolean getPermByUID(String dimensionId, String uid) {
+ HashMap uidMap = getCache().get(dimensionId);
+ if (uidMap == null) {
+ return false;
+ }
+ return uidMap.get(uid);
+ }
+
+ public static boolean hasCacheByUID(String dimensionId, String uid) {
+ HashMap uidMap = getCache().get(dimensionId);
+ if (uidMap == null) {
+ return false;
+ }
+ return uidMap.containsKey(uid);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionTreeCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionTreeCache.java
new file mode 100644
index 00000000..8e9e7a6c
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/DimensionTreeCache.java
@@ -0,0 +1,27 @@
+package com.actionsoft.apps.kms.cache;
+
+import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
+import com.actionsoft.bpms.commons.cache.Cache;
+import com.actionsoft.bpms.commons.cache.CacheManager;
+import com.alibaba.fastjson.JSONArray;
+
+/**
+ * 知识缓存
+ *
+ * @author wangshibao
+ */
+public class DimensionTreeCache extends Cache {
+
+ public DimensionTreeCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+
+ }
+
+ public static DimensionTreeCache getCache() {
+ return CacheManager.getCache(DimensionTreeCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/FileCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/FileCache.java
new file mode 100644
index 00000000..ab8f8ae9
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/FileCache.java
@@ -0,0 +1,36 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.FileDao;
+import com.actionsoft.apps.kms.model.FileModel;
+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.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 文件缓存
+ *
+ * @author wangshibao
+ *
+ */
+public class FileCache extends Cache {
+ public FileCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ FileDao fileDao = new FileDao();
+ IDaoQuery iDaoQuery = fileDao.query();
+ List fileModels = iDaoQuery.list();
+ for (FileModel fileModel : fileModels) {
+ put(fileModel.getId(), fileModel, false);
+ }
+ }
+
+ public static FileCache getCache() {
+ return CacheManager.getCache(FileCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/HotspotCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/HotspotCache.java
new file mode 100644
index 00000000..e6e63135
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/HotspotCache.java
@@ -0,0 +1,37 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.HotspotDao;
+import com.actionsoft.apps.kms.model.HotspotModel;
+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.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 知识地图缓存(图形和维度的绑定缓存)
+ *
+ * @author wangshibao
+ *
+ */
+public class HotspotCache extends Cache {
+ public HotspotCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ HotspotDao hotspotDao = new HotspotDao();
+ IDaoQuery iDaoQuery = hotspotDao.query();
+ List hotspotModels = iDaoQuery.list();
+ for (HotspotModel hotspotModel : hotspotModels) {
+ put(hotspotModel.getId(), hotspotModel, false);
+ }
+ }
+
+ public static HotspotCache getCache() {
+ return CacheManager.getCache(HotspotCache.class);
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaAttrCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaAttrCache.java
new file mode 100644
index 00000000..740d793a
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaAttrCache.java
@@ -0,0 +1,30 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.MetaAttrDao;
+import com.actionsoft.apps.kms.model.MetaAttrModel;
+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.commons.mvc.dao.IDaoQuery;
+
+public class MetaAttrCache extends Cache {
+ public MetaAttrCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ MetaAttrDao metaAttrDao = new MetaAttrDao();
+ IDaoQuery iDaoQuery = metaAttrDao.query();
+ List metaAttrModels = iDaoQuery.list();
+ for (MetaAttrModel metaAttrModel : metaAttrModels) {
+ put(metaAttrModel.getId(), metaAttrModel, false);
+ }
+ }
+
+ public static MetaAttrCache getCache() {
+ return CacheManager.getCache(MetaAttrCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaDataCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaDataCache.java
new file mode 100644
index 00000000..918c2b2a
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaDataCache.java
@@ -0,0 +1,45 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.MetaDataDao;
+import com.actionsoft.apps.kms.model.MetaDataModel;
+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.commons.cache.ListValueIndex;
+import com.actionsoft.bpms.commons.mvc.dao.IDaoQuery;
+
+public class MetaDataCache extends Cache {
+ public MetaDataCache(CachePluginProfile configuration) {
+ super(configuration);
+ registeIndex(metaDataCardIndex.class, new metaDataCardIndex());
+ }
+
+ @Override
+ protected void load() {
+ MetaDataDao metaDataDao = new MetaDataDao();
+ IDaoQuery iDaoQuery = metaDataDao.query();
+ List metaDataModels = iDaoQuery.list();
+ for (MetaDataModel metaDataModel : metaDataModels) {
+ put(metaDataModel.getId(), metaDataModel, false);
+ }
+ }
+
+ public static MetaDataCache getCache() {
+ return CacheManager.getCache(MetaDataCache.class);
+ }
+
+ public List getMetaDataListOfCardId(String cardId) {
+ List list = iteratorToList(getCache().getByIndex(metaDataCardIndex.class, cardId));
+ return list;
+ }
+
+ class metaDataCardIndex extends ListValueIndex {
+
+ @Override
+ public String key(MetaDataModel t) {
+ return t.getCardId();
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaSchemaCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaSchemaCache.java
new file mode 100644
index 00000000..60f07e90
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/MetaSchemaCache.java
@@ -0,0 +1,36 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.MetaSchemaDao;
+import com.actionsoft.apps.kms.model.MetaSchemaModel;
+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.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 元数据缓存
+ *
+ * @author wangshibao
+ *
+ */
+public class MetaSchemaCache extends Cache {
+ public MetaSchemaCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ MetaSchemaDao metaSchemaDao = new MetaSchemaDao();
+ IDaoQuery iDaoQuery = metaSchemaDao.query();
+ List metaschemaModels = iDaoQuery.list();
+ for (MetaSchemaModel metaSchemaModel : metaschemaModels) {
+ put(metaSchemaModel.getId(), metaSchemaModel, false);
+ }
+ }
+
+ public static MetaSchemaCache getCache() {
+ return CacheManager.getCache(MetaSchemaCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/OptCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/OptCache.java
new file mode 100644
index 00000000..f336b33c
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/OptCache.java
@@ -0,0 +1,37 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.OptDao;
+import com.actionsoft.apps.kms.model.OptModel;
+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.commons.mvc.dao.IDaoQuery;
+
+/**
+ * 操作缓存(评论、评分、反馈)
+ *
+ * @author wangshibao
+ *
+ */
+public class OptCache extends Cache {
+
+ public OptCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ OptDao optDao = new OptDao();
+ IDaoQuery iDaoQuery = optDao.query();
+ List optModels = iDaoQuery.list();
+ for (OptModel optModel : optModels) {
+ put(optModel.getId(), optModel, false);
+ }
+ }
+
+ public static OptCache getCache() {
+ return CacheManager.getCache(OptCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/PublishCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/PublishCache.java
new file mode 100644
index 00000000..2830cfa8
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/PublishCache.java
@@ -0,0 +1,32 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.PublishDao;
+import com.actionsoft.apps.kms.model.PublishModel;
+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.commons.mvc.dao.IDaoQuery;
+
+public class PublishCache extends Cache {
+
+ public PublishCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ PublishDao publishDao = new PublishDao();
+ IDaoQuery iDaoQuery = publishDao.query();
+ List publishModels = iDaoQuery.list();
+ for (PublishModel publishModel : publishModels) {
+ put(publishModel.getId(), publishModel, false);
+ }
+ }
+
+ public static PublishCache getCache() {
+ return CacheManager.getCache(PublishCache.class);
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/VersionCache.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/VersionCache.java
new file mode 100644
index 00000000..ad094389
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/cache/VersionCache.java
@@ -0,0 +1,30 @@
+package com.actionsoft.apps.kms.cache;
+
+import java.util.List;
+
+import com.actionsoft.apps.kms.dao.VersionDao;
+import com.actionsoft.apps.kms.model.VersionModel;
+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.commons.mvc.dao.IDaoQuery;
+
+public class VersionCache extends Cache {
+ public VersionCache(CachePluginProfile configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected void load() {
+ VersionDao versionDao = new VersionDao();
+ IDaoQuery iDaoQuery = versionDao.query();
+ List versionModels = iDaoQuery.list();
+ for (VersionModel versionModel : versionModels) {
+ put(versionModel.getId(), versionModel, false);
+ }
+ }
+
+ public static VersionCache getCache() {
+ return CacheManager.getCache(VersionCache.class);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlCenterController.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlCenterController.java
new file mode 100644
index 00000000..592e21de
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlCenterController.java
@@ -0,0 +1,388 @@
+package com.actionsoft.apps.kms.controller;
+
+import java.sql.Date;
+
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.web.KnwlCenterWeb;
+import com.actionsoft.apps.processon.HotspotWeb;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+
+/**
+ * 知识中心(KMS前台)控制器类
+ *
+ * @author wangshibao 知识中心
+ */
+@Controller public class KnwlCenterController {
+ /* 知识中心iframe框架 */
+ @Mapping("com.actionsoft.apps.kms_knwl")
+ public String getKnwlHome(UserContext uc, String page) {
+ PublishCache.getCache().reload();
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getKnwlHome(page);
+ }
+
+ /* 知识中心主页面 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center")
+ public String getKnwlCenterHome(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getKnwlCenterHome();
+ }
+
+ /* 知识中心主页面 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mobile_center_knowladge_count")
+ public String getMobileKnwlCenterCount(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getKnowladgeCount();
+ }
+
+ /* 知识中心-个人-我的知识-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_me_card_list_json")
+ public String getMeCardListJson(UserContext uc, int curPage, int rowsPerPage, String sortIndx, String sortDir, String filter) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getMeCardListJson(curPage, rowsPerPage, sortIndx, sortDir, filter);
+ }
+
+ /* 知识中心-个人-我发布的-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_publish_card_list_json")
+ public String getPublishCardListJson(UserContext uc, int curPage, int rowsPerPage, String sortIndx, String sortDir, String filter) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getPublishListJson(curPage, rowsPerPage, sortIndx, sortDir, filter);
+ }
+
+ /* 知识中心-个人-我借阅的-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_borrow_card_list_json")
+ public String getBorrowCardListJson(UserContext uc, int curPage, int rowsPerPage, String sortIndx, String sortDir, String filter) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getBorrowListJson(curPage, rowsPerPage, sortIndx, sortDir, filter);
+ }
+
+ /* 知识中心-个人-发布待审-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_publish_examine_card_list_json")
+ public String getPublishExamineCardListJson(UserContext uc, int curPage, int rowsPerPage) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getPublishExamineListJson(curPage, rowsPerPage);
+ }
+
+ /* 知识中心-全部-获取维度树json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_dimension_tree_json")
+ public String getDimensionTreeJson(UserContext uc, String parentId, boolean isDimensionKnwlPage) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getDimensionTreeJson(parentId, isDimensionKnwlPage);
+ }
+
+ /* 知识中心-个人-发布知识-获取元数据以及属性json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_schema_attr_list_json")
+ public String getSchemaAttrJson(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getSchemaAttr();
+ }
+
+ /* 知识中心-个人-发布知识-获取维度树json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_me_publish_dimension_tree_json")
+ public String getMeDimensionTreeJson(UserContext uc, String parentId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getMeDimensionTreeJson(parentId);
+ }
+
+ /* 知识中心-全部-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_dimension_card_list_json")
+ public String getDimensionCardListJson(UserContext uc, String dimensionId, int curPage, int rowsPerPage, String sortIndx, String sortDir, String filter) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getDimensionCardListJson(dimensionId, curPage, rowsPerPage, sortIndx, sortDir, filter);
+ }
+
+ /* 知识中心-全部-知识列表json(不分页) */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_dimension_card_list_all_json")
+ public String getDimensionCardListAllJson(UserContext uc, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getDimensionCardListAllJson(dimensionId);
+ }
+
+ /* 知识中心-删除文件 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_file")
+ public String deleteFile(UserContext uc, String cardId, String fileId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.deleteFile(cardId, fileId);
+ }
+
+ /* 知识中心-新建知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_insert_card")
+ public String insertCard(UserContext uc, String cardId, String cardName, Date validDate, int onlineLevel, int securityLevel, int cardType, boolean isComment, boolean isRate, String cardContext) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.insertCard(cardId, cardName, validDate, onlineLevel, securityLevel, cardType, isComment, isRate, cardContext);
+ }
+
+ /* 知识中心-编辑知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_update_card")
+ public String updateCard(UserContext uc, String cardId, String cardName, Date validDate, int onlineLevel, int securityLevel, int cardType, boolean isComment, boolean isRate, String cardContext) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.updateCard(cardId, cardName, validDate, onlineLevel, securityLevel, cardType, isComment, isRate, cardContext);
+ }
+
+ /* 知识中心-删除知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_card")
+ public String deleteFile(UserContext uc, String cardIds) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.deleteCards(cardIds);
+ }
+
+ /* 知识中心-文件列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_file_list_json")
+ public String getFileListJson(UserContext uc, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getFileListJson(cardId);
+ }
+
+ /* 知识中心-发布知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_publish_card")
+ public String publishCard(UserContext uc, String publishCardIds, String publishDimensionIds, String schemaMetaData, String tags, String publishMemo) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.publishCard(uc,publishCardIds, publishDimensionIds, schemaMetaData, tags, publishMemo);
+ }
+
+ /* 知识中心-给知识评分 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_rate_card")
+ public String rateCard(UserContext uc, String rateId, String cardId, Integer rateLevel) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.rateCard(rateId, cardId, rateLevel);
+ }
+
+ /* 知识中心-查询浏览信息 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_browse_card_info_json")
+ public String getBrowseCardInfo(UserContext uc, String cardId, boolean isBorrow, String boId, boolean isEdit, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getBrowseCardInfo(uc,cardId, isBorrow, boId, isEdit, dimensionId);
+ }
+
+ /* 知识中心-发送邀请 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_send_browse_invitation")
+ public String sendBrowseInvitation(UserContext uc,String dimensionId, String cardId, String targetUsers) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.sendBrowseInvitation(dimensionId,cardId, targetUsers);
+ }
+
+ /* 知识中心-打开浏览页面 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_browse_card_page")
+ public String openBrowseCardPage(UserContext uc,String dimensionId, String cardId, boolean isPage) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.openBrowseCardPage(dimensionId,cardId, isPage);
+ }
+
+ /* 知识中心-新增评论 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_comment_insert")
+ public String insertComment(UserContext uc, String cardId, String commentContent) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.insertComment(cardId, commentContent);
+ }
+
+ /* 知识中心-统计数据 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_stat_json")
+ public String statCardFile(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.statCardFile();
+ }
+
+ /* 启动借阅流程 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_borrow_card_process_start")
+ public String startBorrowProcwss(UserContext uc, String cardId, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.startBorrowProcessType(cardId, dimensionId);
+ }
+
+ /* 启动发布流程 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_publish_card_process_start")
+ public String startPublishProcess(UserContext uc, String cardIds, String dimensionId, String schemaMetaData, String tags, String publishMemo) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.startPublishProcessType(cardIds, dimensionId, schemaMetaData, tags, publishMemo);
+ }
+
+ /* 取消发布知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_cancel_publish_card")
+ public String cancelPublishCard(UserContext uc, String publishId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.cancelPublishCard(publishId);
+ }
+
+ /* 打开知识地图home页 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_home")
+ public String getHotspotHome(UserContext uc, String dimensionId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.getHotspot(dimensionId);
+ }
+
+ /* 查询维度的tree路径 */
+ @Mapping("com.actionsoft.apps.kms_get_dimension_path_from_root")
+ public String getDimensionPath(UserContext uc, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getDimensionPath(dimensionId);
+ }
+
+ /* 打包下载 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_package_files")
+ public String packageFiels(UserContext uc, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.packageFiels(cardId);
+ }
+
+ /* 收藏知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_collect_card")
+ public String collectCard(UserContext uc, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.collectCard(cardId);
+ }
+
+ /* 删除未保存的知识卡片上传的文件 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_unsaved_files")
+ public String deleteUnsavedFiles(UserContext uc, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.deleteUnsavedFiles(cardId);
+ }
+
+ /* 反馈 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_report_card")
+ public String reportCard(UserContext uc, String cardId, String dimensionId, String reportContent) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.reportCard(cardId, dimensionId, reportContent);
+ }
+
+ /* 预览 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_preview_file")
+ public String previewFile(UserContext uc, String fileId, boolean isDownload, boolean isCopy) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.previewFile(uc, fileId, isDownload, isCopy);
+ }
+
+ /* 下载文件 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_download_file")
+ public String downloadFile(UserContext uc, String fileId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.downloadFile(uc,fileId);
+ }
+
+ /* 知识中心-个人-我的知识-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_log_list")
+ public String getLogListJson(UserContext uc, int curPage, int rowsPerPage, String cardId, String sortIndx, String sortDir) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getLogListJson(curPage, rowsPerPage, cardId, sortIndx, sortDir);
+ }
+
+ /* 知识中心-个人-我的知识-知识列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_latest_comment")
+ public String getLatestComment(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getLatestComment();
+ }
+
+ /* 加载工作网络树页面 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_get_network_page")
+ public String getNetworkPage(UserContext uc, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getNetWorkPage(cardId);
+ }
+
+ /* 加载工作网络树 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_get_network_tree")
+ public String getNetworkTree(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getNetworkTree();
+ }
+
+ /* 分享到工作网络 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_shareto_network")
+ public String shareToNetwork(UserContext uc, String cardId, String teamId, String networkId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.shareToNetwork(cardId, teamId, networkId);
+ }
+
+ /* 知识中心-全部-移动复制知识-获取维度树json */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_all_move_dimension_tree_json")
+ public String getMoveKnwlDimensionTreeJson(UserContext uc, String parentId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.getMoveKnwlDimensionTreeJson(parentId);
+ }
+
+ /* 知识中心-全部-移动知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_move_card")
+ public String moveCard(UserContext uc, String cardIds, String dimensionIds, String currDimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.moveCard(cardIds, dimensionIds, currDimensionId);
+ }
+
+ /* 知识中心-全部-复制知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_copy_card")
+ public String copyCard(UserContext uc, String cardIds, String dimensionIds, String currDimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.copyCard(cardIds, dimensionIds, currDimensionId);
+ }
+
+ /* 知识中心-全部-移交知识 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_change_carduser")
+ public String changeCardUser(UserContext uc, String cardIds, String handoverCardUser) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.changeCardUser(cardIds, handoverCardUser);
+ }
+ /* 知识中心-发布-检查知识下是否存在文件 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_check_card_has_file")
+ public String checkCardHasFile(UserContext uc, String cardIds) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.checkCardHasFile(cardIds);
+ }
+
+ /* 知识中心-发布-检查知识下是否存在文件 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_cancel_publish_card_process_start")
+ public String startCancelPublishProcess(UserContext uc, String publishId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.startCancelPublishProcess(publishId);
+ }
+
+ /* 浏览器预览文件(区别于onlinedoc) */
+ @Mapping("com.actionsoft.apps.kms_knwl_browser_preview")
+ public String browserPreview(UserContext uc, String fileId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.browserPreview(fileId);
+ }
+
+ /* 浏览器预览图片 */
+ @Mapping("com.actionsoft.apps.kms_knwl_browser_preview_image")
+ public String browserPreviewImg(UserContext uc, String fileId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.browserPreviewImg(fileId);
+ }
+
+ /* 浏览器预览表单 */
+ @Mapping("com.actionsoft.apps.kms_knwl_browser_preview_form")
+ public String browserPreviewForm(UserContext uc, String fileId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.browserPreviewForm(fileId);
+ }
+
+ /* 加载公共维度知识列表html */
+ @Mapping("com.actionsoft.apps.kms_dimension_grid_html")
+ public String dimensionGridHtml(UserContext uc) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.dimensionGridHtml();
+ }
+
+ /* 独立知识展示页面 iframe(为了和知识中心的架构保持一致) */
+ @Mapping("com.actionsoft.apps.kms_dimension_grid_page_iframe")
+ public String dimensionGridPageIframe(UserContext uc, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.dimensionGridPageIframe(dimensionId);
+ }
+
+ /* 独立知识展示页面 */
+ @Mapping("com.actionsoft.apps.kms_dimension_grid_page")
+ public String dimensionGridPage(UserContext uc, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.dimensionGridPage(dimensionId);
+ }
+
+ /* 独立知识展示页面 */
+ @Mapping("com.actionsoft.apps.kms_dimension_write_log")
+ public String dimensionGridWriteLog(UserContext uc, String fileId, String cardId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.dimensionWriteLog(fileId, cardId);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMgrController.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMgrController.java
new file mode 100644
index 00000000..49b2f8cb
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMgrController.java
@@ -0,0 +1,246 @@
+package com.actionsoft.apps.kms.controller;
+
+import com.actionsoft.apps.kms.web.KnwlMgrWeb;
+import com.actionsoft.apps.processon.HotspotWeb;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+
+/**
+ * 知识维护(KMS后台)控制器类
+ *
+ * @author wangshibao
+ */
+@Controller
+public class KnwlMgrController {
+ /* 知识维护主页面 */
+ @Mapping("com.actionsoft.apps.kms_mgr")
+ public String getMgrHome(UserContext uc, String page, String tab) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getMgrHome(page, tab);
+ }
+
+ /* 知识维护主页面 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr")
+ public String getKnwlMgrHome(UserContext uc) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getKnwlMgrHome();
+ }
+
+ /* 获取维度树json-维度维护 */
+ @Mapping("com.actionsoft.apps.kms_dimension_tree_json")
+ public String getDimensionTreeJson(UserContext uc, String parentId) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getDimensionTreeJson(parentId);
+ }
+
+ /* 获取维度树json-设置知识地图 */
+ @Mapping("com.actionsoft.apps.kms_dimension_tree_bindhotspot_json")
+ public String getDimensionBindHotspotTreeJson(UserContext uc, String parentId) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getDimensionBindHotspotTreeJson(parentId);
+ }
+
+ /* 获取维度树json-有效期维度 */
+ @Mapping("com.actionsoft.apps.kms_dimension_validdate_tree_json")
+ public String getDimensionValiddateTreeJson(UserContext uc, String parentId) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getDimensionValiddateTreeJson(parentId);
+ }
+
+ /* 获取维度树json-有效期维度-全部加载 */
+ @Mapping("com.actionsoft.apps.kms_dimension_validdate_tree_all_json")
+ public String getDimensionValiddateTreeAllJson(UserContext uc) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getDimensionValiddateTreeAllJson();
+ }
+
+ /* 获取维度树json */
+ @Mapping("com.actionsoft.apps.kms_dimension_list_json")
+ public String getDimensionJson(UserContext uc, String parentId) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.getDimensionListJson(parentId);
+ }
+
+ /* 新建维度 */
+ @Mapping("com.actionsoft.apps.kms_add_dimension")
+ public String addDimension(UserContext uc, String parentId, String dimensionNames, boolean showtype, boolean isPublishKnwl, boolean isExamine, String memo, String hotspotName, boolean isEnabled) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.createDimension(dimensionNames, parentId, showtype, isPublishKnwl, isExamine, memo, hotspotName, isEnabled);
+ }
+
+ /* 修改维度 */
+ @Mapping("com.actionsoft.apps.kms_update_dimension")
+ public String updateDimension(UserContext uc, String id, String dimensionName, boolean showtype, boolean isPublishKnwl, boolean isExamine, String memo, String hotspotName, boolean isEnabled) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.updateDimension(id, dimensionName, showtype, isPublishKnwl, isExamine, memo, hotspotName, isEnabled);
+ }
+
+ /* 删除维度 */
+ @Mapping("com.actionsoft.apps.kms_delete_dimension")
+ public String deleteDimension(UserContext uc, String ids) {
+ KnwlMgrWeb mgrWeb = new KnwlMgrWeb(uc);
+ return mgrWeb.deleteDimension(ids);
+ }
+
+ /* 知识维护-元数据-列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_schema_list_json")
+ public String getSchemaListJson(UserContext uc, int curPage, int rowsPerPage, String sortIndx, String sortDir) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getSchemaListJson(curPage, rowsPerPage, sortIndx, sortDir);
+ }
+
+ /* 知识维护-有效期-列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_valid_date_card_list_json")
+ public String getValidDateCardListJson(UserContext uc, int curPage, int rowsPerPage, String dimensionIdArr, String validDate, String sortIndx, String sortDir) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getValidDateCardListJson(curPage, rowsPerPage, dimensionIdArr, validDate, sortIndx, sortDir);
+ }
+
+ /* 知识维护-元数据-属性列表json */
+ @Mapping("com.actionsoft.apps.kms_meta_attr_list_json")
+ public String getMetaAttrListJson(UserContext uc, String schemaId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getMetaAttrListJson(schemaId);
+ }
+
+ /* 知识维护-元数据-新建元数据 (包括属性) */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_add_meta_schema")
+ public String addMetaSchema(UserContext uc, String schemaTitle, int schemaShowtype, boolean isNullable, boolean isSearch, String schemaDesc, String metaAttr) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.addMetaSchema(schemaTitle, schemaShowtype, isNullable, isSearch, schemaDesc, metaAttr);
+ }
+
+ /* 知识维护-元数据-修改元数据 (包括属性) */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_update_meta_schema")
+ public String updateMetaSchema(UserContext uc, String schemaId, String schemaTitle, int schemaShowtype, boolean isNullable, boolean isSearch, String schemaDesc, String metaAttr) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.updateMetaSchema(schemaId, schemaTitle, schemaShowtype, isNullable, isSearch, schemaDesc, metaAttr);
+ }
+
+ /* 知识维护-元数据-删除元数据 (包括属性) */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_delete_meta_schema")
+ public String deleteMetaSchema(UserContext uc, String schemaIds) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.deleteSchema(schemaIds);
+ }
+
+ /* 打开绑定维度到知识地图页面 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_binding")
+ public String getBindingHotspotHome(UserContext uc, String dimensionId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc, dimensionId);
+ return hotspotWeb.getBindHotspot(dimensionId);
+ }
+
+ /* 绑定维度到知识地图 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_bind")
+ public String bindHotspot(UserContext uc, String dimensionId, String shapeId, String hotspotDefId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.bindHotspot(dimensionId, shapeId, hotspotDefId);
+ }
+
+ /* 绑定知识到知识地图 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_bind_card")
+ public String bindHotspotCard(UserContext uc, String cardId, String shapeId, String hotspotDefId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.bindHotspotCard(cardId, shapeId, hotspotDefId);
+ }
+
+ /* 绑定维度到知识地图 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_bind_linkurl")
+ public String bindHotspotLinkURL(UserContext uc, String linkurl, String target, String shapeId, String hotspotDefId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.bindHotspotLinkURL(linkurl, target, shapeId, hotspotDefId);
+ }
+
+ /* 删除绑定知识地图 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_delete_bind")
+ public String deleteHotspot(UserContext uc, String hotspotId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.deleteHotspot(hotspotId);
+ }
+
+ /* 删除绑定知识地图 */
+ @Mapping("com.actionsoft.apps.kms_hotspot_render_hotspot_div")
+ public String getAsyncBindingShapeHotspot(UserContext uc, String dimensionId, String shapeId) {
+ HotspotWeb hotspotWeb = new HotspotWeb(uc);
+ return hotspotWeb.getAsyncBindingShapeHotspot(dimensionId, shapeId);
+ }
+
+ /* 移动维度 */
+ @Mapping("com.actionsoft.apps.kms_move_dimension")
+ public String moveDimension(UserContext uc, String sourceDimensionId, String targetDimensionId, String sort) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.moveDimension(sourceDimensionId, targetDimensionId, sort);
+ }
+
+ /* 延期维度 */
+ @Mapping("com.actionsoft.apps.kms_delay_validdate")
+ public String delayValiddate(UserContext uc, String cardIdArr, String validDate, String sort) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.delayValiddate(cardIdArr, validDate);
+ }
+
+ /* 元数据排序 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_meta_schema_order_index_save")
+ public String saveMetaSchemaOrderIndex(UserContext uc, String sourceId, String targetId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.saveMetaSchemaOrderIndex(sourceId, targetId);
+ }
+
+ /* 有效期-取消发布知识(全部维度)前的检查 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_cancel_publishes_card_check")
+ public String cancelPublishesCardCheck(UserContext uc, String cardId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.cancelPublishesCardCheck(cardId);
+ }
+
+ /* 有效期-取消发布知识(全部维度) */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_cancel_publishes_card")
+ public String cancelPublishesCard(UserContext uc, String cardId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.cancelPublishesCard(cardId);
+ }
+
+ /* 有效期-取消发布知识(全部维度) */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_get_examine_user")
+ public String getExamineUser(UserContext uc, String dimensionId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getExamineUser(dimensionId);
+ }
+
+ /* usertask-维度树页面 */
+ @Mapping("com.actionsoft.apps.kms_usertask_html")
+ public String getKMSUsertaskHTML(UserContext uc, String formToKMSOptionDimensionIdJA) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getKMSUsertaskHTML(formToKMSOptionDimensionIdJA);
+ }
+
+ /* 维度策略报告 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_report")
+ public String getDimensionReport(UserContext uc, String dimensionId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.getDimensionReport(dimensionId);
+ }
+
+ /* 应用当前维度的ac权限到后代 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_dimension_ac_to_des")
+ public String dimensionACToDes(UserContext uc, String dimensionId, String style) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.dimensionACToDes(dimensionId, style);
+ }
+
+ /* 复制维度 */
+ @Mapping("com.actionsoft.apps.kms_knwl_mgr_dimension_copy")
+ public String copyDimension(UserContext uc, String newDimensionName, String currDimensionId) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.copyDimension(uc, newDimensionName, currDimensionId);
+ }
+
+ /* 移交维度 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_change_dimensionuser")
+ public String changeCardUser(UserContext uc, String dimensionIds, String handoverCardUser) {
+ KnwlMgrWeb knwlMgrWeb = new KnwlMgrWeb(uc);
+ return knwlMgrWeb.changeDimensionUser(dimensionIds, handoverCardUser);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMobileController.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMobileController.java
new file mode 100644
index 00000000..0814bd84
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlMobileController.java
@@ -0,0 +1,60 @@
+package com.actionsoft.apps.kms.controller;
+
+import com.actionsoft.apps.kms.web.KnwlCenterWeb;
+import com.actionsoft.apps.kms.web.KnwlMobileWeb;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+
+@Controller
+public class KnwlMobileController {
+ /* 主页面 */
+ @Mapping("com.actionsoft.apps.kms_mobile_home")
+ public String getMobileHome(UserContext uc) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.getMobileHome();
+ }
+
+ @Mapping("com.actionsoft.apps.kms_mobile_lists")
+ public String getLists(UserContext uc, String sortIndx, String sortDir, String searchDimensionIds, String schemaMetaData, String cardName, String publishTime, String publishUser, String tags, String lastPublishId, String searchType,String departId) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.mobileListsData(uc, sortIndx, sortDir, searchDimensionIds, schemaMetaData, cardName, publishTime, publishUser, tags, lastPublishId, searchType,departId);
+ }
+
+ /* 启动发布流程 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_publish_card_process_start_mobile")
+ public String startPublishProcess(UserContext uc, String cardIds, String dimensionId, String schemaMetaData, String tags, String publishMemo) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.startPublishProcess(cardIds, dimensionId, schemaMetaData, tags, publishMemo, "mobile");
+ }
+
+ /* 启动借阅流程 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_borrow_card_process_start_mobile")
+ public String startBorrowProcwss(UserContext uc, String cardId, String dimensionId) {
+ KnwlCenterWeb knwlCenterWeb = new KnwlCenterWeb(uc);
+ return knwlCenterWeb.startBorrowProcess(cardId, dimensionId, "mobile");
+ }
+ @Mapping("com.actionsoft.apps.kms_mobile_center_dimension_tree_json")
+ public String getDimensionTreeJson(UserContext uc, String parentId, boolean isDimensionKnwlPage) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.getDimensionTreeJson(uc, parentId, isDimensionKnwlPage);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_mobile_center_dimension_search")
+ public String getDimensionSearchByName(UserContext uc, String key) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.getDimensionSearchByName(uc, key);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_knwl_center_mobile_schema_attr_list_json")
+ public String getSchemaMobile(UserContext uc) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.getSchemaMobile();
+ }
+
+ @Mapping("com.actionsoft.apps.kms_knwl_center_mobile_check_fullsearch")
+ public String checkFullsearchAppActive(UserContext uc) {
+ KnwlMobileWeb web = new KnwlMobileWeb(uc);
+ return web.checkFullsearchAppActive(uc);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlSearchController.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlSearchController.java
new file mode 100644
index 00000000..e87d11c0
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/KnwlSearchController.java
@@ -0,0 +1,167 @@
+package com.actionsoft.apps.kms.controller;
+
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.web.KnwlSearchWeb;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+
+/**
+ * @author wangshibao
+ */
+@Controller
+public class KnwlSearchController {
+ /* 知识检索home页 */
+ @Mapping("com.actionsoft.apps.kms_knwl_search")
+ public String getKnwlMgrHome(UserContext uc, String searchType, String sortIndx) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ return knwlSearchWeb.getKnwlSearchHome(searchType, sortIndx);
+ }
+
+ /* 知识检索-属性-维度树json */
+ @Mapping("com.actionsoft.apps.kms_knwl_search_attr_dimension_tree_json")
+ public String getAttrSearchDimensionTreeJson(UserContext uc, String parentId) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ return knwlSearchWeb.getAttrSearchDimensionTreeJson(parentId, KMSUtil.isKnwlManager(uc.getUID()));
+ }
+
+ /* 知识检索-属性-维度树json */
+ @Mapping("com.actionsoft.apps.kms_knwl_search_attr_dimension_tree_all_json")
+ public String getAttrSearchDimensionTreeAllJson(UserContext uc) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ return knwlSearchWeb.getAttrSearchDimensionTreeAllJson();
+ }
+
+ /* 知识检索-属性-元数据列表json */
+ @Mapping("com.actionsoft.apps.kms_knwl_search_schema_attr_list_json")
+ public String getSchemaAttrListJson(UserContext uc) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ return knwlSearchWeb.getSchemaAttr();
+ }
+
+ /* 知识检索-属性-检索数据库 */
+ @Mapping("com.actionsoft.apps.kms_knwl_attr_search_dosearch")
+ public String attrSearchCard(UserContext uc, int curPage, int rowsPerPage, String sortIndx, String sortDir, String searchDimensionIds, String schemaMetaData, String cardName, String publishUser, String publishTime, String tags, String lastPublishId, String searchType,String departId) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ System.out.println("departId>>>>>>>>>>>"+departId);
+ return knwlSearchWeb.attrSearchCard(curPage, rowsPerPage, sortIndx, sortDir, searchDimensionIds, schemaMetaData, cardName, publishTime, publishUser, tags, lastPublishId, searchType,departId);
+ }
+
+ /* 全文检索 */
+ @Mapping("com.actionsoft.apps.kms_knwl_fullsearch_list_json")
+ public String fullSearch(UserContext uc, int curPage, int rowsPerPage, String searchText, String docTypes, String searchType) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ return knwlSearchWeb.fullSearch(curPage, rowsPerPage, searchText, docTypes, searchType);
+ }
+
+ // 键盘地址本查询团队成员模糊匹配
+ @Mapping("com.actionsoft.apps.kms_knwl_memberlist")
+ public String getApplicationManagementDeploy(UserContext uc, String term) {
+ KnwlSearchWeb knwlSearchWeb = new KnwlSearchWeb(uc);
+ // term为组件默认参数
+ return knwlSearchWeb.getUserList(term);
+ }
+
+ /**
+ * 全文检索查询
+ *
+ * @param me
+ * @param q 关键词
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.kms_es_search")
+ public String openEsSearchPage(UserContext me, String q) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.openEsSearchPage(q);
+ }
+
+ /**
+ * kms注册的xpages页面
+ *
+ * @param me
+ * @return
+ */
+ @Mapping("com.actionsoft.apps.kms_xpages")
+ public String kmsXPages(UserContext me, String showIndex, String showStyle) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.kmsXPages(showIndex, showStyle);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_querycardtoplist")
+ public String queryCardTopList(UserContext me, String sortIndx) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.queryCardTopList(sortIndx);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_querycardtoplistpage")
+ public String queryCardTopPage(UserContext me, String sortIndx) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.queryCardTopPage(sortIndx);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_opencardbydirctory")
+ public String openCardbyDirctory(UserContext me, String rootDirectoryId, String showType, String showIndex, String ifShowDirectory, String sortIndx, String showStyle, String publishTimeFormat) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.openCardByDirctory(rootDirectoryId, showType, showIndex, ifShowDirectory, sortIndx, showStyle, publishTimeFormat);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_getcardbydirctory")
+ public String getCardByDirctory(UserContext me, String directoryId, String sortIndx, String hasPerm, String publishTimeFormat) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.getCardByDirctory(directoryId, sortIndx, hasPerm, publishTimeFormat);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_getxpagecategory")
+ public String getXpageCategory(UserContext me) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.getXpageCategory();
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_savexpagecategory")
+ public String saveXpageCategory(UserContext me, String categoryName) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.saveXpageCategory(categoryName);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_openfastcard")
+ public String openFastCard(UserContext me, String category, String showType, String showIndex, String showStyle, String publishTimeFormat) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.openFastCard(category, showType, showIndex, showStyle, publishTimeFormat);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_savexpagefastcard")
+ public String saveXpageFastCard(UserContext me, String categoryName, String cardIds) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.saveXpageFastCard(categoryName, cardIds);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_deletexpagefastcard")
+ public String deleteXpageFastCard(UserContext me, String id) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.deleteXpageFastCard(id);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_loadfastcard")
+ public String loadFastCard(UserContext me, String categoryName, String publishTimeFormat) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.loadFastCard(categoryName, publishTimeFormat);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_savefastcardorder")
+ public String saveFastCardOrder(UserContext me, String data) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.saveFastCardOrder(data);
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_getcardtree")
+ public String getCardTree(UserContext me) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.getCardTree();
+ }
+
+ @Mapping("com.actionsoft.apps.kms_xpage_getcardtreedata")
+ public String getCardTreeData(UserContext me, String type, String pid, String hasPerm) {
+ KnwlSearchWeb web = new KnwlSearchWeb(me);
+ return web.getCardTreeData(type, pid, hasPerm);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/SystemMgrController.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/SystemMgrController.java
new file mode 100644
index 00000000..718fde88
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/controller/SystemMgrController.java
@@ -0,0 +1,83 @@
+package com.actionsoft.apps.kms.controller;
+
+import com.actionsoft.apps.kms.web.SystemMgrWeb;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.bind.annotation.Controller;
+import com.actionsoft.bpms.server.bind.annotation.Mapping;
+
+/**
+ *
+ * @author wangshibao
+ */
+@Controller
+public class SystemMgrController {
+ /* 系统维护home页 */
+ @Mapping("com.actionsoft.apps.kms_system_mgr")
+ public String getKnwlMgrHome(UserContext uc) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.getSystemMgrHome();
+ }
+
+ /* 系统维护版本号列表json */
+ @Mapping("com.actionsoft.apps.kms_version_list_json")
+ public String getVersionListJson(UserContext uc) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.getVersionListJson();
+ }
+
+ /* 系统维护知识地图定义列表json */
+ @Mapping("com.actionsoft.apps.kms_hotspot_def_list_json")
+ public String getHotspotDefListJson(UserContext uc) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.getHotspotDefListJson();
+ }
+
+ /* 保存知识参数 */
+ @Mapping("com.actionsoft.apps.kms_system_mgr_save_param")
+ public String saveSystemParam(UserContext uc, String maxFileSize, String blackFileList, String gridRowPP, String browserPreview) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.saveSystemParam(maxFileSize, blackFileList, gridRowPP, browserPreview);
+ }
+
+ /* 获取知识参数 */
+ @Mapping("com.actionsoft.apps.kms_system_mgr_get_param_json")
+ public String getSystemParam(UserContext uc) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.getSystemParam();
+ }
+
+ /* 新建版本号 */
+ @Mapping("com.actionsoft.apps.kms_system_mgr_add_version")
+ public String addVersion(UserContext uc, String versionNo, String memo) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.addVersion(versionNo, memo);
+ }
+
+ /* 新建知识地图定义 */
+ @Mapping("com.actionsoft.apps.kms_system_mgr_add_hotspot_def")
+ public String addHotspotDef(UserContext uc, String hotspotName, String hotspotMetaId, String memo) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.addHotspotDef(hotspotName, hotspotMetaId, memo);
+ }
+
+ /* 删除版本号 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_version")
+ public String deleteVersions(UserContext uc, String versionNos) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.deleteVersions(versionNos);
+ }
+
+ /* 删除知识地图定义 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_hotspot_def")
+ public String deleteHotspotDefs(UserContext uc, String hotspotDefIds) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.deleteHotspotDefs(hotspotDefIds);
+ }
+
+ /* 删除知识地图定义 */
+ @Mapping("com.actionsoft.apps.kms_knwl_center_delete_hotspot_check")
+ public String deleteHotspotDefsCheck(UserContext uc, String hotspotDefIds) {
+ SystemMgrWeb systemMgrWeb = new SystemMgrWeb(uc);
+ return systemMgrWeb.deleteHotspotDefsCheck(hotspotDefIds);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/CardDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/CardDao.java
new file mode 100644
index 00000000..a2f6072d
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/CardDao.java
@@ -0,0 +1,170 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 知识
+ *
+ * @author wangshibao
+ */
+public class CardDao extends DaoObject {
+
+ @Override
+ public int insert(CardModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(CardModel.ID, model.getId());
+ paraMap.put(CardModel.CARDNAME, model.getCardName());
+ paraMap.put(CardModel.CARDTYPE, model.getCardType());
+ paraMap.put(CardModel.CREATETIME, model.getCreateTime());
+ paraMap.put(CardModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(CardModel.ONLINELEVEL, model.getOnlineLevel());
+ paraMap.put(CardModel.ISPUBLISHED, model.getIsPublished());
+ paraMap.put(CardModel.ISFULLSEARCH, model.getIsFullSearch());
+ paraMap.put(CardModel.READCOUNT, model.getReadCount());
+ paraMap.put(CardModel.SECURITYLEVEL, model.getSecurityLevel());
+
+ if (model.getLastUpdate() == null) {
+ SQLNullValue lastUpdateNull = SQLNullValue.newInstance(Types.DATE);
+ paraMap.put(CardModel.LASTUPDATE, lastUpdateNull);
+ } else {
+ paraMap.put(CardModel.LASTUPDATE, model.getLastUpdate());
+ }
+ if (model.getValidDate() == null) {
+ SQLNullValue validDateNull = SQLNullValue.newInstance(Types.DATE);
+ paraMap.put(CardModel.VALIDDATE, validDateNull);
+ } else {
+ paraMap.put(CardModel.VALIDDATE, model.getValidDate());
+ }
+
+ paraMap.put(CardModel.ISCOMMENT, model.getIsComment());
+ paraMap.put(CardModel.ISRATE, model.getIsRate());
+ paraMap.put(CardModel.CARDCONTEXT, "");
+ if (model.getExternalUrl() == null) {
+ paraMap.put(CardModel.EXTERNALURL, "");
+ } else {
+ paraMap.put(CardModel.EXTERNALURL, model.getExternalUrl());
+ }
+ if (model.getExtParams() == null) {
+ paraMap.put(CardModel.EXTPARAMS, "");
+ } else {
+ paraMap.put(CardModel.EXTPARAMS, model.getExtParams());
+ }
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ CardCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(CardModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(CardModel.CARDNAME, model.getCardName());
+ paraMap.put(CardModel.CARDTYPE, model.getCardType());
+ paraMap.put(CardModel.CREATETIME, model.getCreateTime());
+ paraMap.put(CardModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(CardModel.ONLINELEVEL, model.getOnlineLevel());
+ paraMap.put(CardModel.ISPUBLISHED, model.getIsPublished());
+ paraMap.put(CardModel.ISFULLSEARCH, model.getIsFullSearch());
+ paraMap.put(CardModel.READCOUNT, model.getReadCount());
+ paraMap.put(CardModel.SECURITYLEVEL, model.getSecurityLevel());
+ if (model.getLastUpdate() == null) {
+ SQLNullValue lastUpdateNull = SQLNullValue.newInstance(Types.DATE);
+ paraMap.put(CardModel.LASTUPDATE, lastUpdateNull);
+ } else {
+ paraMap.put(CardModel.LASTUPDATE, model.getLastUpdate());
+ }
+ if (model.getValidDate() == null) {
+ SQLNullValue validDateNull = SQLNullValue.newInstance(Types.DATE);
+ paraMap.put(CardModel.VALIDDATE, validDateNull);
+ } else {
+ paraMap.put(CardModel.VALIDDATE, model.getValidDate());
+ }
+ paraMap.put(CardModel.ISCOMMENT, model.getIsComment());
+ paraMap.put(CardModel.ISRATE, model.getIsRate());
+ paraMap.put(CardModel.CARDCONTEXT, "");
+ if (model.getExternalUrl() == null) {
+ paraMap.put(CardModel.EXTERNALURL, "");
+ } else {
+ paraMap.put(CardModel.EXTERNALURL, model.getExternalUrl());
+ }
+ if (model.getExtParams() == null) {
+ paraMap.put(CardModel.EXTPARAMS, "");
+ } else {
+ paraMap.put(CardModel.EXTPARAMS, model.getExtParams());
+ }
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ CardCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_CARD;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public CardModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public CardModel record2Model(ResultSet rs) {
+ CardModel cardModel = null;
+ try {
+ if (rs.getString(CardModel.CARDTYPE) == null) {
+ return cardModel;
+ }
+ cardModel = new CardModel();
+ cardModel.setId(rs.getString(CardModel.ID));
+ cardModel.setCardName(rs.getString(CardModel.CARDNAME));
+ cardModel.setCardType(rs.getInt(CardModel.CARDTYPE));
+ cardModel.setCreateTime(rs.getTimestamp(CardModel.CREATETIME));
+ cardModel.setCreateUser(rs.getString(CardModel.CREATEUSER));
+ cardModel.setIsPublished(rs.getInt(CardModel.ISPUBLISHED));
+ cardModel.setLastUpdate(rs.getTimestamp(CardModel.LASTUPDATE));
+ cardModel.setOnlineLevel(rs.getInt(CardModel.ONLINELEVEL));
+ cardModel.setReadCount(rs.getLong(CardModel.READCOUNT));
+ cardModel.setSecurityLevel(rs.getInt(CardModel.SECURITYLEVEL));
+ cardModel.setValidDate(rs.getDate(CardModel.VALIDDATE));
+ cardModel.setIsComment(rs.getInt(CardModel.ISCOMMENT));
+ cardModel.setIsRate(rs.getInt(CardModel.ISRATE));
+ cardModel.setCardContext(rs.getString(CardModel.CARDCONTEXT));
+ cardModel.setIsFullSearch(rs.getInt(CardModel.ISFULLSEARCH));
+ cardModel.setExternalUrl(rs.getString(cardModel.EXTERNALURL));
+ cardModel.setExtParams(rs.getString(cardModel.EXTPARAMS));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return cardModel;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/DimensionDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/DimensionDao.java
new file mode 100644
index 00000000..866aba34
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/DimensionDao.java
@@ -0,0 +1,217 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.model.DimensionModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 维度
+ *
+ * @author wangshibao
+ */
+public class DimensionDao extends DaoObject {
+ /**
+ * 重载方法,传入Connection提高效率
+ *
+ * @param conn
+ * @param model
+ * @return
+ * @throws AWSDataAccessException
+ * @author wangshibao
+ */
+ public int insert(Connection conn, DimensionModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(DimensionModel.ID, model.getId());
+ paraMap.put(DimensionModel.DIMENSIONNAME, model.getDimensionName());
+ paraMap.put(DimensionModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(DimensionModel.CREATETIME, model.getCreateTime());
+ paraMap.put(DimensionModel.HOTSPOTDEFID, model.getHotspotDefId());
+ paraMap.put(DimensionModel.ISENABLED, model.getIsEnabled());
+ paraMap.put(DimensionModel.ISEXAMINE, model.getIsExamine());
+
+ if (model.getMemo() == null) {
+ paraMap.put(DimensionModel.MEMO, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(DimensionModel.MEMO, model.getMemo());
+ }
+
+ paraMap.put(DimensionModel.PARENTID, model.getParentId());
+ paraMap.put(DimensionModel.SHOWTYPE, model.getShowType());
+
+ if (model.getLastUpdate() == null) {
+ paraMap.put(DimensionModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(DimensionModel.LASTUPDATE, model.getLastUpdate());
+ }
+
+ paraMap.put(DimensionModel.ORDERINDEX, model.getOrderIndex());
+
+ int result = 0;
+ if (conn == null) {
+ result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ } else {
+ result = DBSql.update(conn, DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ }
+ if (result == 1) {// 更新cache
+ DimensionCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int insert(DimensionModel model) throws AWSDataAccessException {
+ return insert(null, model);
+ }
+
+ /**
+ * 重载方法,传入Connection提高效率
+ *
+ * @param conn
+ * @param model
+ * @return
+ * @throws AWSDataAccessException
+ * @author wangshibao
+ */
+ public int update(Connection conn, DimensionModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(DimensionModel.DIMENSIONNAME, model.getDimensionName());
+ paraMap.put(DimensionModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(DimensionModel.CREATETIME, model.getCreateTime());
+ paraMap.put(DimensionModel.HOTSPOTDEFID, model.getHotspotDefId());
+ paraMap.put(DimensionModel.ISENABLED, model.getIsEnabled());
+ paraMap.put(DimensionModel.ISEXAMINE, model.getIsExamine());
+ paraMap.put(DimensionModel.MEMO, model.getMemo());
+ paraMap.put(DimensionModel.PARENTID, model.getParentId());
+ paraMap.put(DimensionModel.SHOWTYPE, model.getShowType());
+ if (model.getLastUpdate() == null) {
+ paraMap.put(DimensionModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(DimensionModel.LASTUPDATE, model.getLastUpdate());
+ }
+
+ paraMap.put(DimensionModel.ORDERINDEX, model.getOrderIndex());
+
+ int result = 0;
+ if (conn == null) {
+ result = update(model.getId(), paraMap);
+ } else {
+ result = update(conn, model.getId(), paraMap);
+ }
+ if (result == 1) {// 更新cache
+ DimensionCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(DimensionModel model) throws AWSDataAccessException {
+ return update(null, model);
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_DIMENSION;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public DimensionModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public DimensionModel record2Model(ResultSet rs) {
+ DimensionModel dimensionModel = new DimensionModel();
+ try {
+ dimensionModel.setId(rs.getString(DimensionModel.ID));
+ dimensionModel.setCreateTime(rs.getTimestamp(DimensionModel.CREATETIME));
+ dimensionModel.setCreateUser(rs.getString(DimensionModel.CREATEUSER));
+ dimensionModel.setDimensionName(rs.getString(DimensionModel.DIMENSIONNAME));
+ dimensionModel.setHotspotDefId(rs.getString(DimensionModel.HOTSPOTDEFID));
+ dimensionModel.setIsEnabled(rs.getInt(DimensionModel.ISENABLED));
+ dimensionModel.setIsExamine(rs.getInt(DimensionModel.ISEXAMINE));
+ dimensionModel.setLastUpdate(rs.getTimestamp(DimensionModel.LASTUPDATE));
+ dimensionModel.setMemo(rs.getString(DimensionModel.MEMO));
+ String parentId = rs.getString(DimensionModel.PARENTID);
+ dimensionModel.setParentId(parentId == null ? "" : parentId.trim());// sqlserver和db2把char(36)类型的空字符串默认处理为36位空格 oracle把char(36)类型的空字符串处理为NULL
+ dimensionModel.setShowType(rs.getInt(DimensionModel.SHOWTYPE));
+ dimensionModel.setOrderIndex(rs.getInt(DimensionModel.ORDERINDEX));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return dimensionModel;
+ }
+
+ /**
+ * 删除维度(一并删除子维度)
+ *
+ * @param dimensionIdList 维度集合
+ * @return
+ * @throws AWSDataAccessException
+ * @author wangshibao
+ */
+ public int delete(List dimensionIdList) throws AWSDataAccessException {
+
+ StringBuilder sqlWhere = new StringBuilder("(");
+ for (int i = 0; i < dimensionIdList.size(); i++) {
+ sqlWhere.append("'" + dimensionIdList.get(i) + "',");
+ }
+ String sqlWhere1 = sqlWhere.substring(0, sqlWhere.lastIndexOf(","));
+ sqlWhere1 += ")";
+ String sql = "DELETE FROM " + entityName() + " WHERE " + pkFieldName() + " IN " + sqlWhere1;
+
+ int result = DBSql.update(sql);
+ // 更新cache
+ DimensionCache dimensionCache = DimensionCache.getCache();
+ for (String id : dimensionIdList) {
+ dimensionCache.remove(id);
+ }
+ return result;
+ }
+
+ /**
+ * 填充后代维度id
+ *
+ * @param id
+ * @param dimensionIds
+ * @author wangshibao
+ */
+ public void fillDescendantDimensions(String id, List dimensionIds) {
+ Iterator iterator = DimensionCache.getCache().iterator();
+ while (iterator.hasNext()) {
+ DimensionModel dimensionModel = iterator.next();
+ if (id.equals(dimensionModel.getParentId())) {
+ dimensionIds.add(dimensionModel.getId());
+ String id1 = dimensionModel.getId();
+ fillDescendantDimensions(id1, dimensionIds);
+ }
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/FileDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/FileDao.java
new file mode 100644
index 00000000..ff466792
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/FileDao.java
@@ -0,0 +1,117 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.FileCache;
+import com.actionsoft.apps.kms.model.FileModel;
+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;
+
+/**
+ * 知识-文件
+ *
+ * @author wangshibao
+ */
+public class FileDao extends DaoObject {
+
+ @Override
+ public int insert(FileModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(FileModel.ID, model.getId());
+ paraMap.put(FileModel.CARDID, model.getCardId());
+ paraMap.put(FileModel.CREATETIME, model.getCreateTime());
+ paraMap.put(FileModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(FileModel.FILENAME, model.getFileName());
+ paraMap.put(FileModel.FILESIZE, model.getFileSize());
+ paraMap.put(FileModel.FILESTATE, model.getFileState());
+ paraMap.put(FileModel.FILEVER, model.getFileVer());
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ FileCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(FileModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(FileModel.CARDID, model.getCardId());
+ paraMap.put(FileModel.CREATETIME, model.getCreateTime());
+ paraMap.put(FileModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(FileModel.FILENAME, model.getFileName());
+ paraMap.put(FileModel.FILESIZE, model.getFileSize());
+ paraMap.put(FileModel.FILESTATE, model.getFileState());
+ paraMap.put(FileModel.FILEVER, model.getFileVer());
+ paraMap.put(FileModel.ISFULLSEARCH, model.getIsFullsearch());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ FileCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ /**
+ * 删除文件(但不删除缓存,在调用方删除缓存)
+ *
+ * @param id
+ * @return
+ * @throws AWSDataAccessException
+ * @author wangshibao
+ */
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_FILE;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public FileModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public FileModel record2Model(ResultSet rs) {
+ FileModel fileModel = new FileModel();
+ try {
+ fileModel.setCardId(rs.getString(FileModel.CARDID));
+ fileModel.setCreateTime(rs.getTimestamp(FileModel.CREATETIME));
+ fileModel.setCreateUser(rs.getString(FileModel.CREATEUSER));
+ fileModel.setFileName(rs.getString(FileModel.FILENAME));
+ fileModel.setFileSize(rs.getLong(FileModel.FILESIZE));
+ fileModel.setFileState(rs.getInt(FileModel.FILESTATE));
+ fileModel.setFileVer(rs.getString(FileModel.FILEVER));
+ fileModel.setId(rs.getString(FileModel.ID));
+ fileModel.setIsFullsearch(rs.getInt(FileModel.ISFULLSEARCH));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return fileModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDao.java
new file mode 100644
index 00000000..1b934599
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDao.java
@@ -0,0 +1,144 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.HotspotCache;
+import com.actionsoft.apps.kms.model.HotspotModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 知识地图
+ *
+ * @author wangshibao
+ */
+public class HotspotDao extends DaoObject {
+
+ @Override
+ public int insert(HotspotModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getObjectId());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(HotspotModel.ID, model.getId());
+ paraMap.put(HotspotModel.HOTSPOTDEFID, model.getHotspotDefId());
+ if (model.getDimensionId() == null) {
+ paraMap.put(HotspotModel.DIMENSIONID, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.DIMENSIONID, model.getDimensionId());
+ }
+
+ paraMap.put(HotspotModel.SHAPEID, model.getShapeId());
+ paraMap.put(HotspotModel.BINDTYPE, model.getBindType());
+ if (model.getLinkURL() == null) {
+ paraMap.put(HotspotModel.LINKURL, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.LINKURL, model.getLinkURL());
+ }
+ if (model.getTarget() == null) {
+ paraMap.put(HotspotModel.TARGET, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.TARGET, model.getTarget());
+ }
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ HotspotCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(HotspotModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(HotspotModel.HOTSPOTDEFID, model.getHotspotDefId());
+ if (model.getDimensionId() == null) {
+ paraMap.put(HotspotModel.DIMENSIONID, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.DIMENSIONID, model.getDimensionId());
+ }
+ paraMap.put(HotspotModel.SHAPEID, model.getShapeId());
+ paraMap.put(HotspotModel.BINDTYPE, model.getBindType());
+ if (model.getLinkURL() == null) {
+ paraMap.put(HotspotModel.LINKURL, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.LINKURL, model.getLinkURL());
+ }
+ if (model.getTarget() == null) {
+ paraMap.put(HotspotModel.TARGET, SQLNullValue.newInstance(Types.VARCHAR));
+ } else {
+ paraMap.put(HotspotModel.TARGET, model.getTarget());
+ }
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ HotspotCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ HotspotCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ HotspotCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_HOTSPOT;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public HotspotModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public HotspotModel record2Model(ResultSet rs) {
+ HotspotModel hotspotModel = new HotspotModel();
+ try {
+ hotspotModel.setDimensionId(rs.getString(HotspotModel.DIMENSIONID));
+ hotspotModel.setShapeId(rs.getString(HotspotModel.SHAPEID));
+ hotspotModel.setHotspotDefId(rs.getString(HotspotModel.HOTSPOTDEFID));
+ hotspotModel.setId(rs.getString(HotspotModel.ID));
+ hotspotModel.setBindType(rs.getInt(HotspotModel.BINDTYPE));
+ hotspotModel.setLinkURL(rs.getString(HotspotModel.LINKURL));
+ hotspotModel.setTarget(rs.getString(hotspotModel.TARGET));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return hotspotModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDefDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDefDao.java
new file mode 100644
index 00000000..820d93c4
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/HotspotDefDao.java
@@ -0,0 +1,99 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.model.HotspotDefModel;
+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;
+
+/**
+ * 知识地图定义
+ *
+ * @author wangshibao
+ */
+public class HotspotDefDao extends DaoObject {
+
+ @Override
+ public int insert(HotspotDefModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(HotspotDefModel.ID, model.getId());
+ paraMap.put(HotspotDefModel.CREATETIME, model.getCreateTime());
+ paraMap.put(HotspotDefModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(HotspotDefModel.HOTSPOTNAME, model.getHotspotName());
+ paraMap.put(HotspotDefModel.HOTSPOTMETAID, model.getHotspotMetaId());
+ paraMap.put(HotspotDefModel.MEMO, model.getMemo());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ return result;
+ }
+
+ @Override
+ public int update(HotspotDefModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(HotspotDefModel.CREATETIME, model.getCreateTime());
+ paraMap.put(HotspotDefModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(HotspotDefModel.HOTSPOTNAME, model.getHotspotName());
+ paraMap.put(HotspotDefModel.HOTSPOTMETAID, model.getHotspotMetaId());
+ paraMap.put(HotspotDefModel.MEMO, model.getMemo());
+ int result = update(model.getId(), paraMap);
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_HOTSPOT_DEF;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public HotspotDefModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public HotspotDefModel record2Model(ResultSet rs) {
+ HotspotDefModel hotspotDefModel = new HotspotDefModel();
+ try {
+ hotspotDefModel.setCreateTime(rs.getTimestamp(HotspotDefModel.CREATETIME));
+ hotspotDefModel.setId(rs.getString(HotspotDefModel.ID));
+ hotspotDefModel.setCreateUser(rs.getString(HotspotDefModel.CREATEUSER));
+ hotspotDefModel.setHotspotName(rs.getString(HotspotDefModel.HOTSPOTNAME));
+ hotspotDefModel.setHotspotMetaId(rs.getString(HotspotDefModel.HOTSPOTMETAID));
+ hotspotDefModel.setMemo(rs.getString(HotspotDefModel.MEMO));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return hotspotDefModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/LogDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/LogDao.java
new file mode 100644
index 00000000..6432c755
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/LogDao.java
@@ -0,0 +1,107 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.model.LogModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 日志
+ *
+ * @author wangshibao
+ */
+public class LogDao extends DaoObject {
+
+ @Override
+ public int insert(LogModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(LogModel.ID, model.getId());
+ paraMap.put(LogModel.ACCESSTIME, model.getAccessTime());
+ paraMap.put(LogModel.ACCESSUSER, model.getAccessUser());
+ paraMap.put(LogModel.CARDID, model.getCardId());
+
+ if (model.getFileId() == null) {
+ SQLNullValue fileIdNull = SQLNullValue.newInstance(Types.VARCHAR);
+ paraMap.put(LogModel.FILEID, fileIdNull);
+ } else {
+ paraMap.put(LogModel.FILEID, model.getFileId());
+ }
+ paraMap.put(LogModel.IPADDRESS, model.getIpAddress());
+ paraMap.put(LogModel.LOGTYPE, model.getLogType());
+ paraMap.put(LogModel.LOGINFO, model.getLogInfo());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ return result;
+ }
+
+ @Override
+ public int update(LogModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(LogModel.ACCESSTIME, model.getAccessTime());
+ paraMap.put(LogModel.ACCESSUSER, model.getAccessUser());
+ paraMap.put(LogModel.CARDID, model.getCardId());
+ if (model.getFileId() == null) {
+ SQLNullValue fileIdNull = SQLNullValue.newInstance(Types.VARCHAR);
+ paraMap.put(LogModel.FILEID, fileIdNull);
+ } else {
+ paraMap.put(LogModel.FILEID, model.getFileId());
+ }
+ paraMap.put(LogModel.IPADDRESS, model.getIpAddress());
+ paraMap.put(LogModel.LOGTYPE, model.getLogType());
+ paraMap.put(LogModel.LOGINFO, model.getLogInfo());
+ int result = update(model.getId(), paraMap);
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_LOG;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public LogModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public LogModel record2Model(ResultSet rs) {
+ LogModel logModel = new LogModel();
+ try {
+ logModel.setAccessTime(rs.getTimestamp(LogModel.ACCESSTIME));
+ logModel.setAccessUser(rs.getString(LogModel.ACCESSUSER));
+ logModel.setCardId(rs.getString(LogModel.CARDID));
+ logModel.setFileId(rs.getString(LogModel.FILEID));
+ logModel.setId(rs.getString(LogModel.ID));
+ logModel.setIpAddress(rs.getString(LogModel.IPADDRESS));
+ logModel.setLogType(rs.getInt(LogModel.LOGTYPE));
+ logModel.setLogInfo(rs.getString(LogModel.LOGINFO));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return logModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaAttrDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaAttrDao.java
new file mode 100644
index 00000000..dfcae945
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaAttrDao.java
@@ -0,0 +1,107 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.MetaAttrCache;
+import com.actionsoft.apps.kms.model.MetaAttrModel;
+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;
+
+/**
+ * 元数据-属性
+ *
+ * @author wangshibao
+ */
+public class MetaAttrDao extends DaoObject {
+
+ @Override
+ public int insert(MetaAttrModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaAttrModel.ID, model.getId());
+ paraMap.put(MetaAttrModel.ATTRTITLE, model.getAttrTitle());
+ paraMap.put(MetaAttrModel.CREATETIME, model.getCreateTime());
+ paraMap.put(MetaAttrModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(MetaAttrModel.SCHEMAID, model.getSchemaId());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ MetaAttrCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(MetaAttrModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaAttrModel.ATTRTITLE, model.getAttrTitle());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ MetaAttrModel metaAttrModel = MetaAttrCache.getCache().get(model.getId());
+ metaAttrModel.setAttrTitle(model.getAttrTitle());
+ MetaAttrCache.getCache().put(model.getId(), metaAttrModel);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ MetaAttrCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ MetaAttrCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_META_ATTR;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public MetaAttrModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public MetaAttrModel record2Model(ResultSet rs) {
+ MetaAttrModel metaAttrModel = new MetaAttrModel();
+ try {
+ metaAttrModel.setAttrTitle(rs.getString(MetaAttrModel.ATTRTITLE));
+ metaAttrModel.setCreateTime(rs.getTimestamp(MetaAttrModel.CREATETIME));
+ metaAttrModel.setCreateUser(rs.getString(MetaAttrModel.CREATEUSER));
+ metaAttrModel.setId(rs.getString(MetaAttrModel.ID));
+ metaAttrModel.setSchemaId(rs.getString(MetaAttrModel.SCHEMAID));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return metaAttrModel;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaDataDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaDataDao.java
new file mode 100644
index 00000000..1b54c4d0
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaDataDao.java
@@ -0,0 +1,116 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.MetaDataCache;
+import com.actionsoft.apps.kms.model.MetaDataModel;
+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;
+
+/**
+ * 元数据-数据
+ *
+ * @author wangshibao
+ */
+public class MetaDataDao extends DaoObject {
+
+ @Override
+ public int insert(MetaDataModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaDataModel.ID, model.getId());
+ paraMap.put(MetaDataModel.ATTRID, model.getAttrId());
+ paraMap.put(MetaDataModel.CARDID, model.getCardId());
+ paraMap.put(MetaDataModel.CREATETIME, model.getCreateTime());
+ paraMap.put(MetaDataModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(MetaDataModel.METATEXT, model.getMetaText());
+ paraMap.put(MetaDataModel.SCHEMAID, model.getSchemaId());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ MetaDataCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(MetaDataModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaDataModel.ATTRID, model.getAttrId());
+ paraMap.put(MetaDataModel.CARDID, model.getCardId());
+ paraMap.put(MetaDataModel.CREATETIME, model.getCreateTime());
+ paraMap.put(MetaDataModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(MetaDataModel.METATEXT, model.getMetaText());
+ paraMap.put(MetaDataModel.SCHEMAID, model.getSchemaId());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ MetaDataCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+
+ int result = super.delete(id);
+ if (result == 1) {
+ MetaDataCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ MetaDataCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_META_DATA;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public MetaDataModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public MetaDataModel record2Model(ResultSet rs) {
+ MetaDataModel metaDataModel = new MetaDataModel();
+ try {
+ metaDataModel.setAttrId(rs.getString(MetaDataModel.ATTRID));
+ metaDataModel.setCardId(rs.getString(MetaDataModel.CARDID));
+ metaDataModel.setCreateTime(rs.getTimestamp(MetaDataModel.CREATETIME));
+ metaDataModel.setCreateUser(rs.getString(MetaDataModel.CREATEUSER));
+ metaDataModel.setId(rs.getString(MetaDataModel.ID));
+ metaDataModel.setMetaText(rs.getString(MetaDataModel.METATEXT));
+ metaDataModel.setSchemaId(rs.getString(MetaDataModel.SCHEMAID));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return metaDataModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaSchemaDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaSchemaDao.java
new file mode 100644
index 00000000..a2eec253
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/MetaSchemaDao.java
@@ -0,0 +1,134 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.MetaSchemaCache;
+import com.actionsoft.apps.kms.model.MetaSchemaModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 元数据
+ *
+ * @author wangshibao
+ */
+public class MetaSchemaDao extends DaoObject {
+
+ @Override
+ public int insert(MetaSchemaModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaSchemaModel.ID, model.getId());
+ paraMap.put(MetaSchemaModel.CREATETIME, model.getCreateTime());
+ paraMap.put(MetaSchemaModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(MetaSchemaModel.ISNULLABLE, model.getIsNullable());
+ paraMap.put(MetaSchemaModel.ISSEARCH, model.getIsSearch());
+ paraMap.put(MetaSchemaModel.SCHEMADESC, model.getSchemaDesc());
+ paraMap.put(MetaSchemaModel.SCHEMASHOWTYPE, model.getSchemaShowtype());
+ paraMap.put(MetaSchemaModel.SCHEMATITLE, model.getSchemaTitle());
+
+ if (model.getLastUpdate() == null) {
+ paraMap.put(MetaSchemaModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(MetaSchemaModel.LASTUPDATE, model.getLastUpdate());
+ }
+ paraMap.put(MetaSchemaModel.ORDERINDEX, model.getOrderIndex());
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ MetaSchemaCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(MetaSchemaModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(MetaSchemaModel.ISNULLABLE, model.getIsNullable());
+ paraMap.put(MetaSchemaModel.CREATETIME, model.getCreateTime());
+ paraMap.put(MetaSchemaModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(MetaSchemaModel.ISSEARCH, model.getIsSearch());
+ paraMap.put(MetaSchemaModel.SCHEMADESC, model.getSchemaDesc());
+ paraMap.put(MetaSchemaModel.SCHEMASHOWTYPE, model.getSchemaShowtype());
+ paraMap.put(MetaSchemaModel.SCHEMATITLE, model.getSchemaTitle());
+ if (model.getLastUpdate() == null) {
+ paraMap.put(MetaSchemaModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(MetaSchemaModel.LASTUPDATE, model.getLastUpdate());
+ }
+ paraMap.put(MetaSchemaModel.ORDERINDEX, model.getOrderIndex());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ MetaSchemaCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ MetaSchemaCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ MetaSchemaCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_META_SCHEMA;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public MetaSchemaModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public MetaSchemaModel record2Model(ResultSet rs) {
+ MetaSchemaModel schemaModel = new MetaSchemaModel();
+ try {
+ schemaModel.setCreateTime(rs.getTimestamp(MetaSchemaModel.CREATETIME));
+ schemaModel.setCreateUser(rs.getString(MetaSchemaModel.CREATEUSER));
+ schemaModel.setId(rs.getString(MetaSchemaModel.ID));
+ schemaModel.setIsNullable(rs.getInt(MetaSchemaModel.ISNULLABLE));
+ schemaModel.setIsSearch(rs.getInt(MetaSchemaModel.ISSEARCH));
+ schemaModel.setLastUpdate(rs.getTimestamp(MetaSchemaModel.LASTUPDATE));
+ schemaModel.setSchemaDesc(rs.getString(MetaSchemaModel.SCHEMADESC));
+ schemaModel.setSchemaShowtype(rs.getInt(MetaSchemaModel.SCHEMASHOWTYPE));
+ schemaModel.setSchemaTitle(rs.getString(MetaSchemaModel.SCHEMATITLE));
+ schemaModel.setOrderIndex(rs.getInt(MetaSchemaModel.ORDERINDEX));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return schemaModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/OptDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/OptDao.java
new file mode 100644
index 00000000..281a10be
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/OptDao.java
@@ -0,0 +1,107 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.OptCache;
+import com.actionsoft.apps.kms.model.OptModel;
+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;
+
+public class OptDao extends DaoObject {
+
+ @Override
+ public int insert(OptModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(OptModel.ID, model.getId());
+ paraMap.put(OptModel.CARDID, model.getCardId());
+ paraMap.put(OptModel.OPTCONTENT, model.getOptContent());
+ paraMap.put(OptModel.OPTTIME, model.getOptTime());
+ paraMap.put(OptModel.OPTUSER, model.getOptUser());
+ paraMap.put(OptModel.OPTTYPE, model.getOptType());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {// 更新cache
+ OptCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(OptModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+
+ Map paraMap = new HashMap<>();
+ paraMap.put(OptModel.CARDID, model.getCardId());
+ paraMap.put(OptModel.OPTCONTENT, model.getOptContent());
+ paraMap.put(OptModel.OPTTIME, model.getOptTime());
+ paraMap.put(OptModel.OPTUSER, model.getOptUser());
+ paraMap.put(OptModel.OPTTYPE, model.getOptType());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {// 更新cache
+ OptCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ OptCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ OptCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_OPT;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public OptModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public OptModel record2Model(ResultSet rs) {
+ try {
+ OptModel optModel = new OptModel();
+ optModel.setCardId(rs.getString(OptModel.CARDID));
+ optModel.setId(rs.getString(OptModel.ID));
+ optModel.setOptContent(rs.getString(OptModel.OPTCONTENT));
+ optModel.setOptTime(rs.getTimestamp(OptModel.OPTTIME));
+ optModel.setOptUser(rs.getString(OptModel.OPTUSER));
+ optModel.setOptType(rs.getInt(OptModel.OPTTYPE));
+ return optModel;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/PublishDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/PublishDao.java
new file mode 100644
index 00000000..256643fd
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/PublishDao.java
@@ -0,0 +1,144 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.cache.DimensionCache;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 发布
+ *
+ * @author wangshibao
+ */
+public class PublishDao extends DaoObject {
+
+ @Override
+ public int insert(PublishModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(PublishModel.ID, model.getId());
+ paraMap.put(PublishModel.CARDID, model.getCardId());
+ paraMap.put(PublishModel.DIMENSIONID, model.getDimensionId());
+ paraMap.put(PublishModel.MEMO, model.getMemo());
+
+ paraMap.put(PublishModel.PUBLISHTIME, model.getPublishTime());
+ paraMap.put(PublishModel.PUBLISHUSER, model.getPublishUser());
+ paraMap.put(PublishModel.TAG, model.getTag());
+
+ if (model.getExamineInfo() == null) {
+ SQLNullValue examineNull = SQLNullValue.newInstance(Types.VARCHAR);
+ paraMap.put(PublishModel.EXAMINEINFO, examineNull);
+ } else {
+ paraMap.put(PublishModel.EXAMINEINFO, model.getExamineInfo());
+ }
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ PublishCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(PublishModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(PublishModel.CARDID, model.getCardId());
+ paraMap.put(PublishModel.DIMENSIONID, model.getDimensionId());
+ paraMap.put(PublishModel.MEMO, model.getMemo());
+
+ paraMap.put(PublishModel.PUBLISHTIME, model.getPublishTime());
+ paraMap.put(PublishModel.PUBLISHUSER, model.getPublishUser());
+ paraMap.put(PublishModel.TAG, model.getTag());
+ if (model.getExamineInfo() == null) {
+ SQLNullValue examineNull = SQLNullValue.newInstance(Types.VARCHAR);
+ paraMap.put(PublishModel.EXAMINEINFO, examineNull);
+ } else {
+ paraMap.put(PublishModel.EXAMINEINFO, model.getExamineInfo());
+ }
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ // 更新缓存
+ PublishCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ // 更新缓存
+ PublishCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ // 更新缓存
+ PublishCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_PUBLISH;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public PublishModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public PublishModel record2Model(ResultSet rs) {
+ PublishModel publishModel = new PublishModel();
+ try {
+ publishModel.setCardId(rs.getString(PublishModel.CARDID));
+ // 处理CardModel
+ publishModel.setCardModel(CardCache.getCache().get(publishModel.getCardId()));
+
+ publishModel.setDimensionId(rs.getString(PublishModel.DIMENSIONID));
+ // 处理DimensionModel
+ publishModel.setDimensionModel(DimensionCache.getCache().get(publishModel.getDimensionId()));
+
+ publishModel.setId(rs.getString(PublishModel.ID));
+ publishModel.setMemo(rs.getString(PublishModel.MEMO));
+ publishModel.setPublishTime(rs.getTimestamp(PublishModel.PUBLISHTIME));
+ publishModel.setPublishUser(rs.getString(PublishModel.PUBLISHUSER));
+ publishModel.setTag(rs.getString(PublishModel.TAG));
+ publishModel.setExamineInfo(rs.getString(PublishModel.EXAMINEINFO));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return publishModel;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/SchemaDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/SchemaDao.java
new file mode 100644
index 00000000..be752dea
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/SchemaDao.java
@@ -0,0 +1,106 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.model.SchemaModel;
+import com.actionsoft.bpms.bo.engine.SQLNullValue;
+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;
+
+/**
+ * 元数据
+ *
+ * @author wangshibao
+ */
+public class SchemaDao extends DaoObject {
+
+ @Override
+ public int insert(SchemaModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(SchemaModel.ID, model.getId());
+ paraMap.put(SchemaModel.CREATETIME, model.getCreateTime());
+ paraMap.put(SchemaModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(SchemaModel.ISNULLABLE, model.getIsNullable());
+ paraMap.put(SchemaModel.ISSEARCH, model.getIsSearch());
+ paraMap.put(SchemaModel.SCHEMADESC, model.getSchemaDesc());
+ paraMap.put(SchemaModel.SCHEMASHOWTYPE, model.getSchemaShowtype());
+ paraMap.put(SchemaModel.SCHEMATITLE, model.getSchemaTitle());
+
+ if (model.getLastUpdate() == null) {
+ paraMap.put(SchemaModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(SchemaModel.LASTUPDATE, model.getLastUpdate());
+ }
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ return result;
+ }
+
+ @Override
+ public int update(SchemaModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(SchemaModel.ISNULLABLE, model.getIsNullable());
+ paraMap.put(SchemaModel.ISSEARCH, model.getIsSearch());
+ paraMap.put(SchemaModel.SCHEMADESC, model.getSchemaDesc());
+ paraMap.put(SchemaModel.SCHEMASHOWTYPE, model.getSchemaShowtype());
+ paraMap.put(SchemaModel.SCHEMATITLE, model.getSchemaTitle());
+ if (model.getLastUpdate() == null) {
+ paraMap.put(SchemaModel.LASTUPDATE, SQLNullValue.newInstance(Types.DATE));
+ } else {
+ paraMap.put(SchemaModel.LASTUPDATE, model.getLastUpdate());
+ }
+ int result = update(model.getId(), paraMap);
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_META_SCHEMA;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public SchemaModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public SchemaModel record2Model(ResultSet rs) {
+ SchemaModel schemaModel = new SchemaModel();
+ try {
+ schemaModel.setCreateTime(rs.getTimestamp(SchemaModel.CREATETIME));
+ schemaModel.setCreateUser(rs.getString(SchemaModel.CREATEUSER));
+ schemaModel.setId(rs.getString(SchemaModel.ID));
+ schemaModel.setIsNullable(rs.getInt(SchemaModel.ISNULLABLE));
+ schemaModel.setIsSearch(rs.getInt(SchemaModel.ISSEARCH));
+ schemaModel.setLastUpdate(rs.getTimestamp(SchemaModel.LASTUPDATE));
+ schemaModel.setSchemaDesc(rs.getString(SchemaModel.SCHEMADESC));
+ schemaModel.setSchemaShowtype(rs.getInt(SchemaModel.SCHEMASHOWTYPE));
+ schemaModel.setSchemaTitle(rs.getString(SchemaModel.SCHEMATITLE));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return schemaModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/VersionDao.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/VersionDao.java
new file mode 100644
index 00000000..e68967bb
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dao/VersionDao.java
@@ -0,0 +1,109 @@
+package com.actionsoft.apps.kms.dao;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.VersionCache;
+import com.actionsoft.apps.kms.model.VersionModel;
+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;
+
+/**
+ * 版本号
+ *
+ * @author wangshibao
+ */
+public class VersionDao extends DaoObject {
+
+ @Override
+ public int insert(VersionModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ model.setId(UUIDGener.getUUID());
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(VersionModel.ID, model.getId());
+ paraMap.put(VersionModel.CREATETIME, model.getCreateTime());
+ paraMap.put(VersionModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(VersionModel.VERSIONNO, model.getVersionNo());
+ paraMap.put(VersionModel.MEMO, model.getMemo());
+
+ int result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
+ if (result == 1) {
+ VersionCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ @Override
+ public int update(VersionModel model) throws AWSDataAccessException {
+ if (UtilString.isEmpty(model.getId())) {
+ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
+ }
+ Map paraMap = new HashMap<>();
+ paraMap.put(VersionModel.CREATETIME, model.getCreateTime());
+ paraMap.put(VersionModel.CREATEUSER, model.getCreateUser());
+ paraMap.put(VersionModel.VERSIONNO, model.getVersionNo());
+ paraMap.put(VersionModel.MEMO, model.getMemo());
+ int result = update(model.getId(), paraMap);
+ if (result == 1) {
+ VersionCache.getCache().put(model.getId(), model);
+ }
+ return result;
+ }
+
+ public int delete(String id) throws AWSDataAccessException {
+ int result = super.delete(id);
+ if (result == 1) {
+ VersionCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ public int delete(Connection conn, String id) throws AWSDataAccessException {
+ int result = super.delete(conn, id);
+ if (result == 1) {
+ VersionCache.getCache().remove(id);
+ }
+ return result;
+ }
+
+ @Override
+ public String entityName() {
+ return KMSConstant.ENTITY_NAME_VERSION;
+ }
+
+ @Override
+ public RowMapper rowMapper() {
+ return new RowMapper() {
+ @Override
+ public VersionModel mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return record2Model(rs);
+ }
+ };
+ }
+
+ public VersionModel record2Model(ResultSet rs) {
+ VersionModel versionModel = new VersionModel();
+ try {
+ versionModel.setCreateTime(rs.getTimestamp(VersionModel.CREATETIME));
+ versionModel.setId(rs.getString(VersionModel.ID));
+ versionModel.setCreateUser(rs.getString(VersionModel.CREATEUSER));
+ versionModel.setVersionNo(rs.getString(VersionModel.VERSIONNO));
+ versionModel.setMemo(rs.getString(VersionModel.MEMO));
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new AWSException(e);
+ }
+ return versionModel;
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocCardContentProcessor.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocCardContentProcessor.java
new file mode 100644
index 00000000..8ac83c6d
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocCardContentProcessor.java
@@ -0,0 +1,8 @@
+package com.actionsoft.apps.kms.dc;
+
+import com.actionsoft.bpms.server.fs.AbstFileProcessor;
+import com.actionsoft.bpms.server.fs.FileProcessorListener;
+
+public class DocCardContentProcessor extends AbstFileProcessor implements FileProcessorListener {
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocFileProcessor.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocFileProcessor.java
new file mode 100644
index 00000000..f569cf1b
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/DocFileProcessor.java
@@ -0,0 +1,152 @@
+package com.actionsoft.apps.kms.dc;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.FileCache;
+import com.actionsoft.apps.kms.dao.FileDao;
+import com.actionsoft.apps.kms.model.FileModel;
+import com.actionsoft.apps.resource.AppContext;
+import com.actionsoft.bpms.commons.database.LocalTxManager;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.org.cache.UserCache;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.server.fs.AbstFileProcessor;
+import com.actionsoft.bpms.server.fs.DCContext;
+import com.actionsoft.bpms.server.fs.FileProcessorListener;
+import com.actionsoft.bpms.server.fs.dc.DCMessage;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.bpms.util.UUIDGener;
+import com.actionsoft.bpms.util.UtilDate;
+import com.actionsoft.sdk.local.SDK;
+import com.actionsoft.sdk.local.api.AppAPI;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author wangshibao
+ */
+public class DocFileProcessor extends AbstFileProcessor implements FileProcessorListener {
+
+ @Override
+ public boolean uploadReady(Map param) throws Exception {
+ DCContext dcContext = ((DCContext) param.get("DCContext"));
+ // 根据版本重命名(加上版本号信息,防止文件名冲突)
+ String cardId = dcContext.getFileValue();
+ String fileName = dcContext.getFileName();
+ param.put("originalFileName", fileName);
+ //判断是否有文件版本,存在则使用原版本(文件移交操作)
+ Map extParams = dcContext.getExtParams();
+ String fileVersion = "";
+ if (extParams.containsKey("transferFileVersion")) {
+ fileVersion = extParams.get("transferFileVersion").toString();
+ } else {
+ fileVersion = KMSUtil.getNextFileVersion(cardId, fileName);
+ }
+ param.put("fileVersion", fileVersion);
+ dcContext.setFileName(KMSUtil.getFileNameOfVersion(fileName, fileVersion));
+
+ return super.uploadReady(param);
+ }
+
+ /**
+ * 将文件信息插入数据库
+ */
+ @Override
+ public void uploadSuccess(Map param) {
+ try {
+ DCContext dcContext = (DCContext) param.get("DCContext");
+
+ LocalTxManager.getInstance().begin();
+
+ FileModel fileModel = new FileModel();
+ fileModel.setCardId(dcContext.getFileValue());
+ fileModel.setCreateTime(new Timestamp(System.currentTimeMillis()));
+ fileModel.setCreateUser(dcContext.getSession().getUID());
+ fileModel.setFileName((String) param.get("originalFileName"));
+ fileModel.setFileSize(Long.parseLong(dcContext.getFileLength()));
+ String fileId = UUIDGener.getObjectId();
+ fileModel.setId(fileId);
+
+ fileModel.setFileVer((String) param.get("fileVersion"));
+ fileModel.setFileState(1);
+
+ // 更新其他版本为老版本
+ int result = DBSql.update("UPDATE " + KMSConstant.ENTITY_NAME_FILE + " SET " + FileModel.FILESTATE + " = 0 WHERE " + FileModel.CARDID + " = ? AND " + FileModel.FILENAME + " = ? AND " + FileModel.FILESTATE + " = 1 AND " + FileModel.ID + "<> ?", new Object[] { dcContext.getFileValue(), (String) param.get("originalFileName"), fileId });
+ // 新建file模型
+ FileDao fileDao = new FileDao();
+ fileDao.insert(fileModel);
+
+ LocalTxManager.getInstance().commit();
+
+ if (result != 0) {
+ // 更新缓存
+ FileCache fileCache = FileCache.getCache();
+ Iterator fileIterator = fileCache.iterator();
+ while (fileIterator.hasNext()) {
+ FileModel fileModel2 = fileIterator.next();
+ if (dcContext.getFileValue().equals(fileModel2.getCardId()) && fileModel2.getFileName().equals(param.get("originalFileName")) && fileModel2.getFileState() == 1 && !fileModel2.getId().equals(fileId)) {
+ fileModel2.setFileState(0);
+ fileCache.put(fileModel2.getId(), fileModel2);
+ }
+ }
+ }
+
+ dcContext.setDCMessage(DCMessage.OK, "");
+ dcContext.setFileNameShow((String) param.get("originalFileName"));
+ dcContext.getDCMessage().addAttr("fileDownloadURL", dcContext.getDownloadURL());
+ dcContext.getDCMessage().addAttr("fileId", fileModel.getId());
+ dcContext.getDCMessage().addAttr("fileVer", fileModel.getFileVer());
+ dcContext.getDCMessage().addAttr("createUsername", UserCache.getCache().get(dcContext.getSession().getUID()).getUserName());
+ dcContext.getDCMessage().addAttr("createTime", UtilDate.datetimeFormat(fileModel.getCreateTime(), "yyyy-MM-dd HH:mm"));
+ dcContext.getDCMessage().addAttr("fileSuffixIcon", KMSUtil.getFileIconName((String) param.get("originalFileName")));
+ dcContext.getDCMessage().addAttr("fileCreateUserPhoto", SDK.getPortalAPI().getUserPhoto(dcContext.getSession(), fileModel.getCreateUser()));
+ dcContext.getDCMessage().addAttr("fileCreateUser", fileModel.getCreateUser());
+ //调用转换服务.在预览之前提前进行转换
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ fileCovert(dcContext.getSession(), dcContext, "true");
+ fileCovert(dcContext.getSession(), dcContext, "false");
+ }
+ }).start();
+ } catch (Exception e) {
+ LocalTxManager.getInstance().rollback();
+ }
+ }
+
+ public static ResponseObject fileCovert(UserContext me, DCContext sourceDc, String isCopy) {
+ ResponseObject ro = ResponseObject.newOkResponse();
+ AppAPI appAPI = SDK.getAppAPI();
+ AppContext onlinedocApp = SDK.getAppAPI().getAppContext("com.actionsoft.apps.addons.wpsonline");
+ if (onlinedocApp != null && SDK.getAppAPI().isActive(onlinedocApp.getId())) {
+ String sourceAppId = KMSConstant.APP_ID;
+ // 服务地址
+ String aslp = "aslp://com.actionsoft.apps.addons.wpsonline/filePreviewUrl";
+ Map params = new HashMap();
+ try {
+ params.put("sid", me.getSessionId());
+ //文件DC
+ params.put("sourceDc", sourceDc);
+ //文件是否允许复制
+ params.put("isCopy", isCopy);
+ params.put("isPDFCovertPNG", "0");
+ ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ro.err(e.getMessage());
+ }
+ }
+ return ro;
+ }
+
+
+ @Override
+ public boolean downloadValidate(Map param) {
+ DCContext context = (DCContext) param.get("DCContext");
+ System.out.println("下载校验--" + context.getPath() + context.getFileName());
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/HotspotFileProcessor.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/HotspotFileProcessor.java
new file mode 100644
index 00000000..220e54ad
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/HotspotFileProcessor.java
@@ -0,0 +1,72 @@
+package com.actionsoft.apps.kms.dc;
+
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.dao.HotspotDefDao;
+import com.actionsoft.apps.kms.model.HotspotDefModel;
+import com.actionsoft.apps.processon.posreader.PosReader;
+import com.actionsoft.apps.processon.posreader.model.Document;
+import com.actionsoft.bpms.server.fs.AbstFileProcessor;
+import com.actionsoft.bpms.server.fs.DCContext;
+import com.actionsoft.bpms.server.fs.FileProcessorListener;
+import com.actionsoft.bpms.server.fs.dc.DCMessage;
+import com.actionsoft.bpms.util.UtilFile;
+import com.actionsoft.exception.AWSException;
+
+public class HotspotFileProcessor extends AbstFileProcessor implements FileProcessorListener {
+
+ @Override
+ public boolean uploadReady(Map param) {
+ DCContext dcContext = (DCContext) param.get("DCContext");
+ String fileName = dcContext.getFileName();
+ HotspotDefDao hotspotDefDao = new HotspotDefDao();
+ List hotspotDefModels = hotspotDefDao.query(HotspotDefModel.HOTSPOTNAME + " = ?", new Object[] { fileName }).list();
+ if (hotspotDefModels != null && hotspotDefModels.size() > 0) {
+ // 返回状态
+ dcContext.getDCMessage();
+ dcContext.setDCMessage(DCMessage.ERROR, "不能上传重名文件");
+ return false;
+ }
+ return true;
+
+ }
+
+ @Override
+ public void uploadSuccess(Map param) {
+ super.uploadSuccess(param);
+
+ // 判断是否已经上传过该文件(根据文件内容的meta的id判断)
+ DCContext dcContext = (DCContext) param.get("DCContext");
+ UtilFile posFile = new UtilFile(dcContext.getFilePath());
+
+ PosReader reader = new PosReader();
+ Document document = null;
+ try {
+ document = reader.read(posFile.readStr(StandardCharsets.UTF_8.name()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (document == null) {
+ // 先删除文件再返回异常
+ dcContext.delete();
+ // 返回状态
+ dcContext.getDCMessage().addAttr("hotspotResult", "文件解析错误,请检查知识地图版本是否正确");
+ throw new AWSException("文件解析错误,请检查知识地图版本是否正确");
+ }
+
+ HotspotDefDao hotspotDefDao = new HotspotDefDao();
+ List hotspotDefModels = hotspotDefDao.query(HotspotDefModel.HOTSPOTMETAID + " = ?", new Object[] { document.getMeta().getId() }).list();
+ if (hotspotDefModels != null && hotspotDefModels.size() > 0) {
+ // 先删除文件再返回异常
+ dcContext.delete();
+ // 返回状态
+ dcContext.getDCMessage().addAttr("hotspotResult", "不能上传重复文件(重命名文件视为一个文件)");
+ throw new AWSException("不能上传重复文件(重命名文件视为一个文件)");
+ }
+ // 返回hotspotMetaId
+ dcContext.getDCMessage().addAttr("hotspotMetaId", document.getMeta().getId());
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/OnlinedocFileProcessor.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/OnlinedocFileProcessor.java
new file mode 100644
index 00000000..c7915914
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/OnlinedocFileProcessor.java
@@ -0,0 +1,8 @@
+package com.actionsoft.apps.kms.dc;
+
+import com.actionsoft.bpms.server.fs.AbstFileProcessor;
+import com.actionsoft.bpms.server.fs.FileProcessorListener;
+
+public class OnlinedocFileProcessor extends AbstFileProcessor implements FileProcessorListener {
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/TmpFileProcessor.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/TmpFileProcessor.java
new file mode 100644
index 00000000..c7d9cfa6
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/dc/TmpFileProcessor.java
@@ -0,0 +1,18 @@
+package com.actionsoft.apps.kms.dc;
+
+import com.actionsoft.bpms.server.fs.AbstFileProcessor;
+import com.actionsoft.bpms.server.fs.DCContext;
+import com.actionsoft.bpms.server.fs.FileProcessorListener;
+
+import java.util.Map;
+
+public class TmpFileProcessor extends AbstFileProcessor implements FileProcessorListener {
+ @Override
+ public boolean downloadValidate(Map param) {
+ DCContext context = (DCContext) param.get("DCContext");
+ System.out.println("下载校验--" + context.getPath() + context.getFileName());
+ return true;
+ }
+
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyBeforeComplete.java
new file mode 100644
index 00000000..0ba49629
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyBeforeComplete.java
@@ -0,0 +1,29 @@
+package com.actionsoft.apps.kms.event.borrow;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * 借阅申请任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "作废")) {
+ String processInstId = pec.getProcessInstance().getId();
+ // 更新bo状态为作废
+ String sqlBO = "UPDATE " + KMSConstant.BO_ENTITY_NAME_BORROW + " SET STATUS = '作废' WHERE BINDID = ?";
+ DBSql.update(sqlBO, new Object[] { processInstId });
+ }
+
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyFormAfterLoad.java
new file mode 100644
index 00000000..aec18668
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ApplyFormAfterLoad.java
@@ -0,0 +1,19 @@
+package com.actionsoft.apps.kms.event.borrow;
+
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
+
+/**
+ * 借阅申请表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ KMSUtil.commonFormAfterLoad(pec);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingAfterCreate.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingAfterCreate.java
new file mode 100644
index 00000000..992057a8
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingAfterCreate.java
@@ -0,0 +1,23 @@
+package com.actionsoft.apps.kms.event.borrow;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
+import com.actionsoft.bpms.util.DBSql;
+
+/***
+ * 借阅审批任务创建后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingAfterCreate extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ // 修改状态为"审批中"
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_BORROW + " SET STATUS = '审批中' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingBeforeComplete.java
new file mode 100644
index 00000000..bf1e745d
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingBeforeComplete.java
@@ -0,0 +1,30 @@
+package com.actionsoft.apps.kms.event.borrow;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * 借阅审批任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ // 修改状态
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "不同意")) {
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_BORROW + " SET STATUS = '不同意', READTIMES = 0 WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ } else if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "同意")) {
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_BORROW + " SET STATUS = '同意', READTIMES = 0 WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ }
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingFormAfterLoad.java
new file mode 100644
index 00000000..e396374b
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/borrow/ExaminingFormAfterLoad.java
@@ -0,0 +1,32 @@
+package com.actionsoft.apps.kms.event.borrow;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+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.listener.ListenerConst;
+
+/**
+ * 借阅审批表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ // 查询文件列表
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ String cardId = bo.getString("CARDID");
+
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+
+ KMSUtil.commonFormAfterLoad(pec);
+ KMSUtil.browseFormAfterLoad(pec);
+ macroLibraries.put("CARDID", cardId);
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyBeforeComplete.java
new file mode 100644
index 00000000..1d56ada8
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyBeforeComplete.java
@@ -0,0 +1,29 @@
+package com.actionsoft.apps.kms.event.cancelpublish;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * 取消发布申请任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "作废")) {
+ String processInstId = pec.getProcessInstance().getId();
+ // 更新bo状态为作废
+ String sqlBO = "UPDATE " + KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH + " SET STATUS = '作废' WHERE BINDID = ?";
+ DBSql.update(sqlBO, new Object[] { processInstId });
+ }
+
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyFormAfterLoad.java
new file mode 100644
index 00000000..6c7f0d29
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ApplyFormAfterLoad.java
@@ -0,0 +1,28 @@
+package com.actionsoft.apps.kms.event.cancelpublish;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+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.listener.ListenerConst;
+
+/**
+ * 取消发布申请表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ KMSUtil.commonFormAfterLoad(pec);
+ KMSUtil.browseFormAfterLoad(pec);
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ String cardId = bo.getString("CARDID");
+ macroLibraries.put("CARDID", cardId);
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingAfterCreate.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingAfterCreate.java
new file mode 100644
index 00000000..a3bce387
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingAfterCreate.java
@@ -0,0 +1,23 @@
+package com.actionsoft.apps.kms.event.cancelpublish;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
+import com.actionsoft.bpms.util.DBSql;
+
+/**
+ * 取消发布流程任务创建后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingAfterCreate extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ // 修改状态为"审批中"
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH + " SET STATUS = '审批中' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingBeforeComplete.java
new file mode 100644
index 00000000..998b5b26
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingBeforeComplete.java
@@ -0,0 +1,71 @@
+package com.actionsoft.apps.kms.event.cancelpublish;
+
+import java.sql.Connection;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.service.CardService;
+import com.actionsoft.apps.kms.service.PublishService;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.commons.database.LocalTxManager;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.exception.AWSException;
+import com.actionsoft.sdk.local.SDK;
+
+/**
+ * 取消发布审批任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ // 修改状态
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "同意")) {
+ boolean isInTx = false;// 标识是否当前方法打开的事务
+ Connection conn = null;
+ try {
+ if (!LocalTxManager.getInstance().inTransaction()) {
+ LocalTxManager.getInstance().begin();
+ isInTx = true;
+ }
+ conn = DBSql.open();
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH + " SET STATUS = '同意' WHERE BINDID = ?";
+ DBSql.update(conn, sql, new Object[] { pec.getProcessInstance().getId() });
+
+ // 删除发布信息
+ String publishId = (String) SDK.getBOAPI().query(KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH).detailByBindId(pec.getProcessInstance().getId(), "PUBLISHID");
+ PublishService publishService = new PublishService();
+ boolean result = publishService.delete(conn, publishId);
+ if (!result) {
+ throw new AWSException("删除知识发布信息失败");
+ } else {
+ // 判断并修改知识的发布状态
+ CardService cardService = new CardService();
+ String cardId = (String) SDK.getBOAPI().getByProcess(KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH, pec.getProcessInstance().getId(), "CARDID");
+ cardService.updateCardIsPublishedStatus(conn, cardId);
+ // 判断并删除全文检索
+ publishService.deleteFullSearch(cardId);
+ }
+ if (isInTx) {
+ LocalTxManager.getInstance().commit();
+ }
+ } catch (Exception e) {
+ if (isInTx) {
+ LocalTxManager.getInstance().rollback();
+ }
+ e.printStackTrace();
+ throw e;
+ } finally {
+ DBSql.close(conn);
+ }
+ } else if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "不同意")) {
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_CANCEL_PUBLISH + " SET STATUS = '不同意' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ }
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingFormAfterLoad.java
new file mode 100644
index 00000000..c186668f
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/cancelpublish/ExaminingFormAfterLoad.java
@@ -0,0 +1,32 @@
+package com.actionsoft.apps.kms.event.cancelpublish;
+
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+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.listener.ListenerConst;
+
+/**
+ * 取消发布审批表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ // 查询文件列表
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ String cardId = bo.getString("CARDID");
+
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+
+ KMSUtil.commonFormAfterLoad(pec);
+ KMSUtil.browseFormAfterLoad(pec);
+ macroLibraries.put("CARDID", cardId);
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyBeforeComplete.java
new file mode 100644
index 00000000..51c10c7a
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyBeforeComplete.java
@@ -0,0 +1,55 @@
+package com.actionsoft.apps.kms.event.publish;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.bpms.bo.engine.BO;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+
+/**
+ * 发布申请任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "作废")) {
+ String processInstId = pec.getProcessInstance().getId();
+ // 更新bo状态为作废
+ String sqlBO = "UPDATE " + KMSConstant.BO_ENTITY_NAME_PUBLISH + " SET STATUS = '作废' WHERE BINDID = ?";
+ DBSql.update(sqlBO, new Object[] { processInstId });
+ // 删除临时publish信息
+ BO bo = SDK.getBOAPI().query(KMSConstant.BO_ENTITY_NAME_PUBLISH).detailByBindId(processInstId);
+ String publishIds = bo.getString("PUBLISHIDS");
+ List publishIdList = JSONArray.parseArray(publishIds, String.class);
+
+ String sql = "DELETE FROM " + KMSConstant.ENTITY_NAME_PUBLISH + " WHERE " + PublishModel.ID + " IN (";
+ List params = new ArrayList<>();
+ for (String publishId : publishIdList) {
+ sql += "?,";
+ params.add(publishId);
+ }
+ sql = sql.substring(0, sql.length() - 1);
+ sql += ")";
+ DBSql.update(sql, params.toArray());
+
+ // 更新缓存
+ for (String publishId : publishIdList) {
+ PublishCache.getCache().remove(publishId);
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyFormAfterLoad.java
new file mode 100644
index 00000000..68638c1e
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ApplyFormAfterLoad.java
@@ -0,0 +1,50 @@
+package com.actionsoft.apps.kms.event.publish;
+
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+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.listener.ListenerConst;
+import com.actionsoft.bpms.util.UtilString;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 发布申请表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ApplyFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ KMSUtil.commonFormAfterLoad(pec);
+ KMSUtil.browseFormAfterLoad(pec);
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ if (bo != null) {
+ String cardIds = bo.getString("CARDIDS");
+ if (UtilString.isNotEmpty(cardIds)) {
+ List cardIdList = JSONArray.parseArray(cardIds, String.class);
+ JSONArray cardInfoJA = new JSONArray();
+ for (String cardId : cardIdList) {
+ JSONObject cardInfoJO = new JSONObject();
+ cardInfoJO.put("cardId", cardId);
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ cardInfoJO.put("cardName", cardModel == null ? "知识不存在" : cardModel.getCardName());
+
+ cardInfoJA.add(cardInfoJO);
+ }
+ macroLibraries.put("cardInfoJA", cardInfoJA.toString());
+ } else {
+ macroLibraries.put("cardInfoJA", "");
+ }
+ }
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingAfterCreate.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingAfterCreate.java
new file mode 100644
index 00000000..d9441459
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingAfterCreate.java
@@ -0,0 +1,48 @@
+package com.actionsoft.apps.kms.event.publish;
+
+import java.util.Iterator;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
+import com.actionsoft.bpms.util.DBSql;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 发布审批任务创建后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingAfterCreate extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ String processInstId = pec.getProcessInstance().getId();
+ // 修改BO状态为"审批中"
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_PUBLISH + " SET STATUS = '审批中' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { processInstId });
+ // 修改publish状态为审批中
+ JSONObject examineInfoJO1 = new JSONObject();
+ examineInfoJO1.put("processInstId", processInstId);
+ examineInfoJO1.put("status", "申请中");
+ JSONObject examineInfoJO2 = new JSONObject();
+ examineInfoJO2.put("processInstId", processInstId);
+ examineInfoJO2.put("status", "审批中");
+
+ String tempPublishSql = "UPDATE " + KMSConstant.ENTITY_NAME_PUBLISH + " SET " + PublishModel.EXAMINEINFO + " =? WHERE " + PublishModel.EXAMINEINFO + " LIKE ?";
+ DBSql.update(tempPublishSql, new Object[] { examineInfoJO2.toString(), "%" + processInstId + "%" });
+ // 更新publish缓存
+ Iterator publishIterator = PublishCache.getCache().iterator();
+ while (publishIterator.hasNext()) {
+ PublishModel publishModel = publishIterator.next();
+ if (publishModel.getExamineInfo() != null && publishModel.getExamineInfo().contains(processInstId)) {
+ publishModel.setExamineInfo(examineInfoJO2.toString());
+ PublishCache.getCache().put(publishModel.getId(), publishModel);
+ }
+ }
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingBeforeComplete.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingBeforeComplete.java
new file mode 100644
index 00000000..8e59189a
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingBeforeComplete.java
@@ -0,0 +1,81 @@
+package com.actionsoft.apps.kms.event.publish;
+
+import java.util.Iterator;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.apps.kms.cache.PublishCache;
+import com.actionsoft.apps.kms.model.PublishModel;
+import com.actionsoft.apps.kms.service.CardService;
+import com.actionsoft.bpms.bo.engine.BO;
+import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
+import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.bpms.util.DBSql;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 发布审批任务完成前事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingBeforeComplete extends InterruptListener implements InterruptListenerInterface {
+
+ @Override
+ public boolean execute(ProcessExecutionContext pec) throws Exception {
+ String processInstId = pec.getProcessInstance().getId();
+ if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "同意")) {
+ // 修改BO状态
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_PUBLISH + " SET STATUS = '同意' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { processInstId });
+ // 删除临时发布的publish数据
+ BO bo = SDK.getBOAPI().query(KMSConstant.BO_ENTITY_NAME_PUBLISH).detailByBindId(processInstId);
+ String tempPublishSql = "DELETE FROM " + KMSConstant.ENTITY_NAME_PUBLISH + " WHERE " + PublishModel.EXAMINEINFO + " LIKE ?";
+ DBSql.update(tempPublishSql, new Object[] { "%" + processInstId + "%" });
+ // 更新publish缓存
+ Iterator publishIterator = PublishCache.getCache().iterator();
+ while (publishIterator.hasNext()) {
+ PublishModel publishModel = publishIterator.next();
+ if (publishModel.getExamineInfo() != null && publishModel.getExamineInfo().contains(processInstId)) {
+ PublishCache.getCache().remove(publishModel.getId());
+ }
+ }
+ // 发布
+ JSONArray publishCardJA = JSONArray.parseArray(bo.getString("CARDIDS"));
+ JSONArray publishDimensionJA = new JSONArray();
+ publishDimensionJA.add(bo.getString("DIMENSIONID"));
+ JSONObject schemaMetaDataJO = JSONObject.parseObject(bo.getString("SCHEMAMETADATA"));
+ String tags = bo.getString("TAGS");
+ String publishMemo = bo.getString("PUBLISHMEMO");
+ CardService cardService = new CardService();
+
+ JSONObject examineInfoJO3 = new JSONObject();
+ examineInfoJO3.put("processInstId", processInstId);
+ examineInfoJO3.put("status", "同意");
+ cardService.publishCard(UserContext.fromUID(bo.getString("APPLYUSER")), publishCardJA, publishDimensionJA, schemaMetaDataJO, tags, publishMemo, examineInfoJO3.toString());
+
+ } else if (SDK.getTaskAPI().isChoiceActionMenu(pec.getTaskInstance(), "不同意")) {
+ String sql = "UPDATE " + KMSConstant.BO_ENTITY_NAME_PUBLISH + " SET STATUS = '不同意' WHERE BINDID = ?";
+ DBSql.update(sql, new Object[] { pec.getProcessInstance().getId() });
+ // 修改publish表的发布信息
+ JSONObject examineInfoJO3 = new JSONObject();
+ examineInfoJO3.put("processInstId", processInstId);
+ examineInfoJO3.put("status", "不同意");
+ String tempPublishSql = "UPDATE " + KMSConstant.ENTITY_NAME_PUBLISH + " SET " + PublishModel.EXAMINEINFO + " =? WHERE " + PublishModel.EXAMINEINFO + " LIKE ?";
+ DBSql.update(tempPublishSql, new Object[] { examineInfoJO3.toString(), "%" + processInstId + "%" });
+ // 更新publish缓存
+ Iterator publishIterator = PublishCache.getCache().iterator();
+ while (publishIterator.hasNext()) {
+ PublishModel publishModel = publishIterator.next();
+ if (publishModel.getExamineInfo() != null && publishModel.getExamineInfo().contains(processInstId)) {
+ publishModel.setExamineInfo(examineInfoJO3.toString());
+ PublishCache.getCache().put(publishModel.getId(), publishModel);
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingFormAfterLoad.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingFormAfterLoad.java
new file mode 100644
index 00000000..e676bf7b
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/event/publish/ExaminingFormAfterLoad.java
@@ -0,0 +1,44 @@
+package com.actionsoft.apps.kms.event.publish;
+
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSUtil;
+import com.actionsoft.apps.kms.cache.CardCache;
+import com.actionsoft.apps.kms.model.CardModel;
+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.listener.ListenerConst;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 发布审批表单加载后事件
+ *
+ * @author wangshibao
+ *
+ */
+public class ExaminingFormAfterLoad extends ExecuteListener {
+
+ @Override
+ public void execute(ProcessExecutionContext pec) throws Exception {
+ KMSUtil.commonFormAfterLoad(pec);
+ KMSUtil.browseFormAfterLoad(pec);
+ Map macroLibraries = pec.getParameterOfMap(ListenerConst.FORM_EVENT_PARAM_TAGS);
+ BO bo = (BO) pec.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
+ String cardIds = bo.getString("CARDIDS");
+ List cardIdList = JSONArray.parseArray(cardIds, String.class);
+ JSONArray cardInfoJA = new JSONArray();
+ for (String cardId : cardIdList) {
+ JSONObject cardInfoJO = new JSONObject();
+ cardInfoJO.put("cardId", cardId);
+ CardModel cardModel = CardCache.getCache().get(cardId);
+ cardInfoJO.put("cardName", cardModel == null ? "知识不存在" : cardModel.getCardName());
+
+ cardInfoJA.add(cardInfoJO);
+ }
+ macroLibraries.put("cardInfoJA", cardInfoJA.toString());
+ }
+
+}
diff --git a/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/formatter/KMSNotificationFormatter.java b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/formatter/KMSNotificationFormatter.java
new file mode 100644
index 00000000..997de356
--- /dev/null
+++ b/com.actionsoft.apps.kms/src/com/actionsoft/apps/kms/formatter/KMSNotificationFormatter.java
@@ -0,0 +1,48 @@
+package com.actionsoft.apps.kms.formatter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.actionsoft.apps.kms.KMSConstant;
+import com.actionsoft.bpms.client.notification.NotificationMessageFormatter;
+import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
+import com.actionsoft.bpms.server.UserContext;
+import com.actionsoft.sdk.local.SDK;
+import com.alibaba.fastjson.JSONObject;
+
+public class KMSNotificationFormatter implements NotificationMessageFormatter {
+ /**
+ * KMS阅读邀请:当用户接收到提醒窗口或在通知中心点击通知条目时被触发,格式化通知的内容
+ *
+ * @param userContext 通知查看人
+ * @param content 发送的原始内容
+ * @return ResponseObject,包含content和buttons两个变量
+ */
+ @Override public ResponseObject parser(UserContext userContext, String content) {
+ ResponseObject ro = ResponseObject.newOkResponse();
+ JSONObject contentJO = JSONObject.parseObject(content);
+ String cardId = contentJO.getString("cardId");
+ String dimensionId = contentJO.getString("dimensionId");
+ String inviteUser = contentJO.getString("inviteUser");
+ String cardName = contentJO.getString("cardName");
+ ro.put("content", inviteUser + "邀请您阅读知识:" + cardName);
+ List