自己做过的excel导入

package com.topsuntech.gUnit_hbyf.gEU_so.framework.actions;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.topsuntech.gOS.query.TSDBException;
import com.topsuntech.gOS.user.en.user.User;
import com.topsuntech.gOS.user.session.UserSession;
import com.topsuntech.gUnit.gEU_util.framework.actions.BaseAction;
import com.topsuntech.gUnit.gEU_util.tools.Constants;
import com.topsuntech.gUnit.gEU_util.tools.Dicts;
import com.topsuntech.gUnit.gEU_util.tools.Tools;
import com.topsuntech.gUnit.gEU_util.vo.AreaInfo;
import com.topsuntech.gUnit_hbyf.gEU_so.entity.ApSpecObjHealthCare;
import com.topsuntech.gUnit_hbyf.gEU_so.entity.ApSpecObjInfo;
import com.topsuntech.gUnit_hbyf.gEU_so.entity.ApSpecObjLivSources;
import com.topsuntech.gUnit_hbyf.gEU_so.framework.actionForms.ApSpecObjInfoExcelImportForm;
import com.topsuntech.gUnit_hbyf.gEU_so.service.ApSpecObjInfoExcelImportService;
import com.topsuntech.gUnit_hbyf.gEU_so.service.ApSpecObjInfoService;
import com.topsuntech.gUnit_hbyf.gEU_so.service.BaSpecObjInfoService;
import com.topsuntech.gUnit_workflow.service.WfWorkRouteService;
import com.topsuntech.gUnit_workflow.service.vo.WfWorkflowRouteBean;
import com.topsuntech.gUnit_workflow.tools.WorkflowConfig;
import com.topsuntech.gUnit_workflow.tools.WorkflowTools;

@Scope("prototype")
@Controller("/main_hbyf/so/apSpecObjInfoExcelImportAction")
public class ApSpecObjInfoExcelImportAction extends BaseAction {
	@Autowired
	private ApSpecObjInfoExcelImportService apSpecObjInfoExcelImportService;
	@Autowired
	private BaSpecObjInfoService baSpecObjInfoService;
	@Autowired
	private ApSpecObjInfoService apSpecObjInfoService;
	@Autowired
	private WfWorkRouteService wfWorkRouteService;

	/**
	 * 转到伤残认定导入页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * 
	 * @author Auto-Build
	 * 
	 */
	public ActionForward prepScrdImport(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String type = request.getParameter("type");
		request.setAttribute("type", type);
		return mapping.findForward("prepScrdImport");
	};


