Commit 67b64ec25727479a8ae4ab6ec4a2a07cb8d9cf61
1 parent
533c665337
Exists in
master
and in
1 other branch
update
Showing 1 changed file with 20 additions and 19 deletions
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
View file @
67b64ec
| ... | ... | @@ -33,25 +33,27 @@ |
| 33 | 33 | System.out.println("saveLis data size = "+ lisList.size()); |
| 34 | 34 | if (CollectionUtils.isNotEmpty(lisList)) |
| 35 | 35 | { |
| 36 | - int batchSize = 10; | |
| 37 | - //线程数 | |
| 38 | - int threadCount = lisList.size()%batchSize == 0 ? lisList.size()/batchSize : lisList.size()/batchSize+1; | |
| 39 | - System.out.println("threadCount = "+ threadCount); | |
| 40 | - CountDownLatch countDownLatch = new CountDownLatch(threadCount); | |
| 41 | - int end = 0; | |
| 42 | - for (int i = 0; i < lisList.size(); i += batchSize) { | |
| 43 | - end = (end + batchSize); | |
| 44 | - if (end > lisList.size()) { | |
| 45 | - end = lisList.size(); | |
| 46 | - } | |
| 47 | - List<LisReportModel> models = lisList.subList(i, end); | |
| 48 | - LisSaveTask lis =new LisSaveTask(countDownLatch,masterLisMapper,models); | |
| 49 | - Thread t1=new Thread(lis); | |
| 50 | - t1.start(); | |
| 51 | - System.out.println("spit end"); | |
| 52 | - } | |
| 36 | + CountDownLatch countDownLatch = new CountDownLatch(1); | |
| 37 | + new Thread(new LisSaveTask(countDownLatch,masterLisMapper,lisList)).start(); | |
| 53 | 38 | countDownLatch.await(); |
| 54 | 39 | |
| 40 | +// int batchSize = 10; | |
| 41 | +// //线程数 | |
| 42 | +// int threadCount = lisList.size()%batchSize == 0 ? lisList.size()/batchSize : lisList.size()/batchSize+1; | |
| 43 | +// System.out.println("threadCount = "+ threadCount); | |
| 44 | +// CountDownLatch countDownLatch = new CountDownLatch(threadCount); | |
| 45 | +// int end = 0; | |
| 46 | +// for (int i = 0; i < lisList.size(); i += batchSize) { | |
| 47 | +// end = (end + batchSize); | |
| 48 | +// if (end > lisList.size()) { | |
| 49 | +// end = lisList.size(); | |
| 50 | +// } | |
| 51 | +// List<LisReportModel> models = lisList.subList(i, end); | |
| 52 | +// new Thread(new LisSaveTask(countDownLatch,masterLisMapper,models)).start(); | |
| 53 | +// System.out.println("spit end"); | |
| 54 | +// } | |
| 55 | +// countDownLatch.await(); | |
| 56 | + | |
| 55 | 57 | System.out.println("exce end"); |
| 56 | 58 | |
| 57 | 59 | } |
| ... | ... | @@ -149,8 +151,7 @@ |
| 149 | 151 | { |
| 150 | 152 | masterLisMapper.saveLisData(model); |
| 151 | 153 | } |
| 152 | - else | |
| 153 | - { | |
| 154 | + else { | |
| 154 | 155 | System.out.println("======================="+model.getVcCardNo()); |
| 155 | 156 | } |
| 156 | 157 | } |