java110 vor 5 Jahren
Ursprung
Commit
481100011e

+ 15 - 13
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java

@@ -183,18 +183,20 @@ public class QueryOweFeeImpl implements IQueryOweFee {
         }
         //查询费用信息arrearsEndTime
         List<RoomDto> tmpRoomDtos = new ArrayList<>();
-        List<RoomDto> tempRooms = new ArrayList<>();
+        //List<RoomDto> tempRooms = new ArrayList<>();
         int threadNum = Java110ThreadPoolFactory.JAVA110_DEFAULT_THREAD_NUM;
-        for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
-            tempRooms.add(roomDtos.get(roomIndex));
-            if (roomIndex % threadNum == 0 && roomIndex != 0) {
-                tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, threadNum));
-                tempRooms = new ArrayList();
-            }
-        }
-        if (tempRooms.size() > 0) {
-            tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, tempRooms.size()));
-        }
+        //for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
+        // tempRooms.add(roomDtos.get(roomIndex));
+        //if (roomIndex % threadNum == 0 && roomIndex != 0) {
+        //    tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, threadNum));
+        //   tempRooms = new ArrayList();
+        // }
+        // }
+//        if (tempRooms.size() > 0) {
+//            tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, tempRooms.size()));
+//        }
+
+        tmpRoomDtos.addAll(doGetTmpRoomDto(roomDtos, feeDto, threadNum));
 
         return ResultVo.createResponseEntity(tmpRoomDtos);
     }
@@ -209,8 +211,8 @@ public class QueryOweFeeImpl implements IQueryOweFee {
                 });
             }
             return java110ThreadPoolFactory.get();
-        }finally {
-            if(java110ThreadPoolFactory != null){
+        } finally {
+            if (java110ThreadPoolFactory != null) {
                 java110ThreadPoolFactory.stop();
             }
         }

+ 18 - 1
service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java

@@ -326,5 +326,22 @@ public class ExportFeeManualCollectionSMOImpl extends BaseComponentSMO implement
         this.restTemplate = restTemplate;
     }
 
-
+    public static void main(String[] args) {
+        Java110ThreadPoolFactory<String> pool =Java110ThreadPoolFactory.getInstance().createThreadPool(20);
+        for (int i = 21; i > 0; i--) {
+            Integer data = i;
+            pool.submit(() -> {
+//这个地方可以写一个函数,参数可以从外层传入
+                System.out.println("网络操作开始" + data);
+                Thread.sleep(data * 1000);
+                System.out.println("网络操作结束" + data);
+                return data+"";
+            });
+        }
+        List<String> users = pool.get();
+        for (String u : users) {
+            System.out.println(u);
+        }
+        pool.stop();
+    }
 }