Commit 8d9e78c5d8605a641eaf50fb50c6012a7f38cc0b
1 parent
c902bb6c9e
Exists in
master
and in
1 other branch
update code
Showing 1 changed file with 57 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
8d9e78c
| ... | ... | @@ -289,7 +289,58 @@ |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | + * 同步聊城东昌区妇幼数据到线上 | |
| 292 | 293 | * 定时任务配置applicationContext.xml |
| 294 | + */ | |
| 295 | + public void lcdcqfySyncDataSSL() { | |
| 296 | + | |
| 297 | + try{ | |
| 298 | + String json = HttpClientUtil.doPost("https://area-lc-api.healthbaby.com.cn:55581/findSyncData", new HashMap<String, String>(), "utf-8"); | |
| 299 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json)) | |
| 300 | + { | |
| 301 | + List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class); | |
| 302 | + System.out.println("lcdcqfy syncdata size = "+ list.size()); | |
| 303 | + int batchSize = 200; | |
| 304 | + int end = 0; | |
| 305 | + for (int i = 0; i < list.size(); i += batchSize) { | |
| 306 | + end = (end + batchSize); | |
| 307 | + if (end > list.size()) { | |
| 308 | + end = list.size(); | |
| 309 | + } | |
| 310 | + System.out.println("lcdcqfy start:" + i + ",end:" + end); | |
| 311 | + final List<SyncDataModel> tempList = list.subList(i, end); | |
| 312 | + new Thread(new Runnable() { | |
| 313 | + @Override | |
| 314 | + public void run() { | |
| 315 | + if (CollectionUtils.isNotEmpty(tempList)) | |
| 316 | + { | |
| 317 | + StringBuffer ids = new StringBuffer(); | |
| 318 | + for (SyncDataModel model : tempList) { | |
| 319 | + boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
| 320 | + if (boo) { | |
| 321 | + ids.append(model.getId()); | |
| 322 | + ids.append(","); | |
| 323 | + } | |
| 324 | + } | |
| 325 | + if (ids.length() > 0) { | |
| 326 | + Map<String,String> params = new HashMap<String, String>(); | |
| 327 | + params.put("ids", ids.toString()); | |
| 328 | + String result = HttpClientUtil.doPost("https://area-lc-api.healthbaby.com.cn:55581/updateSyncData", params, "utf-8"); | |
| 329 | + System.out.println("lcdcqfy exc result = "+ result); | |
| 330 | + } | |
| 331 | + } | |
| 332 | + } | |
| 333 | + }).start(); | |
| 334 | + } | |
| 335 | + } | |
| 336 | + }catch(Exception ex){ | |
| 337 | + ExceptionUtils.catchException(ex, "lcdcqfy Error."); | |
| 338 | + } | |
| 339 | + } | |
| 340 | + | |
| 341 | + | |
| 342 | + /** | |
| 343 | + * 定时任务配置applicationContext.xml | |
| 293 | 344 | * |
| 294 | 345 | */ |
| 295 | 346 | public void syncDataSSL() |
| ... | ... | @@ -315,6 +366,12 @@ |
| 315 | 366 | nczxyySyncDataSSL(); |
| 316 | 367 | } |
| 317 | 368 | },"nczxyy-thread").start(); |
| 369 | + new Thread(new Runnable() { | |
| 370 | + @Override | |
| 371 | + public void run() { | |
| 372 | + lcdcqfySyncDataSSL(); | |
| 373 | + } | |
| 374 | + },"lcdcqfy-thread").start(); | |
| 318 | 375 | |
| 319 | 376 | } |
| 320 | 377 |