`
fwgforce
  • 浏览: 10076 次
  • 性别: Icon_minigender_1
  • 来自: 中国
最近访客 更多访客>>
社区版块
存档分类
最新评论

POI导入EXCLE,支持2003和2007

阅读更多

POI导入EXCLE,支持2003和2007

作者:fwgforce

[本文原创]

一.目的:实现将EXCEL的数据插入到数据库的一张表中

 1,例子POJO

 

import java.util.Date;
import java.math.BigDecimal;

/**
 * Enterprise entity.
 * 
 * @author fwgforce
 */

@SuppressWarnings("serial")
public class Enterprise implements java.io.Serializable {

	private String EName;// 企业名称
	private String ERegNo;// 注册号
	private String EManager;// 负责人
	private Date ESetupDate;// 成立日期
	private BigDecimal ERegisteredCapital;// 注册资金
	private String EAddress;// 住所地址
	private String ETel;// 电话
	private String EBusinessScope;// 经营范围
	private Date EStartDate;// 营业日期(起)
	private Date EEndDate;// 营业日期(止)
	private String ETrade;// 所属行业
	private String ETradeNo;// 行业编码
	private String ERegGov;// 登记机关
	private String EManageGov;// 管辖机关
	private String EBusinessPlace;// 工商所
	private Date EConfirmDate;// 核准日期
	private String EType;// 企业类型(市局)
	private String EState;// 企业状态(市局)
	private String EBusinessPlaceMemo;// 工商所备注
	private String EHotTrade;// 重热点行业
	private String ESupplierType;// 经营户类别
	private Date EAdddate;// 加入日期
	private Date EUpdatedate;// 更新日期
	private String ERoomNo;// 楼层房间号
	private String ELinkman;// 联系人
	private String ELinkTel;// 联系电话
	private String EPlaceType;// 住所管理分类
	private String EPlaceMark;// 住所标注
	private String ERealityAddress;// 实际经营地址
	private String ERealityTel;// 实际联系电话
	private String ERealityType;// 实际经营地分类
	private String ERealityStatus;// 实际经营地状况
	private String ERealityBuilding;// 实际经营地所在写字楼
	private String ERealityArea;// 实际经营地面积
	private String ERealityReason;// 异地经营原因
	private String ERealityMemo;// 异地经营备注
	private BigDecimal ERealityIncome;// 实收资本
	private String EType2;// 企业类型
	private String EProperties;// 经营主体性质
	private String EPermision;// 前置许可
	private String ETradeType;// 行业分类
	private String e3mark;// 三区标注
	private String ERegionName;// 园区名称
	private String ETaxGov;// 缴税机关名称
	private String EZentLimit;// 租赁协议期限
	private String EPlaceStatus;// 住所状态
	private String EFoodSafe;// 食品安全监管
	private String EImportantRegion;// 重点地域
	private String EAd;// 广告情况
	private String ELogo;// 商标情况
	private String EBName;// 住所写字楼
	private String CreditLevel;// 信用等级
	private String ManagerWidth;// 责任区(管片)
	private String BusinessLogo;// 业务标志
	private String isOff;// 是否已注销;已注销为 "是";不是已注销为 "否"
	private String isSimpleEnt;// 是否是异地注册/经营企业;如果是异地注册/经营则为 是, 如果不是 则为否
	private String INCEntDate;// 新增日期
	private String DECEntDate;// 注销日期
	private String ENumber;// 税号
	private String isNullENumber;// 税号是否为空,警告。为空 "是",不为空 "否"
	private String isDeleteYet;// 企业是否已清除,已清除 "是",未清除 "否";
	private Date EDate;// 做表信息导入时间
	private Integer EId;
	private Integer TSid;
	private Integer EBId;

	// 日期字符串
	private String ESetupDateStr;
	private String EConfirmDateStr;
	private String EStartDateStr;
	private String EEndDateStr;
	private String EAdddateStr;
	private String EUpdatedateStr;

	// public Enterprise(String name, String regNo, String manager,
	// Date setupDate, BigDecimal registeredCapital, String address,
	// String tel, String businessScope, Date startDate, Date endDate,
	// String trade, String tradeNo, String regGov, String manageGov,
	// String businessPlace, Date confirmDate, String type, String state,
	// String businessPlaceMemo, String hotTrade, String supplierType,
	// Date adddate, Date updatedate, String roomNo, String linkman,
	// String linkTel, String placeType, String placeMark,
	// String realityAddress, String realityTel, String realityType,
	// String realityStatus, String realityBuilding, String realityArea,
	// String realityReason, String realityMemo, BigDecimal realityIncome,
	// String type2, String properties, String permision,
	// String tradeType, String e3mark, String regionName, String taxGov,
	// String zentLimit, String placeStatus, String foodSafe,
	// String importantRegion, String ad, String logo, String name2,
	// Date date) {
	// super();
	// EName = name;
	// ERegNo = regNo;
	// EManager = manager;
	// ESetupDate = setupDate;
	// ERegisteredCapital = registeredCapital;
	// EAddress = address;
	// ETel = tel;
	// EBusinessScope = businessScope;
	// EStartDate = startDate;
	// EEndDate = endDate;
	// ETrade = trade;
	// ETradeNo = tradeNo;
	// ERegGov = regGov;
	// EManageGov = manageGov;
	// EBusinessPlace = businessPlace;
	// EConfirmDate = confirmDate;
	// EType = type;
	// EState = state;
	// EBusinessPlaceMemo = businessPlaceMemo;
	// EHotTrade = hotTrade;
	// ESupplierType = supplierType;
	// EAdddate = adddate;
	// EUpdatedate = updatedate;
	// ERoomNo = roomNo;
	// ELinkman = linkman;
	// ELinkTel = linkTel;
	// EPlaceType = placeType;
	// EPlaceMark = placeMark;
	// ERealityAddress = realityAddress;
	// ERealityTel = realityTel;
	// ERealityType = realityType;
	// ERealityStatus = realityStatus;
	// ERealityBuilding = realityBuilding;
	// ERealityArea = realityArea;
	// ERealityReason = realityReason;
	// ERealityMemo = realityMemo;
	// ERealityIncome = realityIncome;
	// EType2 = type2;
	// EProperties = properties;
	// EPermision = permision;
	// ETradeType = tradeType;
	// this.e3mark = e3mark;
	// ERegionName = regionName;
	// ETaxGov = taxGov;
	// EZentLimit = zentLimit;
	// EPlaceStatus = placeStatus;
	// EFoodSafe = foodSafe;
	// EImportantRegion = importantRegion;
	// EAd = ad;
	// ELogo = logo;
	// EBName = name2;
	// EDate = date;
	// }

	public Enterprise(String name, String regNo, String manager,
			Date setupDate, BigDecimal registeredCapital, String address,
			String tel, String businessScope, Date startDate, Date endDate,
			String trade, String tradeNo, String regGov, String manageGov,
			String businessPlace, Date confirmDate, String type, String state,
			String businessPlaceMemo, String hotTrade, String supplierType,
			Date adddate, Date updatedate, String roomNo, String linkman,
			String linkTel, String placeType, String placeMark,
			String realityAddress, String realityTel, String realityType,
			String realityStatus, String realityBuilding, String realityArea,
			String realityReason, String realityMemo, BigDecimal realityIncome,
			String type2, String properties, String permision,
			String tradeType, String e3mark, String regionName, String taxGov,
			String zentLimit, String placeStatus, String foodSafe,
			String importantRegion, String ad, String logo, String name2,
			String creditLevel, String managerWidth, String businessLogo,
			String isOff, String isSimpleEnt, String entDate, String entDate2,
			String number, String isNullENumber, String isDeleteYet, Date date,
			Integer id, Integer sid, Integer id2) {
		super();
		EName = name;
		ERegNo = regNo;
		EManager = manager;
		ESetupDate = setupDate;
		ERegisteredCapital = registeredCapital;
		EAddress = address;
		ETel = tel;
		EBusinessScope = businessScope;
		EStartDate = startDate;
		EEndDate = endDate;
		ETrade = trade;
		ETradeNo = tradeNo;
		ERegGov = regGov;
		EManageGov = manageGov;
		EBusinessPlace = businessPlace;
		EConfirmDate = confirmDate;
		EType = type;
		EState = state;
		EBusinessPlaceMemo = businessPlaceMemo;
		EHotTrade = hotTrade;
		ESupplierType = supplierType;
		EAdddate = adddate;
		EUpdatedate = updatedate;
		ERoomNo = roomNo;
		ELinkman = linkman;
		ELinkTel = linkTel;
		EPlaceType = placeType;
		EPlaceMark = placeMark;
		ERealityAddress = realityAddress;
		ERealityTel = realityTel;
		ERealityType = realityType;
		ERealityStatus = realityStatus;
		ERealityBuilding = realityBuilding;
		ERealityArea = realityArea;
		ERealityReason = realityReason;
		ERealityMemo = realityMemo;
		ERealityIncome = realityIncome;
		EType2 = type2;
		EProperties = properties;
		EPermision = permision;
		ETradeType = tradeType;
		this.e3mark = e3mark;
		ERegionName = regionName;
		ETaxGov = taxGov;
		EZentLimit = zentLimit;
		EPlaceStatus = placeStatus;
		EFoodSafe = foodSafe;
		EImportantRegion = importantRegion;
		EAd = ad;
		ELogo = logo;
		EBName = name2;
		CreditLevel = creditLevel;
		ManagerWidth = managerWidth;
		BusinessLogo = businessLogo;
		this.isOff = isOff;
		this.isSimpleEnt = isSimpleEnt;
		INCEntDate = entDate;
		DECEntDate = entDate2;
		ENumber = number;
		this.isNullENumber = isNullENumber;
		this.isDeleteYet = isDeleteYet;
		EDate = date;
		EId = id;
		TSid = sid;
		EBId = id2;
	}

	/** default constructor */
	public Enterprise() {
	}

	public Enterprise(Integer id) {
		this.EId = id;
	}

	public Enterprise(String etrade, Long count) {
	}

	// EId,EName,building,EManager,ETrade,ERegisteredCapital,EType2,ELinkman,ETel
	public Enterprise(Integer id, String name, String ebname, String manager,
			String trade, BigDecimal registeredcapital, String linkman,
			String tel) {
		this.EId = id;
		this.EName = name;
		this.EBName = ebname;
		this.EManager = manager;
		this.ETrade = trade;
		this.ERegisteredCapital = registeredcapital;
		this.ELinkman = linkman;
		this.ETel = tel;

	}

	public Enterprise(Integer id,Integer ebid, String name, String ebname, String trade,
			BigDecimal registeredcapital, String eRegNo, String eBusinessScope,
			String eNumber, String isDeleteYet, String isNullENumber,
			String ERealityBuilding, String ERealityAddress) {
		this.EId = id;
		this.EBId = ebid;
		this.EName = name;
		this.EBName = ebname;
		this.ETrade = trade;
		this.ERegisteredCapital = registeredcapital;
		this.ERegNo = eRegNo;
		this.EBusinessScope = eBusinessScope;
		this.ENumber = eNumber;
		this.isDeleteYet = isDeleteYet;
		this.isNullENumber = isNullENumber;
		this.ERealityBuilding = ERealityBuilding;
		this.ERealityAddress = ERealityAddress;

	}

	// 异地
	public Enterprise(Integer id, String name, String ebname, String address,
			String eRegNo, String eNumber, String isDeleteYet,
			String isNullENumber, String ERealityBuilding,
			String ERealityAddress) {
		this.EId = id;
		this.EName = name;
		this.EBName = ebname;
		this.ERegNo = eRegNo;
		this.EAddress = address;
		this.ENumber = eNumber;
		this.isDeleteYet = isDeleteYet;
		this.isNullENumber = isNullENumber;
		this.ERealityBuilding = ERealityBuilding;
		this.ERealityAddress = ERealityAddress;

	}

	public Integer getEId() {
		return this.EId;
	}

	public void setEId(Integer EId) {
		this.EId = EId;
	}

	public String getEName() {
		return this.EName;
	}

	public void setEName(String EName) {
		this.EName = EName;
	}

	public String getERegNo() {
		return this.ERegNo;
	}

	public void setERegNo(String ERegNo) {
		this.ERegNo = ERegNo;
	}

	public String getEManager() {
		return this.EManager;
	}

	public void setEManager(String EManager) {
		this.EManager = EManager;
	}

	public Date getESetupDate() {
		return this.ESetupDate;
	}

	public void setESetupDate(Date ESetupDate) {
		this.ESetupDate = ESetupDate;
	}

	public BigDecimal getERegisteredCapital() {
		return this.ERegisteredCapital;
	}

	public void setERegisteredCapital(BigDecimal ERegisteredCapital) {
		this.ERegisteredCapital = ERegisteredCapital;
	}

	public String getEAddress() {
		return this.EAddress;
	}

	public void setEAddress(String EAddress) {
		this.EAddress = EAddress;
	}

	public String getETel() {
		return this.ETel;
	}

	public void setETel(String ETel) {
		this.ETel = ETel;
	}

	public String getEBusinessScope() {
		return this.EBusinessScope;
	}

	public void setEBusinessScope(String EBusinessScope) {
		this.EBusinessScope = EBusinessScope;
	}

	public Date getEStartDate() {
		return this.EStartDate;
	}

	public void setEStartDate(Date EStartDate) {
		this.EStartDate = EStartDate;
	}

	public Date getEEndDate() {
		return this.EEndDate;
	}

	public void setEEndDate(Date EEndDate) {
		this.EEndDate = EEndDate;
	}

	public String getETrade() {
		return this.ETrade;
	}

	public void setETrade(String ETrade) {
		this.ETrade = ETrade;
	}

	public String getETradeNo() {
		return this.ETradeNo;
	}

	public void setETradeNo(String ETradeNo) {
		this.ETradeNo = ETradeNo;
	}

	public String getERegGov() {
		return this.ERegGov;
	}

	public void setERegGov(String ERegGov) {
		this.ERegGov = ERegGov;
	}

	public String getEManageGov() {
		return this.EManageGov;
	}

	public void setEManageGov(String EManageGov) {
		this.EManageGov = EManageGov;
	}

	public String getEBusinessPlace() {
		return this.EBusinessPlace;
	}

	public void setEBusinessPlace(String EBusinessPlace) {
		this.EBusinessPlace = EBusinessPlace;
	}

	public Date getEConfirmDate() {
		return this.EConfirmDate;
	}

	public void setEConfirmDate(Date EConfirmDate) {
		this.EConfirmDate = EConfirmDate;
	}

	public String getEType() {
		return this.EType;
	}

	public void setEType(String EType) {
		this.EType = EType;
	}

	public String getEState() {
		return this.EState;
	}

	public void setEState(String EState) {
		this.EState = EState;
	}

	public String getEBusinessPlaceMemo() {
		return this.EBusinessPlaceMemo;
	}

	public void setEBusinessPlaceMemo(String EBusinessPlaceMemo) {
		this.EBusinessPlaceMemo = EBusinessPlaceMemo;
	}

	public String getEHotTrade() {
		return this.EHotTrade;
	}

	public void setEHotTrade(String EHotTrade) {
		this.EHotTrade = EHotTrade;
	}

	public String getESupplierType() {
		return this.ESupplierType;
	}

	public void setESupplierType(String ESupplierType) {
		this.ESupplierType = ESupplierType;
	}

	public Date getEAdddate() {
		return this.EAdddate;
	}

	public void setEAdddate(Date EAdddate) {
		this.EAdddate = EAdddate;
	}

	public Date getEUpdatedate() {
		return this.EUpdatedate;
	}

	public void setEUpdatedate(Date EUpdatedate) {
		this.EUpdatedate = EUpdatedate;
	}

	public String getERoomNo() {
		return this.ERoomNo;
	}

	public void setERoomNo(String ERoomNo) {
		this.ERoomNo = ERoomNo;
	}

	public String getELinkman() {
		return this.ELinkman;
	}

	public void setELinkman(String ELinkman) {
		this.ELinkman = ELinkman;
	}

	public String getELinkTel() {
		return this.ELinkTel;
	}

	public void setELinkTel(String ELinkTel) {
		this.ELinkTel = ELinkTel;
	}

	public String getEPlaceType() {
		return this.EPlaceType;
	}

	public void setEPlaceType(String EPlaceType) {
		this.EPlaceType = EPlaceType;
	}

	public String getEPlaceMark() {
		return this.EPlaceMark;
	}

	public void setEPlaceMark(String EPlaceMark) {
		this.EPlaceMark = EPlaceMark;
	}

	public String getERealityAddress() {
		return this.ERealityAddress;
	}

	public void setERealityAddress(String ERealityAddress) {
		this.ERealityAddress = ERealityAddress;
	}

	public String getERealityTel() {
		return this.ERealityTel;
	}

	public void setERealityTel(String ERealityTel) {
		this.ERealityTel = ERealityTel;
	}

	public String getERealityType() {
		return this.ERealityType;
	}

	public void setERealityType(String ERealityType) {
		this.ERealityType = ERealityType;
	}

	public String getERealityStatus() {
		return this.ERealityStatus;
	}

	public void setERealityStatus(String ERealityStatus) {
		this.ERealityStatus = ERealityStatus;
	}

	public String getERealityBuilding() {
		return this.ERealityBuilding;
	}

	public void setERealityBuilding(String ERealityBuilding) {
		this.ERealityBuilding = ERealityBuilding;
	}

	public String getERealityArea() {
		return this.ERealityArea;
	}

	public void setERealityArea(String ERealityArea) {
		this.ERealityArea = ERealityArea;
	}

	public String getERealityReason() {
		return this.ERealityReason;
	}

	public void setERealityReason(String ERealityReason) {
		this.ERealityReason = ERealityReason;
	}

	public String getERealityMemo() {
		return this.ERealityMemo;
	}

	public void setERealityMemo(String ERealityMemo) {
		this.ERealityMemo = ERealityMemo;
	}

	public BigDecimal getERealityIncome() {
		return this.ERealityIncome;
	}

	public void setERealityIncome(BigDecimal ERealityIncome) {
		this.ERealityIncome = ERealityIncome;
	}

	public String getEType2() {
		return this.EType2;
	}

	public void setEType2(String EType2) {
		this.EType2 = EType2;
	}

	public String getEProperties() {
		return this.EProperties;
	}

	public void setEProperties(String EProperties) {
		this.EProperties = EProperties;
	}

	public String getEPermision() {
		return this.EPermision;
	}

	public void setEPermision(String EPermision) {
		this.EPermision = EPermision;
	}

	public String getETradeType() {
		return this.ETradeType;
	}

	public void setETradeType(String ETradeType) {
		this.ETradeType = ETradeType;
	}

	public String getE3mark() {
		return this.e3mark;
	}

	public void setE3mark(String e3mark) {
		this.e3mark = e3mark;
	}

	public String getERegionName() {
		return this.ERegionName;
	}

	public void setERegionName(String ERegionName) {
		this.ERegionName = ERegionName;
	}

	public String getETaxGov() {
		return this.ETaxGov;
	}

	public void setETaxGov(String ETaxGov) {
		this.ETaxGov = ETaxGov;
	}

	public String getEZentLimit() {
		return this.EZentLimit;
	}

	public void setEZentLimit(String EZentLimit) {
		this.EZentLimit = EZentLimit;
	}

	public String getEPlaceStatus() {
		return this.EPlaceStatus;
	}

	public void setEPlaceStatus(String EPlaceStatus) {
		this.EPlaceStatus = EPlaceStatus;
	}

	public String getEFoodSafe() {
		return this.EFoodSafe;
	}

	public void setEFoodSafe(String EFoodSafe) {
		this.EFoodSafe = EFoodSafe;
	}

	public String getEImportantRegion() {
		return this.EImportantRegion;
	}

	public void setEImportantRegion(String EImportantRegion) {
		this.EImportantRegion = EImportantRegion;
	}

	public String getEAd() {
		return this.EAd;
	}

	public void setEAd(String EAd) {
		this.EAd = EAd;
	}

	public String getELogo() {
		return this.ELogo;
	}

	public void setELogo(String ELogo) {
		this.ELogo = ELogo;
	}

	public String getEBName() {
		return EBName;
	}

	public void setEBName(String ebname) {
		EBName = ebname;
	}

	public String getINCEntDate() {
		return INCEntDate;
	}

	public void setINCEntDate(String entDate) {
		INCEntDate = entDate;
	}

	public String getDECEntDate() {
		return DECEntDate;
	}

	public void setDECEntDate(String entDate) {
		DECEntDate = entDate;
	}

	public String getIsSimpleEnt() {
		return isSimpleEnt;
	}

	public void setIsSimpleEnt(String isSimpleEnt) {
		this.isSimpleEnt = isSimpleEnt;
	}

	public String getCreditLevel() {
		return CreditLevel;
	}

	public void setCreditLevel(String creditLevel) {
		CreditLevel = creditLevel;
	}

	public String getManagerWidth() {
		return ManagerWidth;
	}

	public void setManagerWidth(String managerWidth) {
		ManagerWidth = managerWidth;
	}

	public String getBusinessLogo() {
		return BusinessLogo;
	}

	public void setBusinessLogo(String businessLogo) {
		BusinessLogo = businessLogo;
	}

	public String getIsOff() {
		return isOff;
	}

	public void setIsOff(String isOff) {
		this.isOff = isOff;
	}

	public Integer getEBId() {
		return EBId;
	}

	public void setEBId(Integer id) {
		EBId = id;
	}

	public Integer getTSid() {
		return TSid;
	}

	public void setTSid(Integer sid) {
		TSid = sid;
	}

	public Date getEDate() {
		return EDate;
	}

	public void setEDate(Date date) {
		EDate = date;
	}

	public String getESetupDateStr() {
		return ESetupDateStr;
	}

	public void setESetupDateStr(String setupDateStr) {
		ESetupDateStr = setupDateStr;
	}

	public String getEConfirmDateStr() {
		return EConfirmDateStr;
	}

	public void setEConfirmDateStr(String confirmDateStr) {
		EConfirmDateStr = confirmDateStr;
	}

	public String getEStartDateStr() {
		return EStartDateStr;
	}

	public void setEStartDateStr(String startDateStr) {
		EStartDateStr = startDateStr;
	}

	public String getEEndDateStr() {
		return EEndDateStr;
	}

	public void setEEndDateStr(String endDateStr) {
		EEndDateStr = endDateStr;
	}

	public String getEAdddateStr() {
		return EAdddateStr;
	}

	public void setEAdddateStr(String adddateStr) {
		EAdddateStr = adddateStr;
	}

	public String getEUpdatedateStr() {
		return EUpdatedateStr;
	}

	public void setEUpdatedateStr(String updatedateStr) {
		EUpdatedateStr = updatedateStr;
	}

	public String getENumber() {
		return ENumber;
	}

	public void setENumber(String number) {
		ENumber = number;
	}

	public String getIsNullENumber() {
		return isNullENumber;
	}

	public void setIsNullENumber(String isNullENumber) {
		this.isNullENumber = isNullENumber;
	}

	public String getIsDeleteYet() {
		return isDeleteYet;
	}

	public void setIsDeleteYet(String isDeleteYet) {
		this.isDeleteYet = isDeleteYet;
	}

}

2.Enterprise.hbm.xml配置如下:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.btwob.squall.bmis.model.Enterprise" table="Enterprise">
        <id name="EId" type="java.lang.Integer">
            <column name="E_ID" />
            <generator class="identity" />
        </id>
        <property name="TSid" type="java.lang.Integer">
            <column name="T_SID"/>
        </property>
         <property name="EBId" type="java.lang.Integer">
            <column name="E_BID"/>
        </property>
        <property name="EBName" type="java.lang.String">
            <column name="E_BName" length="100" />
        </property>
        <property name="EName" type="java.lang.String">
            <column name="E_Name" length="100" />
        </property>
        <property name="ERegNo" type="java.lang.String">
            <column name="E_RegNo" length="100" />
        </property>
        <property name="EManager" type="java.lang.String">
            <column name="E_Manager" length="50" />
        </property>
        <property name="ESetupDate" type="java.util.Date" >
            <column name="E_SetupDate" length="23" />
        </property>
        <property name="ERegisteredCapital" type="java.math.BigDecimal">
            <column name="E_RegisteredCapital" precision="18" scale="2" />
        </property>
        <property name="EAddress" type="java.lang.String">
            <column name="E_Address" length="255" />
        </property>
        <property name="ETel" type="java.lang.String">
            <column name="E_Tel" length="50" />
        </property>
        <property name="EBusinessScope" type="java.lang.String">
            <column name="E_BusinessScope" length="8000" />
        </property>
        <property name="EStartDate" type="java.util.Date">
            <column name="E_StartDate" length="23" />
        </property>
        <property name="EEndDate" type="java.util.Date">
            <column name="E_EndDate" length="23" />
        </property>
        <property name="ETrade" type="java.lang.String">
            <column name="E_Trade" length="50" />
        </property>
        <property name="ETradeNo" type="java.lang.String">
            <column name="E_TradeNo" length="50" />
        </property>
        <property name="ERegGov" type="java.lang.String">
            <column name="E_RegGov" length="50" />
        </property>
        <property name="EManageGov" type="java.lang.String">
            <column name="E_ManageGov" length="50" />
        </property>
        <property name="EBusinessPlace" type="java.lang.String">
            <column name="E_BusinessPlace" length="50" />
        </property>
        <property name="EConfirmDate" type="java.util.Date">
            <column name="E_ConfirmDate" length="23" />
        </property>
        <property name="EType" type="java.lang.String">
            <column name="E_Type" length="100" />
        </property>
        <property name="EState" type="java.lang.String">
            <column name="E_State" />
        </property>
        <property name="EBusinessPlaceMemo" type="java.lang.String">
            <column name="E_BusinessPlaceMemo" length="200" />
        </property>
        <property name="EHotTrade" type="java.lang.String">
            <column name="E_HotTrade" length="50" />
        </property>
        <property name="ESupplierType" type="java.lang.String">
            <column name="E_SupplierType" length="50" />
        </property>
        <property name="EAdddate" type="java.util.Date">
            <column name="E_Adddate" length="23" />
        </property>
        <property name="EUpdatedate" type="java.util.Date">
            <column name="E_Updatedate" length="23" />
        </property>
        <property name="ERoomNo" type="java.lang.String">
            <column name="E_RoomNo" length="200" />
        </property>
        <property name="ELinkman" type="java.lang.String">
            <column name="E_Linkman" length="50" />
        </property>
        <property name="ELinkTel" type="java.lang.String">
            <column name="E_LinkTel" length="50" />
        </property>
        <property name="EPlaceType" type="java.lang.String">
            <column name="E_PlaceType" length="50" />
        </property>
        <property name="EPlaceMark" type="java.lang.String">
            <column name="E_PlaceMark" length="50" />
        </property>
        <property name="ERealityAddress" type="java.lang.String">
            <column name="E_RealityAddress" length="255" />
        </property>
        <property name="ERealityTel" type="java.lang.String">
            <column name="E_RealityTel" length="50" />
        </property>
        <property name="ERealityType" type="java.lang.String">
            <column name="E_RealityType" length="50" />
        </property>
        <property name="ERealityStatus" type="java.lang.String">
            <column name="E_RealityStatus" length="50" />
        </property>
        <property name="ERealityBuilding" type="java.lang.String">
            <column name="E_RealityBuilding" length="100" />
        </property>
        <property name="ERealityArea" type="java.lang.String">
            <column name="E_RealityArea" length="50" />
        </property>
        <property name="ERealityReason" type="java.lang.String">
            <column name="E_RealityReason" length="100" />
        </property>
        <property name="ERealityMemo" type="java.lang.String">
            <column name="E_RealityMemo" length="200" />
        </property>
        <property name="ERealityIncome" type="java.math.BigDecimal">
            <column name="E_RealityIncome" precision="18" scale="2" />
        </property>
        <property name="EType2" type="java.lang.String">
            <column name="E_Type2" length="50"/>
        </property>
        <property name="EProperties" type="java.lang.String">
            <column name="E_Properties" length="50" />
        </property>
        <property name="EPermision" type="java.lang.String">
            <column name="E_Permision" />
        </property>
        <property name="ETradeType" type="java.lang.String">
            <column name="E_TradeType" length="50" />
        </property>
        <property name="e3mark" type="java.lang.String">
            <column name="E_3Mark" length="50" />
        </property>
        <property name="ERegionName" type="java.lang.String">
            <column name="E_RegionName" length="100" />
        </property>
        <property name="ETaxGov" type="java.lang.String">
            <column name="E_TaxGov" length="100" />
        </property>
        <property name="EZentLimit" type="java.lang.String">
            <column name="E_ZentLimit" length="50" />
        </property>
        <property name="EPlaceStatus" type="java.lang.String">
            <column name="E_PlaceStatus" length="50" />
        </property>
        <property name="EFoodSafe" type="java.lang.String">
            <column name="E_FoodSafe" length="50" />
        </property>
        <property name="EImportantRegion" type="java.lang.String">
            <column name="E_ImportantRegion" length="50" />
        </property>
        <property name="EAd" type="java.lang.String">
            <column name="E_AD" length="100" />
        </property>
        <property name="INCEntDate" type="java.lang.String">
            <column name="INCEntDate" length="100" />
        </property>
          <property name="DECEntDate" type="java.lang.String">
            <column name="DECEntDate" length="100" />
        </property>
         <property name="isSimpleEnt" type="java.lang.String">
            <column name="isSimpleEnt" length="50" />
        </property>
          <property name="CreditLevel" type="java.lang.String">
            <column name="CreditLevel" length="50" />
        </property>
         <property name="ManagerWidth" type="java.lang.String">
            <column name="ManagerWidth" length="50" />
        </property>
         <property name="BusinessLogo" type="java.lang.String">
            <column name="BusinessLogo" length="50" />
        </property>
         <property name="isOff" type="java.lang.String">
            <column name="isOff" length="50" />
        </property>
        <property name="ELogo" type="java.lang.String">
            <column name="E_Logo" length="100" />
        </property>
          <property name="ENumber" type="java.lang.String">
            <column name="E_Number" length="100" />
        </property>
         <property name="isNullENumber" type="java.lang.String">
            <column name="isNullENumber" length="50" />
        </property>
          <property name="isDeleteYet" type="java.lang.String">
            <column name="isDeleteYet" length="50" />
        </property>
        <property name="EDate" type="java.util.Date">
            <column name="E_Date" length="23" />
        </property>
      </class>
</hibernate-mapping>

 

3.公有方法:

import java.io.File;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

/**
 * 对读取数据进行格式处理
 * 
 * @author fwgforce
 * @date 2010-3-3
 * 
 */
public class ChangeMethod {
	/*
	 * 获取Excel表内日期(yyyy-MM-dd)
	 */
	@SuppressWarnings("deprecation")
	public Date getExcelDate(String str) {
		@SuppressWarnings("unused")
		String[] strArray = str.split("-");
		Integer month = Integer.valueOf(getMonth(strArray[1])) - 1;// 获取月
		Integer year = Integer.valueOf(strArray[2]) - 1900;// 获取年
		Date date = new Date(year, month, Integer.valueOf(strArray[0]));// 依据西方日期规则
		return date;
	}

	/*
	 * 将数字月转换成字符串月显示出来
	 */
	public static Integer getMonth(String str) {
		Integer i = 1;
		if (str.equals("二月")) {
			i = 2;
		} else if (str.equals("三月")) {
			i = 3;
		} else if (str.equals("四月")) {
			i = 4;
		} else if (str.equals("五月")) {
			i = 5;
		} else if (str.equals("六月")) {
			i = 6;
		} else if (str.equals("七月")) {
			i = 7;
		} else if (str.equals("八月")) {
			i = 8;
		} else if (str.equals("九月")) {
			i = 9;
		} else if (str.equals("十月")) {
			i = 10;
		} else if (str.equals("十一月")) {
			i = 11;
		} else if (str.equals("十二月")) {
			i = 12;
		}
		return i;
	}

	/*
	 * 数据为空字符串
	 */
	/*
	 * 数据为空字符串
	 */
	@SuppressWarnings("deprecation")
	public String isNullStr(Cell cell) {
		String result = "";
		if (null == cell)
			return result;
		else {
			switch (cell.getCellType()) {
			case Cell.CELL_TYPE_NUMERIC:
				cell.setCellType(1);
				result = cell.getStringCellValue().trim();
				break;
			case Cell.CELL_TYPE_STRING:
				result = cell.getStringCellValue().trim();
				break;

			}
			return result;
		}
	}

	/*
	 * // 公式型求值 @SuppressWarnings("deprecation") public BigDecimal
	 * isBigDecimalVal(Cell cell) { Double result = null; if (null == cell)
	 * return BigDecimal.valueOf(0.00); else { if (Cell.CELL_TYPE_ERROR ==
	 * cell.getCellType()) { result = 0.00; } return BigDecimal.valueOf(result); } }
	 */
	/*
	 * 数据为空Integer
	 */
	@SuppressWarnings( { "deprecation", "deprecation", "unused" })
	public Integer isNullInteger(Cell cell) {
		int result = 0;
		if (null == cell)
			return null;
		else {
			switch (cell.getCellType()) {
			case Cell.CELL_TYPE_NUMERIC:
				String tmpStr = String.valueOf(cell.getNumericCellValue());
				result = Integer.parseInt(tmpStr.substring(0, tmpStr
						.indexOf(".")));
				break;
			case Cell.CELL_TYPE_STRING:
				result = Integer.parseInt(cell.getStringCellValue().trim());
				break;
			}
			return result;
		}
	}

	/*
	 * 数据为空bigDecimal 导出
	 */
	@SuppressWarnings( { "unused", "deprecation" })
	public BigDecimal isNullBigDecimal(Cell cell) {
		Double result = null;
		if (null == cell) {
			return null;
		} else {
			switch (cell.getCellType()) {
			case Cell.CELL_TYPE_NUMERIC:
				if (cell != null) {
					result = cell.getNumericCellValue();
				} else {
					result = 0.00;
				}

				break;
			case Cell.CELL_TYPE_STRING:
				if ("".equals(cell.getStringCellValue().trim())) {
					return null;
				} else {
					result = Double.valueOf(cell.getStringCellValue());
				}
				break;
			case Cell.CELL_TYPE_BLANK:
				result = 0.00;
				break;
			}
			if (null == result) {
				return null;
			} else {
				return BigDecimal.valueOf(result);
			}
		}
	}

	/*
	 * 数据为空bigDecimal 导入
	 */
	@SuppressWarnings( { "unused", "deprecation" })
	public BigDecimal isNullBigDecimalImport(Cell cell) {
		Double result = null;
		if (null == cell)
			return null;
		else {
			switch (cell.getCellType()) {
			case Cell.CELL_TYPE_NUMERIC:
				result = cell.getNumericCellValue();
				break;
			case Cell.CELL_TYPE_STRING:
				if ("".equals(cell.getStringCellValue().trim()))
					return null;
				else
					result = Double.valueOf(cell.getStringCellValue());
				break;
			}
			return BigDecimal.valueOf(result);
		}
	}

	/*
	 * 数据为空bigDecimal 日期 返回String
	 */
	@SuppressWarnings( { "deprecation", "unused" })
	public Date isNullDate(Cell cell) {
		Date result = null;
		if (cell != null) {
			cell.setCellType(1);
			String stringCellValue = cell.getStringCellValue();
			int indexOf = stringCellValue.indexOf(".");
			if (-1 != indexOf) {
				stringCellValue = stringCellValue.substring(0, indexOf);
			}

			boolean date = isDate(stringCellValue);
			if (!date) {
				Long numericCellValue = Long.valueOf(stringCellValue);
				String stringDate = getStringDate(numericCellValue);
				result = Date.valueOf(stringDate);

			} else {
				result = strDate(stringCellValue);
			}

		}

		return result;
	}

	/**
	 * 返回当前月的总天数
	 * 
	 * @author fwgforce
	 * @param year
	 * @param month
	 * @return
	 */
	public String getEndDay(String year, String month) {
		String daycount = null;// 当前月的天数
		Calendar c = Calendar.getInstance();
		c.set(Integer.valueOf(year), 1, 29);
		int m = c.get(Calendar.MONTH) + 1;
		switch (Integer.valueOf(month)) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			daycount = "31";
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			daycount = "30";
			break;
		case 2:
			if (m == 2) {// 判断当前年份是否为闰年
				daycount = "29";
			} else {
				daycount = "28";
			}
			break;
		default:
			break;
		}

		return daycount;
	}

	/**
	 * 对日期进行封装(01-2月-2010转成2010-2-01)
	 * 
	 * @author fwgforce
	 * @param str
	 * @return
	 */
	public String dateStr(String str) {
		String[] strArray = str.split("-");
		String day = strArray[0];// 日
		String month = getMonth(strArray[1]).toString();// 月
		String year = strArray[2];// 年
		String str1;
		if (Integer.valueOf(month) < 10) {
			str1 = year + "-0" + month + "-" + day;
		} else {
			str1 = year + "-" + month + "-" + day;
		}
		return str1;
	}

	/**
	 * 对日期进行封装(2010-1-1转成2010-01-01)
	 * 
	 * @author fwgforce
	 * @param str
	 * @return
	 */
	public String dateStr2(String str) {
		String[] strArray = str.trim().split("-");
		String day = strArray[2];// 日
		String month = strArray[1].toString();// 月
		String year = strArray[0];// 年
		String str1;
		if (Integer.valueOf(month) < 10) {
			str1 = year + "-0" + month + "-" + day;
		} else {
			str1 = year + "-" + month + "-" + day;
		}
		return str1;
	}

	/**
	 * 封装成Date类型
	 * 
	 * @author fwgforce
	 */
	@SuppressWarnings("deprecation")
	public Date strDate(String str) {
		Date date = null;
		if (!str.equals("")) {
			String[] strArray = str.trim().split("-");
			String month = strArray[1].toString();// 月
			String year = strArray[0];// 年
			Integer month2 = Integer.valueOf(month) - 1;// 获取月
			Integer year2 = Integer.valueOf(year) - 1900;// 获取年
			date = new Date(year2, month2, Integer.valueOf(strArray[2]
					.toString()));// 依据西方日期规则
		}
		return date;
	}

	/**
	 * 对excel取出为数字类型的将其转成日期格式例如(2010-3-4 数字为40241,后台读取为40241 ,插入数据库需转成日期格式)
	 * 
	 * @author fwgforce
	 * @param date
	 * @return
	 */
	public String getStringDate(Long date) {
		Calendar c = Calendar.getInstance();
		Long year = 0L;// 需加的年份
		Long dayleft = date;// 总天数
		String datetime = "";// 返回日期
		if (date > 367) {// 相对1900-1-1差额天数
			date = date - 367;
			for (long i = 1;; i++) {
				Long s = i + 1900;
				Integer valueOf = Integer.valueOf(s.toString());
				c.set(valueOf, 1, 29);
				int m = c.get(Calendar.MONTH) + 1;
				if (m == 2) {
					date -= 366;
				} else {
					date -= 365;
				}
				year = i;
				if (date < 0) {
					if (m == 2) {
						dayleft = date + 366;
					} else {
						dayleft = date + 365;
					}
					break;
				}

			}
			Long left = 0L;// 剩余天数
			Long month = 0L;// 需加月份
			for (long j = 1; j < 13; j++) {
				Long daynext = Long.valueOf(getEndDay(year.toString(),
						((Long) j).toString()));
				dayleft -= daynext;
				if (dayleft < 0) {
					month = j - 1;
					left = dayleft + daynext;
					break;
				}

			}
			datetime = ((Long) (1900 + year)).toString() + "-"
					+ ((Long) (1 + month)).toString() + "-"
					+ ((Long) (left + 1)).toString();

		}
		return dateStr2(datetime);
	}

	/**
	 * 判断导入报表日期(年、月)与所选日期是否一致
	 * 
	 * @author fwgforce
	 * 
	 * @param date
	 *            表日期
	 * @param selectyear
	 *            所选年份
	 * @param selectmonth
	 *            所选季度
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public boolean isTrueDate(Date date, String selectyear, String selectquarter) {
		Integer year = date.getYear() + 1900;
		Integer month = date.getMonth() + 1;
		String whichQuarter = isWhichQuarter(month);// 当前月季度
		Integer selectYear = Integer.valueOf(selectyear);
		if (year.equals(selectYear) && whichQuarter.equals(selectquarter)) {
			return true;
		}

		return false;

	}

	/**
	 * 将数字月转换成字符串季度(2转换成"第二季度")
	 * 
	 * @author fwgforce
	 * @param month
	 * @return
	 */
	public String isWhichQuarter(int month) {
		String quarter = "";
		switch (month) {
		case 1:
		case 2:
		case 3:
			quarter = "第一季度";
			break;
		case 4:
		case 5:
		case 6:
			quarter = "第二季度";
			break;
		case 7:
		case 8:
		case 9:
			quarter = "第三季度";
			break;
		case 10:
		case 11:
		case 12:
			quarter = "第四季度";
			break;

		default:
			break;
		}
		return quarter;
	}

	/*	*//**
			 * 判断所导报表与所选单位是否一致
			 * 
			 * @author fwgforce
			 * @param companyName
			 * @param getCellName
			 * @return
			 */
	/*
	 * public boolean isTrueCompanyName(String companyName, String getCellName) {
	 * if (companyName.equals(getCellName)) { return true; } return false; }
	 */

	/**
	 * 判断用户所导报表日期是否和所选日期一致
	 * 
	 * @author fwgforce
	 * @param wb
	 * @param selectyear
	 * @param selectquarter
	 * @return
	 */
	public boolean isTrueQuarter(Workbook wb, String selectyear,
			String selectquarter) {
		boolean right = true;
		for (int i = 0; i < 3; i++) {
			Sheet hssfsheet = wb.getSheetAt(i);
			Row hssfrow = hssfsheet.getRow(1);
			if (hssfrow == null) {// 判断Excel表中是否有数据
				right = false;
				break;
			}
			Date date = isNullDate(hssfrow.getCell((short) 0));// 依据西方日期规则获取时间,getExcelDate方法调用
			boolean trueDate = isTrueDate(date, selectyear, selectquarter);
			if (!trueDate) {// 判断所选年,季度与所导报表年,季度是否一致
				right = false;
				break;
			}
		}

		return right;
	}

	/**
	 * 判断该字符串日期是否为JDBC日期格式
	 * 
	 * @author fwgforce
	 * @param s
	 * @return
	 */
	public boolean isDate(String s) {
		boolean t = false;
		if (s != null && !s.equals("")) {
			String[] split = s.split("-");
			if (split.length > 1) {
				t = true;
			}
		} else if (s == null || s.equals("")) {
			t = true;
		}
		return t;

	}


}

 

 ACTION实现类,具体实现:

 

@SuppressWarnings( { "deprecation", "static-access" })
	public String TaxEnterprise() throws IOException {
		HttpServletRequest request = ServletActionContext.getRequest();

		try {
			// 获取excel 文件
			FileInputStream fis = new FileInputStream(upfile);
			// 通过得到的文件输入流inputstream创建一个Wordbook对象
			Workbook wb = null;
			if (flag) {// true为2007 excel版本
				wb = new XSSFWorkbook(fis);
			} else {// false 为2003 excel版本
				wb = new HSSFWorkbook(fis);
			}
			Sheet hssfsheet = wb.getSheetAt(0);// 第一个工作表
			Row hssfrow = hssfsheet.getRow(0);// 第一行
			ChangeMethod cm = new ChangeMethod();
			if (null == hssfrow) {// 判断Excel表中是否有数据
				request.setAttribute("taxNull", 1);// 空数据
				return Action.ERROR;
			} else {
				// Cell hssfCell = hssfrow.getCell((short) 0);// 获取首行首列的日期元素
				// String str = hssfCell.toString();
				// Date date=cm.getExcelDate(str);//
				// 依据西方日期规则获取时间,getExcelDate方法调用
				// 根据isTrue值判断是否对数据库操作
				// if (date.toString().equals(cm.dateStr(str))) {//判断首行日期是否正确
				int length = 0;

				// 遍历该行所有的行,j表示行数 getPhysicalNumberOfRows行的总数
				for (int j = 1; j < hssfsheet.getPhysicalNumberOfRows()
						+ length; j++) {
					input = j;
					hssfrow = hssfsheet.getRow(j);
					// 判断是否还存在需要导入的数据
					if (null == hssfrow) {
						length++;
						continue;
					}
					// 循环插入当前row的对象属性
					if (!"".equals(hssfrow.getCell((short) 0))) {
						// 企业注册信息表
						String ERegNo = cm.isNullStr((hssfrow
								.getCell((short) 1)));// 注册号
						String EName = cm.isNullStr(hssfrow.getCell((short) 0));// 获取企业名称
						ename = EName;
						Enterprise enterpriseByOne = entService
								.getEnterpriseByNo(EName, ERegNo);
						Enterprise ent = new Enterprise();
						if (null != enterpriseByOne) {
							ent = enterpriseByOne;
						}
						// 如果税表里存在当前月份的税表信息就更新

						ERegNo = cm.isNullStr(hssfrow.getCell((short) 1));// 获取注册号
						String EManager = cm.isNullStr(hssfrow
								.getCell((short) 2));// 获取负责人
						rownumber = 4;
						Date ESetupDate = cm.isNullDate(hssfrow
								.getCell((short) 3));// 获取成立日期
						rownumber = 5;
						BigDecimal ERegisteredCapital = cm
								.isNullBigDecimal(((hssfrow.getCell((short) 4))));// 获取注册资金
						String EAddress = cm.isNullStr(hssfrow
								.getCell((short) 5));// 获取住所地址
						String ETel = cm.isNullStr(hssfrow.getCell((short) 6));// 获取电话
						String EBusinessScope = cm.isNullStr(hssfrow
								.getCell((short) 7));// 获取经营范围
						rownumber = 9;
						Date EStartDate = cm.isNullDate(hssfrow
								.getCell((short) 8));// 获取营业日期(起)
						rownumber = 10;
						Date EEndDate = cm.isNullDate(hssfrow
								.getCell((short) 9));// 营业日期(止)
						String ETrade = cm.isNullStr(hssfrow
								.getCell((short) 10));// 所属行业
						String ETradeNo = cm.isNullStr(hssfrow
								.getCell((short) 11));// 行业编码
						String ERegGov = cm.isNullStr(hssfrow
								.getCell((short) 12));// 登记机关
						String EManageGov = cm.isNullStr(hssfrow
								.getCell((short) 13));// 管辖机关
						String EBusinessPlace = cm.isNullStr(hssfrow
								.getCell((short) 14));// 工商所
						rownumber = 16;
						Date EConfirmDate = cm.isNullDate(hssfrow
								.getCell((short) 15));// 核准日期
						String EType = cm
								.isNullStr(hssfrow.getCell((short) 16));// 企业类型(市局)
						String EState = cm.isNullStr(hssfrow
								.getCell((short) 17));// 企业状态(市局)
						String EBusinessPlaceMemo = cm.isNullStr(hssfrow
								.getCell((short) 18));// 工商所备注
						String EHotTrade = cm.isNullStr(hssfrow
								.getCell((short) 19));// 重热点行业
						String ESupplierType = cm.isNullStr(hssfrow
								.getCell((short) 20));// 经营户类别
						rownumber = 22;
						Date EAdddate = cm.isNullDate(hssfrow
								.getCell((short) 21));// 加入日期
						rownumber = 23;
						Date EUpdatedate = cm.isNullDate(hssfrow
								.getCell((short) 22));// 更新日期
						String EBname = cm.isNullStr(hssfrow
								.getCell((short) 23));// 住所写字楼
						String ERoomNo = cm.isNullStr(hssfrow
								.getCell((short) 24));// 楼层房间号
						String ELinkman = cm.isNullStr(hssfrow
								.getCell((short) 25));// 联系人
						String ELinkTel = cm.isNullStr(hssfrow
								.getCell((short) 26));// 联系电话
						String EPlaceType = cm.isNullStr(hssfrow
								.getCell((short) 27));// 住所管理分类
						String EPlaceMark = cm.isNullStr(hssfrow
								.getCell((short) 28));// 住所标注
						String ERealityAddress = cm.isNullStr(hssfrow
								.getCell((short) 29));// 实际经营地址
						String ERealityTel = cm.isNullStr(hssfrow
								.getCell((short) 30));// 实际联系电话
						String ERealityType = cm.isNullStr(hssfrow
								.getCell((short) 31));// 实际经营地分类
						String ERealityStatus = cm.isNullStr(hssfrow
								.getCell((short) 32));// 实际经营地状况
						String ERealityBuilding = cm.isNullStr(hssfrow
								.getCell((short) 33));// 实际经营地所在写字楼
						String ERealityArea = cm.isNullStr(hssfrow
								.getCell((short) 34));// 实际经营地面积
						String ERealityReason = cm.isNullStr(hssfrow
								.getCell((short) 35));// 异地经营原因
						String ERealityMemo = cm.isNullStr(hssfrow
								.getCell((short) 36));// 异地经营备注
						BigDecimal ERealityIncome = cm
								.isNullBigDecimal((hssfrow.getCell((short) 37)));// 实收资本
						String EType2 = cm.isNullStr(hssfrow
								.getCell((short) 38));// 企业类型
						String EProperties = cm.isNullStr(hssfrow
								.getCell((short) 39));// 经营主体性质
						String EPermision = cm.isNullStr(hssfrow
								.getCell((short) 40));// 前置许可
						String ETradeType = cm.isNullStr(hssfrow
								.getCell((short) 41));// 行业分类
						String e3mark = cm.isNullStr(hssfrow
								.getCell((short) 42));// 三区标注
						String ERegionName = cm.isNullStr(hssfrow
								.getCell((short) 43));// 园区名称
						String ETaxGov = cm.isNullStr(hssfrow
								.getCell((short) 44));// 缴税机关名称
						String EZentLimit = cm.isNullStr(hssfrow
								.getCell((short) 45));// 租赁协议期限
						String EPlaceStatus = cm.isNullStr(hssfrow
								.getCell((short) 46));// 住所状态
						String EFoodSafe = cm.isNullStr(hssfrow
								.getCell((short) 47));// 食品安全监管
						String EImportantRegion = cm.isNullStr(hssfrow
								.getCell((short) 48));// 重点地域
						String EAd = cm.isNullStr(hssfrow.getCell((short) 49));// 广告情况
						String ELogo = cm
								.isNullStr(hssfrow.getCell((short) 50));// 商标情况
						// 插入操作
						ent.setERegNo(ERegNo);
						ent.setE3mark(e3mark);
						ent.setEAd(EAd);
						if (null != EAdddate) {
							ent.setEAdddate(EAdddate);
						}
						ent.setEAddress(EAddress);
						ent.setEBusinessPlace(EBusinessPlace);
						ent.setEBusinessScope(EBusinessScope);
						if (null != EConfirmDate) {
							ent.setEConfirmDate(EConfirmDate);
						}
						if (null != EEndDate) {
							ent.setEEndDate(EEndDate);
						}
						ent.setEFoodSafe(EFoodSafe);
						ent.setEHotTrade(EHotTrade);
						ent.setEImportantRegion(EImportantRegion);
						ent.setELinkman(ELinkman);
						ent.setELinkTel(ELinkTel);
						ent.setELogo(ELogo);
						ent.setEManageGov(EManageGov);
						ent.setEManager(EManager);
						ent.setEName(EName);
						ent.setEPermision(EPermision);
						ent.setEPlaceMark(EPlaceMark);
						ent.setEPlaceStatus(EPlaceStatus);
						ent.setEPlaceType(EPlaceType);
						ent.setEProperties(EProperties);
						ent.setERealityAddress(ERealityAddress);
						ent.setERealityArea(ERealityArea);
						if (ERealityBuilding.equals("台儿庄路6、7号(原9号)")) {
							ERealityBuilding = "六号院创意产业园";
						}
						ent.setERealityBuilding(ERealityBuilding);
						if (null != ERealityIncome) {
							ent.setERealityIncome(ERealityIncome);
						}
						ent.setERealityMemo(ERealityMemo);
						ent.setERealityReason(ERealityReason);
						ent.setERealityStatus(ERealityStatus);
						ent.setERealityTel(ERealityTel);
						ent.setERealityType(ERealityType);
						ent.setERegGov(ERegGov);
						ent.setETel(ETel);
						ent.setETrade(ETrade);
						ent.setETradeNo(ETradeNo);
						ent.setETradeType(ETradeType);
						ent.setEType(EType);
						ent.setEType2(EType2);
						if (null != EUpdatedate) {
							ent.setEUpdatedate(EUpdatedate);
						}
						ent.setEZentLimit(EZentLimit);
						ent.setERegionName(ERegionName);
						if (null != ESetupDate) {
							ent.setESetupDate(ESetupDate);
						}
						if (null != EStartDate) {
							ent.setEStartDate(EStartDate);
						}
						ent.setESupplierType(ESupplierType);
						ent.setEState(EState);
						ent.setEBusinessPlaceMemo(EBusinessPlaceMemo);
						ent.setETaxGov(ETaxGov);
						ent.setERoomNo(ERoomNo);
						if (null != ERegisteredCapital) {
							ent.setERegisteredCapital(ERegisteredCapital);
						}
						ent.setEBName(EBname);
						if (null != ERealityBuilding
								&& !"".equals(ERealityBuilding)) {
							ent.setEBId(taxLicenseService
									.getBuildId(ERealityBuilding));
						} else {
							if (null != EBname && !"".equals(EBname)) {
								ent.setEBId(taxLicenseService
										.getBuildId(EBname));
							}
						}
						ent.setIsSimpleEnt("否");
						ent.setIsOff("否");
						if (null != enterpriseByOne) { // 如果数据库存在该对象则进行更新,否则执行else语句
							entService.updateEnterprise(ent);
						} else {
							entService.addEnterprise(ent);
						}
					}

				}
				return Action.SUCCESS;
			}
		} catch (Exception e) {
			request.setAttribute("importFalse", "taxEnterprise");
			if (input > 0) {
				throw new RuntimeException("第" + (input + 1) + "行,第"
						+ rownumber + "列数据格式有误!企业名称:" + ename + "", e);
			} 
		}
		return Action.SUCCESS;
	}

 

   提供支持03,07通用版本的POI3.6  jar包下载 !

1
2
分享到:
评论

相关推荐

    poi Excle 导入导出

    "poi Excle 导入导出"这个主题主要涉及如何使用Apache POI库在Java中读取和写入Excel文件。以下是对这个主题的详细解释: 1. **Apache POI简介** Apache POI是一个强大的Java API,它允许开发人员创建、修改和显示...

    poi导出和导入Excle使用文档

    POI导入Excel ##### 5.1 Excel导入不同版本的Excel - 导入Excel 2003: - 使用`HSSFWorkbook`类。 - 导入Excel 2007及以上版本: - 使用`XSSFWorkbook`类。 ```java // 导入Excel 2003 InputStream is = new ...

    java poi EXCLE 导入/导出 源代码+数据库建表语句+测试数据

    java poi EXCLE 导入/导出 EXCLE 导入 EXCLE导出 poi 导入/导出 源代码+数据库建表语句+测试数据 mysql下建库表 源代码导入eclipse 直接运行 畅通无阻 OK!!!

    导入excel 导出excle poi3.8 全量包

    在这个"导入excel 导出excle poi3.8 全量包"中,主要关注的是使用POI 3.8版本来操作Excel文件。这个版本的POI提供了一套完整的API,允许开发者在Java环境中读取、写入和修改Excel文件,而无需依赖于Microsoft Office...

    Java 使用poi导入excel 并使用xml做数据验证

    在本项目中,我们结合了POI库和XML技术来实现Excel数据的验证与导入数据库。 首先,Apache POI提供了HSSF和XSSF两个API,分别用于处理老版本的BIFF8格式(.xls)和新版本的OOXML格式(.xlsx)。在这个案例中,我们...

    poi实现excel2003和excel2007导入功能

    标题提到的“poi实现excel2003和excel2007导入功能”是指利用Apache POI库来处理这两种不同版本的Excel文件的导入操作。下面将详细讲解如何使用Apache POI来实现这一功能。 1. **Apache POI简介** Apache POI是一...

    POI导出excle例子+代码+poi文档

    总之,Apache POI是Java开发人员处理Excel文件的得力工具,其丰富的API使得我们可以轻松地实现数据的导入、导出和操作,极大地提升了工作效率。通过深入学习和实践,你可以利用POI构建出符合业务需求的高效Excel解决...

    springboot-poi-Excle.zip

    Apache POI提供了两个主要的API:HSSF(用于处理旧版的.BIFF8 Excel 97-2003格式)和XSSF(用于处理较新的OOXML .xlsx格式)。在这个项目中,我们可能使用了XSSF,因为它是处理.xlsx格式的标准选择。 Spring Boot是...

    java使用poi进行excle读取和输出,myeclipse源码

    XSSF用于处理.xlsx(Excel 2007及以上版本)文件,而HSSF则用于处理.xls(Excel 97-2003)文件。 在使用POI读取Excel文件时,你需要创建一个`Workbook`对象,它是Excel文件的顶级容器。对于.xlsx文件,我们使用`...

    JAVA通过POI读取excle

    Apache POI是一个强大的库,它允许开发者使用Java读取、创建和修改Microsoft Office格式的文件,包括Excel(XLS和XLSX)。本资源提供了使用POI库在Java中读取Excel文件的示例,适用于处理.xlsx和.xls两种格式。 ...

    通用的POI导入Excel解决方案-ExcelUtilTest

    在项目中,经常免不了要导入、导出Excel,导出Excel稍微简单点,制作一张模板,然后将查询之后的数据写入到模板中即可,导出程序可以做到一次写好,基本上就可以通用。 但导入Excel相对麻烦点,一般情况下,导入的...

    java 导入Excel 文件,支持xls、xlsx、csv格式

    综上所述,Java导入Excel文件涉及的关键技术包括Apache POI库的使用,对HSSF和XSSF的理解,以及对CSV文件处理的技巧。通过熟练掌握这些知识,你可以编写出高效且健壮的文件导入程序,满足各种需求。

    POI 完美生成带文字水印的excle

    在Java编程环境中,Apache POI库是一个非常强大的工具,它允许开发者读取、写入和修改Microsoft Office格式的文件,包括Excel(XLS和XLSX)。本教程将深入探讨如何利用Apache POI来创建带有文字水印的Excel文档。 ...

    Excel导入导出 jxl及Poi 工具类

    接下来,我们转向Apache POI,这是一个更加强大的库,它不仅支持Excel(HSSF for .xls, XSSF for .xlsx),还支持Word和PowerPoint。POI提供更丰富和灵活的功能,如下: 1. **创建工作簿**:使用`XSSFWorkbook`...

    poi解析excle

    Apache POI是一个流行的Java库,用于处理Microsoft Office格式的文件,如Excel(.xls和.xlsx)和Word(.doc和.docx)。POI提供了读取、写入以及修改这些文件的功能。在企业级应用开发中,经常需要用到POI来实现数据...

    poi 自己写的excel sax方式导入大量数据

    以下是一些关于使用Apache POI的SAX方式导入大量Excel数据的关键知识点: 1. **SAX解析原理**: SAX解析器遵循事件驱动模式,当XML文件中的元素开始、结束、遇到文本等事件时,会触发相应的回调函数。对于Excel...

    java导入excle详解

    1. **Apache POI**:Apache POI是Apache软件基金会的一个项目,专注于在Java中读写Microsoft Office格式的文件,如Excel(.xls和.xlsx)、Word和PowerPoint等。它是最成熟且功能全面的库,支持创建、读取和修改...

    POI操作EXCLE

    在Java开发中,Apache POI库是一个非常实用的工具,它允许程序员操作Microsoft Office格式的文件,特别是Excel(.xlsx和.xls)文件。本篇将详细介绍如何使用POI库进行Excel的操作,包括读取和写入数据,尤其适用于...

    poi 生成excel模板,下拉选项,批注。现在有模板中插入下拉信息

    在这个场景中,我们将讨论如何使用 POI 在 Java 中生成带有下拉选项和批注的 Excel 模板。 首先,我们需要理解 POI 的核心组件,如 HSSFWorkbook(用于 .xls 文件)和 XSSFWorkbook(用于 .xlsx 文件)。这些工作簿...

    Mysql导入到excle中jsp

    在IT行业中,数据的处理和迁移是常见的任务...总的来说,"Mysql导入到excle中jsp"是一个融合了数据库操作、文件处理和Web开发技术的综合应用实例。通过这样的实践,开发者可以提升在数据交互和Web服务开发方面的能力。

Global site tag (gtag.js) - Google Analytics