Example #1
0
  public void updateTacTerminal() {
    /**
     * List<String[]> list = CvsFileParser.getCSV("厂商数据_01.csv"); for(String[] ss:list){
     * if(ss.length < 3){ System.out.println(" >> "+ss[0]+"|"+ss[1]); } }
     */
    Cnd condition = Cnd.where("d_status", "=", "1");
    List<Tac> tlist = dao.search(Tac.class, condition.orderBy().asc("d_hsman_name"));
    for (Tac t : tlist) {
      List<String[]> list = CvsFileParser.getCSV("厂商数据_01.csv");
      for (String[] str : list) {
        if (t.getHsmanName().toLowerCase().equals(str[0].toLowerCase())) {
          if (!"0".equals(str[1])) {
            t.setHsmanNameEn(str[1].toLowerCase());
          }
          if (!"0".equals(str[2])) {
            t.setHsmanName(str[2].toLowerCase());
          }

          if (dao.update(t)) {
            System.out.println(
                " >> 更新成功["
                    + t.getId()
                    + "|"
                    + t.getTac()
                    + "|"
                    + t.getHsmanName()
                    + "|"
                    + t.getHsmanNameEn()
                    + "]");
            break;
          }
        }
      }
    }
  }
Example #2
0
 public void find() {
   String tac = "01058001";
   int c = 0;
   IndexParser.init();
   HashMap<String, String[]> map = IndexParser.getTacMap();
   Iterator it = map.keySet().iterator();
   while (it.hasNext()) {
     String key = (String) it.next();
     Tac t = dao.getByTac(key);
     String[] str = map.get(key);
     if (null != t) {
       t.setTac(key);
       t.setHsmanNameEn(str[1]);
       t.setHsmanName(str[1]);
       t.setHstypeNameEn(str[2]);
       t.setHstypeName(str[2]);
       t.setModifytime(new Date());
       if (dao.update(t)) {
         System.out.println(" >> Update Success!");
       }
     } else {
       t = new Tac();
       t.setTac(key);
       t.setHsmanNameEn(str[1]);
       t.setHstypeNameEn(str[2]);
       System.out.println(" >> 添加数据:" + Json.toJson(t));
       t = dao.save(t);
       if (t.getId() > 0) {
         c++;
         System.out.println(Json.toJson(t));
       }
     }
   }
   System.out.println(" >> c:" + c);
 }
Example #3
0
  public void test() throws ClassNotFoundException {
    if (null != dao) {
      System.out.println(" >> dao is not null");
      List<String[]> list = IMEIParser.getCSV("IMEI终端型号统计.csv");
      Tac tac = null;
      for (String[] s : list) {
        tac = new Tac();
        tac.setTac(s[0]);
        tac.setHsmanName(s[1]);
        tac.setHstypeName(s[2]);

        Tac tmp = dao.findByCondition(Tac.class, Cnd.where("d_tac", "=", tac.getTac()));
        if (null == tmp) {
          tac = dao.save(tac);
          System.out.println(" >> " + tac.getId());
        } else {
          System.out.println(" >> 已存在tac[" + tmp.getTac() + "]");
        }
        break;
      }
    } else {
      System.out.println(" >> dao is null");
    }
  }