Commit c5e836066000cbdf6dff6037607f318c94d875a1
1 parent
9d7f4ff536
Exists in
master
and in
6 other branches
update code
Showing 2 changed files with 37 additions and 42 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
c5e8360
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
c5e8360
... | ... | @@ -131,52 +131,47 @@ |
131 | 131 | { |
132 | 132 | for (final String url : urls.keySet()) |
133 | 133 | { |
134 | - pool.execute(new Runnable() { | |
135 | - @Override | |
136 | - public void run() { | |
137 | - try{ | |
138 | - System.out.println(DateUtil.getyyyy_MM_dd_hms(new Date()) +" ; request url = " + url); | |
139 | - String json = excePost("https://" + url + "/findSyncData", new HashMap<String, String>()); | |
140 | - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json)) | |
141 | - { | |
142 | - List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class); | |
143 | - System.out.println(DateUtil.getyyyy_MM_dd_hms(new Date())+url+" ; syncdata size = "+ list.size()); | |
144 | - int batchSize = 200; | |
145 | - int end = 0; | |
146 | - for (int i = 0; i < list.size(); i += batchSize) { | |
147 | - end = (end + batchSize); | |
148 | - if (end > list.size()) { | |
149 | - end = list.size(); | |
150 | - } | |
151 | - final List<SyncDataModel> tempList = list.subList(i, end); | |
152 | - commonThreadPool.execute(new Runnable() { | |
153 | - @Override | |
154 | - public void run() { | |
155 | - if (CollectionUtils.isNotEmpty(tempList)) | |
156 | - { | |
157 | - StringBuffer ids = new StringBuffer(); | |
158 | - for (SyncDataModel model : tempList) { | |
159 | - boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
160 | - if (boo) { | |
161 | - ids.append(model.getId()); | |
162 | - ids.append(","); | |
163 | - } | |
164 | - } | |
165 | - if (ids.length() > 0) { | |
166 | - Map<String,String> params = new HashMap<String, String>(); | |
167 | - params.put("ids", ids.toString()); | |
168 | - excePost("https://" + url + "/updateSyncData", params); | |
169 | - } | |
134 | + try{ | |
135 | + System.out.println(DateUtil.getyyyy_MM_dd_hms(new Date()) +" ; request url = " + url); | |
136 | + String json = excePost("https://" + url + "/findSyncData", new HashMap<String, String>()); | |
137 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json)) | |
138 | + { | |
139 | + List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class); | |
140 | + System.out.println(DateUtil.getyyyy_MM_dd_hms(new Date())+url+" ; syncdata size = "+ list.size()); | |
141 | + int batchSize = 200; | |
142 | + int end = 0; | |
143 | + for (int i = 0; i < list.size(); i += batchSize) { | |
144 | + end = (end + batchSize); | |
145 | + if (end > list.size()) { | |
146 | + end = list.size(); | |
147 | + } | |
148 | + final List<SyncDataModel> tempList = list.subList(i, end); | |
149 | + commonThreadPool.execute(new Runnable() { | |
150 | + @Override | |
151 | + public void run() { | |
152 | + if (CollectionUtils.isNotEmpty(tempList)) | |
153 | + { | |
154 | + StringBuffer ids = new StringBuffer(); | |
155 | + for (SyncDataModel model : tempList) { | |
156 | + boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
157 | + if (boo) { | |
158 | + ids.append(model.getId()); | |
159 | + ids.append(","); | |
170 | 160 | } |
171 | 161 | } |
172 | - }); | |
162 | + if (ids.length() > 0) { | |
163 | + Map<String,String> params = new HashMap<String, String>(); | |
164 | + params.put("ids", ids.toString()); | |
165 | + excePost("https://" + url + "/updateSyncData", params); | |
166 | + } | |
167 | + } | |
173 | 168 | } |
174 | - } | |
175 | - }catch(Exception ex){ | |
176 | - ExceptionUtils.catchException(ex, url+": syncData Error."); | |
169 | + }); | |
177 | 170 | } |
178 | 171 | } |
179 | - }); | |
172 | + }catch(Exception ex){ | |
173 | + ExceptionUtils.catchException(ex, url+": syncData Error."); | |
174 | + } | |
180 | 175 | } |
181 | 176 | } |
182 | 177 |