Browse Source

导入XLS问题处理

anderx 6 years ago
parent
commit
981990203e

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TemporaryReceivablesMapper.xml

@@ -387,7 +387,7 @@
     where aid = #{aid,jdbcType=INTEGER}
   </select>
   <select id="selectReceivablesList" parameterType="java.lang.String" resultType="com.goafanti.order.bo.ReceivablesListBo">
-  	select a.id,a.order_no orderNo,b.contract_no contractNo,a.corporate_name corporateName,c.nickname,b.total_amount totalAmount,d.name depName,a.status ,
+  	select a.id,a.order_no orderNo,b.contract_no contractNo,a.corporate_name corporateName,c.nickname,b.total_amount totalAmount,d.name depName,a.status ,b.settlement_amount settlementAmount,
 	a.financial_pay_no financialPayNo,a.amount,date_format(a.receivables_time, '%Y-%m-%d')receivablesTimes,date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes,a.remarks
 	from temporary_receivables a left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join department d on b.order_dep=d.id
 	left join admin e on b.salesman_id=e.id 

+ 7 - 0
src/main/java/com/goafanti/order/bo/ReceivablesListBo.java

@@ -7,6 +7,7 @@ public class ReceivablesListBo {
 	private String corporateName;
 	private String nickname;
 	private String totalAmount;
+	private String settlementAmount;
 	private String depName;
 	private Integer status;
 	private String amount;
@@ -92,6 +93,12 @@ public class ReceivablesListBo {
 	public void setFinancialPayNo(String financialPayNo) {
 		this.financialPayNo = financialPayNo;
 	}
+	public String getSettlementAmount() {
+		return settlementAmount;
+	}
+	public void setSettlementAmount(String settlementAmount) {
+		this.settlementAmount = settlementAmount;
+	}
 	
 	
 

+ 35 - 36
src/main/java/com/goafanti/order/service/impl/OrderReceivablesServiceImpl.java

@@ -396,7 +396,7 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 						trb.setCorporateName(getCellValue(cell));
 						break;
 					case 3:
-						trb.setAmount(new BigDecimal((null==getCellValue(cell)?"0":getCellValue(cell))));
+						trb.setAmount(new BigDecimal((getCellValue(cell).equals("")?"0":getCellValue(cell))));
 						break;
 					case 4:
 						trb.setReceivablesTime(DateUtils.StringToDate(getCellValue(cell), AFTConstants.YYYYMMDD));
@@ -436,42 +436,41 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
         }
         @SuppressWarnings("deprecation")
 		public static String getCellValue(Cell cell){
-        String cellValue = "";
-        if(cell == null){
-        return cellValue;
-        }
-        //把数字当成String来读,避免出现1读成1.0的情况
-        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
-        cell.setCellType(Cell.CELL_TYPE_STRING);
-        }
-        //判断数据的类型
-        switch (cell.getCellType()){
-        case Cell.CELL_TYPE_NUMERIC: //数字
-        cellValue = String.valueOf(cell.getNumericCellValue());
-        break;
-        case Cell.CELL_TYPE_STRING: //字符串
-        cellValue = String.valueOf(cell.getStringCellValue());
-        break;
-        case Cell.CELL_TYPE_BOOLEAN: //Boolean
-        cellValue = String.valueOf(cell.getBooleanCellValue());
-        break;
-        case Cell.CELL_TYPE_FORMULA: //公式
-        cellValue = String.valueOf(cell.getCellFormula());
-        break;
-        case Cell.CELL_TYPE_BLANK: //空值
-        cellValue = "未知";
-        break;
-        case Cell.CELL_TYPE_ERROR: //故障
-        cellValue = "非法字符";
-        break;
-        default:
-        cellValue = "未知类型";
-        break;
-        }
-        return cellValue;
-        
-		
+        	String cellValue = "";
+        	if(cell == null){
+        		return cellValue;
+        	}
+        	        //把数字当成String来读,避免出现1读成1.0的情况
+        	        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
+        	        cell.setCellType(Cell.CELL_TYPE_STRING);
+        	        }
+        	        //判断数据的类型
+        	        switch (cell.getCellType()){
+        	        case Cell.CELL_TYPE_NUMERIC: //数字
+        	        cellValue = String.valueOf(cell.getNumericCellValue());
+        	        break;
+        	        case Cell.CELL_TYPE_STRING: //字符串
+        	        cellValue = String.valueOf(cell.getStringCellValue());
+        	        break;
+        	        case Cell.CELL_TYPE_BOOLEAN: //Boolean
+        	        cellValue = String.valueOf(cell.getBooleanCellValue());
+        	        break;
+        	        case Cell.CELL_TYPE_FORMULA: //公式
+        	        cellValue = String.valueOf(cell.getCellFormula());
+        	        break;
+        	        case Cell.CELL_TYPE_BLANK: //空值
+        	        cellValue = "未知";
+        	        break;
+        	        case Cell.CELL_TYPE_ERROR: //故障
+        	        cellValue = "非法字符";
+        	        break;
+        	        default:
+        	        cellValue = "未知类型";
+        	        break;
+        	        }
+        	        return cellValue;
 	}
+        
 		@SuppressWarnings("unchecked")
 		@Override
 		public void exportReceivables(HttpServletResponse response,OrderListBo order, Integer pageSize, Integer pageNo) throws Exception {