package sina.hive.vipfaninfo;
import java.io.File;
import java.util.Iterator;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.log4j.Logger;
import sina.hive.init.EffectInit;
public class FanExcel {
private Logger log = Logger.getLogger(FanExcel.class);
private HTablePool hTablePool;
private static final String TABLE_NAME = "temp_sina_analyzer";
private static final String PATH = "/home/hdfs/effect/liubx/tempFan.xls";
private static final String TEMPLATE_PATH = "/home/hdfs/effect/liubx/template.xls";
private static FanExcel fanExcel = new FanExcel();
private WritableWorkbook wokbook = null;
private int one_index = 0;
private int two_index = 0;
private int three_index = 0;
private int four_index = 0;
private int five_index = 0;
private int six_index = 0;
private int seven_index = 0;
private WritableSheet oneSheet;
private WritableSheet twoSheet;
private WritableSheet threeSheet;
private WritableSheet fourSheet;
private WritableSheet fiveSheet;
private WritableSheet sixSheet;
private WritableSheet sevenSheet;
private Label label = null;
private jxl.write.Number numberCell = null;
private byte[] family = "baseInfo".getBytes();
String arry1[] = null;
String arry2[] = null;
String fan_str = null;
byte tmp[] = null;
public static FanExcel getFanExcel() {
if (fanExcel == null) {
fanExcel = new FanExcel();
}
return fanExcel;
}
private FanExcel() {
init(true);
}
public HTable getHtable(String tableName) {
if (hTablePool != null) {
return (HTable) hTablePool.getTable(tableName);
} else {
Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.master", EffectInit.hbaseMaster);
configuration.set("hbase.zookeeper.quorum",
EffectInit.hbaseZkQuorum);
configuration.set("hbase.zookeeper.property.clientPort",
EffectInit.hbaseZkClientPort);
configuration.get("hbase.master");
hTablePool = new HTablePool(configuration,
EffectInit.hbasePoolMaxSize);
return (HTable) hTablePool.getTable(tableName);
}
}
private void init(boolean isFirst) {
File file = new File(FanExcel.PATH);
log.info("开始初始化EXCEL信息:");
Workbook wb = null;
try {
// Excel模板
if(isFirst){
wb = Workbook.getWorkbook(new File(FanExcel.TEMPLATE_PATH));
}else{
wb = Workbook.getWorkbook(new File(FanExcel.PATH));
}
this.wokbook = Workbook.createWorkbook(file, wb);
this.oneSheet = this.wokbook.getSheet(0);
this.twoSheet = this.wokbook.getSheet(1);
this.threeSheet = this.wokbook.getSheet(2);
this.fourSheet = this.wokbook.getSheet(3);
this.fiveSheet = this.wokbook.getSheet(4);
this.sixSheet = this.wokbook.getSheet(5);
this.sevenSheet = this.wokbook.getSheet(6);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
log.info("结束初始化EXCEL信息!");
}
/**
* 微博基本信息页
*/
private void oneSheet(Result rs) throws Exception {
this.one_index++;
label = new Label(0, one_index, new String(rs.getRow(), "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "gender".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "attentCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "favCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "description".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "createdTime".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "activeDegree".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "isVip".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "isCorpseFan".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "recentFdCount200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(13, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "recentCmCount200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(14, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "oriRate200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(15, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "forwardRate200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(16, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWbCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(17, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByFwdCounts90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(18, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByCmtCounts90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(19, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "l1ByFCCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(20, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgByFCCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(21, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgWbCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(22, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWbCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(23, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByFwdCounts30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(24, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByCmtCounts30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(25, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "l1ByFCCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(26, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgByFCCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(27, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgWbCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(28, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
/*
* 生成一个保存数字的单元格 必须使用Number的完整包路径,否则有语法歧义 单元格位置是第二列,第一行,值为789.123
*/
// jxl.write.Number number = new jxl.write.Number(1, 0, 555.12541);
// sheet.addCell(number);
}
/**
* 近90天用户指数
*/
private void twoSheet(Result rs) throws Exception {
this.two_index++;
label = new Label(0, two_index, new String(rs.getRow(), "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "netEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanCountIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanQualityIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenCountIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenQualityIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboInteractIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanJoinIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "interactTrendIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
}
/**
* 近30天用户指数
*/
public void threeSheet(Result rs) throws Exception {
this.three_index++;
label = new Label(0, this.three_index, new String(rs.getRow(), "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "netEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanCountIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanQualityIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenCountIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenQualityIndex30".getBytes());
if (tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboInteractIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanJoinIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "interactTrendIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
}
/**
* 粉丝性别&质量
*/
public void foursheet(Result rs) throws Exception {
this.four_index++;
label = new Label(0, this.four_index, new String(rs.getRow(), "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lMFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lVFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lCorpseFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lGrassRootsFan".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
}
/**
* 二级粉丝区间分布
*/
public void fivesheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "fan2fenbu".getBytes());
if (this.tmp == null) {
return;
}
fan_str = new String(this.tmp, "utf-8");
if (fan_str == null || fan_str.indexOf("|") <= 0) {
return;
}
arry1 = fan_str.split(" ");
for (String str : arry1) {
this.five_index++;
arry2 = str.split("\\|");
label = new Label(0, this.five_index, new String(rs.getRow(),
"utf-8"));
this.fiveSheet.addCell(label);
label = new Label(1, this.five_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.fiveSheet.addCell(label);
label = new Label(2, this.five_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.fiveSheet.addCell(label);
label = new Label(5, this.five_index, arry2[1]);
this.fiveSheet.addCell(label);
arry2 = arry2[0].split("_");
label = new Label(3, this.five_index, arry2[0]);
this.fiveSheet.addCell(label);
if(arry2.length<2){
label = new Label(4, this.five_index, "-1");
}else{
label = new Label(4, this.five_index, arry2[1]);
}
this.fiveSheet.addCell(label);
}
}
/**
* 粉丝地域分布
*/
public void sixsheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "diyufenbu".getBytes());
if (tmp == null) {
return;
}
this.fan_str = new String(this.tmp, "utf-8");
if (this.fan_str == null || this.fan_str.indexOf("|") <= 0) {
return;
}
this.arry1 = this.fan_str.split(" ");
for (String str : arry1) {
this.six_index++;
arry2 = str.split("\\|");
label = new Label(0, this.six_index, new String(rs.getRow(),
"utf-8"));
this.sixSheet.addCell(label);
label = new Label(1, this.six_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.sixSheet.addCell(label);
label = new Label(2, this.six_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.sixSheet.addCell(label);
label = new Label(3, this.six_index, arry2[0]);
this.sixSheet.addCell(label);
label = new Label(4, this.six_index, arry2[1]);
this.sixSheet.addCell(label);
}
}
/**
* 粉丝活跃度分布
*/
public void sevensheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "daywbfenbu".getBytes());
if (this.tmp == null) {
return;
}
this.fan_str = new String(this.tmp, "utf-8");
if (this.fan_str == null || this.fan_str.indexOf("|") <= 0) {
return;
}
this.arry1 = this.fan_str.split(" ");
for (String str : arry1) {
this.seven_index++;
arry2 = str.split("\\|");
label = new Label(0, this.seven_index, new String(rs.getRow(),
"utf-8"));
this.sevenSheet.addCell(label);
label = new Label(1, this.seven_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.sevenSheet.addCell(label);
label = new Label(2, this.seven_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.sevenSheet.addCell(label);
label = new Label(5, this.seven_index, arry2[1]);
this.sevenSheet.addCell(label);
arry2 = arry2[0].split("_");
label = new Label(3, this.seven_index, arry2[0]);
this.sevenSheet.addCell(label);
if(arry2.length<2){
label = new Label(4, this.seven_index, "-1");
}else{
label = new Label(4, this.seven_index, arry2[1]);
}
this.sevenSheet.addCell(label);
}
}
private void closeExcel() {
try {
if (this.wokbook != null) {
this.wokbook.write();
this.wokbook.close();
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
public void exportExcel() {
HTable htable = getHtable(FanExcel.TABLE_NAME);
Scan scan = new Scan();
Result rs = null;
int n =0;
int n2=0;
try {
ResultScanner rscan = htable.getScanner(scan);
Iterator<Result> it = rscan.iterator();
while (it.hasNext()) {
rs = it.next();
if (rs == null || rs.isEmpty()) {
continue;
}
this.oneSheet(rs);
this.twoSheet(rs);
this.threeSheet(rs);
this.foursheet(rs);
this.fivesheet(rs);
this.sixsheet(rs);
this.sevensheet(rs);
n2++;
n++;
if(n==500){
System.out.println("重新初始化操作!");
this.closeExcel();
this.init(false);
}
}
} catch (Exception ex) {
log.error(new String(rs.getRow()));
log.error(ex.getMessage(), ex);
} finally {
System.out.println("写入记录数:"+n2);
System.out.println("sheet1:"+this.one_index);
System.out.println("sheet2:"+this.two_index);
System.out.println("sheet3:"+this.three_index);
System.out.println("sheet4:"+this.four_index);
System.out.println("sheet5:"+this.five_index);
System.out.println("sheet6:"+this.six_index);
System.out.println("sheet7:"+this.seven_index);
closeExcel();
}
}
public static void main(String arg[]) {
FanExcel fanexcel = FanExcel.getFanExcel();
System.out.println("开始导出excel数据:");
fanexcel.exportExcel();
System.out.println("结束导出excel数据:");
}
}
import java.io.File;
import java.util.Iterator;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.log4j.Logger;
import sina.hive.init.EffectInit;
public class FanExcel {
private Logger log = Logger.getLogger(FanExcel.class);
private HTablePool hTablePool;
private static final String TABLE_NAME = "temp_sina_analyzer";
private static final String PATH = "/home/hdfs/effect/liubx/tempFan.xls";
private static final String TEMPLATE_PATH = "/home/hdfs/effect/liubx/template.xls";
private static FanExcel fanExcel = new FanExcel();
private WritableWorkbook wokbook = null;
private int one_index = 0;
private int two_index = 0;
private int three_index = 0;
private int four_index = 0;
private int five_index = 0;
private int six_index = 0;
private int seven_index = 0;
private WritableSheet oneSheet;
private WritableSheet twoSheet;
private WritableSheet threeSheet;
private WritableSheet fourSheet;
private WritableSheet fiveSheet;
private WritableSheet sixSheet;
private WritableSheet sevenSheet;
private Label label = null;
private jxl.write.Number numberCell = null;
private byte[] family = "baseInfo".getBytes();
String arry1[] = null;
String arry2[] = null;
String fan_str = null;
byte tmp[] = null;
public static FanExcel getFanExcel() {
if (fanExcel == null) {
fanExcel = new FanExcel();
}
return fanExcel;
}
private FanExcel() {
init(true);
}
public HTable getHtable(String tableName) {
if (hTablePool != null) {
return (HTable) hTablePool.getTable(tableName);
} else {
Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.master", EffectInit.hbaseMaster);
configuration.set("hbase.zookeeper.quorum",
EffectInit.hbaseZkQuorum);
configuration.set("hbase.zookeeper.property.clientPort",
EffectInit.hbaseZkClientPort);
configuration.get("hbase.master");
hTablePool = new HTablePool(configuration,
EffectInit.hbasePoolMaxSize);
return (HTable) hTablePool.getTable(tableName);
}
}
private void init(boolean isFirst) {
File file = new File(FanExcel.PATH);
log.info("开始初始化EXCEL信息:");
Workbook wb = null;
try {
// Excel模板
if(isFirst){
wb = Workbook.getWorkbook(new File(FanExcel.TEMPLATE_PATH));
}else{
wb = Workbook.getWorkbook(new File(FanExcel.PATH));
}
this.wokbook = Workbook.createWorkbook(file, wb);
this.oneSheet = this.wokbook.getSheet(0);
this.twoSheet = this.wokbook.getSheet(1);
this.threeSheet = this.wokbook.getSheet(2);
this.fourSheet = this.wokbook.getSheet(3);
this.fiveSheet = this.wokbook.getSheet(4);
this.sixSheet = this.wokbook.getSheet(5);
this.sevenSheet = this.wokbook.getSheet(6);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
log.info("结束初始化EXCEL信息!");
}
/**
* 微博基本信息页
*/
private void oneSheet(Result rs) throws Exception {
this.one_index++;
label = new Label(0, one_index, new String(rs.getRow(), "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "gender".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "attentCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "favCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "description".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "createdTime".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "activeDegree".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "isVip".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "isCorpseFan".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "recentFdCount200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(13, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "recentCmCount200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(14, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "oriRate200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(15, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "forwardRate200".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(16, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWbCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(17, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByFwdCounts90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(18, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByCmtCounts90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(19, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "l1ByFCCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(20, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgByFCCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(21, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgWbCount90".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(22, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWbCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(23, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByFwdCounts30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(24, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lByCmtCounts30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(25, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "l1ByFCCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(26, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgByFCCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(27, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lAvgWbCount30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(28, one_index, new String(this.tmp, "utf-8"));
this.oneSheet.addCell(label);
/*
* 生成一个保存数字的单元格 必须使用Number的完整包路径,否则有语法歧义 单元格位置是第二列,第一行,值为789.123
*/
// jxl.write.Number number = new jxl.write.Number(1, 0, 555.12541);
// sheet.addCell(number);
}
/**
* 近90天用户指数
*/
private void twoSheet(Result rs) throws Exception {
this.two_index++;
label = new Label(0, two_index, new String(rs.getRow(), "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "netEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanCountIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanQualityIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboEffectIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenCountIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenQualityIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboInteractIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanJoinIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
this.tmp = rs.getValue(this.family, "interactTrendIndex".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, two_index, new String(this.tmp, "utf-8"));
this.twoSheet.addCell(label);
}
/**
* 近30天用户指数
*/
public void threeSheet(Result rs) throws Exception {
this.three_index++;
label = new Label(0, this.three_index, new String(rs.getRow(), "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "netEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanCountIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanQualityIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboEffectIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenCountIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(8, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "bowenQualityIndex30".getBytes());
if (tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(9, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "weiboInteractIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(10, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "fanJoinIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(11, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
this.tmp = rs.getValue(this.family, "interactTrendIndex30".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(12, this.three_index, new String(this.tmp, "utf-8"));
this.threeSheet.addCell(label);
}
/**
* 粉丝性别&质量
*/
public void foursheet(Result rs) throws Exception {
this.four_index++;
label = new Label(0, this.four_index, new String(rs.getRow(), "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "nickName".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(1, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "address".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(2, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lMFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(3, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lWFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(4, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lVFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(5, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lCorpseFansCount".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(6, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
this.tmp = rs.getValue(this.family, "lGrassRootsFan".getBytes());
if (this.tmp == null) {
this.tmp = "".getBytes();
}
label = new Label(7, this.four_index, new String(this.tmp, "utf-8"));
this.fourSheet.addCell(label);
}
/**
* 二级粉丝区间分布
*/
public void fivesheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "fan2fenbu".getBytes());
if (this.tmp == null) {
return;
}
fan_str = new String(this.tmp, "utf-8");
if (fan_str == null || fan_str.indexOf("|") <= 0) {
return;
}
arry1 = fan_str.split(" ");
for (String str : arry1) {
this.five_index++;
arry2 = str.split("\\|");
label = new Label(0, this.five_index, new String(rs.getRow(),
"utf-8"));
this.fiveSheet.addCell(label);
label = new Label(1, this.five_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.fiveSheet.addCell(label);
label = new Label(2, this.five_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.fiveSheet.addCell(label);
label = new Label(5, this.five_index, arry2[1]);
this.fiveSheet.addCell(label);
arry2 = arry2[0].split("_");
label = new Label(3, this.five_index, arry2[0]);
this.fiveSheet.addCell(label);
if(arry2.length<2){
label = new Label(4, this.five_index, "-1");
}else{
label = new Label(4, this.five_index, arry2[1]);
}
this.fiveSheet.addCell(label);
}
}
/**
* 粉丝地域分布
*/
public void sixsheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "diyufenbu".getBytes());
if (tmp == null) {
return;
}
this.fan_str = new String(this.tmp, "utf-8");
if (this.fan_str == null || this.fan_str.indexOf("|") <= 0) {
return;
}
this.arry1 = this.fan_str.split(" ");
for (String str : arry1) {
this.six_index++;
arry2 = str.split("\\|");
label = new Label(0, this.six_index, new String(rs.getRow(),
"utf-8"));
this.sixSheet.addCell(label);
label = new Label(1, this.six_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.sixSheet.addCell(label);
label = new Label(2, this.six_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.sixSheet.addCell(label);
label = new Label(3, this.six_index, arry2[0]);
this.sixSheet.addCell(label);
label = new Label(4, this.six_index, arry2[1]);
this.sixSheet.addCell(label);
}
}
/**
* 粉丝活跃度分布
*/
public void sevensheet(Result rs) throws Exception {
this.tmp = rs.getValue(this.family, "daywbfenbu".getBytes());
if (this.tmp == null) {
return;
}
this.fan_str = new String(this.tmp, "utf-8");
if (this.fan_str == null || this.fan_str.indexOf("|") <= 0) {
return;
}
this.arry1 = this.fan_str.split(" ");
for (String str : arry1) {
this.seven_index++;
arry2 = str.split("\\|");
label = new Label(0, this.seven_index, new String(rs.getRow(),
"utf-8"));
this.sevenSheet.addCell(label);
label = new Label(1, this.seven_index, new String(rs.getValue(
this.family, "nickName".getBytes()), "utf-8"));
this.sevenSheet.addCell(label);
label = new Label(2, this.seven_index, new String(rs.getValue(
this.family, "address".getBytes()), "utf-8"));
this.sevenSheet.addCell(label);
label = new Label(5, this.seven_index, arry2[1]);
this.sevenSheet.addCell(label);
arry2 = arry2[0].split("_");
label = new Label(3, this.seven_index, arry2[0]);
this.sevenSheet.addCell(label);
if(arry2.length<2){
label = new Label(4, this.seven_index, "-1");
}else{
label = new Label(4, this.seven_index, arry2[1]);
}
this.sevenSheet.addCell(label);
}
}
private void closeExcel() {
try {
if (this.wokbook != null) {
this.wokbook.write();
this.wokbook.close();
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
public void exportExcel() {
HTable htable = getHtable(FanExcel.TABLE_NAME);
Scan scan = new Scan();
Result rs = null;
int n =0;
int n2=0;
try {
ResultScanner rscan = htable.getScanner(scan);
Iterator<Result> it = rscan.iterator();
while (it.hasNext()) {
rs = it.next();
if (rs == null || rs.isEmpty()) {
continue;
}
this.oneSheet(rs);
this.twoSheet(rs);
this.threeSheet(rs);
this.foursheet(rs);
this.fivesheet(rs);
this.sixsheet(rs);
this.sevensheet(rs);
n2++;
n++;
if(n==500){
System.out.println("重新初始化操作!");
this.closeExcel();
this.init(false);
}
}
} catch (Exception ex) {
log.error(new String(rs.getRow()));
log.error(ex.getMessage(), ex);
} finally {
System.out.println("写入记录数:"+n2);
System.out.println("sheet1:"+this.one_index);
System.out.println("sheet2:"+this.two_index);
System.out.println("sheet3:"+this.three_index);
System.out.println("sheet4:"+this.four_index);
System.out.println("sheet5:"+this.five_index);
System.out.println("sheet6:"+this.six_index);
System.out.println("sheet7:"+this.seven_index);
closeExcel();
}
}
public static void main(String arg[]) {
FanExcel fanexcel = FanExcel.getFanExcel();
System.out.println("开始导出excel数据:");
fanexcel.exportExcel();
System.out.println("结束导出excel数据:");
}
}