// 如果数据库中已存在,则continue
if( mapdata.containsKey(telegraphcode)) continue;
dataMap.put("telegraph", telegraph);
dataMap.put("telegraphcode", telegraphcode);
resultList.add(dataMap);
};
}
}
} catch (Exception e) {
//e.printStackTrace();
logger.error(e.getMessage());
}
}
}
}
}
return resultList;
}
/** 导入数据进库
* @param request
* @param retList
*/
private void importToDB(HttpServletRequest request, List dataList)throws Exception{
try {
String userLabel=SessionUtil.getCurrentUserLabel(request);
if(dataList!=null&&dataList.size()>0){
for (int i = 0; i < dataList.size(); i++) {
//System.out.println("******dataList.get(i)="+dataList.get(i));
logger.info("******dataList.get(i)="+dataList.get(i));
HashMap row = (HashMap)dataList.get(i);
Telegraphcode telegraphcode=new Telegraphcode();
telegraphcode.setTelegraph(row.get("telegraph").toString());
telegraphcode.setTelegraphcode(row.get("telegraphcode").toString());
telegraphcode.setAliveFlag(Constants.REC_STATUS_USE);
telegraphcode.setCreateUserLabel(userLabel);
telegraphcode.setUpdateUserLabel(userLabel);
GROUPAgentFactory.getTelegraphcodeManager().insert(telegraphcode);
}
}
} catch (Exception e) {
// TODO: handle exception
//e.printStackTrace();
logger.error(e.getMessage());
throw new Exception(e);
}
}
}
三:配置web.xml