Commit 308e0db222a025b625b8539df4324cc2ffa06ed0
1 parent
7e991afdce
Exists in
master
and in
6 other branches
update code
Showing 3 changed files with 18 additions and 15 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java
View file @
308e0db
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | // 设置连接池 |
| 36 | 36 | connMgr = new PoolingHttpClientConnectionManager(); |
| 37 | 37 | // 设置连接池大小 |
| 38 | - connMgr.setMaxTotal(10); | |
| 38 | + connMgr.setMaxTotal(20); | |
| 39 | 39 | connMgr.setDefaultMaxPerRoute(connMgr.getMaxTotal()); |
| 40 | 40 | |
| 41 | 41 | RequestConfig.Builder configBuilder = RequestConfig.custom(); |
| ... | ... | @@ -107,6 +107,7 @@ |
| 107 | 107 | try{ |
| 108 | 108 | httpClient = new SSLClient(); |
| 109 | 109 | httpGet = new HttpGet(url+sb.toString()); |
| 110 | + httpGet.setConfig(requestConfig); | |
| 110 | 111 | httpGet.addHeader("Authorization", authorization); |
| 111 | 112 | HttpResponse response = httpClient.execute(httpGet); |
| 112 | 113 | if(response != null){ |
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
View file @
308e0db
| ... | ... | @@ -8,8 +8,7 @@ |
| 8 | 8 | import com.lyms.platform.msg.worker.ChanAmsMsgGenerateWorker; |
| 9 | 9 | import com.lyms.platform.msg.worker.TempleteMsgGenerateWorker; |
| 10 | 10 | import com.lyms.platform.msg.worker.YunAmsMsgGenerateWorker; |
| 11 | -import com.lyms.platform.permission.service.OrganizationService; | |
| 12 | -import com.lyms.platform.permission.service.UsersService; | |
| 11 | + | |
| 13 | 12 | import com.lyms.platform.pojo.SmsConfigModel; |
| 14 | 13 | import org.apache.commons.collections.CollectionUtils; |
| 15 | 14 | import org.slf4j.Logger; |
| ... | ... | @@ -18,6 +17,7 @@ |
| 18 | 17 | import org.springframework.stereotype.Service; |
| 19 | 18 | |
| 20 | 19 | import java.util.*; |
| 20 | +import java.util.concurrent.CountDownLatch; | |
| 21 | 21 | import java.util.concurrent.ExecutorService; |
| 22 | 22 | import java.util.concurrent.Executors; |
| 23 | 23 | |
| ... | ... | @@ -64,7 +64,7 @@ |
| 64 | 64 | logger.info("The generatePatAmsMsg configs hospital size is {}",configModels.size()); |
| 65 | 65 | if (CollectionUtils.isNotEmpty(configModels)) |
| 66 | 66 | { |
| 67 | - int batchSize = 3; | |
| 67 | + int batchSize = 5; | |
| 68 | 68 | int end = 0; |
| 69 | 69 | for (int i = 0; i < configModels.size(); i += batchSize) { |
| 70 | 70 | end = (end + batchSize); |
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | logger.info("The generateBabyAmsMsg configs hospital size is {}",configModels.size()); |
| 91 | 91 | if (CollectionUtils.isNotEmpty(configModels)) |
| 92 | 92 | { |
| 93 | - int batchSize = 3; | |
| 93 | + int batchSize = 5; | |
| 94 | 94 | int end = 0; |
| 95 | 95 | for (int i = 0; i < configModels.size(); i += batchSize) { |
| 96 | 96 | end = (end + batchSize); |
| ... | ... | @@ -116,7 +116,7 @@ |
| 116 | 116 | logger.info("The generateChanAmsMsg configs hospital size is {}",configModels.size()); |
| 117 | 117 | if (CollectionUtils.isNotEmpty(configModels)) |
| 118 | 118 | { |
| 119 | - int batchSize = 3; | |
| 119 | + int batchSize = 5; | |
| 120 | 120 | int end = 0; |
| 121 | 121 | for (int i = 0; i < configModels.size(); i += batchSize) { |
| 122 | 122 | end = (end + batchSize); |
| ... | ... | @@ -142,7 +142,7 @@ |
| 142 | 142 | logger.info("The generateChanAmsMsg configs hospital size is {}",configModels.size()); |
| 143 | 143 | if (CollectionUtils.isNotEmpty(configModels)) |
| 144 | 144 | { |
| 145 | - int batchSize = 3; | |
| 145 | + int batchSize = 5; | |
| 146 | 146 | int end = 0; |
| 147 | 147 | for (int i = 0; i < configModels.size(); i += batchSize) { |
| 148 | 148 | end = (end + batchSize); |
| 149 | 149 | |
| ... | ... | @@ -163,11 +163,13 @@ |
| 163 | 163 | @Override |
| 164 | 164 | public void generaterAllMsg() { |
| 165 | 165 | |
| 166 | + final CountDownLatch countDownLatch = new CountDownLatch(2); | |
| 166 | 167 | logger.info("generater all msg starting."); |
| 167 | 168 | new Thread(new Runnable() { |
| 168 | 169 | @Override |
| 169 | 170 | public void run() { |
| 170 | 171 | generateTemplateMsg(null); |
| 172 | + countDownLatch.countDown(); | |
| 171 | 173 | } |
| 172 | 174 | }).start(); |
| 173 | 175 | |
| 174 | 176 | |
| 175 | 177 | |
| 176 | 178 | |
| ... | ... | @@ -176,17 +178,17 @@ |
| 176 | 178 | @Override |
| 177 | 179 | public void run() { |
| 178 | 180 | generateChanAmsMsg(null); |
| 179 | - } | |
| 180 | - }).start(); | |
| 181 | - | |
| 182 | - new Thread(new Runnable() { | |
| 183 | - @Override | |
| 184 | - public void run() { | |
| 185 | 181 | generateBabyAmsMsg(null); |
| 182 | + generatePatAmsMsg(null); | |
| 183 | + countDownLatch.countDown(); | |
| 186 | 184 | } |
| 187 | 185 | }).start(); |
| 186 | + try { | |
| 187 | + countDownLatch.await(); | |
| 188 | + } catch (InterruptedException e) { | |
| 189 | + e.printStackTrace(); | |
| 190 | + } | |
| 188 | 191 | |
| 189 | - generatePatAmsMsg(null); | |
| 190 | 192 | logger.info("generater all msg ending."); |
| 191 | 193 | } |
| 192 | 194 | } |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
308e0db