	/**
	 * 功能:优抚对象伤残认定信息导入
	 * 导入依赖jar 1.jxl.jar 2.commons-fileupload.jar 3.poi-3.9-20121203.jar
	 * 4.poi-ooxml-3.9-20121203.jar 5.poi-ooxml-schemas-3.9-20121203.jar
	 * 
	 * @return
	 */
	public ActionForward importApSpecScrdObjInfo(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		log.info("优待金发放信息导入开始>>>>>>>>>>>>>>>>>>>>>>>>>>...");
		// 所属市和所属区县
		String cityName = "";
		String countyName = "";
		// 所属街道和所属社区
		String streetName = "";
		String communityName = "";
		// 姓名和身份证号
		String name = "";
		String cardNo = "";
		// 民族和出生日期
		String nation = "";
		String birthDate = "";
		// 性别和伤残等级
		String sex = "";
		String deformityLevel = "";
		// 伤残性质和伤残属别
		String deformityProperty = "";
		String deformityProp = "";
		// 婚姻状况和入伍(参加工作)时间
		String marry = "";
		String joinArmyDate = "";
		// 退伍(离退休)时间和劳动能力
		String retireArmyDate = "";
		String laborAbility = "";
		// 生活自理能力和就业情况
		String liveAbility = "";
		String workStatus = "";
		// 户口类型和户口薄上住址类型
		String registerType = "";
		String resideType = "";
		// 工作单位
		String tel = "";
		// 工作单位
		String workOrg = "";
		// 备注
		String remark = "";
		// 户口簿上地址和实际居住地地址
		String registerAddress = "";
		String address = "";
		// 类别信息
		// 对象类别
		String specialObjType = "";
		// 是否精神残疾和是否孤儿
		String isMentalDisability = "";
		String isOrphan = "";
		// 是否孤老和涉核情况
		String isOldAlone = "";
		String isNuclear = "";
		// 伤残时期和伤残情形
		String deformityPeriod = "";
		String deformityCondition = "";
		// 情形描述
		String conditionRemark = "";
		// 生活费来源
		// 生活费合计(元/年)和伤残抚恤金(元/年)
		String totalCostLiving = "";
		String disabilityPension = "";
		// 伤残人员生活补助金(元/年)和护理费(元/年)
		String disabledPersonsLivingGrant = "";
		String careFee = "";
		// 优待金(元/年)和最低生活保障金(元/年)
		String preferentialFee = "";
		String minimumLivingBenefit = "";
		// 低收入家庭补助金(元/年)和一次性抚恤金(元/年)
		String lowIncomeFamiliesSubsidies = "";
		String disposablePension = "";
		// 特别抚恤金(元/年)和建国前老党员补助金(元/年)
		String specialPensions = "";
		String oldPartyGrants = "";
		// 高龄老人社会补助金(元/年)和其他(元/年)
		String elderlySocialGrants = "";
		String other = "";
		// 工资/养老金/离退休费(元/年):合计(元/年)
		String wagesTotal = "";
		// 工资/养老金/离退休费(元/年):工资(元/年)和新农保(元/年)
		String wages = "";
		String newAgriculturalInsurance = "";
		// 工资/养老金/离退休费(元/年):城居保养老金(元/年)和城镇职工基本养老金(元/年)
		String cityInsurancePension = "";
		String basicPensions = "";
		// 工资/养老金/离退休费(元/年):离退休费(元/年)
		String payMoney = "";
		// 账户信息
		// 开户银行账户和开户银行账号
		String bankid = "";
		String bankCard = "";
		// 开户银行名称和开户银行地址
		String bankName = "";
		String bankAddress = "";
		// 生活医疗保障信息
		// 医疗保险
		// 城镇职工基本医疗保险
		String medicalInsurance_1 = "";
		// 城镇居民基本医疗保险
		String medicalInsurance_2 = "";
		// 新型农村合作医疗
		String medicalInsurance_3 = "";
		// 商业保险
		String medicalInsurance_4 = "";
		// 其他保障方式
		// 公费医疗
		String otherSecurityMode_1 = "";
		// 优抚对象医疗减免
		String otherSecurityMode_2 = "";
		// 城乡医疗救助
		String otherSecurityMode_3 = "";
		// 其他
		String otherSecurityMode_4 = "";
		// 养老保障方式
		// 新型农村养老保险
		String medicalSecurityMode_1 = "";
		// 城镇居民养老保险
		String medicalSecurityMode_2 = "";
		// 城镇职工基本养老保险
		String medicalSecurityMode_3 = "";
		// 商业保险
		String medicalSecurityMode_4 = "";
		// 无
		String medicalSecurityMode_5 = "";
		// 医疗保障标准和供养信息
		// 医疗保障体系报销(元/年)和城乡医疗救助(元/年)
		String medicalSecurity = "";
		String ruralMedicalAssistance = "";
		// 优抚对象医疗补助(元/年)和医疗机构减免(元/年)
		String recipientsMedicaid = "";
		String medicalInstitutionsRelief = "";
		// 个人负担(元/年)和医疗费合计(元/年)
		String personalUndertake = "";
		String totalMedicalFee = "";
		// 供养方式
		String supportMode = "";
		// 其他信息
		// 住房信息
		// 房屋性质和房屋情况
		String houseType = "";
		String houseStatus = "";
		// 房屋面积(平米数)和房屋间数
		String houseArea = "";
		String houseCount = "";
		// 家庭情况
		// 家庭总人数和18岁以下人数
		String familySize = "";
		String underAge = "";
		// 60岁以上人数
		String overAge = "";
		//三属关系
		//牺牲者姓名和牺牲病故时间
		String sacrificeName = "";
		String sacrificeDate = "";
		//是否持证人和与牺牲者关系
		String hasCredentials = "";
		String martyrRelation = "";
		//证书编号
		String credentialsCode = "";
		// 是否残疾和是否正在上学
		String isDisability = "";
		String isStudent = "";
		
		final int OFFSET_ROW = 3;
		Long timeBegin = System.currentTimeMillis();
		// 导入文件大小
		// Long fileSize = 0L;
		int i_count = 0; // 累计错误行
		// 设置在线用户信息
		User user = UserSession.getUser(request);
		// 通过user获取各项区域信息
		AreaInfo areaInfo = Dicts.getAreaInfoByUserId(user.getId());
		Long importSuccessCount = new Long(0);
		List<String> msgList = new ArrayList();
		String importmsg = "";
		InputStream inxls = null;
		HSSFWorkbook wb = null;
		// 判断是否存在导入错误信息
		String importerror = "";
		request.setAttribute("type", "scrd");
		try {
			ApSpecObjInfoExcelImportForm recelveForm = (ApSpecObjInfoExcelImportForm) form;
			FormFile file = recelveForm.getFile();
			if (file == null) {
				importmsg = "文件导入错误,不存在导入文件。";
				request.setAttribute("importmsg", importmsg);
				return mapping.findForward("prepScrdImport");
			}

			// 文件输入流
			inxls = file.getInputStream();
			// 创建Excel对象
			wb = new HSSFWorkbook(inxls);
			// 获取第一个工作薄sheet
			HSSFSheet sheet = wb.getSheetAt(0);
			//计算excel公式
			HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(sheet,wb);
			
			// 获取第一行
			boolean title_true = true;
			if (title_true) {
				// 获取最后一行
				int i_num = sheet.getLastRowNum();
				if (i_num > 0) {
						//基本信息
						//直接获取第四行所属市所属区县
						HSSFRow row3 = sheet.getRow(3);
						if (row3 != null) {
							cityName = row3.getCell(3) == null ? "": row3.getCell(3).getStringCellValue(); // 所属市
							countyName = row3.getCell(6) == null ? "": row3.getCell(6).getStringCellValue();// 所属区县
						}
						//第六行所属街道和所属社区
						HSSFRow row6 = sheet.getRow(5);
						if (row6 != null) {
							streetName = row6.getCell(3) == null ? "": row6.getCell(3).getStringCellValue(); // 所属街道
							communityName = row6.getCell(6) == null ? "": row6.getCell(6).getStringCellValue();// 所属社区
						}
						//第八行姓名和身份证号
						HSSFRow row8 = sheet.getRow(7);
						if (row8 != null) {
							name = row8.getCell(3) == null ? "": row8.getCell(3).getStringCellValue(); // 姓名
							cardNo = row8.getCell(6) == null ? "": row8.getCell(6).getStringCellValue();// 身份证号
						}
						//第十行民族和出生日期
						HSSFRow row10 = sheet.getRow(9);
						if (row10 != null) {
							nation = row10.getCell(3) == null ? "": row10.getCell(3).getStringCellValue(); // 民族
							
							birthDate = row10.getCell(6) == null ? "": row10.getCell(6).getStringCellValue();// 出生日期
						}
						//第12行性别和伤残等级
						HSSFRow row12 = sheet.getRow(11);
						if (row12 != null) {
							sex = row12.getCell(3) == null ? "": row12.getCell(3).getStringCellValue(); // 性别
							deformityLevel = row12.getCell(6) == null ? "": row12.getCell(6).getStringCellValue();// 伤残等级
						}
						//第14行伤残性质和伤残属别
						HSSFRow row14 = sheet.getRow(13);
						if (row14 != null) {
							deformityProperty = row14.getCell(3) == null ? "": row14.getCell(3).getStringCellValue(); // 伤残性质
							deformityProp = row14.getCell(6) == null ? "": row14.getCell(6).getStringCellValue();// 伤残属别
						}
						//第16行婚姻状况和入伍(参加工作)时间
						HSSFRow row16 = sheet.getRow(15);
						if (row16 != null) {
							marry = row16.getCell(3) == null ? "": row16.getCell(3).getStringCellValue(); // 婚姻状况
							joinArmyDate = row16.getCell(6) == null ? "": row16.getCell(6).getStringCellValue();// 入伍(参加工作)时间
						}
						//第18行退伍(离退休)时间和劳动能力
						HSSFRow row18 = sheet.getRow(17);
						if (row18 != null) {
							retireArmyDate = row18.getCell(3) == null ? "": row18.getCell(3).getStringCellValue(); // 退伍(离退休)时间
							laborAbility = row18.getCell(6) == null ? "": row18.getCell(6).getStringCellValue();// 劳动能力
						}
						//第20行生活自理能力和就业情况
						HSSFRow row20 = sheet.getRow(19);
						if (row20 != null) {
							liveAbility = row20.getCell(3) == null ? "": row20.getCell(3).getStringCellValue(); // 生活自理能力
							workStatus = row20.getCell(6) == null ? "": row20.getCell(6).getStringCellValue();// 就业情况
						}
						//第22行户口类型和户口薄上住址类型
						HSSFRow row22 = sheet.getRow(21);
						if (row22 != null) {
							registerType = row22.getCell(3) == null ? "": row22.getCell(3).getStringCellValue(); // 户口类型
							resideType = row22.getCell(6) == null ? "": row22.getCell(6).getStringCellValue();// 户口薄上住址类型
						}
						//第24行工作单位
						HSSFRow row24 = sheet.getRow(23);
						if (row24 != null) {
							tel = row24.getCell(3) == null ? "": row24.getCell(3).getStringCellValue(); // 联系电话
						}
						//第26行工作单位
						HSSFRow row26 = sheet.getRow(25);
						if (row26 != null) {
							workOrg = row26.getCell(3) == null ? "": row26.getCell(3).getStringCellValue(); // 工作单位
						}
						//第28行备注
						HSSFRow row28 = sheet.getRow(27);
						if (row28 != null) {
							remark = row28.getCell(3) == null ? "": row28.getCell(3).getStringCellValue(); // 备注
						}
						//第30行户口簿上地址和实际居住地地址
						HSSFRow row30 = sheet.getRow(29);
						if (row30 != null) {
							registerAddress = row30.getCell(3) == null ? "": row30.getCell(3).getStringCellValue(); // 户口簿上地址
							address = row30.getCell(6) == null ? "": row30.getCell(6).getStringCellValue();// 实际居住地地址
						}
						//类别信息
						//第35行对象类别
						HSSFRow row35 = sheet.getRow(34);
						if (row35 != null) {
							specialObjType = row35.getCell(3) == null ? "": row35.getCell(3).getStringCellValue(); // 对象类别
						}
						//第37行是否精神残疾和是否孤儿
						HSSFRow row37 = sheet.getRow(36);
						if (row37 != null) {
							isMentalDisability = row37.getCell(3) == null ? "": row37.getCell(3).getStringCellValue(); // 是否精神残疾
							isOrphan = row37.getCell(6) == null ? "": row37.getCell(6).getStringCellValue();// 是否孤儿
						}
						//第39行是否孤老和涉核情况
						HSSFRow row39 = sheet.getRow(38);
						if (row39 != null) {
							isOldAlone = row39.getCell(3) == null ? "": row39.getCell(3).getStringCellValue(); // 是否孤老
							isNuclear = row39.getCell(6) == null ? "": row39.getCell(6).getStringCellValue();// 涉核情况
						}
						//第41行伤残时期和伤残情形
						HSSFRow row41 = sheet.getRow(40);
						if (row41 != null) {
							deformityPeriod = row41.getCell(3) == null ? "": row41.getCell(3).getStringCellValue(); // 伤残时期
							deformityCondition = row41.getCell(6) == null ? "": row41.getCell(6).getStringCellValue();// 伤残情形
						}
						//第43行情形描述
						HSSFRow row43 = sheet.getRow(42);
						if (row43 != null) {
							conditionRemark = row43.getCell(3) == null ? "": row43.getCell(3).getStringCellValue(); // 情形描述
						}
						
						//生活费来源
						//生活费合计(元/年)和伤残抚恤金(元/年)
						HSSFRow row48 = sheet.getRow(47);
						if (row48 != null) {
						double	totalCostLivingD = (row48.getCell(3) == null ? 0.0: eval.evaluate(row48.getCell(3)).getNumberValue()); // 生活费合计(元/年)
						totalCostLiving	= String.valueOf(totalCostLivingD);
						disabilityPension = row48.getCell(6) == null ? "": row48.getCell(6).getStringCellValue();// 伤残抚恤金(元/年)
						}
						//伤残人员生活补助金(元/年)和护理费(元/年)
						HSSFRow row50 = sheet.getRow(49);
						if (row50 != null) {
							disabledPersonsLivingGrant = row50.getCell(3) == null ? "": row50.getCell(3).getStringCellValue(); // 伤残人员生活补助金(元/年)
							careFee = row50.getCell(6) == null ? "": row50.getCell(6).getStringCellValue();// 护理费(元/年)
						}
						//优待金(元/年)和最低生活保障金(元/年)
						HSSFRow row52 = sheet.getRow(51);
						if (row52 != null) {
							preferentialFee = row52.getCell(3) == null ? "": row52.getCell(3).getStringCellValue(); // 优待金(元/年)
							minimumLivingBenefit = row52.getCell(6) == null ? "": row52.getCell(6).getStringCellValue();//最低生活保障金(元/年)
						}
						//低收入家庭补助金(元/年)和一次性抚恤金(元/年)
						HSSFRow row54 = sheet.getRow(53);
						if (row54 != null) {
							lowIncomeFamiliesSubsidies = row54.getCell(3) == null ? "": row54.getCell(3).getStringCellValue(); // 低收入家庭补助金(元/年)
							disposablePension = row54.getCell(6) == null ? "": row54.getCell(6).getStringCellValue();//一次性抚恤金(元/年)
						}
						//特别抚恤金(元/年)和建国前老党员补助金(元/年)
						HSSFRow row56 = sheet.getRow(55);
						if (row56 != null) {
							specialPensions = row56.getCell(3) == null ? "": row56.getCell(3).getStringCellValue(); // 特别抚恤金(元/年)
							oldPartyGrants = row56.getCell(6) == null ? "": row56.getCell(6).getStringCellValue();//建国前老党员补助金(元/年)
						}
						//高龄老人社会补助金(元/年)和其他(元/年)
						HSSFRow row58 = sheet.getRow(57);
						if (row58 != null) {
							elderlySocialGrants = row58.getCell(3) == null ? "": row58.getCell(3).getStringCellValue(); // 高龄老人社会补助金(元/年)
							other = row58.getCell(6) == null ? "": row58.getCell(6).getStringCellValue();//其他(元/年)
						}
						//工资/养老金/离退休费(元/年):合计(元/年)
						HSSFRow row60 = sheet.getRow(59);
						if (row60 != null) {
							double wagesTotalD = row60.getCell(4) == null ? 0.0: eval.evaluate(row60.getCell(4)).getNumberValue(); // 合计(元/年)
							wagesTotal = String.valueOf(wagesTotalD);
						}
						//工资/养老金/离退休费(元/年):工资(元/年)和新农保(元/年)
						HSSFRow row62 = sheet.getRow(61);
						if (row62 != null) {
							wages = row62.getCell(4) == null ? "": row62.getCell(4).getStringCellValue(); // 工资(元/年)
							newAgriculturalInsurance = row62.getCell(6) == null ? "": row62.getCell(6).getStringCellValue(); // 新农保(元/年)
						}
						//工资/养老金/离退休费(元/年):城居保养老金(元/年)和城镇职工基本养老金(元/年)
						HSSFRow row64 = sheet.getRow(63);
						if (row64 != null) {
							cityInsurancePension = row64.getCell(4) == null ? "": row64.getCell(4).getStringCellValue(); // 城居保养老金(元/年)
							basicPensions = row64.getCell(6) == null ? "": row64.getCell(6).getStringCellValue(); // 城镇职工基本养老金(元/年)
						}
						//工资/养老金/离退休费(元/年):离退休费(元/年)
						HSSFRow row66 = sheet.getRow(65);
						if (row66 != null) {
							payMoney = row66.getCell(4) == null ? "": row66.getCell(4).getStringCellValue(); // 离退休费(元/年)
						}
						
						//账户信息
						//开户银行账户和开户银行账号
						HSSFRow row70 = sheet.getRow(69);
						if (row70 != null) {
							bankid = row70.getCell(3) == null ? "": row70.getCell(3).getStringCellValue(); // 开户银行账户
							bankCard = row70.getCell(6) == null ? "": row70.getCell(6).getStringCellValue(); // 开户银行账号
						}
						//开户银行名称和开户银行地址
						HSSFRow row72 = sheet.getRow(71);
						if (row72 != null) {
							bankName = row72.getCell(3) == null ? "": row72.getCell(3).getStringCellValue(); // 开户银行名称
							bankAddress = row72.getCell(6) == null ? "": row72.getCell(6).getStringCellValue(); // 开户银行地址
						}
						
						//生活医疗保障信息
						//医疗保险
						//城镇职工基本医疗保险
						HSSFRow row77 = sheet.getRow(76);
						if (row77 != null) {
							medicalInsurance_1 = row77.getCell(5) == null ? "": row77.getCell(5).getStringCellValue(); // 城镇职工基本医疗保险
						}
						//城镇居民基本医疗保险
						HSSFRow row79 = sheet.getRow(78);
						if (row79 != null) {
							medicalInsurance_2 = row79.getCell(5) == null ? "": row79.getCell(5).getStringCellValue(); // 城镇职工基本医疗保险
						}
						//新型农村合作医疗
						HSSFRow row81 = sheet.getRow(80);
						if (row81 != null) {
							medicalInsurance_3 = row81.getCell(5) == null ? "": row81.getCell(5).getStringCellValue(); // 新型农村合作医疗
						}
						//商业保险
						HSSFRow row83 = sheet.getRow(82);
						if (row83 != null) {
							medicalInsurance_4 = row83.getCell(5) == null ? "": row83.getCell(5).getStringCellValue(); // 商业保险
						}
						//其他保障方式
						//公费医疗
						HSSFRow row85 = sheet.getRow(84);
						if (row85 != null) {
							otherSecurityMode_1 = row85.getCell(5) == null ? "": row85.getCell(5).getStringCellValue(); // 公费医疗
						}
						//优抚对象医疗减免
						HSSFRow row87 = sheet.getRow(86);
						if (row87 != null) {
							otherSecurityMode_2 = row87.getCell(5) == null ? "": row87.getCell(5).getStringCellValue(); // 优抚对象医疗减免
						}
						//城乡医疗救助
						HSSFRow row89 = sheet.getRow(88);
						if (row89 != null) {
							otherSecurityMode_3 = row89.getCell(5) == null ? "": row89.getCell(5).getStringCellValue(); // 城乡医疗救助
						}
						//其他
						HSSFRow row91 = sheet.getRow(90);
						if (row91 != null) {
							otherSecurityMode_4 = row91.getCell(5) == null ? "": row91.getCell(5).getStringCellValue(); // 其他
						}
						
						//养老保障方式
						//新型农村养老保险
						HSSFRow row93 = sheet.getRow(92);
						if (row93 != null) {
							medicalSecurityMode_1 = row93.getCell(5) == null ? "": row93.getCell(5).getStringCellValue(); // 新型农村养老保险
						}
						//城镇居民养老保险
						HSSFRow row95 = sheet.getRow(94);
						if (row95 != null) {
							medicalSecurityMode_2 = row95.getCell(5) == null ? "": row95.getCell(5).getStringCellValue(); // 城镇居民养老保险
						}
						//城镇职工基本养老保险
						HSSFRow row97 = sheet.getRow(96);
						if (row97 != null) {
							medicalSecurityMode_3 = row97.getCell(5) == null ? "": row97.getCell(5).getStringCellValue(); // 城镇职工基本养老保险
						}
						//商业保险
						HSSFRow row99 = sheet.getRow(98);
						if (row99 != null) {
							medicalSecurityMode_4 = row99.getCell(5) == null ? "": row99.getCell(5).getStringCellValue(); // 商业保险
						}
						//无
						HSSFRow row101 = sheet.getRow(100);
						if (row101 != null) {
							medicalSecurityMode_5 = row99.getCell(5) == null ? "": row101.getCell(5).getStringCellValue(); // 无
						}
						
						//医疗保障标准和供养信息
						//医疗保障体系报销(元/年)和城乡医疗救助(元/年)
						HSSFRow row105 = sheet.getRow(104);
						if (row105 != null) {
							medicalSecurity = row105.getCell(3) == null ? "": row105.getCell(3).getStringCellValue(); // 医疗保障体系报销(元/年)
							ruralMedicalAssistance = row105.getCell(6) == null ? "": row105.getCell(6).getStringCellValue(); // 城乡医疗救助(元/年)
						}
						//优抚对象医疗补助(元/年)和医疗机构减免(元/年)
						HSSFRow row107 = sheet.getRow(106);
						if (row107 != null) {
							recipientsMedicaid = row107.getCell(3) == null ? "": row107.getCell(3).getStringCellValue(); // 优抚对象医疗补助(元/年)
							medicalInstitutionsRelief = row107.getCell(6) == null ? "": row107.getCell(6).getStringCellValue(); // 医疗机构减免(元/年)
						}
						//个人负担(元/年)和医疗费合计(元/年)
						HSSFRow row109 = sheet.getRow(108);
						if (row109 != null) {
							personalUndertake = row109.getCell(3) == null ? "": row109.getCell(3).getStringCellValue(); // 个人负担(元/年)
							double totalMedicalFeeD = row109.getCell(6) == null ? 0.0: eval.evaluate(row109.getCell(6)).getNumberValue(); // 医疗费合计(元/年)
							totalMedicalFee = String.valueOf(totalMedicalFeeD);
						}
						//供养方式
						HSSFRow row111 = sheet.getRow(110);
						if (row111 != null) {
							supportMode = row111.getCell(3) == null ? "": row111.getCell(3).getStringCellValue(); // 供养方式
						}
						
						//其他信息
						//住房信息
						//房屋性质和房屋情况
						HSSFRow row118 = sheet.getRow(117);
						if (row118 != null) {
							houseType = row118.getCell(3) == null ? "": row118.getCell(3).getStringCellValue(); // 房屋性质
							houseStatus = row118.getCell(6) == null ? "": row118.getCell(6).getStringCellValue(); // 房屋情况
						}
						//房屋面积(平米数)和房屋间数
						HSSFRow row120 = sheet.getRow(119);
						if (row120 != null) {
							houseArea = row120.getCell(3) == null ? "": row120.getCell(3).getStringCellValue(); // 房屋面积(平米数)
							houseCount = row120.getCell(6) == null ? "": row120.getCell(6).getStringCellValue(); // 房屋间数
						}
						
						//家庭情况
						//家庭总人数和18岁以下人数
						HSSFRow row124 = sheet.getRow(123);
						if (row124 != null) {
							familySize = row124.getCell(3) == null ? "": row124.getCell(3).getStringCellValue(); // 家庭总人数
							underAge = row124.getCell(6) == null ? "": row124.getCell(6).getStringCellValue(); // 18岁以下人数
						}
						//60岁以上人数
						HSSFRow row126 = sheet.getRow(125);
						if (row126 != null) {
							overAge = row126.getCell(3) == null ? "": row126.getCell(3).getStringCellValue(); // 60岁以上人数
						}
																						
							// 正式导入数据
							try {
								Map<String,String> dqbzMap = new HashMap<String,String>();
								importmsg = import_start(
										 cityName,  countyName,
										 streetName,  communityName,
										 name,  cardNo,
										 nation,  birthDate,
										 sex,  deformityLevel,
										 deformityProperty,  deformityProp,
										 marry,  joinArmyDate, 
										 retireArmyDate,  laborAbility,
										 liveAbility,  workStatus, 
										 registerType,  resideType,
										 tel,  workOrg,
										 remark,  registerAddress,
										 address,  specialObjType,
										 isMentalDisability,  isOrphan,
										 isOldAlone,  isNuclear,
										 deformityPeriod,  deformityCondition,
										 conditionRemark,  totalCostLiving,
										 disabilityPension,  disabledPersonsLivingGrant,
										 careFee,  preferentialFee,
										 minimumLivingBenefit,  lowIncomeFamiliesSubsidies,
										 disposablePension,  specialPensions,
										 oldPartyGrants,  elderlySocialGrants,
										 other,  wagesTotal,
										 wages,  newAgriculturalInsurance,
										 cityInsurancePension,  basicPensions,
										 payMoney,  bankid,
										 bankCard,  bankName,
										 bankAddress,  medicalInsurance_1,
										 medicalInsurance_2,  medicalInsurance_3,
										 medicalInsurance_4,  otherSecurityMode_1,
										 otherSecurityMode_2,  otherSecurityMode_3,
										 otherSecurityMode_4,  medicalSecurityMode_1,
										 medicalSecurityMode_2,  medicalSecurityMode_3,
										 medicalSecurityMode_4,  medicalSecurityMode_5, medicalSecurity,
										 ruralMedicalAssistance,  recipientsMedicaid,
										 medicalInstitutionsRelief,  personalUndertake,
										 totalMedicalFee,  supportMode,
										 houseType,  houseStatus,
										 houseArea,  houseCount,
										 familySize,  underAge,
										 overAge,importmsg,
										 isDisability,isStudent,
										 sacrificeName,sacrificeDate,
										 hasCredentials,martyrRelation,
										 credentialsCode,request,"1",dqbzMap);
								//如果有错误信息,则添加到错误信息列表中
								if(!Tools.isEmpty(importmsg)){
								   msgList.add(importmsg);
								}else{
									importmsg = importmsg + "导入成功!";
									msgList.add(importmsg);
								}
							} catch (Exception e2) {
								log.error("", e2.fillInStackTrace());
								i_count++;
								msgList.add(importmsg);
							}
					}
				} else {
					importmsg = "无任何导入的数据。";
					msgList.add(importmsg);
				}
			
		} catch (Exception e) {
			importmsg = "文件导入错误,未知错误。(请导入Excel 97-2003 工作薄(*.xls)";
			msgList.add(importmsg);
			e.printStackTrace();
		} finally {
			if (inxls != null) {
				inxls.close();
			}
		}
		Long timeEnd = System.currentTimeMillis();
		log.info("优抚对象伤残人员信息导入结束>>>>>>>>>>>>>>>>>>>>>>>>>>...");
		log.info("#######导入结束!########,用时:" + (timeEnd - timeBegin) + "s");


		request.setAttribute("msgList", msgList);
		return mapping.findForward("prepScrdImport");
	}



