package cn.hmsoft.skill.helper;

import cn.hmsoft.log.LogHelper;

/*************************
 * 考生号辅助类
 * 
 * @author zxq
 * @create 2018-11-06 10:59:10
 * @version 5.0.0
 * @email: revisit@126.com
 * @Company: www.hmsoft.cn
 */
public abstract class ExamIdHelper {
	private static ExamIdHelper exam;

	/**********************
	 * 验证考生号
	 * 
	 * @param exam_id
	 * @return 如果没有错误，返回空值，如果有错误，返回错误信息
	 */
	public static String valid(String exam_id) {
		init();
		if (exam == null) {
			return "内部错误，请联系系统管理员";
		}

		return exam.validExamId(exam_id);
	}


	protected abstract String validExamId(String exam_id);


	private static void init() {
		if (exam == null) {
			synchronized (ExamIdHelper.class) {
				if (exam == null) {
					String class_name = "cn.hmsoft.skill.helper.examid.ExamId" + SkillParamHelper.GobalProvinceId;
					try {
						exam = (ExamIdHelper) Class.forName(class_name).newInstance();
					} catch (Exception e) {
						LogHelper.error(e);
					}
					if (exam == null) {
						// return "内部错误，请联系系统管理员";
					}
				}

			}
		}
	}
}
