导入Excel
来源:互联网 发布:手机qq变声软件 编辑:程序博客网 时间:2024/05/22 02:16
Action :
public Reply readExcel() {
File file = _getFileOne(); //获取上传的excel文件
String fileName = new SimpleDateFormat("yyyyMMddHHmmss")
.format(Calendar.getInstance().getTime())+UUID.randomUUID()+".xls";
Workbook wb; // 工作薄
try {
wb = WorkbookFactory.create(file);
Sheet sheet = wb.getSheetAt(0); //获取工作表
for(int i=1;i<=sheet.getLastRowNum();i++){
Row row = sheet.getRow(i); //获取行数据
Cell idCell = row.getCell(0); //获取 当前行的 某一单元格
//返回服务费 付费状态
Cell payStatusCell = row.getCell(14);
Map<String,Object> map = new HashMap<String, Object>();
if(idCell!=null){
double id = idCell.getNumericCellValue();
map.put("ID",id);
}
if(payStatusCell!=null){
String payStatus = payStatusCell.getStringCellValue();
System.out.println(payStatus+"--------bb---------"+map.get("ID"));
if("成功".equals(payStatus)){
map.put("STATUS", 2);
map.put("TYPE", 2);
}else if("失败".equals(payStatus)){
map.put("STATUS", 3);
map.put("TYPE", 1);
}
System.out.println(map+"--------");
service.updateServiceFeeStatus(map); //修改数据库信息
}
}
String filePath = SkyEye.getConfig("file.path")+File.separator+"serviceFee";
BaseUtil.createDirectory(filePath);
File file2 = new File(filePath+File.separator+fileName);
System.out.println(filePath+"----path----");
FileCopyUtils.copy(file, file2);
} catch (InvalidFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ReplyAjax(true, "成功").addOp(new OpLog("贷后管理","返佣管理",
"导入文件名:"+fileName+",导入时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(new Date())));
}
- EXCEL导入
- 导入EXCEL
- Excel 导入
- Excel导入
- 导入Excel
- 导入Excel
- 导入Excel
- excel导入
- 导入EXCEL
- 导入excel
- 导入excel
- 导入Excel
- 导入excel
- Excel 导入
- 导入excel
- excel 导入
- Excel导入
- 导入Excel
- Spring ListFactoryBean example
- iDT算法
- 使用NSTimer计时器实现简单的按钮倒计时功能
- 怎样让兰花多发芽
- exchange2013域名(AD域)名称与外网邮箱的域名后缀不相同该如何配置
- 导入Excel
- 如何通过自学,成为数据挖掘“高手”
- MySQL5.5主从同步配置及问题
- CS231N 卷积神经网络课程学习笔记
- WebSokect 简单案例
- 50个必备的实用jQuery代码段
- Intent详解
- LeetCode题解:Add Binary
- 聚类算法:K-Means算法