WANG 5 年之前
父节点
当前提交
e276b33f43

+ 274 - 239
src/main/java/cn/com/qmth/examcloud/support/cache/CacheHelper.java

@@ -1,6 +1,24 @@
 package cn.com.qmth.examcloud.support.cache;
 
-import cn.com.qmth.examcloud.support.cache.bean.*;
+import cn.com.qmth.examcloud.support.cache.bean.AppCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.BasePaperCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamOrgPropertyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamOrgSettingsCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamRecordPropertyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.OrgPropertyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.PrivilegeRolesCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.QuestionAnswerCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.QuestionCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.RootOrgCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.RootOrgPrivilegesCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.SmsAssemblyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
 import cn.com.qmth.examcloud.web.cache.ObjectRedisCacheProcessor;
 
 /**
@@ -12,243 +30,260 @@ import cn.com.qmth.examcloud.web.cache.ObjectRedisCacheProcessor;
  */
 public class CacheHelper {
 
-    /**
-     * 获取APP
-     *
-     * @param appId
-     * @return
-     * @author WANGWEI
-     */
-    public static AppCacheBean getApp(Long appId) {
-        return ObjectRedisCacheProcessor.get("$_APP:", new Object[]{appId}, AppCacheBean.class);
-    }
-
-    /**
-     * 获取系统属性<br>
-     *
-     * @param propKey
-     * @return
-     * @author WANGWEI
-     */
-    public static SysPropertyCacheBean getSysProperty(String propKey) {
-        return ObjectRedisCacheProcessor.get("$_SYS_PROP:", new Object[]{propKey},
-                SysPropertyCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.SystemPropertyCache");
-    }
-
-    /**
-     * 根据考试记录id获取考试信息<br>
-     *
-     * @param propKey
-     * @return
-     * @author WANGWEI
-     */
-    public static ExamRecordPropertyCacheBean getExamRecordProperty(Long examRecordDataId) {
-        return ObjectRedisCacheProcessor.get("OE_EXAM_RECORD_PROP:", new Object[]{examRecordDataId},
-                ExamRecordPropertyCacheBean.class, "EC-CORE-OE-STUDENT",
-                "cn.com.qmth.examcloud.core.oe.common.cache.ExamRecordPropertyCache");
-    }
-
-    /**
-     * 根据短信配置代码获取短信配置详情
-     *
-     * @param smsAssemblyCode 短信配置代码
-     * @return
-     */
-    public static SmsAssemblyCacheBean getSmsAssembly(String smsAssemblyCode) {
-        return ObjectRedisCacheProcessor.get("B_SMS_ASSEMBLY_PROP:", new Object[]{smsAssemblyCode},
-                SmsAssemblyCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.SmsAssemblyCache");
-    }
-
-    /**
-     * 获取权限关联的角色集合
-     *
-     * @param rootOrgId
-     * @param privilegeCode
-     * @return
-     * @author WANGWEI
-     */
-    public static PrivilegeRolesCacheBean getPrivilegeRoles(Long rootOrgId, String privilegeCode) {
-        return ObjectRedisCacheProcessor.get("$_PRIV_ROLES:",
-                new Object[]{rootOrgId, privilegeCode}, PrivilegeRolesCacheBean.class,
-                "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.PrrivilegeRolesCache");
-    }
-
-    /**
-     * 获取顶级机构关联的角色集合
-     *
-     * @param rootOrgId
-     * @return
-     * @author WANGWEI
-     */
-    public static RootOrgPrivilegesCacheBean getRootOrgPrivileges(Long rootOrgId) {
-        return ObjectRedisCacheProcessor.get("B_ROOT_ORG_PRIVS:", new Object[]{rootOrgId},
-                PrivilegeRolesCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.RootOrgPrrivilegesCache");
-    }
-
-    /**
-     * 获取调卷规则信息(题库)
-     *
-     * @param examId
-     * @param courseCode
-     * @return
-     */
-    public static ExtractConfigCacheBean getExtractConfig(Long examId, String courseCode) {
-        return ObjectRedisCacheProcessor.get("Q_EXTRACT_CONFIG:", new Object[]{examId, courseCode},
-                ExtractConfigCacheBean.class, "EC-CORE-QUESTION",
-                "cn.com.qmth.examcloud.core.questions.service.cache.ExtractConfigCache");
-    }
-
-    /**
-     * 获取调卷规则调取的试卷结构(题库)
-     *
-     * @param examId
-     * @param courseCode
-     * @param groupCode
-     * @param paperId
-     * @return
-     */
-    public static ExtractConfigPaperCacheBean getExtractConfigPaper(Long examId, String courseCode, String groupCode, String paperId) {
-        return ObjectRedisCacheProcessor.get("Q_PAPER:EXTRACT_CONFIG_PAPER_", new Object[]{examId, courseCode, groupCode, paperId},
-                ExtractConfigPaperCacheBean.class, "EC-CORE-QUESTION",
-                "cn.com.qmth.examcloud.core.questions.service.cache.ExtractConfigPaperCache");
-    }
-
-    /**
-     * 获取试卷结构(题库)
-     *
-     * @param paperId
-     * @return
-     */
-    public static BasePaperCacheBean getBasePaper(String paperId) {
-        return ObjectRedisCacheProcessor.get("Q_PAPER:BASE_", new Object[]{paperId},
-                BasePaperCacheBean.class, "EC-CORE-QUESTION",
-                "cn.com.qmth.examcloud.core.questions.service.cache.BasePaperCache");
-    }
-
-    /**
-     * 获取试题(题库)
-     *
-     * @param examId
-     * @param courseCode
-     * @param groupCode
-     * @param questionId
-     * @return
-     */
-    public static QuestionCacheBean getQuestion(Long examId, String courseCode, String groupCode,
-                                                String questionId) {
-        return ObjectRedisCacheProcessor.get("Q_QUESTION:",
-                new Object[]{examId, courseCode, groupCode, questionId}, QuestionCacheBean.class,
-                "EC-CORE-QUESTION",
-                "cn.com.qmth.examcloud.core.questions.service.cache.QuestionCache");
-    }
-
-    /**
-     * 获取试题答案(题库)
-     *
-     * @param questionId
-     * @return
-     */
-    public static QuestionAnswerCacheBean getQuestionAnswer(String questionId) {
-        return ObjectRedisCacheProcessor.get("Q_QUESTION:ANSWER_", new Object[]{questionId},
-                QuestionAnswerCacheBean.class, "EC-CORE-QUESTION",
-                "cn.com.qmth.examcloud.core.questions.service.cache.QuestionAnswerCache");
-    }
-
-    /**
-     * 查询课程
-     *
-     * @param courseId
-     * @return
-     * @author WANGWEI
-     */
-    public static CourseCacheBean getCourse(Long courseId) {
-        return ObjectRedisCacheProcessor.get("B_COURSE:", new Object[]{courseId},
-                CourseCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.CourseCache");
-    }
-
-    /**
-     * 查询学生
-     *
-     * @param courseId
-     * @param rootOrgId
-     * @return
-     * @author WANGWEI
-     */
-    public static StudentCacheBean getStudent(Long studentId) {
-        return ObjectRedisCacheProcessor.get("B_STUDENT:", new Object[]{studentId},
-                StudentCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.StudentCache");
-    }
-
-    /**
-     * 查询考试机构配置
-     *
-     * @param examId
-     * @param orgId
-     * @return
-     * @author WANGWEI
-     */
-    public static ExamOrgSettingsCacheBean getExamOrgSettings(Long examId, Long orgId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_ORG_SETTINGS:", new Object[]{examId, orgId},
-                ExamOrgSettingsCacheBean.class, "EC-CORE-EXAMWORK",
-                "cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgSettingsCache");
-    }
-
-    /**
-     * 查询考试机构属性
-     *
-     * @param examId
-     * @param orgId
-     * @return
-     * @author WANGWEI
-     */
-    public static ExamOrgPropertyCacheBean getExamOrgProperty(Long examId, Long orgId, String key) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_ORG_PROP:", new Object[]{examId, orgId, key},
-                ExamOrgSettingsCacheBean.class, "EC-CORE-EXAMWORK",
-                "cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgPropertyCache");
-    }
-
-    /**
-     * 查询考试
-     *
-     * @param examId
-     * @return
-     * @author WANGWEI
-     */
-    public static ExamSettingsCacheBean getExamSettings(Long examId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM:", new Object[]{examId},
-                ExamSettingsCacheBean.class, "EC-CORE-EXAMWORK",
-                "cn.com.qmth.examcloud.core.examwork.service.cache.ExamSettingsCache");
-    }
-
-    /**
-     * 查询机构
-     *
-     * @param orgId
-     * @return
-     * @author WANGWEI
-     */
-    public static OrgCacheBean getOrg(Long orgId) {
-        return ObjectRedisCacheProcessor.get("B_ORG:", new Object[]{orgId}, OrgCacheBean.class,
-                "EC-CORE-BASIC", "cn.com.qmth.examcloud.core.basic.service.cache.OrgCache");
-    }
-
-    /**
-     * 通过域名查询顶级机构
-     *
-     * @param domain
-     * @return
-     * @author WANGWEI
-     */
-    public static RootOrgCacheBean getRootOrg(String domain) {
-        return ObjectRedisCacheProcessor.get("B_ROOT_ORG:", new Object[]{domain},
-                RootOrgCacheBean.class, "EC-CORE-BASIC",
-                "cn.com.qmth.examcloud.core.basic.service.cache.RootOrgCache");
-    }
+	/**
+	 * 获取APP
+	 *
+	 * @param appId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static AppCacheBean getApp(Long appId) {
+		return ObjectRedisCacheProcessor.get("$_APP:", new Object[]{appId}, AppCacheBean.class);
+	}
+
+	/**
+	 * 获取系统属性<br>
+	 *
+	 * @param propKey
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static SysPropertyCacheBean getSysProperty(String propKey) {
+		return ObjectRedisCacheProcessor.get("$_SYS_PROP:", new Object[]{propKey},
+				SysPropertyCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.SystemPropertyCache");
+	}
+
+	/**
+	 * 根据考试记录id获取考试信息<br>
+	 *
+	 * @param propKey
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static ExamRecordPropertyCacheBean getExamRecordProperty(Long examRecordDataId) {
+		return ObjectRedisCacheProcessor.get("OE_EXAM_RECORD_PROP:", new Object[]{examRecordDataId},
+				ExamRecordPropertyCacheBean.class, "EC-CORE-OE-STUDENT",
+				"cn.com.qmth.examcloud.core.oe.common.cache.ExamRecordPropertyCache");
+	}
+
+	/**
+	 * 根据短信配置代码获取短信配置详情
+	 *
+	 * @param smsAssemblyCode
+	 *            短信配置代码
+	 * @return
+	 */
+	public static SmsAssemblyCacheBean getSmsAssembly(String smsAssemblyCode) {
+		return ObjectRedisCacheProcessor.get("B_SMS_ASSEMBLY_PROP:", new Object[]{smsAssemblyCode},
+				SmsAssemblyCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.SmsAssemblyCache");
+	}
+
+	/**
+	 * 获取权限关联的角色集合
+	 *
+	 * @param rootOrgId
+	 * @param privilegeCode
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static PrivilegeRolesCacheBean getPrivilegeRoles(Long rootOrgId, String privilegeCode) {
+		return ObjectRedisCacheProcessor.get("$_PRIV_ROLES:",
+				new Object[]{rootOrgId, privilegeCode}, PrivilegeRolesCacheBean.class,
+				"EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.PrrivilegeRolesCache");
+	}
+
+	/**
+	 * 获取顶级机构关联的角色集合
+	 *
+	 * @param rootOrgId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static RootOrgPrivilegesCacheBean getRootOrgPrivileges(Long rootOrgId) {
+		return ObjectRedisCacheProcessor.get("B_ROOT_ORG_PRIVS:", new Object[]{rootOrgId},
+				PrivilegeRolesCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.RootOrgPrrivilegesCache");
+	}
+
+	/**
+	 * 获取调卷规则信息(题库)
+	 *
+	 * @param examId
+	 * @param courseCode
+	 * @return
+	 */
+	public static ExtractConfigCacheBean getExtractConfig(Long examId, String courseCode) {
+		return ObjectRedisCacheProcessor.get("Q_EXTRACT_CONFIG:", new Object[]{examId, courseCode},
+				ExtractConfigCacheBean.class, "EC-CORE-QUESTION",
+				"cn.com.qmth.examcloud.core.questions.service.cache.ExtractConfigCache");
+	}
+
+	/**
+	 * 获取调卷规则调取的试卷结构(题库)
+	 *
+	 * @param examId
+	 * @param courseCode
+	 * @param groupCode
+	 * @param paperId
+	 * @return
+	 */
+	public static ExtractConfigPaperCacheBean getExtractConfigPaper(Long examId, String courseCode,
+			String groupCode, String paperId) {
+		return ObjectRedisCacheProcessor.get("Q_PAPER:EXTRACT_CONFIG_PAPER_",
+				new Object[]{examId, courseCode, groupCode, paperId},
+				ExtractConfigPaperCacheBean.class, "EC-CORE-QUESTION",
+				"cn.com.qmth.examcloud.core.questions.service.cache.ExtractConfigPaperCache");
+	}
+
+	/**
+	 * 获取试卷结构(题库)
+	 *
+	 * @param paperId
+	 * @return
+	 */
+	public static BasePaperCacheBean getBasePaper(String paperId) {
+		return ObjectRedisCacheProcessor.get("Q_PAPER:BASE_", new Object[]{paperId},
+				BasePaperCacheBean.class, "EC-CORE-QUESTION",
+				"cn.com.qmth.examcloud.core.questions.service.cache.BasePaperCache");
+	}
+
+	/**
+	 * 获取试题(题库)
+	 *
+	 * @param examId
+	 * @param courseCode
+	 * @param groupCode
+	 * @param questionId
+	 * @return
+	 */
+	public static QuestionCacheBean getQuestion(Long examId, String courseCode, String groupCode,
+			String questionId) {
+		return ObjectRedisCacheProcessor.get("Q_QUESTION:",
+				new Object[]{examId, courseCode, groupCode, questionId}, QuestionCacheBean.class,
+				"EC-CORE-QUESTION",
+				"cn.com.qmth.examcloud.core.questions.service.cache.QuestionCache");
+	}
+
+	/**
+	 * 获取试题答案(题库)
+	 *
+	 * @param questionId
+	 * @return
+	 */
+	public static QuestionAnswerCacheBean getQuestionAnswer(String questionId) {
+		return ObjectRedisCacheProcessor.get("Q_QUESTION:ANSWER_", new Object[]{questionId},
+				QuestionAnswerCacheBean.class, "EC-CORE-QUESTION",
+				"cn.com.qmth.examcloud.core.questions.service.cache.QuestionAnswerCache");
+	}
+
+	/**
+	 * 查询课程
+	 *
+	 * @param courseId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static CourseCacheBean getCourse(Long courseId) {
+		return ObjectRedisCacheProcessor.get("B_COURSE:", new Object[]{courseId},
+				CourseCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.CourseCache");
+	}
+
+	/**
+	 * 查询学生
+	 *
+	 * @param courseId
+	 * @param rootOrgId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static StudentCacheBean getStudent(Long studentId) {
+		return ObjectRedisCacheProcessor.get("B_STUDENT:", new Object[]{studentId},
+				StudentCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.StudentCache");
+	}
+
+	/**
+	 * 查询考试机构配置
+	 *
+	 * @param examId
+	 * @param orgId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static ExamOrgSettingsCacheBean getExamOrgSettings(Long examId, Long orgId) {
+		return ObjectRedisCacheProcessor.get("E_EXAM_ORG_SETTINGS:", new Object[]{examId, orgId},
+				ExamOrgSettingsCacheBean.class, "EC-CORE-EXAMWORK",
+				"cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgSettingsCache");
+	}
+
+	/**
+	 * 查询考试机构属性
+	 *
+	 * @param examId
+	 * @param orgId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static ExamOrgPropertyCacheBean getExamOrgProperty(Long examId, Long orgId, String key) {
+		return ObjectRedisCacheProcessor.get("E_EXAM_ORG_PROP:", new Object[]{examId, orgId, key},
+				ExamOrgSettingsCacheBean.class, "EC-CORE-EXAMWORK",
+				"cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgPropertyCache");
+	}
+
+	/**
+	 * 查询考试
+	 *
+	 * @param examId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static ExamSettingsCacheBean getExamSettings(Long examId) {
+		return ObjectRedisCacheProcessor.get("E_EXAM:", new Object[]{examId},
+				ExamSettingsCacheBean.class, "EC-CORE-EXAMWORK",
+				"cn.com.qmth.examcloud.core.examwork.service.cache.ExamSettingsCache");
+	}
+
+	/**
+	 * 查询机构
+	 *
+	 * @param orgId
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static OrgCacheBean getOrg(Long orgId) {
+		return ObjectRedisCacheProcessor.get("B_ORG:", new Object[]{orgId}, OrgCacheBean.class,
+				"EC-CORE-BASIC", "cn.com.qmth.examcloud.core.basic.service.cache.OrgCache");
+	}
+
+	/**
+	 * 通过域名查询顶级机构
+	 *
+	 * @param domain
+	 * @return
+	 * @author WANGWEI
+	 */
+	public static RootOrgCacheBean getRootOrg(String domain) {
+		return ObjectRedisCacheProcessor.get("B_ROOT_ORG:", new Object[]{domain},
+				RootOrgCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.RootOrgCache");
+	}
+
+	/**
+	 * 获取机构属性
+	 *
+	 * @author WANGWEI
+	 * @param orgId
+	 * @param key
+	 * @return
+	 */
+	public static OrgPropertyCacheBean getOrgProperty(Long orgId, String key) {
+		return ObjectRedisCacheProcessor.get("B_ORG_PROP:", new Object[]{orgId, key},
+				OrgPropertyCacheBean.class, "EC-CORE-BASIC",
+				"cn.com.qmth.examcloud.core.basic.service.cache.OrgPropertyCache");
+	}
 
 }

+ 39 - 0
src/main/java/cn/com/qmth/examcloud/support/cache/bean/OrgPropertyCacheBean.java

@@ -0,0 +1,39 @@
+package cn.com.qmth.examcloud.support.cache.bean;
+
+import cn.com.qmth.examcloud.web.cache.RandomCacheBean;
+
+public class OrgPropertyCacheBean extends RandomCacheBean {
+
+	private static final long serialVersionUID = -8320620858676945769L;
+
+	private Long orgId;
+
+	private String key;
+
+	private Object value;
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public Object getValue() {
+		return value;
+	}
+
+	public void setValue(Object value) {
+		this.value = value;
+	}
+
+}