	/**
	 * 功能:优抚对象伤残人员信息导入
	 * 
	 * @param type "1" 伤残人员 "2"定期抚恤 "3"定期补助 
	 * @param Map<String,String> dqbzMap 定期补助导入时所需的额外的参数
	 * @return 有效:返回"" 无效:返回String信息
	 * @throws ParseException
	 */
	private String import_start(
			String cityName, String countyName,
			String streetName, String communityName,
			String name, String cardNo,
			String nation, String birthDate,
			String sex, String deformityLevel,
			String deformityProperty, String deformityProp,
			String marry, String joinArmyDate, 
			String retireArmyDate, String laborAbility,
			String liveAbility, String workStatus, 
			String registerType, String resideType,
			String tel, String workOrg,
			String remark, String registerAddress,
			String address, String specialObjType,
			String isMentalDisability, String isOrphan,
			String isOldAlone, String isNuclear,
			String deformityPeriod, String deformityCondition,
			String conditionRemark, String totalCostLiving,
			String disabilityPension, String disabledPersonsLivingGrant,
			String careFee, String preferentialFee,
			String minimumLivingBenefit, String lowIncomeFamiliesSubsidies,
			String disposablePension, String specialPensions,
			String oldPartyGrants, String elderlySocialGrants,
			String other, String wagesTotal,
			String wages, String newAgriculturalInsurance,
			String cityInsurancePension, String basicPensions,
			String payMoney, String bankid,
			String bankCard, String bankName,
			String bankAddress, String medicalInsurance_1,
			String medicalInsurance_2, String medicalInsurance_3,
			String medicalInsurance_4, String otherSecurityMode_1,
			String otherSecurityMode_2, String otherSecurityMode_3,
			String otherSecurityMode_4, String medicalSecurityMode_1,
			String medicalSecurityMode_2, String medicalSecurityMode_3,
			String medicalSecurityMode_4, String medicalSecurityMode_5,
			String medicalSecurity,
			String ruralMedicalAssistance, String recipientsMedicaid,
			String medicalInstitutionsRelief, String personalUndertake,
			String totalMedicalFee, String supportMode,
			String houseType, String houseStatus,
			String houseArea, String houseCount,
			String familySize, String underAge,
			String overAge,String importmsg,
			String isDisability,String isStudent,
			String sacrificeName,String sacrificeDate,
			String hasCredentials,String martyrRelation,
			String credentialsCode,HttpServletRequest request,
			String type,Map<String,String> dqbzMap) throws Exception {
		
		StringBuilder sbAddStr = new StringBuilder();
		// 优抚对象
		ApSpecObjInfo apSpecObjInfo = new ApSpecObjInfo();
		//生活费来源
		ApSpecObjLivSources apSpecObjLivSources = new ApSpecObjLivSources();
		//生活医疗保障信息
		ApSpecObjHealthCare apSpecObjHealthCareAdd = new ApSpecObjHealthCare();
		
		if (!Tools.isEmpty(specialObjType)) {
			apSpecObjInfo.setSpecialObjType(Dicts.getDictionaryKey(specialObjType, "YFDXLX"));
		} else {
			importmsg = importmsg + "导入时优抚对象类别为空。<br>";
			return importmsg;
		}
		//优抚对象大类
		Long objCategory = Dicts.getObjCategoryByType(apSpecObjInfo.getSpecialObjType());
		Long cityId = null;
		Long countyId = null;
		Long streetId = null;
		Long communityId = null;
		if(Tools.isEmpty(cityName)){
			importmsg = importmsg + "导入时所属市为空。<br>";
			return importmsg;
		}else{
			cityId = getAramAreaId(cityName,null);
			if(cityId != null && cityId.longValue() != 0){
			apSpecObjInfo.setCityId(cityId);
			}else{
				importmsg = importmsg + "导入时所属市不正确。(例如:石家庄市)<br>";
				return importmsg;
			}
		}
		
		if(Tools.isEmpty(countyName)){
			importmsg = importmsg + "导入时所属区县为空。<br>";
			return importmsg;
		}else{
			if(cityId != null && cityId.longValue() > 0){
			countyId = getAramAreaId(countyName,cityId);
			}
			if(countyId != null && countyId.longValue() != 0){
				apSpecObjInfo.setCountyId(countyId);
			}else{
				importmsg = importmsg + "导入时所属区县不正确。(例如:长安区)<br>";
				return importmsg;
			}
		}
		
		if(Tools.isEmpty(streetName)){
			importmsg = importmsg + "导入时所属街道为空。<br>";
			return importmsg;
		}else{
			if(countyId != null && countyId.longValue() > 0){
			streetId = getAramAreaId(streetName,countyId);
			}
			if(streetId != null && streetId.longValue() != 0){
				apSpecObjInfo.setStreetId(streetId);
			}else{
				importmsg = importmsg + "导入时所属街道不正确。(例如:建北街道办事处)<br>";
				return importmsg;
			}
		}
		
		if(Tools.isEmpty(communityName)){
			importmsg = importmsg + "导入时所属社区为空。<br>";
			return importmsg;
		}else{
			if(streetId != null && streetId.longValue() > 0){
			communityId = getAramAreaId(communityName,streetId);
			}
			if(communityId != null && communityId.longValue() != 0){
				apSpecObjInfo.setCommunityId(communityId);
			}else{
				importmsg = importmsg + "导入时所属社区不正确。(例如:丽水家园社区)<br>";
				return importmsg;
			}
		}
		
		if(Tools.isEmpty(name)){
			importmsg = importmsg + "导入时姓名为空。<br>";
			return importmsg;
		}else{
			if(name.length() > 50){
				importmsg = importmsg + "导入时姓名超长。<br>";
			}else{
			if(checkName(name)){
			apSpecObjInfo.setName(name);
			}else{
				importmsg = importmsg + "导入时姓名不合法。<br>";
			}
			}
		}
		if(Tools.isEmpty(cardNo)){
			importmsg = importmsg + "导入时身份证号为空。<br>";
			return importmsg;
		}else{
			cardNo = cardNo.toUpperCase();
			//优抚对象不允许有重复身份证号
			List baList = apSpecObjInfoService.getObjListByIDCard(cardNo);
			if(baList.size() > 0){
				importmsg = importmsg + "导入时身份证号和现有的记录重复。<br>";
				return importmsg;
			}else{
				String errorMsg = IDCardValidate(cardNo.trim());
				if(Tools.isEmpty(errorMsg)){
				    apSpecObjInfo.setCardNo(cardNo.trim());
				}else{
					importmsg = importmsg + errorMsg + "<br>";
				}
			}
		}
		
		if (!Tools.isEmpty(nation)) {
			apSpecObjInfo.setNation(Dicts.getDictionaryKey(nation, "MZ"));
		} else {
			importmsg = importmsg + "导入时民族为空。<br>";
		}
		
		if(!Tools.isEmpty(birthDate)){
			try{
				apSpecObjInfo.setBirthDate(Tools.getDateByStr(birthDate,
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时出生日期格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		}else{
			importmsg = importmsg + "导入时出生日期为空。<br>";
		}
		
		if (!Tools.isEmpty(sex)) {
			apSpecObjInfo.setSex(Dicts.getDictionaryKey(sex, "XB"));
		} else {
			importmsg = importmsg + "导入时性别为空。<br>";
		}
		if ("1".equals(type)) {
			if (!Tools.isEmpty(deformityLevel)) {
				apSpecObjInfo.setDeformityLevel(Dicts.getDictionaryKey(
						deformityLevel, "SCJB"));
			} else {
				importmsg = importmsg + "导入时伤残等级为空。<br>";
			}

			if (!Tools.isEmpty(deformityProperty)) {
				apSpecObjInfo.setDeformityProperty(Dicts.getDictionaryKey(
						deformityProperty, "SCXZ"));
			} else {
				importmsg = importmsg + "导入时伤残性质为空。<br>";
			}

			if (!Tools.isEmpty(deformityProp)) {
				apSpecObjInfo.setDeformityProp(Dicts.getDictionaryKey(
						deformityProp, "SCSB"));
			} else {
				importmsg = importmsg + "导入时伤残属别为空。<br>";
			}
		}
		if (!Tools.isEmpty(marry)) {
			apSpecObjInfo.setMarry(Dicts.getDictionaryKey(marry, "HYZK"));
		} else {
			importmsg = importmsg + "导入时婚姻状况为空。<br>";
		}
		
		if(!Tools.isEmpty(joinArmyDate)){
			try{
				apSpecObjInfo.setJoinArmyDate(Tools.getDateByStr(joinArmyDate,
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时入伍(参加工作)时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		}
		
		if(!Tools.isEmpty(retireArmyDate)){
			try{
				apSpecObjInfo.setRetireArmyDate(Tools.getDateByStr(retireArmyDate,
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时退伍(离退休)时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		}
		//如果入伍时间和退伍时间都不为空的情况下,退伍时间应大于入伍时间,入伍时间应大于出生日期
		if(apSpecObjInfo.getBirthDate() != null){
			long birthDateTimes = apSpecObjInfo.getBirthDate().getTime();
			long joinArmyTimes = 0L;
			long retireArmyTimes = 0L;
			if(apSpecObjInfo.getJoinArmyDate() != null){
				joinArmyTimes = apSpecObjInfo.getJoinArmyDate().getTime();
				if(birthDateTimes>=joinArmyTimes){
					importmsg = importmsg + "导入时入伍(参加工作)时间应大于出生日期。<br>";
				}
			}
			if(apSpecObjInfo.getRetireArmyDate() != null){
				retireArmyTimes = apSpecObjInfo.getRetireArmyDate().getTime();
				if(birthDateTimes>=retireArmyTimes){
					importmsg = importmsg + "导入时退伍(离退休)时间应大于出生日期。<br>";
				}
			}
			if(apSpecObjInfo.getJoinArmyDate() != null && apSpecObjInfo.getRetireArmyDate() != null){
				joinArmyTimes = apSpecObjInfo.getJoinArmyDate().getTime();
				retireArmyTimes = apSpecObjInfo.getRetireArmyDate().getTime();
				if(joinArmyTimes>=retireArmyTimes){
					importmsg = importmsg + "导入时退伍(离退休)时间应大于入伍(参加工作)时间。<br>";
				}
			}
		}
		
		if (!Tools.isEmpty(laborAbility)) {
			apSpecObjInfo.setLaborAbility(Dicts.getDictionaryKey(laborAbility, "LDNL"));
		}
		
		if (!Tools.isEmpty(liveAbility)) {
			apSpecObjInfo.setLiveAbility(Dicts.getDictionaryKey(liveAbility, "SHZLNL"));
		}
		
		if (!Tools.isEmpty(workStatus)) {
			apSpecObjInfo.setWorkStatus(Dicts.getDictionaryKey(workStatus, "JYZK"));
		}
		
		if (!Tools.isEmpty(registerType)) {
			apSpecObjInfo.setRegisterType(Dicts.getDictionaryKey(registerType, "HKLX"));
		}

		if (!Tools.isEmpty(resideType)) {
			apSpecObjInfo.setResideType(Dicts.getDictionaryKey(resideType, "HKXZ"));
		} else {
			importmsg = importmsg + "导入时户口薄上住址类型为空。<br>";
		}
		
//		if (!Tools.isEmpty(registerType)) {
//			apSpecObjInfo.setRegisterType(Dicts.getDictionaryKey(registerType, "HKLX"));
//		}
		
		if (!Tools.isEmpty(tel)) {
			if(tel.length() > 20){
				importmsg = importmsg + "导入时联系电话超长。<br>";
			} else {
				if (isNumerics(tel)) {
					apSpecObjInfo.setTel(tel);
				} else {
					importmsg = importmsg + "导入时联系电话不正确。<br>";
				}
			}
		}
		
		if (!Tools.isEmpty(workOrg)) {
			if(workOrg.length() > 50){
				importmsg = importmsg + "导入时工作单位长度大于50个汉字。<br>";
			}else{
			    apSpecObjInfo.setWorkOrg(workOrg);
			}
		}
		
		if (!Tools.isEmpty(remark)) {
			if(remark.length() > 100){
				importmsg = importmsg + "导入时备注长度大于100个汉字。<br>";
			}else{
			    apSpecObjInfo.setRemark(remark);
			}
		}
		
		if (!Tools.isEmpty(registerAddress)) {
			if(registerAddress.length() > 50){
				importmsg = importmsg + "导入时户口簿上地址超长。<br>";
			}else{
			    apSpecObjInfo.setRegisterAddress(registerAddress);
			}
		} else {
			importmsg = importmsg + "导入时户口簿上地址为空。<br>";
		}
		
		if (!Tools.isEmpty(address)) {
			if(address.length() > 50){
				importmsg = importmsg + "导入时实际居住地地址超长。<br>";
			}else{
			    apSpecObjInfo.setAddress(address);
			}
		} else {
			importmsg = importmsg + "导入时实际居住地地址为空。<br>";
		}
		
		if (!Tools.isEmpty(isMentalDisability)) {
			apSpecObjInfo.setIsMentalDisability(Dicts.getDictionaryKey(isMentalDisability, "SF"));
		} 
		
		if (!Tools.isEmpty(isOrphan)) {
			apSpecObjInfo.setIsOrphan(Dicts.getDictionaryKey(isOrphan, "SF"));
		} 
		
		if (!Tools.isEmpty(isOldAlone)) {
			apSpecObjInfo.setIsOldAlone(Dicts.getDictionaryKey(isOldAlone, "SF"));
		} 
	
		//定期抚恤导入
		if("2".equals(type)){
		if (!Tools.isEmpty(sacrificeName)) {
			if(sacrificeName.length() > 50){
				importmsg = importmsg + "导入时牺牲者姓名超长。<br>";
			}else{
			    apSpecObjInfo.setSacrificeName(sacrificeName);
			}
		} 
		
		if (!Tools.isEmpty(sacrificeDate)) {
			try{
				apSpecObjInfo.setSacrificeDate(Tools.getDateByStr(sacrificeDate,
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时牺牲病故时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		} 
		
		if (!Tools.isEmpty(hasCredentials)) {
			apSpecObjInfo.setHasCredentials(Dicts.getDictionaryKey(hasCredentials, "SF"));
		} 
		
		if (!Tools.isEmpty(martyrRelation)) {
			apSpecObjInfo.setMartyrRelation(Dicts.getDictionaryKey(martyrRelation, "YXSZGX"));
		} 
		
		if (!Tools.isEmpty(credentialsCode)) {
			if(credentialsCode.length() > 50){
				importmsg = importmsg + "导入时证书编号超长。<br>";
			}else{
			    apSpecObjInfo.setCredentialsCode(credentialsCode);
			}
		} 
		
		if (!Tools.isEmpty(isDisability)) {
			apSpecObjInfo.setIsDisability(Dicts.getDictionaryKey(isDisability, "SF"));
		} 
		
		if (!Tools.isEmpty(isStudent)) {
			apSpecObjInfo.setIsStudent(Dicts.getDictionaryKey(isStudent, "SF"));
		} 
		}
		
		if (!Tools.isEmpty(isNuclear)) {
			apSpecObjInfo.setIsNuclear(Dicts.getDictionaryKey(isNuclear, "SHQK"));
		} 
		
		if (!Tools.isEmpty(deformityPeriod)) {
			apSpecObjInfo.setDeformityPeriod(Dicts.getDictionaryKey(deformityPeriod, "SCSQ"));
		} 
		
		if (!Tools.isEmpty(deformityCondition)) {
			apSpecObjInfo.setDeformityCondition(Dicts.getDictionaryKey(deformityCondition, "SCQX"));
		} 
		
		if (!Tools.isEmpty(conditionRemark)) {
			if(conditionRemark.length() > 200){
				importmsg = importmsg + "导入时情形描述超长。<br>";
			}else{
			    apSpecObjInfo.setConditionRemark(conditionRemark);
			}
		} 
		
		if (!Tools.isEmpty(totalCostLiving)) {
			try{
				if(totalCostLiving.length() > 10){
					importmsg = importmsg + "导入时生活费合计(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setTotalCostLiving(Double.valueOf(totalCostLiving));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时生活费合计(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(disabilityPension)) {
			try{
				if(disabilityPension.length() > 10){
					importmsg = importmsg + "导入时伤残抚恤金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setDisabilityPension(Double.valueOf(disabilityPension));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时伤残抚恤金(元/年)不合法。<br>";
			}
		}else{
			importmsg = importmsg + "导入时伤残抚恤金(元/年)为空。<br>";
		}
		
		if (!Tools.isEmpty(disabledPersonsLivingGrant)) {
			try{
				if(disabledPersonsLivingGrant.length() > 10){
					importmsg = importmsg + "导入时伤残人员生活补助金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setDisabledPersonsLivingGrant(Double.valueOf(disabledPersonsLivingGrant));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时伤残人员生活补助金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(careFee)) {
			try{
				if(careFee.length() > 10){
					importmsg = importmsg + "导入时护理费(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setCareFee(Double.valueOf(careFee));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时护理费(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(preferentialFee)) {
			try{
				if(preferentialFee.length() > 10){
					importmsg = importmsg + "导入时优待金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setPreferentialFee(Double.valueOf(preferentialFee));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时优待金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(minimumLivingBenefit)) {
			try{
				if(minimumLivingBenefit.length() > 10){
					importmsg = importmsg + "导入时最低生活保障金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setMinimumLivingBenefit(Double.valueOf(minimumLivingBenefit));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时最低生活保障金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(lowIncomeFamiliesSubsidies)) {
			try{
				if(lowIncomeFamiliesSubsidies.length() > 10){
					importmsg = importmsg + "导入时低收入家庭补助金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setLowIncomeFamiliesSubsidies(Double.valueOf(lowIncomeFamiliesSubsidies));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时低收入家庭补助金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(disposablePension)) {
			try{
				if(disposablePension.length() > 10){
					importmsg = importmsg + "导入时一次性抚恤金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setDisposablePension(Double.valueOf(disposablePension));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时一次性抚恤金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(specialPensions)) {
			try{
				if(specialPensions.length() > 10){
					importmsg = importmsg + "导入时特别抚恤金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setSpecialPensions(Double.valueOf(specialPensions));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时特别抚恤金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(oldPartyGrants)) {
			try{
				if(oldPartyGrants.length() > 10){
					importmsg = importmsg + "导入时建国前老党员补助金(元/年)超长。<br>";
				}else{
			    	apSpecObjLivSources.setOldPartyGrants(Double.valueOf(oldPartyGrants));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时建国前老党员补助金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(elderlySocialGrants)) {
			try{
				if(elderlySocialGrants.length() > 10){
					importmsg = importmsg + "导入时高龄老人社会补助金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setElderlySocialGrants(Double.valueOf(elderlySocialGrants));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时高龄老人社会补助金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(other)) {
			try{
				if(elderlySocialGrants.length() > 10){
					importmsg = importmsg + "导入时其他(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setOther(Double.valueOf(other));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时其他(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(wagesTotal)) {
			try{
				if(wagesTotal.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):合计(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setWagesTotal(Double.valueOf(wagesTotal));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):合计(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(wages)) {
			try{
				if(wages.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):工资(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setWages(Double.valueOf(wages));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):工资(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(newAgriculturalInsurance)) {
			try{
				if(newAgriculturalInsurance.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):新农保(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setNewAgriculturalInsurance(Double.valueOf(newAgriculturalInsurance));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):新农保(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(cityInsurancePension)) {
			try{
				if(cityInsurancePension.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):城居保养老金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setCityInsurancePension(Double.valueOf(cityInsurancePension));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):城居保养老金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(basicPensions)) {
			try{
				if(basicPensions.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):城镇职工基本养老金(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setBasicPensions(Double.valueOf(basicPensions));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):城镇职工基本养老金(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(payMoney)) {
			try{
				if(payMoney.length() > 10){
					importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):离退休费(元/年)超长。<br>";
				}else{
				    apSpecObjLivSources.setPayMoney(Double.valueOf(payMoney));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时工资/养老金/离退休费(元/年):离退休费(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(bankid)) {
			if(bankid.length() > 30){
				importmsg = importmsg + "导入时开户银行账户超长。<br>";
			}else{
				apSpecObjLivSources.setBankid(bankid);
			}
		}
		
		if (!Tools.isEmpty(bankCard)) {
			if(bankCard.length() > 20){
				importmsg = importmsg + "导入时开户银行账号超长。<br>";
			}else{
			    apSpecObjLivSources.setBankCard(bankCard);
			}
		}
		
		if (!Tools.isEmpty(bankName)) {
			if(bankName.length() > 50){
				importmsg = importmsg + "导入时开户银行名称超长。<br>";
			}else{
		     	apSpecObjLivSources.setBankName(bankName);
			}
		}
		
		if (!Tools.isEmpty(bankAddress)) {
			if(bankAddress.length() > 50){
				importmsg = importmsg + "导入时开户银行地址超长。<br>";
			}else{
			    apSpecObjLivSources.setBankAddress(bankAddress);
			}
		}
		
		//医疗保险(多选)
		String medicalInsurance = "";
		if (Constants.SF_STR.YES.equals(medicalInsurance_1)) {
			medicalInsurance = this.addStr(sbAddStr, Constants.YLBZFS_YLBX.CZZGJBYLBX, true);
		}
		if (Constants.SF_STR.YES.equals(medicalInsurance_2)) {
			medicalInsurance = this.addStr(sbAddStr, Constants.YLBZFS_YLBX.CZJMJBYLBX, false);
		}
		if (Constants.SF_STR.YES.equals(medicalInsurance_3)) {
			medicalInsurance = this.addStr(sbAddStr, Constants.YLBZFS_YLBX.XXNCHZ, false);
		}
		if (Constants.SF_STR.YES.equals(medicalInsurance_4)) {
			medicalInsurance = this.addStr(sbAddStr, Constants.YLBZFS_YLBX.SYBX, false);
		}
		if(medicalInsurance.trim().length()>0){
		    apSpecObjHealthCareAdd.setMedicalInsurance(medicalInsurance.substring(0,medicalInsurance.length()-1));
		}
		
		//其他保障方式
		String otherSecurityMode = "";
		if (Constants.SF_STR.YES.equals(otherSecurityMode_1)) {
			otherSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_QTYLBZ.GFYL, true);
		}
		if (Constants.SF_STR.YES.equals(otherSecurityMode_2)) {
			otherSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_QTYLBZ.YFDXYLJM, false);
		}
		if (Constants.SF_STR.YES.equals(otherSecurityMode_3)) {
			otherSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_QTYLBZ.CXYLJZ, false);
		}
		if (Constants.SF_STR.YES.equals(otherSecurityMode_4)) {
			otherSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_QTYLBZ.QT, false);
		}
		if(otherSecurityMode.trim().length()>0){
		    apSpecObjHealthCareAdd.setOtherSecurityMode(otherSecurityMode.substring(0,otherSecurityMode.length()-1));
		}
		
		//养老保障方式
		String medicalSecurityMode = "";
		if (Constants.SF_STR.YES.equals(medicalSecurityMode_1)) {
			medicalSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_YLBZ.XXNCYLBX, true);
		}
		if (Constants.SF_STR.YES.equals(medicalSecurityMode_2)) {
			medicalSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_YLBZ.CZJMYLBX, false);
		}
		if (Constants.SF_STR.YES.equals(medicalSecurityMode_3)) {
			medicalSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_YLBZ.CZZGJBYLBX, false);
		}
		if (Constants.SF_STR.YES.equals(medicalSecurityMode_4)) {
			medicalSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_YLBZ.SYBX, false);
		}
		if (Constants.SF_STR.YES.equals(medicalSecurityMode_5)) {
			medicalSecurityMode = this.addStr(sbAddStr, Constants.YLBZFS_YLBZ.NO, false);
		}
		if(medicalSecurityMode.trim().length()>0){
		    apSpecObjHealthCareAdd.setMedicalSecurityMode(medicalSecurityMode.substring(0,medicalSecurityMode.length()-1));
		}
		if (!Tools.isEmpty(medicalSecurity)) {
			try{
				if(medicalSecurity.length() > 10){
					importmsg = importmsg + "导入时医疗保障体系报销(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setMedicalSecurity(Double.valueOf(medicalSecurity));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时医疗保障体系报销(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(ruralMedicalAssistance)) {
			try{
				if(ruralMedicalAssistance.length() > 10){
					importmsg = importmsg + "导入时城乡医疗救助(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setRuralMedicalAssistance(Double.valueOf(ruralMedicalAssistance));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时城乡医疗救助(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(recipientsMedicaid)) {
			try{
				if(recipientsMedicaid.length() > 10){
					importmsg = importmsg + "导入时优抚对象医疗补助(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setRecipientsMedicaid(Double.valueOf(recipientsMedicaid));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时优抚对象医疗补助(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(medicalInstitutionsRelief)) {
			try{
				if(medicalInstitutionsRelief.length() > 10){
					importmsg = importmsg + "导入时医疗机构减免(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setMedicalInstitutionsRelief(Double.valueOf(medicalInstitutionsRelief));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时医疗机构减免(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(personalUndertake)) {
			try{
				if(personalUndertake.length() > 10){
					importmsg = importmsg + "导入时个人负担(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setPersonalUndertake(Double.valueOf(personalUndertake));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时个人负担(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(totalMedicalFee)) {
			try{
				if(totalMedicalFee.length() > 10){
					importmsg = importmsg + "导入时医疗费合计(元/年)超长。<br>";
				}else{
				    apSpecObjHealthCareAdd.setTotalMedicalFee(Double.valueOf(totalMedicalFee));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时医疗费合计(元/年)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(supportMode)) {
			apSpecObjHealthCareAdd.setSupportMode(Dicts.getDictionaryKey(supportMode, "GYFS"));
		}
		
		if (!Tools.isEmpty(houseType)) {
			apSpecObjInfo.setHouseType(Dicts.getDictionaryKey(houseType, "FWXZ"));
		}
		
		if (!Tools.isEmpty(houseStatus)) {
			apSpecObjInfo.setHouseStatus(Dicts.getDictionaryKey(houseStatus, "FWQK"));
		}

		if (!Tools.isEmpty(houseArea)) {
			try{
				if(houseArea.length() > 10){
					importmsg = importmsg + "导入时房屋面积(平米数)超长。<br>";
				}else{
				    apSpecObjInfo.setHouseArea(Double.valueOf(houseArea));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时房屋面积(平米数)不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(houseCount)) {
			if(isNumerics(houseCount)){
				if(houseCount.length() > 10){
					importmsg = importmsg + "导入时房屋间数超长。<br>";
				}else{
			        apSpecObjInfo.setHouseCount(new Long(houseCount));
				}
			}else{
				importmsg = importmsg + "导入时房屋间数不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(familySize)) {
			if(isNumerics(familySize)){
				if(familySize.length() > 10){
					importmsg = importmsg + "导入时家庭总人数超长。<br>";
				}else{
			        apSpecObjInfo.setFamilySize(new Long(familySize));
				}
			}else{
				importmsg = importmsg + "导入时家庭总人数不合法。<br>";
			}
		}
		
		if (!Tools.isEmpty(underAge)) {
			if (underAge.length() > 10) {
				importmsg = importmsg + "导入时18岁以下人数超长。<br>";
			} else {
				if (isNumerics(underAge)) {
					apSpecObjInfo.setUnderAge(new Long(underAge));
				} else {
					importmsg = importmsg + "导入时18岁以下人数不合法。<br>";
				}
			}
		}
		
		if (!Tools.isEmpty(overAge)) {
			if (overAge.length() > 10) {
				importmsg = importmsg + "导入时60岁以上人数超长。<br>";
			} else {
				if (isNumerics(overAge)) {
					apSpecObjInfo.setOverAge(new Long(overAge));
				} else {
					importmsg = importmsg + "导入时60岁以上人数不合法。<br>";
				}
			}
		}
		//如果家庭总人数不为空,18岁以下人数和60岁以上人数之和应小于家庭总人数
		if(apSpecObjInfo.getFamilySize() != null && apSpecObjInfo.getFamilySize().longValue() != 0){
			long familySizeNum = apSpecObjInfo.getFamilySize().longValue();
			if(apSpecObjInfo.getUnderAge() != null && apSpecObjInfo.getUnderAge().longValue() > familySizeNum)
				importmsg = importmsg + "导入时18岁以下人数不应该大于家庭总人数。<br>";
			if(apSpecObjInfo.getOverAge() != null && apSpecObjInfo.getOverAge().longValue() > familySizeNum)
				importmsg = importmsg + "导入时60岁以上人数不应该大于家庭总人数。<br>";
			if(apSpecObjInfo.getUnderAge() != null && apSpecObjInfo.getOverAge() != null){
				long underAgeNum = apSpecObjInfo.getUnderAge().longValue();
				long overAgeNum = apSpecObjInfo.getOverAge().longValue();
				if((underAgeNum + overAgeNum) > familySizeNum){
					importmsg = importmsg + "导入时18岁以下人数和60岁以上人数之和不应该大于家庭总人数。<br>";
				}
			}
		}
		
		//定期补助导入时额外字段
		/*********************定期补助导入start***************************/
		if("3".equals(type)){
		if (!Tools.isEmpty(dqbzMap.get("retireCard"))) {
			if (dqbzMap.get("retireCard").length() > 50) {
				importmsg = importmsg + "导入时退役证件号超长。<br>";
			} else {
			    apSpecObjInfo.setRetireCard(dqbzMap.get("retireCard"));
			}
		} 
		if (!Tools.isEmpty(dqbzMap.get("armyName"))) {
			if (dqbzMap.get("armyName").length() > 50) {
				importmsg = importmsg + "导入时服役部队名称/番号超长。<br>";
			} else {
			    apSpecObjInfo.setArmyName(dqbzMap.get("armyName"));
			}
		} 
		if (!Tools.isEmpty(dqbzMap.get("armyCode"))) {
			if (dqbzMap.get("armyCode").length() > 50) {
				importmsg = importmsg + "导入时部队代号超长。<br>";
			} else {
			    apSpecObjInfo.setArmyCode(dqbzMap.get("armyCode"));
			}
		} 
		
		//参战类别(多选)
		String joinBattleType = "";
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_1"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.JFYJSDZZ, true);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_2"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.CGQZCDQPPZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_3"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.PJJMZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_4"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.ZMBJKJJWZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_5"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.ZYBJZWFJZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_6"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.BLHZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_7"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.CWYDHZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_8"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.YYKMZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_9"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.YLKMZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_10"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.ZBDZWFJZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_11"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.XSQDZWFJZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_12"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.LSZYSDQDYFYZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_13"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.NSQDZWFJZZ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_14"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.JJWZBRDDQTZZXD, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("joinBattleType_15"))) {
			joinBattleType = this.addStr(sbAddStr, Constants.CZLB.ZYBJZWFJZZ, false);
		}
		if(joinBattleType.trim().length()>0){
		    apSpecObjInfo.setJoinBattleType(joinBattleType.substring(0,joinBattleType.length()-1));
		}else{
			if(Constants.YFDXLX.CZTYRY.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时参战类别为空。<br>";
			}
		}
		//参战享受待遇
		if (!Tools.isEmpty(dqbzMap.get("pay"))) {
			apSpecObjInfo.setPay(Dicts.getDictionaryKey(dqbzMap.get("pay"), "CZXSDY"));
		} else{
			if(Constants.YFDXLX.CZTYRY.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时参战享受待遇为空。<br>";
			}
		}
		//享受待遇
		if (!Tools.isEmpty(dqbzMap.get("hpay"))) {
			apSpecObjInfo.setHpay(Dicts.getDictionaryKey(dqbzMap.get("hpay"), "SHXSDY"));
		}  else{
			if(Constants.YFDXLX.HBDTYRY.equals(String.valueOf(apSpecObjInfo.getSpecialObjType())) || Constants.YFDXLX.QTHRY.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
				importmsg = importmsg + "导入时参战享受待遇为空。<br>";
				}
			}
		//是否参加职业健康检查
		if (!Tools.isEmpty(dqbzMap.get("isHealthCheck"))) {
			apSpecObjInfo.setIsHealthCheck(Dicts.getDictionaryKey(dqbzMap.get("isHealthCheck"), "SF"));
		} 
		//先天性残疾子女数(个)
		if (!Tools.isEmpty(dqbzMap.get("congenitalDisabilityChildren"))) {
			if(isNumerics(houseCount)){
				if (dqbzMap.get("congenitalDisabilityChildren").length() > 50) {
					importmsg = importmsg + "导入时先天性残疾子女数(个)超长。<br>";
				} else {
				   apSpecObjInfo.setCongenitalDisabilityChildren(new Long(dqbzMap.get("congenitalDisabilityChildren")));
				}
				}else{
					importmsg = importmsg + "导入时先天性残疾子女数(个)不合法。<br>";
				}
		} 
		//子女补助标准(元/年)
		if (!Tools.isEmpty(dqbzMap.get("childrenSubsidy"))) {
			try{
				if (dqbzMap.get("childrenSubsidy").length() > 6) {
					importmsg = importmsg + "导入时子女补助标准(元/年)超长。<br>";
				} else {
				    apSpecObjInfo.setChildrenSubsidy(Double.valueOf(dqbzMap.get("childrenSubsidy")));
				}
			}catch(Exception e){
				importmsg = importmsg + "导入时子女补助标准(元/年)不合法。<br>";
			}
		} 
		
		//牺牲者姓名
		if (!Tools.isEmpty(sacrificeName)) {
			apSpecObjInfo.setSacrificeName(sacrificeName);
		} 
		//牺牲时间
		if (!Tools.isEmpty(sacrificeDate)) {
			try{
				apSpecObjInfo.setSacrificeDate(Tools.getDateByStr(sacrificeDate,
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时牺牲时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		} else{
			if(Constants.YFDXLX.YSLSZN.equals(String.valueOf(apSpecObjInfo.getSpecialObjType())) || Constants.YFDXLX.CSPFZN.equals(String.valueOf(apSpecObjInfo.getSpecialObjType())) || Constants.YFDXLX.YKKC.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时牺牲时间为空。(例如:yyyy/MM/dd)<br>";
			}
		}
		//批准烈士(平反)时间
		if (!Tools.isEmpty(dqbzMap.get("martyrDate"))) {
			try{
				apSpecObjInfo.setMartyrDate(Tools.getDateByStr(dqbzMap.get("martyrDate"),
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时批准烈士(平反)时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		} else{
			if(Constants.YFDXLX.YSLSZN.equals(String.valueOf(apSpecObjInfo.getSpecialObjType())) || Constants.YFDXLX.CSPFZN.equals(String.valueOf(apSpecObjInfo.getSpecialObjType())) || Constants.YFDXLX.YKKC.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时批准烈士(平反)时间为空。(例如:yyyy/MM/dd)<br>";
			}
		}
		//与牺牲者关系
		if (!Tools.isEmpty(martyrRelation)) {
			apSpecObjInfo.setMartyrRelation(Dicts.getDictionaryKey(martyrRelation, "YXSZGX"));
		} 
		//是否为持证人
		if (!Tools.isEmpty(hasCredentials)) {
			apSpecObjInfo.setHasCredentials(Dicts.getDictionaryKey(hasCredentials, "SF"));
		} 
		//证书编号
		if (!Tools.isEmpty(credentialsCode)) {
			apSpecObjInfo.setCredentialsCode(credentialsCode);
		} 
		//是否享受低保待遇
		if (!Tools.isEmpty(dqbzMap.get("isBasicLiving"))) {
			apSpecObjInfo.setIsBasicLiving(Dicts.getDictionaryKey(dqbzMap.get("isBasicLiving"), "SF"));
		} 
		//是否享受五保待遇
		if (!Tools.isEmpty(dqbzMap.get("isFiveGuarantees"))) {
			apSpecObjInfo.setIsFiveGuarantees(Dicts.getDictionaryKey(dqbzMap.get("isFiveGuarantees"), "SF"));
		} 
		//服义务兵开始时间
		if (!Tools.isEmpty(dqbzMap.get("joinObligationDate"))) {
			try{
				apSpecObjInfo.setJoinObligationDate(Tools.getDateByStr(dqbzMap.get("joinObligationDate"),
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时服义务兵开始时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		} else{
			if(Constants.YFDXLX.NCTYSB.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时服义务兵开始时间为空。(例如:yyyy/MM/dd)<br>";
			}
		}
		//服义务兵结束时间
		if (!Tools.isEmpty(dqbzMap.get("retireObligationDate"))) {
			try{
				apSpecObjInfo.setRetireObligationDate(Tools.getDateByStr(dqbzMap.get("retireObligationDate"),
				"yyyy/MM/dd"));
			}catch(Exception e){
				importmsg = importmsg + "导入时服义务兵结束时间格式不正确。(例如:yyyy/MM/dd)<br>";
			}
		} else{
			if(Constants.YFDXLX.NCTYSB.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时服义务兵结束时间为空。(例如:yyyy/MM/dd)<br>";
			}
		}
		
		//所服义务兵折算年限
		if (!Tools.isEmpty(dqbzMap.get("obligationYear"))) {
			if(isNumerics(dqbzMap.get("obligationYear"))){
			   apSpecObjInfo.setObligationYear(new Long(dqbzMap.get("obligationYear")));
			}else {
				importmsg = importmsg + "导入时所服义务兵折算年限不合法。<br>";
			}
		} else{
			if(Constants.YFDXLX.NCTYSB.equals(String.valueOf(apSpecObjInfo.getSpecialObjType()))){
			importmsg = importmsg + "导入时所服义务兵折算年限为空。<br>";
			}
		}
		
		//是否具有其他优抚对象身份
		if (!Tools.isEmpty(dqbzMap.get("isOtherStatus"))) {
			apSpecObjInfo.setIsOtherStatus(Dicts.getDictionaryKey(dqbzMap.get("isOtherStatus"), "SF"));
		} 
		//身份确认依据(多选)
		String objBase = "";
		if (Constants.SF_STR.YES.equals(dqbzMap.get("objBase_1"))) {
			objBase = this.addStr(sbAddStr, Constants.SFQRYJ.GRDA, true);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("objBase_2"))) {
			objBase = this.addStr(sbAddStr, Constants.SFQRYJ.TWZJ, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("objBase_3"))) {
			objBase = this.addStr(sbAddStr, Constants.SFQRYJ.YQRRYSMZM, false);
		}
		if (Constants.SF_STR.YES.equals(dqbzMap.get("objBase_4"))) {
			objBase = this.addStr(sbAddStr, Constants.SFQRYJ.QT, false);
		}
		if(objBase.trim().length()>0){
		    apSpecObjInfo.setObjBase(objBase.substring(0,objBase.length()-1));
		}
	}
		/**********************定期补助导入end*****************************/
		
		//1 伤残对象       2定期抚恤      3定期补助
		if ("1".equals(type)) {
			apSpecObjInfo.setBusinessApplyType(Constants.LCLX.XP);
			apSpecObjInfo
					.setSpecialObjCategory(new Long(Constants.YFDXDL.SCRY));
		} else if ("2".equals(type)) {
			apSpecObjInfo.setBusinessApplyType(Constants.LCLX.FXDX);
			apSpecObjInfo
					.setSpecialObjCategory(new Long(Constants.YFDXDL.SS));
		} else if ("3".equals(type)) {
			apSpecObjInfo.setBusinessApplyType(Constants.LCLX.BZDX);
			apSpecObjInfo.setSpecialObjCategory(objCategory);
		}
		//是否身份证扫描
		apSpecObjInfo.setIsIdCardScan(new Long(Constants.SF.NO));
		apSpecObjInfo.setUseFlag(new Long(Constants.USE_FLAG.USE_FLAG_ON.longValue()));
		apSpecObjLivSources.setUseFlag(new Long(Constants.USE_FLAG.USE_FLAG_ON.longValue()));
		apSpecObjHealthCareAdd.setUseFlag(new Long(Constants.USE_FLAG.USE_FLAG_ON.longValue()));
		apSpecObjInfo.setCreatedate(new Date());
		apSpecObjInfo.setCreatorid(UserSession.getUserId(request));
		apSpecObjLivSources.setCreatedate(new Date());
		apSpecObjLivSources.setCreatorid(UserSession.getUserId(request));
		apSpecObjHealthCareAdd.setCreatedate(new Date());
		apSpecObjHealthCareAdd.setCreatorid(UserSession.getUserId(request));
		if(Tools.isEmpty(importmsg)){
			apSpecObjInfoExcelImportService.addAllApSpecObjInfo(apSpecObjInfo, apSpecObjLivSources, apSpecObjHealthCareAdd);
			Long flowId = null;
			//1 伤残对象       2定期抚恤     3定期补助
			if ("1".equals(type)) {
			    //新评 启动工作流,写入状态
			    flowId = WorkflowConfig.WF_FLOW_ID.SOJ_XP;
			}else  if ("2".equals(type)){
				// 定期抚恤流程ID
				flowId = WorkflowConfig.WF_FLOW_ID.SOJ_DQFX;
			}else  if ("3".equals(type)){
				// 定期补助流程ID
				flowId = WorkflowConfig.WF_FLOW_ID.SOJ_DQBZ;
			}
			WfWorkflowRouteBean wfBean = new WfWorkflowRouteBean(); 
	        WorkflowTools.copyProperties(wfBean, request);         //自动赋值 
	        wfBean.setFlowId(flowId);    //定义流程ID 
	        wfBean.setWfEntity(apSpecObjInfo);   //业务表实体 
	        wfBean.setIsAudit(false);                               //定义是否为审核节点 
	        wfBean.setIsWfReturn(WorkflowConfig.WF_IS_RETURN.ON);
	        wfWorkRouteService.startWorkFlow(wfBean);
		}
		
		return importmsg;
	}



	/**
	 * 功能:身份证的有效验证
	 * 
	 * @param IDStr
	 *            身份证号
	 * @return 有效:返回"" 无效:返回String信息
	 * @throws ParseException
	 */
	public String IDCardValidate(String IDStr) throws ParseException {
		String errorInfo = "";// 记录错误信息
		String[] ValCodeArr = { "1", "0", "X", "9", "8", "7", "6", "5", "4",
				"3", "2" };
		String[] Wi = { "7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7",
				"9", "10", "5", "8", "4", "2" };
		String Ai = "";
		// ================ 号码的长度 15位或18位 ================
		if (IDStr.length() != 15 && IDStr.length() != 18) {
			errorInfo = "身份证号码长度应该为15位或18位。";
			return errorInfo;
		}
		// =======================(end)========================

		// ================ 数字 除最后一位都为数字 ================
		if (IDStr.length() == 18) {
			Ai = IDStr.substring(0, 17);
			String x = IDStr.substring(17);
			if ("X".equalsIgnoreCase(x)) {
				IDStr = Ai + "X";
			}
		} else if (IDStr.length() == 15) {
			Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
		}
		if (isNumerics(Ai) == false) {
			errorInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
			return errorInfo;
		}
		// =======================(end)========================

		// ================ 出生年月是否有效 ================
		String strYear = Ai.substring(6, 10);// 年份
		String strMonth = Ai.substring(10, 12);// 月份
		String strDay = Ai.substring(12, 14);// 月份
		if (isDataFormat(strYear + "-" + strMonth + "-" + strDay) == false) {
			errorInfo = "身份证生日无效。";
			return errorInfo;
		}
		GregorianCalendar gc = new GregorianCalendar();
		SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
		if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150
				|| (gc.getTime().getTime() - s.parse(
						strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) {
			errorInfo = "身份证生日不在有效范围。";
			return errorInfo;
		}
		if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
			errorInfo = "身份证月份无效";
			return errorInfo;
		}
		if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) {
			errorInfo = "身份证日期无效";
			return errorInfo;
		}
		// =====================(end)=====================

		// ================ 地区码时候有效 ================
		Hashtable h = GetAreaCode();
		if (h.get(Ai.substring(0, 2)) == null) {
			errorInfo = "身份证地区编码错误。";
			return errorInfo;
		}
		// ==============================================

		// ================ 判断最后一位的值 ================
		int TotalmulAiWi = 0;
		for (int i = 0; i < 17; i++) {
			TotalmulAiWi = TotalmulAiWi
					+ Integer.parseInt(String.valueOf(Ai.charAt(i)))
					* Integer.parseInt(Wi[i]);
		}
		int modValue = TotalmulAiWi % 11;
		String strVerifyCode = ValCodeArr[modValue];
		Ai = Ai + strVerifyCode;

		if (IDStr.length() == 18) {
			if (Ai.equalsIgnoreCase(IDStr) == false) {
				errorInfo = "身份证无效,不是合法的身份证号码";
				return errorInfo;
			}
		} else {
			return "";
		}
		// =====================(end)=====================
		return "";
	}

	/**
	 * 功能:判断字符串是否为数字
	 * 
	 * @param str
	 * @return
	 */
	private static boolean isNumerics(String str) {
		Pattern pattern = Pattern.compile("[0-9]*");
		Matcher isNum = pattern.matcher(str);
		if (isNum.matches()) {
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * 功能:拼接字符串
	 * 
	 * @param str 要拼接的字符
	 * @param b 是否清空
	 * @return
	 */
	private static String addStr(StringBuilder sb,String str,boolean b) {
		if(b){
			sb.setLength(0);
		}
		sb.append(str).append(",");
		return sb.toString();
	}

	/**
	 * 验证日期字符串是否是YYYY-MM-DD格式
	 * 
	 * @param str
	 * @return
	 */
	public boolean isDataFormat(String str) {
		boolean flag = false;
		// String
		// regxStr="[1-9][0-9]{3}-[0-1][0-2]-((0[1-9])|([12][0-9])|(3[01]))";
		String regxStr = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$";
		Pattern pattern1 = Pattern.compile(regxStr);
		Matcher isNo = pattern1.matcher(str);
		if (isNo.matches()) {
			flag = true;
		}
		return flag;
	}

	/**
	 * 验证姓名字符串是否含有特殊符号
	 * 
	 * @param str
	 * @return true 合法  false不合法
	 */
	public boolean checkName(String name){
		boolean flag=false;
		//中文编码:[\\u4e00-\\u9fa5]
		String regxStr = "[\\u4e00-\\u9fa5]{2,}";
		Pattern pattern = Pattern.compile(regxStr);
		Matcher matcher = pattern.matcher(name);
		if(matcher.matches()){
			flag = true;
		}
		return flag;
	}
	
	/**
	 * 功能:设置地区编码
	 * 
	 * @return Hashtable 对象
	 */
	private static Hashtable GetAreaCode() {
		Hashtable hashtable = new Hashtable();
		hashtable.put("11", "北京");
		hashtable.put("12", "天津");
		hashtable.put("13", "河北");
		hashtable.put("14", "山西");
		hashtable.put("15", "内蒙古");
		hashtable.put("21", "辽宁");
		hashtable.put("22", "吉林");
		hashtable.put("23", "黑龙江");
		hashtable.put("31", "上海");
		hashtable.put("32", "江苏");
		hashtable.put("33", "浙江");
		hashtable.put("34", "安徽");
		hashtable.put("35", "福建");
		hashtable.put("36", "江西");
		hashtable.put("37", "山东");
		hashtable.put("41", "河南");
		hashtable.put("42", "湖北");
		hashtable.put("43", "湖南");
		hashtable.put("44", "广东");
		hashtable.put("45", "广西");
		hashtable.put("46", "海南");
		hashtable.put("50", "重庆");
		hashtable.put("51", "四川");
		hashtable.put("52", "贵州");
		hashtable.put("53", "云南");
		hashtable.put("54", "西藏");
		hashtable.put("61", "陕西");
		hashtable.put("62", "甘肃");
		hashtable.put("63", "青海");
		hashtable.put("64", "宁夏");
		hashtable.put("65", "新疆");
		hashtable.put("71", "台湾");
		hashtable.put("81", "香港");
		hashtable.put("82", "澳门");
		hashtable.put("91", "国外");
		return hashtable;
	}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值