Commit 17c16744f23d3ebb4301309591732e32fe89d172
1 parent
a2728cf080
Exists in
master
同步数据模块完善
Showing 3 changed files with 19 additions and 5 deletions
parent/center.manager/src/main/java/com/lyms/cm/controller/sync/SyncController.java
View file @
17c1674
parent/core.sdk/src/main/java/com/lyms/sync/channel/ChannelData.java
View file @
17c1674
| ... | ... | @@ -69,6 +69,11 @@ |
| 69 | 69 | * 出错重试次数 |
| 70 | 70 | */ |
| 71 | 71 | private int errorRetryCount; |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 是否成功 | |
| 75 | + */ | |
| 76 | + private boolean success; | |
| 72 | 77 | |
| 73 | 78 | public ChannelData(String remote, String remoteClazz, String remoteMethod, String data, boolean loop) { |
| 74 | 79 | this.id = StrUtils.uuid(); |
| ... | ... | @@ -178,6 +183,14 @@ |
| 178 | 183 | |
| 179 | 184 | public void setErrorRetryCount(int errorRetryCount) { |
| 180 | 185 | this.errorRetryCount = errorRetryCount; |
| 186 | + } | |
| 187 | + | |
| 188 | + public boolean isSuccess() { | |
| 189 | + return success; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void setSuccess(boolean success) { | |
| 193 | + this.success = success; | |
| 181 | 194 | } |
| 182 | 195 | |
| 183 | 196 |
parent/hospital.web/src/main/java/com/lyms/hospital/job/SyncPushToCenterJob.java
View file @
17c1674
| ... | ... | @@ -34,11 +34,10 @@ |
| 34 | 34 | @Autowired |
| 35 | 35 | private SyncDataBasicService syncDataBasicService; |
| 36 | 36 | |
| 37 | - @SuppressWarnings("unused") | |
| 38 | 37 | public void excute() { |
| 39 | 38 | if(null != CENTER_SYNCPUSH_URL && CENTER_SYNCPUSH_URL.startsWith("http")){ |
| 40 | 39 | List<SyncDataBasic> dataList = syncDataBasicService.selectList(new EntityWrapper<SyncDataBasic>().where("IFSUC=0").and("ERROR_COUNT < {0}", ERROR_COUNT_MAX)); |
| 41 | - if(dataList != null ){ | |
| 40 | + if(dataList != null && dataList.size() > 0){ | |
| 42 | 41 | log.debug("=======开始进行 SYNC_DATA_BASIC 表格数据的推送到中心======="); |
| 43 | 42 | for(SyncDataBasic entity : dataList){ |
| 44 | 43 | try{ |
| ... | ... | @@ -51,9 +50,10 @@ |
| 51 | 50 | return; |
| 52 | 51 | } |
| 53 | 52 | ChannelData model = JsonUtils.jsonToBean(result, ChannelData.class); |
| 54 | - entity.setIfsuc(1); | |
| 55 | - syncDataBasicService.updateById(entity); | |
| 56 | - log.debug("中心处后数据:"+result); | |
| 53 | + if(model.isSuccess()){ | |
| 54 | + entity.setIfsuc(1); | |
| 55 | + syncDataBasicService.updateById(entity); | |
| 56 | + } | |
| 57 | 57 | }catch (Exception e) { |
| 58 | 58 | syncDataBasicService.errorCountAdd(entity.getId()); |
| 59 | 59 | log.error("【SYNC_DATA_BASIC】表格数据的的推送到中心错误:SyncDataBasic = {} {}",JSONObject.toJSON(entity),e); |