Beispiel #1
0
 public void run() {
   Logger.println("Version " + Version.getAgentFullVersion());
   long dateUnit = DateUtil.getDateUnit();
   while (running) {
     reload(false);
     // Text Data Reset..
     long nowUnit = DateUtil.getDateUnit();
     if (dateUnit != nowUnit) {
       dateUnit = nowUnit;
       DataProxy.reset();
     }
     ThreadUtil.sleep(3000);
   }
 }
 private Object getNumericCellValue(final Cell cell) {
   Object cellValue;
   if (DateUtil.isCellDateFormatted(cell)) {
     cellValue = new Date(cell.getDateCellValue().getTime());
   } else {
     cellValue = cell.getNumericCellValue();
   }
   return cellValue;
 }
Beispiel #3
0
  protected static void recordToErrorCounter(String cmd) {

    String today = DateUtil.format(new Date(), "yyyyMMdd");
    try {

      RedisUtil.incr(ERROR_COUNT_KEY + today);

    } catch (Exception e) {

      logger.warn("记录api返回错误请求的次数失败, today: {}", today, e);
    }

    try {

      RedisUtil.incr(ERROR_COUNT_KEY + today + ":cmd:" + cmd);

    } catch (Exception e) {

      logger.warn("记录cmd: {}, today: {} 返回错误请求的次数失败", cmd, today, e);
    }
  }
Beispiel #4
0
 /**
  * 获得指定位置的值,返回object,可为数值,字符串,布尔类型,null类型
  *
  * @param column
  * @return
  */
 public Object getCellValueObject(int rowNum, int column) {
   // 定义返回的数组
   Object tempObject = null;
   row = sheet.getRow(rowNum);
   cell = row.getCell(column);
   // 判断值类型
   switch (cell.getCellType()) {
       // 字符串类型
     case Cell.CELL_TYPE_STRING:
       tempObject = cell.getRichStringCellValue().getString();
       // System.out.println(cell.getRichStringCellValue().getString());
       break;
       // 数值类型
     case Cell.CELL_TYPE_NUMERIC:
       if (DateUtil.isCellDateFormatted(cell)) {
         tempObject = cell.getDateCellValue();
         // System.out.println(cell.getDateCellValue());
       } else {
         tempObject = cell.getNumericCellValue();
         // System.out.println(cell.getNumericCellValue());
       }
       break;
       // 布尔类型
     case Cell.CELL_TYPE_BOOLEAN:
       tempObject = cell.getBooleanCellValue();
       // System.out.println(cell.getBooleanCellValue());
       break;
       // 数学公式类型
     case Cell.CELL_TYPE_FORMULA:
       tempObject = cell.getCellFormula();
       // System.out.println(cell.getCellFormula());
       break;
     default:
       System.out.println();
   }
   return tempObject;
 }
Beispiel #5
0
 public void tradeForTomorrow() throws Exception {
   tradeForDate(DateUtil.getGameTomorrow());
 }