/*
   * (non-Javadoc)
   *
   * @see com.synesoft.fisp.domain.service.cm.BusinessCommonService#
   * commonBusinessValidate(java.lang.String, java.lang.Object)
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  public void commonBusinessValidate(String pageId, Object obj) {
    ResultMessages messages = ResultMessages.error();
    SysControlDept query_SysControlDept = new SysControlDept();
    UserInf userInfo = ContextConst.getCurrentUser();
    query_SysControlDept.setControlDept(userInfo.getDepartment());
    query_SysControlDept.setPageId(pageId);
    List<SysControlDept> sysControlDepts =
        sysControlDeptRepos.queryListByPageCheck(query_SysControlDept);
    Class clazz = obj.getClass();

    if (null != sysControlDepts) {
      for (int i = 0; i < sysControlDepts.size(); i++) {
        Object objValue = null;
        String getValue = "get" + sysControlDepts.get(i).getControlId();
        Method method;
        try {
          method = clazz.getMethod(getValue, new Class[] {});
          objValue = method.invoke(obj);
          if (objValue instanceof String) {
            if (!StringUtil.isNotTrimEmpty((String) objValue)) {
              ResultMessage resultMessage =
                  ResultMessage.fromCode(
                      "e.fisp.commonValidate." + sysControlDepts.get(i).getControlId());
              messages.add(resultMessage);
            }
          } else {
            if (null == objValue) {
              ResultMessage resultMessage =
                  ResultMessage.fromCode(
                      "e.fisp.commonValidate." + sysControlDepts.get(i).getControlId());
              messages.add(resultMessage);
            }
          }
        } catch (SecurityException e) {
          e.printStackTrace();
        } catch (NoSuchMethodException e) {
          e.printStackTrace();
        } catch (IllegalArgumentException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
        }
        if (messages.isNotEmpty()) {
          throw new BusinessException(messages);
        }
      }
    }
  }
 public boolean isValidate(String department, String pageId, String controlId) {
   SysControlDept query_SysControlDept = new SysControlDept();
   query_SysControlDept.setControlDept(department);
   query_SysControlDept.setPageId(pageId);
   query_SysControlDept.setControlId(controlId);
   SysControlDept sysControlDept = sysControlDeptRepos.querySysControlDept(query_SysControlDept);
   if (null != sysControlDept && "0".equals(sysControlDept.getCheckFlag())) {
     return true;
   } else {
     return false;
   }
 }