|
@@ -114,12 +114,13 @@ public class ImportExcelNew {
|
|
* 构造函数
|
|
* 构造函数
|
|
* @param headerNum 标题行号,数据行号=标题行号+1
|
|
* @param headerNum 标题行号,数据行号=标题行号+1
|
|
* @param sheetIndex 工作表编号
|
|
* @param sheetIndex 工作表编号
|
|
|
|
+ * @param type 数据来源(js:江苏;sh:上海)
|
|
* @throws InvalidFormatException
|
|
* @throws InvalidFormatException
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- public List ImportExcelNew(MultipartFile multipartFile, int headerNum, int sheetIndex)
|
|
|
|
|
|
+ public List ImportExcelNew(MultipartFile multipartFile, int headerNum, int sheetIndex, String type)
|
|
throws InvalidFormatException, IOException {
|
|
throws InvalidFormatException, IOException {
|
|
- return this.list(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
|
|
|
|
|
|
+ return this.list(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex, type);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -127,10 +128,11 @@ public class ImportExcelNew {
|
|
* 构造函数
|
|
* 构造函数
|
|
* @param headerNum 标题行号,数据行号=标题行号+1
|
|
* @param headerNum 标题行号,数据行号=标题行号+1
|
|
* @param sheetIndex 工作表编号
|
|
* @param sheetIndex 工作表编号
|
|
|
|
+ * @param type 数据来源(js:江苏;sh:上海)
|
|
* @throws InvalidFormatException
|
|
* @throws InvalidFormatException
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- public List list(String fileName, InputStream is, int headerNum, int sheetIndex)
|
|
|
|
|
|
+ public List list(String fileName, InputStream is, int headerNum, int sheetIndex, String type)
|
|
throws NullPointerException, IOException {
|
|
throws NullPointerException, IOException {
|
|
if (StringUtils.isBlank(fileName)){
|
|
if (StringUtils.isBlank(fileName)){
|
|
throw new RuntimeException("导入文档为空!");
|
|
throw new RuntimeException("导入文档为空!");
|
|
@@ -156,65 +158,157 @@ public class ImportExcelNew {
|
|
if(lastCellNum<3){
|
|
if(lastCellNum<3){
|
|
throw new RuntimeException("当前表格无数据!");
|
|
throw new RuntimeException("当前表格无数据!");
|
|
}else{
|
|
}else{
|
|
- for(int i=2;i<lastCellNum;i++){ //第三列 0,1,2
|
|
|
|
- //到每一列 获取对应行单元格数据
|
|
|
|
- ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
|
|
|
|
- if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
|
|
|
|
- projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
|
|
|
|
- if(sheet.getRow(1).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(1).getCell(i).getCellType() == 0) {
|
|
|
|
- BigDecimal bd = new BigDecimal(sheet.getRow(1).getCell(i).toString());
|
|
|
|
- projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
|
|
|
|
- }else {
|
|
|
|
- throw new RuntimeException("请填写正确的金额!");
|
|
|
|
|
|
+ if ("sh".equals(type)){
|
|
|
|
+ for(int i=2;i<lastCellNum;i++){ //第三列 0,1,2
|
|
|
|
+ //到每一列 获取对应行单元格数据
|
|
|
|
+ ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
|
|
|
|
+ if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
|
|
|
|
+ projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(sheet.getRow(1).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectAccountNumber(sheet.getRow(1).getCell(i).toString());
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(2).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(2).getCell(i).getCellType() == 0) {
|
|
|
|
- BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
|
|
|
|
- projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
|
|
|
|
- }else {
|
|
|
|
- throw new RuntimeException("请填写正确的金额!");
|
|
|
|
|
|
+
|
|
|
|
+ if(sheet.getRow(2).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(2).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(3).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(3).getCell(i).getCellType() == 0) {
|
|
|
|
- BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
|
|
|
|
- projectReportSignatureInfo.setConstructionUnitAssessmentFee(bd.toPlainString());
|
|
|
|
- }else {
|
|
|
|
- throw new RuntimeException("请填写正确的金额!");
|
|
|
|
|
|
+ if(sheet.getRow(3).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(3).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(4).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(4).getCell(i).getCellType() == 0) {
|
|
|
|
- BigDecimal bd = new BigDecimal(sheet.getRow(4).getCell(i).toString());
|
|
|
|
- projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(bd.toPlainString());
|
|
|
|
- }else {
|
|
|
|
- throw new RuntimeException("请填写正确的金额!");
|
|
|
|
|
|
+ if(sheet.getRow(4).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectName(sheet.getRow(4).getCell(i).toString());
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(5).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setConstructionUnit(sheet.getRow(5).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(6).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(6).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(7).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setDescriptionOfExceedingTheContractAmount(sheet.getRow(7).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(8).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setDescriptionOfSpecialMatters(sheet.getRow(8).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(9).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(9).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(9).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setStampDate(sheet.getRow(9).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(5).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDevelopmentOrganization(sheet.getRow(5).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(6).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConstructionUnit(sheet.getRow(6).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(sheet.getRow(7).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(7).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(sheet.getRow(8).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(8).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(8).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setStampDate(sheet.getRow(8).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(sheet.getRow(9).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setPrintQuantity(sheet.getRow(9).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(10).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(10).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(10).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(10).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(11).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(11).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(11).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(sheet.getRow(12).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConsultant(sheet.getRow(12).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(13).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(13).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(14).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setReviewOpinion(sheet.getRow(14).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(15).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(15).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(16).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setCalculateValuationBasisDocument(sheet.getRow(16).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ projectReportSignatureInfo.setType("2");
|
|
|
|
+ projectReportSignatureInfo.preInsert();
|
|
|
|
+ list.add(projectReportSignatureInfo);
|
|
|
|
+ }else {
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
- if(sheet.getRow(10).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setPrintQuantity(sheet.getRow(10).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ for(int i=2;i<lastCellNum;i++){ //第三列 0,1,2
|
|
|
|
+ //到每一列 获取对应行单元格数据
|
|
|
|
+ ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
|
|
|
|
+ if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
|
|
|
|
+ projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
|
|
|
|
+ if(sheet.getRow(1).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(1).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(1).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(2).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(2).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(3).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(3).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setConstructionUnitAssessmentFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(4).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(4).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(4).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(5).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConstructionUnit(sheet.getRow(5).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(6).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(6).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(7).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDescriptionOfExceedingTheContractAmount(sheet.getRow(7).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(8).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDescriptionOfSpecialMatters(sheet.getRow(8).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(9).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(9).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(9).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setStampDate(sheet.getRow(9).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(10).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setPrintQuantity(sheet.getRow(10).getCell(i).toString());
|
|
|
|
+ }
|
|
/*if(sheet.getRow(11).getCell(i) != null) {
|
|
/*if(sheet.getRow(11).getCell(i) != null) {
|
|
if(sheet.getRow(11).getCell(i).getCellType()==0) {
|
|
if(sheet.getRow(11).getCell(i).getCellType()==0) {
|
|
if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
|
|
if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
|
|
@@ -222,29 +316,29 @@ public class ImportExcelNew {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
}*/
|
|
- if(sheet.getRow(11).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(11).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(11).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(11).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(11).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(11).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(12).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(12).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(12).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(12).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(12).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(12).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(12).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(12).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(13).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setConsultant(sheet.getRow(13).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(14).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(14).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(15).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setReviewOpinion(sheet.getRow(15).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ if(sheet.getRow(13).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConsultant(sheet.getRow(13).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(14).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(14).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(15).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setReviewOpinion(sheet.getRow(15).getCell(i).toString());
|
|
|
|
+ }
|
|
/*if(sheet.getRow(17).getCell(i) != null) {
|
|
/*if(sheet.getRow(17).getCell(i) != null) {
|
|
if(sheet.getRow(17).getCell(i).getCellType()==0) {
|
|
if(sheet.getRow(17).getCell(i).getCellType()==0) {
|
|
if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(17).getCell(i))) {
|
|
if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(17).getCell(i))) {
|
|
@@ -280,142 +374,144 @@ public class ImportExcelNew {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
}*/
|
|
- if(sheet.getRow(16).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setProjectScaleContentScope(sheet.getRow(16).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(17).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setMainContentsOfProject(sheet.getRow(17).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(18).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(18).getCell(i).getCellType() == 0) {
|
|
|
|
- BigDecimal bd = new BigDecimal(sheet.getRow(18).getCell(i).toString());
|
|
|
|
- projectReportSignatureInfo.setTotalContractPrice(bd.toPlainString());
|
|
|
|
- }else {
|
|
|
|
- throw new RuntimeException("请填写正确的金额!");
|
|
|
|
|
|
+ if(sheet.getRow(16).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectScaleContentScope(sheet.getRow(16).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(17).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setMainContentsOfProject(sheet.getRow(17).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(18).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(18).getCell(i).getCellType() == 0) {
|
|
|
|
+ BigDecimal bd = new BigDecimal(sheet.getRow(18).getCell(i).toString());
|
|
|
|
+ projectReportSignatureInfo.setTotalContractPrice(bd.toPlainString());
|
|
|
|
+ }else {
|
|
|
|
+ throw new RuntimeException("请填写正确的金额!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(19).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(19).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(19).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setContractStartDate(sheet.getRow(19).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(19).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(19).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(19).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setContractStartDate(sheet.getRow(19).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(20).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(20).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(20).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setContractEndDate(sheet.getRow(20).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(20).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(20).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(20).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setContractEndDate(sheet.getRow(20).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(21).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(21).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(21).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setActualStartDate(sheet.getRow(21).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(21).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(21).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(21).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setActualStartDate(sheet.getRow(21).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(22).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(22).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(22).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setActualEndDate(sheet.getRow(22).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(22).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(22).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(22).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setActualEndDate(sheet.getRow(22).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(23).getCell(i) != null) {
|
|
|
|
- if(sheet.getRow(23).getCell(i).getCellType()==0) {
|
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(23).getCell(i))) {
|
|
|
|
- projectReportSignatureInfo.setCompletionAcceptanceDate(sheet.getRow(23).getCell(i).getDateCellValue());
|
|
|
|
|
|
+ if(sheet.getRow(23).getCell(i) != null) {
|
|
|
|
+ if(sheet.getRow(23).getCell(i).getCellType()==0) {
|
|
|
|
+ if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(23).getCell(i))) {
|
|
|
|
+ projectReportSignatureInfo.setCompletionAcceptanceDate(sheet.getRow(23).getCell(i).getDateCellValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(sheet.getRow(24).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setDesignUnit(sheet.getRow(24).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(25).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setConstructionControlUnit(sheet.getRow(25).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(26).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setFollowUpAuditUnit(sheet.getRow(26).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ if(sheet.getRow(24).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDesignUnit(sheet.getRow(24).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(25).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConstructionControlUnit(sheet.getRow(25).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(26).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setFollowUpAuditUnit(sheet.getRow(26).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
|
|
- if(sheet.getRow(27).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setContractName(sheet.getRow(27).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(28).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setContractDetails(sheet.getRow(28).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(29).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setContractDate(sheet.getRow(29).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ if(sheet.getRow(27).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setContractName(sheet.getRow(27).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(28).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setContractDetails(sheet.getRow(28).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(29).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setContractDate(sheet.getRow(29).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- if(sheet.getRow(30).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setEngineeringDesignChangeOrder(sheet.getRow(30).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(31).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setConfirmationSheetOfQuantities(sheet.getRow(31).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(32).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setProjectVisa(sheet.getRow(32).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ if(sheet.getRow(30).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setEngineeringDesignChangeOrder(sheet.getRow(30).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(31).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConfirmationSheetOfQuantities(sheet.getRow(31).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(32).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectVisa(sheet.getRow(32).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
|
|
- if(sheet.getRow(33).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setQualityPriceConfirmationOfEngineeringMaterials(sheet.getRow(33).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(34).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setListmaterialsEquipmentByA(sheet.getRow(34).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(35).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setProjectRewardAndDamages(sheet.getRow(35).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
|
|
+ if(sheet.getRow(33).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setQualityPriceConfirmationOfEngineeringMaterials(sheet.getRow(33).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(34).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setListmaterialsEquipmentByA(sheet.getRow(34).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(35).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectRewardAndDamages(sheet.getRow(35).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- if(sheet.getRow(36).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setCharge(sheet.getRow(36).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(37).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setTaxes(sheet.getRow(37).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(38).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setDurationDifferenceCausesAndResponsibilities(sheet.getRow(38).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(39).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setQualityDifferenceCausesAndResponsibilities(sheet.getRow(39).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(40).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setOtherContentsAndExpenses(sheet.getRow(40).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(41).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setProjectCostConsultingContract(sheet.getRow(41).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(42).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(42).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(43).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setMaterialsAndEquipmentByA(sheet.getRow(43).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(44).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setaMaterialsByB(sheet.getRow(44).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(45).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setRewardAndPunishmentFees(sheet.getRow(45).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(46).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setWaterAndElectricityFeesHandleSituation(sheet.getRow(46).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(47).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setConstructionQualityWarrantyDeposit(sheet.getRow(47).getCell(i).toString());
|
|
|
|
- }
|
|
|
|
- if(sheet.getRow(48).getCell(i) != null) {
|
|
|
|
- projectReportSignatureInfo.setTaxDifferenceCalculationAndProcessing(sheet.getRow(48).getCell(i).toString());
|
|
|
|
|
|
+ if(sheet.getRow(36).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setCharge(sheet.getRow(36).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(37).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setTaxes(sheet.getRow(37).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(38).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setDurationDifferenceCausesAndResponsibilities(sheet.getRow(38).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(39).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setQualityDifferenceCausesAndResponsibilities(sheet.getRow(39).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(40).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setOtherContentsAndExpenses(sheet.getRow(40).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(41).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setProjectCostConsultingContract(sheet.getRow(41).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(42).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(42).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(43).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setMaterialsAndEquipmentByA(sheet.getRow(43).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(44).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setaMaterialsByB(sheet.getRow(44).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(45).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setRewardAndPunishmentFees(sheet.getRow(45).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(46).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setWaterAndElectricityFeesHandleSituation(sheet.getRow(46).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(47).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setConstructionQualityWarrantyDeposit(sheet.getRow(47).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ if(sheet.getRow(48).getCell(i) != null) {
|
|
|
|
+ projectReportSignatureInfo.setTaxDifferenceCalculationAndProcessing(sheet.getRow(48).getCell(i).toString());
|
|
|
|
+ }
|
|
|
|
+ projectReportSignatureInfo.setType("1");
|
|
|
|
+ projectReportSignatureInfo.preInsert();
|
|
|
|
+ list.add(projectReportSignatureInfo);
|
|
|
|
+ }else {
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
- projectReportSignatureInfo.preInsert();
|
|
|
|
- list.add(projectReportSignatureInfo);
|
|
|
|
- }else {
|
|
|
|
- return list;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -711,194 +807,6 @@ public class ImportExcelNew {
|
|
return dataList;
|
|
return dataList;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 客户的报表数据
|
|
|
|
- * @return
|
|
|
|
- * @throws InstantiationException
|
|
|
|
- * @throws IllegalAccessException
|
|
|
|
- *//*
|
|
|
|
- public <E> Map<Object,Object> getClientDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{
|
|
|
|
- HashMap<Object, Object> map = Maps.newHashMap();
|
|
|
|
- List<Object[]> annotationList = Lists.newArrayList();
|
|
|
|
- // Get annotation field
|
|
|
|
- Field[] fs = cls.getDeclaredFields();
|
|
|
|
- for (Field f : fs){
|
|
|
|
- ExcelField ef = f.getAnnotation(ExcelField.class);
|
|
|
|
- if (ef != null && (ef.type()==0 || ef.type()==2)){
|
|
|
|
- if (groups!=null && groups.length>0){
|
|
|
|
- boolean inGroup = false;
|
|
|
|
- for (int g : groups){
|
|
|
|
- if (inGroup){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- for (int efg : ef.groups()){
|
|
|
|
- if (g == efg){
|
|
|
|
- inGroup = true;
|
|
|
|
- annotationList.add(new Object[]{ef, f});
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- annotationList.add(new Object[]{ef, f});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // Get annotation method
|
|
|
|
- Method[] ms = cls.getDeclaredMethods();
|
|
|
|
- for (Method m : ms){
|
|
|
|
- ExcelField ef = m.getAnnotation(ExcelField.class);
|
|
|
|
- if (ef != null && (ef.type()==0 || ef.type()==2)){
|
|
|
|
- if (groups!=null && groups.length>0){
|
|
|
|
- boolean inGroup = false;
|
|
|
|
- for (int g : groups){
|
|
|
|
- if (inGroup){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- for (int efg : ef.groups()){
|
|
|
|
- if (g == efg){
|
|
|
|
- inGroup = true;
|
|
|
|
- annotationList.add(new Object[]{ef, m});
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- annotationList.add(new Object[]{ef, m});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // Field sorting
|
|
|
|
- Collections.sort(annotationList, new Comparator<Object[]>() {
|
|
|
|
- public int compare(Object[] o1, Object[] o2) {
|
|
|
|
- return new Integer(((ExcelField)o1[0]).sort()).compareTo(
|
|
|
|
- new Integer(((ExcelField)o2[0]).sort()));
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
- //log.debug("Import column count:"+annotationList.size());
|
|
|
|
- // Get excel data
|
|
|
|
- List<E> dataList = Lists.newArrayList();
|
|
|
|
- List<String> errList = Lists.newArrayList();
|
|
|
|
- for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) {
|
|
|
|
- E e = (E)cls.newInstance();
|
|
|
|
- int column = 0;
|
|
|
|
- Row row = this.getRow(i);
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
- String errMsg = "";
|
|
|
|
- for (Object[] os : annotationList){
|
|
|
|
- Object val = this.getCellValue(row, column++);
|
|
|
|
- if (val != null){
|
|
|
|
- ExcelField ef = (ExcelField)os[0];
|
|
|
|
- // If is dict type, get dict value
|
|
|
|
- if (StringUtils.isNotBlank(ef.dictType())){
|
|
|
|
- val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
|
|
|
|
- //log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
|
|
|
|
- }
|
|
|
|
- // Get param type and type cast
|
|
|
|
- Class<?> valType = Class.class;
|
|
|
|
- if (os[1] instanceof Field){
|
|
|
|
- valType = ((Field)os[1]).getType();
|
|
|
|
- }else if (os[1] instanceof Method){
|
|
|
|
- Method method = ((Method)os[1]);
|
|
|
|
- if ("get".equals(method.getName().substring(0, 3))){
|
|
|
|
- valType = method.getReturnType();
|
|
|
|
- }else if("set".equals(method.getName().substring(0, 3))){
|
|
|
|
- valType = ((Method)os[1]).getParameterTypes()[0];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //log.debug("Import value type: ["+i+","+column+"] " + valType);
|
|
|
|
- try {
|
|
|
|
- //如果导入的java对象,需要在这里自己进行变换。
|
|
|
|
- if (valType == String.class){
|
|
|
|
- String s = String.valueOf(val.toString());
|
|
|
|
- if(StringUtils.endsWith(s, ".0")){
|
|
|
|
- val = StringUtils.substringBefore(s, ".0");
|
|
|
|
- }else{
|
|
|
|
- val = String.valueOf(val.toString());
|
|
|
|
- }
|
|
|
|
- }else if (valType == Integer.class){
|
|
|
|
- val = Double.valueOf(val.toString()).intValue();
|
|
|
|
- }else if (valType == Long.class){
|
|
|
|
- val = Double.valueOf(val.toString()).longValue();
|
|
|
|
- }else if (valType == Double.class){
|
|
|
|
- val = Double.valueOf(val.toString());
|
|
|
|
- }else if (valType == Float.class){
|
|
|
|
- val = Float.valueOf(val.toString());
|
|
|
|
- }else if (valType == Date.class){
|
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- val=sdf.parse(val.toString());
|
|
|
|
- }else if (valType == User.class){
|
|
|
|
- val = UserUtils.getByUserName(val.toString());
|
|
|
|
- }else if (valType == Office.class){
|
|
|
|
- val = UserUtils.getByOfficeName(val.toString());
|
|
|
|
- }else if (valType == Area.class){
|
|
|
|
- val = UserUtils.getByAreaName(val.toString());
|
|
|
|
- }else{
|
|
|
|
- if (ef.fieldType() != Class.class){
|
|
|
|
- val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
|
|
|
|
- }else{
|
|
|
|
- val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
|
|
|
- "fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } catch (Exception ex) {
|
|
|
|
- log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
|
|
|
|
- val = null;
|
|
|
|
- }
|
|
|
|
- if(column == 1 || column == 2 || column == 3
|
|
|
|
- || column == 4 || column == 5 || column == 6 || column == 7
|
|
|
|
- || column == 8 || column == 9 || column == 10){
|
|
|
|
- if(val == null || val == ""){
|
|
|
|
- errMsg += "第+i+条,第"+column+"列数据不能为空";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // set entity value
|
|
|
|
- if (os[1] instanceof Field){
|
|
|
|
- if(Strings.isNullOrEmpty(errMsg)){
|
|
|
|
- Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else if (os[1] instanceof Method){
|
|
|
|
- String mthodName = ((Method)os[1]).getName();
|
|
|
|
- if ("get".equals(mthodName.substring(0, 3))){
|
|
|
|
- mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
|
|
|
|
- }
|
|
|
|
- if(Strings.isNullOrEmpty(errMsg)){
|
|
|
|
- Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sb.append(val+", ");
|
|
|
|
- }
|
|
|
|
- if(!"".equals(errMsg)){
|
|
|
|
- errList.add(errMsg);
|
|
|
|
- }else{
|
|
|
|
- dataList.add(e);
|
|
|
|
- }
|
|
|
|
- log.debug("Read success: ["+i+"] "+sb.toString());
|
|
|
|
- }
|
|
|
|
- map.put("dataList",dataList);
|
|
|
|
- map.put("errList",errList);
|
|
|
|
- return map;
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 导入测试
|
|
|
|
-// */
|
|
|
|
-// public static void main(String[] args) throws Throwable {
|
|
|
|
-//
|
|
|
|
-// ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
|
|
|
|
-//
|
|
|
|
-// for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
|
|
|
|
-// Row row = ei.getRow(i);
|
|
|
|
-// for (int j = 0; j < ei.getLastCellNum(); j++) {
|
|
|
|
-// Object val = ei.getCellValue(row, j);
|
|
|
|
-// System.out.print(val+", ");
|
|
|
|
-// }
|
|
|
|
-// System.out.print("\n");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
public static String replaceBlank(String str) {
|
|
public static String replaceBlank(String str) {
|
|
String dest = "";
|
|
String dest = "";
|
|
if (str!=null) {
|
|
if (str!=null) {
|
|
@@ -908,9 +816,4 @@ public class ImportExcelNew {
|
|
}
|
|
}
|
|
return dest;
|
|
return dest;
|
|
}
|
|
}
|
|
-
|
|
|
|
- /* public static void main(String[] args) {
|
|
|
|
- replaceBlank("桩基框架-剪力墙结构\n" +
|
|
|
|
- "(主体部分)空间钢桁架结构(屋顶部分)");
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|