| 
					
				 | 
			
			
				@@ -6,9 +6,7 @@ import kd.bos.bill.AbstractBillPlugIn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.cache.CacheFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.cache.TempFileCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.dataentity.entity.DynamicObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import kd.bos.dataentity.entity.DynamicObjectCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.exception.KDBizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import kd.bos.exception.KDException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.form.control.AttachmentPanel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.form.control.Toolbar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.form.control.events.UploadEvent; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -16,7 +14,6 @@ import kd.bos.form.control.events.UploadListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.orm.query.QFilter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.servicehelper.BusinessDataServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.ss.usermodel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -30,10 +27,10 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static String bos_org = "bos_org"; //业务单元组织标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static String bos_adminorg="bos_adminorg";//行政组织标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //给附件面板添加监听 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void registerListener(EventObject e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //给附件面板添加监听 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         super.registerListener(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //按钮面板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Toolbar toolbar = this.getControl("tbmain"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -94,19 +91,20 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Row> rowList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //表头字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Row> headList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //人力薪酬和薪酬明细等excel分开处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (billtype.equals("nckd_salaryentry")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 headList.add(filesheet.getRow(line-3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 headList.add(filesheet.getRow(line-2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //读取每行的数据存入list中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (int i=line;i<=filesheet.getLastRowNum();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //获取每一行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Row row = filesheet.getRow(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (null==row.getCell(1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //根据字段行循环,没有值的单元格则赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //根据字段行循环,没有值的单元格则赋值,防止空指针 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for(int j=1;j<column;j++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Cell cell=row.getCell(j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (null==cell) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -123,40 +121,13 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new RuntimeException(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 对Excel的各个单元格的格式进行判断并转换 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public  String getCellValue(Cell cell) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String cellValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (cell == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return cellValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 判断数据的类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        switch (cell.getCellType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            case NUMERIC: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cellValue=String.valueOf(cell.getNumericCellValue());; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            case STRING: // 字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cellValue = String.valueOf(cell.getStringCellValue()).trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            case BLANK: // 空值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cellValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            case ERROR: // 故障 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cellValue = "未知类型"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cellValue = "未知类型"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return cellValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @rowList 读取的excel数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @nckd_entrytype 分录标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @description:根据分录类型不同,赋值分录封装 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @description:根据分录类型不同,赋值分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void createNewRow(List<Row> rowList,String nckd_entry){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //薪酬明细(一般员工)分录字段标识 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -208,8 +179,7 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //新增动态单据分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int rowIndex = this.getModel().createNewEntryRow(nckd_entry); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //发薪机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!getCellValue(rowList.get(i).getCell(1)).isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!getCellValue(rowList.get(i).getCell(1)).isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     QFilter filter=new QFilter("number", QFilter.equals,getCellValue(rowList.get(i).getCell(1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取发薪机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DynamicObject entrycostdept= BusinessDataServiceHelper 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -237,8 +207,7 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     this.getModel().setValue(nckd_generalemployees.get(4),entrycostdept,rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //所在部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!getCellValue(rowList.get(i).getCell(6)).isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!getCellValue(rowList.get(i).getCell(6)).isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     QFilter filter=new QFilter("number", QFilter.equals,getCellValue(rowList.get(i).getCell(6))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DynamicObject entrycostdept= BusinessDataServiceHelper 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -250,15 +219,13 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     this.getModel().setValue(nckd_generalemployees.get(6),getCellValue(rowList.get(i).getCell(6)),rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //成本归结单元 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!getCellValue(rowList.get(i).getCell(8)).isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!getCellValue(rowList.get(i).getCell(8)).isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     QFilter filter=new QFilter("number", QFilter.equals,getCellValue(rowList.get(i).getCell(8))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DynamicObject entrycostdept= BusinessDataServiceHelper 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             .loadSingle(bos_org,"id,entrycostdept",new QFilter[]{filter}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     this.getModel().setValue(nckd_generalemployees.get(7),entrycostdept,rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //金额类型字段赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (int j=8;j<nckd_generalemployees.size();j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Cell cell=rowList.get(i).getCell(j+1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -478,11 +445,10 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @headList 读取的excel表头数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @rowList 读取excel的表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @billtype 分录标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @description:校验excel数据是否合法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @description:校验excel数据是否合法,传入的excel是否为正确的格式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void dataVerify(List<Row> headList,List<Row> rowList,String billtype) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //获取单据的字段名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void dataVerify(List<Row> headList,List<Row> rowList,String billtype) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取对应单据的字段名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //薪酬明细(一般员工) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (billtype.equals("nckd_staffentry")) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -491,37 +457,111 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!flag.equals("基本工资")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new KDBizException("上传的文件格式有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i=0;i<rowList.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //校验金额字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j=9;j<rowList.get(i).getLastCellNum();j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Cell cell=rowList.get(i).getCell(j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //单元格不为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!Objects.equals(getCellValue(cell), "")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (cell.getCellType()!=CellType.NUMERIC){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //输入金额字段的类型不为数字则提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            throw new KDBizException("第"+(i+1)+"行第"+j+"列的数据:"+headList.get(i).getCell(j).getStringCellValue()+"字段有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //薪酬明细(内退) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (billtype.equals("nckd_earlyretiredentry")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             flag=headList.get(0).getCell(9).getStringCellValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!flag.equals("内退员工基本工资")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new KDBizException("上传的文件格式有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i=0;i<rowList.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //校验金额字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j=9;j<rowList.get(i).getLastCellNum();j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Cell cell=rowList.get(i).getCell(j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //单元格不为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!Objects.equals(getCellValue(cell), "")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (cell.getCellType()!=CellType.NUMERIC){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //输入金额字段的类型不为数字则提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            throw new KDBizException("第"+(i+1)+"行第"+j+"列的数据:"+headList.get(i).getCell(j).getStringCellValue()+"字段有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //薪酬明细(退休) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (billtype.equals("nckd_retireentry")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             flag=headList.get(0).getCell(9).getStringCellValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!flag.equals("退休员工生活补贴")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new KDBizException("上传的文件格式有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i=0;i<rowList.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //校验金额字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j=9;j<rowList.get(i).getLastCellNum();j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Cell cell=rowList.get(i).getCell(j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //单元格不为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!Objects.equals(getCellValue(cell), "")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (cell.getCellType()!=CellType.NUMERIC){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //输入金额字段的类型不为数字则提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            throw new KDBizException("第"+(i+1)+"行第"+j+"列的数据:"+headList.get(i).getCell(j).getStringCellValue()+"字段有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //人力薪酬 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (billtype.equals("nckd_salaryentry")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             flag=headList.get(0).getCell(9).getStringCellValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!flag.equals("职务工资")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new KDBizException("上传的文件格式有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i=0;i<rowList.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //校验金额字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j=8;j<rowList.get(i).getLastCellNum();j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Cell cell=rowList.get(i).getCell(j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //单元格不为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!Objects.equals(getCellValue(cell), "")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (cell.getCellType()!=CellType.NUMERIC){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //输入金额字段的类型不为数字则提示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            throw new KDBizException("第"+(i+1)+"行第"+(j+1)+"列的数据:"+headList.get(i).getCell(j+1).getStringCellValue()+"字段有误,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 对Excel的各个单元格的格式进行判断并转换 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public  String getCellValue(Cell cell) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String cellValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cell == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return cellValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 判断数据的类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (cell.getCellType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case NUMERIC: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //读取数字将不必要的小数点去掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal bigDecimal=new BigDecimal(Double.toString(cell.getNumericCellValue())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cellValue=bigDecimal.stripTrailingZeros().toPlainString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case STRING: // 字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cellValue = String.valueOf(cell.getStringCellValue()).trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case BLANK: // 空值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cellValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case ERROR: // 故障 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cellValue = "未知类型"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cellValue = "未知类型"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return cellValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |