示例#1
0
 /**
  * 添加一条日志(测试用)
  *
  * @param session
  * @return
  */
 private Object addStocks(Session session) {
   List<String> stockList = getAllStockDefList(session);
   for (String temp : stockCodes) {
     if (stockList.contains(temp) || stockList.contains(temp.replace("type_0", ""))) {
       continue;
     } else {
       StockDef stock = new StockDef();
       if (temp.indexOf("type_0") > -1) {
         temp = temp.replace("type_0", "");
         stock.setType(0);
       } else {
         stock.setType(1);
       }
       stock.setStockcode(temp);
       stock.setStockname(
           ConnectionFactory.getServiceCommon()
               .getStockNameByCode(temp, ConnectionFactory.newConnectionInstant(temp)));
       // System.out.println(stock.getStockname());
       session.saveOrUpdate(stock);
       stockList.add(temp);
       log.info("add stocks successfully!");
     }
   }
   return Constants.SUCCESS;
 }
示例#2
0
 private List<String> getAllStockDefList(Session session) {
   List<StockDef> resultList = session.createQuery("from StockDef").list();
   List<String> stockCodes = new ArrayList<String>();
   if (resultList != null) {
     for (StockDef temp : resultList) {
       stockCodes.add(temp.getStockcode());
     }
   }
   return stockCodes;
 }
示例#3
0
 private List<String> getAnalysisBigStockDefList(Session session) {
   List<StockDef> resultList =
       session.createQuery("from StockDef where type = 0 and stockst = 1").list();
   List<String> stockCodes = new ArrayList<String>();
   if (resultList != null) {
     for (StockDef temp : resultList) {
       stockCodes.add("s_" + temp.getStockcode());
     }
   }
   return stockCodes;
 }