ソースを参照

生产装备汇总分析非空判断

gaodandan 6 年 前
コミット
7972a91296
共有1 個のファイルを変更した16 個の追加10 個の削除を含む
  1. 16 10
      src/main/java/com/chinaitop/depot/device/controller/StorageDeviceInputController.java

+ 16 - 10
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceInputController.java

@@ -186,21 +186,27 @@ public class StorageDeviceInputController {
186 186
     	//入库数量
187 187
     	List<Map<String, Object>> queryCountByType = deviceInputService.queryCountByType();
188 188
     	String sumCount = "";
189
-    	for (Map<String, Object> map : queryCountByType) {
190
-    		int useCount = Integer.parseInt(map.get("userCounts").toString());
191
-    		sumCount = sumCount + useCount+",";
192
-		}
193
-    	sumCount = sumCount.substring(0, sumCount.length()-1);
189
+    	if(queryCountByType.size()>0 && queryCountByType!=null){
190
+    		for (Map<String, Object> map : queryCountByType) {
191
+        		int useCount = Integer.parseInt(map.get("userCounts").toString());
192
+        		sumCount = sumCount + useCount+",";
193
+    		}
194
+    		sumCount = sumCount.substring(0, sumCount.length()-1);
195
+    	}
196
+    	
194 197
     	returnMap.put("sumCount", sumCount);
195 198
     	
196 199
     	//使用数量
197 200
     	List<Map<String, Object>> queryUseCountByType = deviceGetService.queryCountByType();
198 201
     	String useCount = "";
199
-    	for (Map<String, Object> map : queryUseCountByType) {
200
-    		int getCount = Integer.parseInt(map.get("getCounts").toString());
201
-    		useCount = useCount + getCount+",";
202
-		}
203
-    	useCount = useCount.substring(0, useCount.length()-1);
202
+    	if(queryUseCountByType.size()>0 && queryUseCountByType!=null){
203
+    		for (Map<String, Object> map : queryUseCountByType) {
204
+        		int getCount = Integer.parseInt(map.get("getCounts").toString());
205
+        		useCount = useCount + getCount+",";
206
+    		}
207
+        	useCount = useCount.substring(0, useCount.length()-1);
208
+    	}
209
+    	
204 210
     	returnMap.put("useCount", useCount);
205 211
         return returnMap;
206 212
     }