日期:2014-05-17 浏览次数:20838 次
public void doExecute(HttpServletRequest request) throws Throwable {
try {
String filePath = request.getParameter("filepath");//文件路径
String contact_way = "测试01";
String management_style = "测试02";
String operator = "测试03";
FileImpUtils imp = new FileImpUtils();
filePath = imp.change(filePath);
imp.readExcel(filePath, 1);//文件路径、忽略行数
List list2 = null;
List list = imp.getData();//获取数据
int rows = imp.getSum();//总记录数
for (int i = 0; i < rows; i++) {
list2 = (List) list.get(i);
String sql = "insert into t_label_info values ('"
+ list2.get(0) + "','" + list2.get(1) + "','"
+ list2.get(2) + "','" + list2.get(3)
+ "',?,?,?,sysdate)";
setSqlString(sql);
setSqlParameter(1, contact_way);
setSqlParameter(2, management_style);
setSqlParameter(3, operator);
boolean flag = updateSql();
System.out.println(flag);
if(!flag){
throw new OurException("自定义异常!");
}
}
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally{
}