public ServiceProduct getServiceProductBySpId(String productId) {
   //        ServiceProduct sp=new ServiceProduct();
   List list = null;
   Session session = getSession();
   try {
     String sql =
         "select sp.csp_id from service_product sp,product p where p.id = sp.product_id and p.MOBILE_PRODUCT = 1";
     Query query = session.createSQLQuery(sql);
     list = query.list();
   } catch (DataAccessResourceFailureException e) {
     logger.error("Hibernate错误:" + e.getMessage());
     e
         .printStackTrace(); // To change body of catch statement use File | Settings | File
                             // Templates.
   } catch (IllegalStateException e) {
     logger.error("Hibernate错误:" + e.getMessage());
     e
         .printStackTrace(); // To change body of catch statement use File | Settings | File
                             // Templates.
   } catch (HibernateException e) {
     logger.error("Hibernate错误:" + e.getMessage());
     e.printStackTrace();
   } finally {
     session.close();
   }
   //        return list==null||list.size() == 0?null:list.get(0);
   return null;
 }
示例#2
0
  public List<PlannedNotification> getPlannedNotificationsForCorrespondence() {
    List<PlannedNotification> result;

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {
      Query query =
          session
              .createQuery(
                  "from PlannedNotification p left join fetch p.userBasedRecipientInternal where p.eventName = :var")
              .setString(
                  "var",
                  NotificationEventTypeEnum.CORRESPONDENCE_CREATED_OR_UPDATED_EVENT.toString());

      result = query.list().subList(0, 1);
    } catch (DataAccessResourceFailureException e) {
      log.error(e.getMessage());
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (HibernateException e) {
      log.error(e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
      session.close();
    }
    return result;
  }
示例#3
0
  /**
   * Gets the planned notifications for the list of sites that are passed in. This method access the
   * db using a new session from the hibernate session factory.
   *
   * @param hcsList the hcs list
   * @return the planned notifications
   */
  public List<PlannedNotification> getPlannedNotificationsForUpdateMasterSubject() {
    List<PlannedNotification> result;

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {
      Query query =
          session
              .createQuery("from PlannedNotification p where p.eventName = :var")
              .setString("var", NotificationEventTypeEnum.MASTER_SUBJECT_UPDATED_EVENT.toString());

      result = query.list();
    } catch (DataAccessResourceFailureException e) {
      log.error(e.getMessage());
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (HibernateException e) {
      log.error(e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
      session.close();
    }
    return result;
  }
 /** 根据所属单位和项目类型Id查询内容模板 */
 public List<CfacontentFramework> getCfacontentFrameworkByAffiliation(Integer affiliation) {
   try {
     Session session = super.getSession();
     Query query = session.createQuery("from CfacontentFramework where affiliation=?");
     query.setInteger(0, affiliation);
     return query.list();
   } catch (DataAccessResourceFailureException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (HibernateException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IllegalStateException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }
示例#5
0
  /**
   * Gets the planned notifications for the list of sites that are passed in. This method access the
   * db using a new session from the hibernate session factory.
   *
   * @param hcsList the hcs list
   * @return the planned notifications
   */
  public List<PlannedNotification> getPlannedNotifications(List<HealthcareSite> hcsList) {
    List<PlannedNotification> result;
    List<String> nciCodeList = new ArrayList<String>();
    for (HealthcareSite hcs : hcsList) {
      if (hcs != null) {
        nciCodeList.add(hcs.getPrimaryIdentifier());
      }
    }

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {
      Query query =
          session
              .createQuery(
                  "select p from PlannedNotification p, HealthcareSite o, Identifier i where p = any elements(o.plannedNotificationsInternal) and "
                      + "i = any elements(o.identifiersAssignedToOrganization) and i.primaryIndicator = 'true' and "
                      + "i.value in (:nciCodeList)")
              .setParameterList("nciCodeList", nciCodeList);

      result = query.list();
    } catch (DataAccessResourceFailureException e) {
      log.error(e.getMessage());
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (HibernateException e) {
      log.error(e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
      session.close();
    }
    return result;
  }
示例#6
0
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    ApplicationContext ctx =
        WebApplicationContextUtils.getRequiredWebApplicationContext(
            req.getSession().getServletContext());
    MachineCabinetService machineCabinetService =
        (MachineCabinetService) ctx.getBean("machineCabinetService");
    SubUnitSituationService subUnitSituationService =
        (SubUnitSituationService) ctx.getBean("subUnitSituationService");

    //    	JiGuiRemoteService remoteJiGuiService = (JiGuiRemoteService)
    // ctx.getBean("remoteJiGuiService");
    //    	MachineCabinetSituationManager machineCabinetSituationManager =
    // (MachineCabinetSituationManager) ctx.getBean("machineCabinetSituationManager");
    PrintWriter out = resp.getWriter();
    String value = "";
    String oper = req.getParameter("oper");
    String locationIdentify = req.getParameter("locationIdentify");
    String id = req.getParameter("id");
    id = id == null ? "1" : id;
    id = EscapeUnescape.unescape(id);

    if (oper.equals("getInitValue")) {

      // value = remoteWangLuoService.getInitValues(new Integer(locationIdentify) , name);
      try {
        value = subUnitSituationService.getInitValues(Integer.parseInt(id), "JiGui");
        //        		value = machineCabinetSituationManager.getInitValues(new Integer(id));
        //        		value = "ColorRange{red:80;yellow:60;green:40}
        // SubNodes{默认机柜:0;E4机柜:0;C7机柜:0;C4机柜:0;D4机柜:0;A4机柜:0;7号楼3楼:0;6号楼2楼203:0;6号楼2层-1:0;6号楼2层52:0;6号楼2楼22:0;59:0;6号楼2楼6:0;1号楼7楼:0;6号楼2层-5:0;6号楼2层61:0;6号楼2层-9:0;1号楼712:0;6号楼2层039:0;6号楼2楼24:0;6号楼2层-7:0;054:0;4号楼1楼:0;6号楼2层-4:0;6号楼2楼32:0;6号楼2层-57:0;4-1:0;6号楼2层-40:0;6号楼2层53:0;6号楼2层-19:0;1号楼2楼:0;6号楼2层-60:0;6号楼2层-29:0;6号楼2层-66:0;5号楼4楼:0;6号楼2层-48:0;6号楼2楼56:0;6号搂2层-8:0;6号楼2楼20:0;6号楼2楼12:0;6号楼2楼:0;54:0;6号楼2层-74:0;45:0;6号楼2层201:0;73:0;4号楼113:0;6号楼2层42:0;9号楼2楼:0;411:0} HistoryValue{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}";
      } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
      } catch (IllegalStateException e) {
        e.printStackTrace();
      } catch (ParseException e) {
        e.printStackTrace();
      }
    } else if (oper.equals("getCurrentValue")) {
      value = subUnitSituationService.getCurrentValues(Integer.parseInt(id), "JiGui");
      // value = remoteWangLuoService.getCurrentValues(new Integer(locationIdentify), name);
      //        	value = machineCabinetSituationManager.getCurrentValues(new Integer(id));
      //        	value = "ColorRange{red:80;yellow:60;green:40}
      // SubNodes{默认机柜:0;E4机柜:0;C7机柜:0;C4机柜:0;D4机柜:0;A4机柜:0;7号楼3楼:0;6号楼2楼203:0;6号楼2层-1:0;6号楼2层52:0;6号楼2楼22:0;59:0;6号楼2楼6:0;1号楼7楼:0;6号楼2层-5:0;6号楼2层61:0;6号楼2层-9:0;1号楼712:0;6号楼2层039:0;6号楼2楼24:0;6号楼2层-7:0;054:0;4号楼1楼:0;6号楼2层-4:0;6号楼2楼32:0;6号楼2层-57:0;4-1:0;6号楼2层-40:0;6号楼2层53:0;6号楼2层-19:0;1号楼2楼:0;6号楼2层-60:0;6号楼2层-29:0;6号楼2层-66:0;5号楼4楼:0;6号楼2层-48:0;6号楼2楼56:0;6号搂2层-8:0;6号楼2楼20:0;6号楼2楼12:0;6号楼2楼:0;54:0;6号楼2层-74:0;45:0;6号楼2层201:0;73:0;4号楼113:0;6号楼2层42:0;9号楼2楼:0;411:0} HistoryValue{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}";
    } else if (oper.equals("getHistoryValue")) {
      String beginTime = req.getParameter("beginTime");
      String endTime = req.getParameter("endTime");
      beginTime = EscapeUnescape.unescape(beginTime);
      endTime = EscapeUnescape.unescape(endTime);
      String firstIndex = req.getParameter("firstIndex");
      firstIndex = (firstIndex == null) ? "0" : firstIndex;
      // value = remoteWangLuoService.getHistoryValue(null, null, new Integer(locationIdentify),
      // name, 1);
      try {
        value =
            subUnitSituationService.getHistoryValue(
                beginTime, endTime, Integer.parseInt(id), "JiGui", new Integer(firstIndex));
        //        		value = machineCabinetSituationManager.getHistoryValue(beginTime, endTime, new
        // Integer(id), new Integer(firstIndex));
        //        		value = "ColorRange{red:80;yellow:60;green:40}
        // SubNodes{默认机柜:0;E4机柜:0;C7机柜:0;C4机柜:0;D4机柜:0;A4机柜:0;7号楼3楼:0;6号楼2楼203:0;6号楼2层-1:0;6号楼2层52:0;6号楼2楼22:0;59:0;6号楼2楼6:0;1号楼7楼:0;6号楼2层-5:0;6号楼2层61:0;6号楼2层-9:0;1号楼712:0;6号楼2层039:0;6号楼2楼24:0;6号楼2层-7:0;054:0;4号楼1楼:0;6号楼2层-4:0;6号楼2楼32:0;6号楼2层-57:0;4-1:0;6号楼2层-40:0;6号楼2层53:0;6号楼2层-19:0;1号楼2楼:0;6号楼2层-60:0;6号楼2层-29:0;6号楼2层-66:0;5号楼4楼:0;6号楼2层-48:0;6号楼2楼56:0;6号搂2层-8:0;6号楼2楼20:0;6号楼2楼12:0;6号楼2楼:0;54:0;6号楼2层-74:0;45:0;6号楼2层201:0;73:0;4号楼113:0;6号楼2层42:0;9号楼2楼:0;411:0} HistoryValue{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}";
      } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
      } catch (IllegalStateException e) {
        e.printStackTrace();
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
    //        System.out.println(value);
    out.println(EscapeUnescape.escape(value));
  }