wt1101serviceimpl.java
来自「一个完整的物流系统」· Java 代码 · 共 66 行
JAVA
66 行
package jp.com.cost.wt.service.impl;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import jp.com.cost.wt.service.WT1101Service;
import jp.com.cost.wt.web.form.WT1201Form;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
/**
* 主要用于实现WT1101页面中导入一条委托书信息的业务
* @author 白银虎
* @version 1.0
*
*/
public class WT1101ServiceImpl implements WT1101Service{
/**
* 将Excel表中的数据读取并封装到一个Formbean中
*
* @param filepath -- Excel表存放的路径
* @return Formbean对象
*/
public WT1201Form excelQuery(String filepath) {
// TODO Auto-generated method stub
WT1201Form wt1101form=new WT1201Form();
try {
InputStream is = new FileInputStream(filepath);
Workbook wb;
System.out.println(filepath);
wb = Workbook.getWorkbook(is);
Sheet st = wb.getSheet("Sheet1");
wt1101form.setSendperon(st.getCell(0,1).getContents());
wt1101form.setReceperson(st.getCell(1,1).getContents());
wt1101form.setNotifyperson(st.getCell(2,1).getContents());
wt1101form.setType(st.getCell(3,1).getContents());
wt1101form.setSize(Double.parseDouble(st.getCell(4,1).getContents()));
wt1101form.setWeight(Double.parseDouble(st.getCell(5,1).getContents()));
wt1101form.setReceplace(st.getCell(6,1).getContents());
wt1101form.setDeliplace(st.getCell(7,1).getContents());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return wt1101form;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?