Commit 1c05143c5fcf6e439de46f9fcf60854da81cf952
1 parent
232a0080c3
Exists in
master
and in
1 other branch
rebuild sync data controller
Showing 1 changed file with 18 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/InitDataController.java
View file @
1c05143
... | ... | @@ -80,18 +80,26 @@ |
80 | 80 | synclist.add(Base64.encodeBase64String(SerializUtils.objToByte(model))); |
81 | 81 | index++; |
82 | 82 | if (index%100 == 0) { |
83 | - postser(synclist, cla.getName()); | |
83 | + boolean boo = postser(synclist, cla.getName()); | |
84 | + if (!boo) { | |
85 | + System.out.println(cla.getName()); | |
86 | + System.out.println(JsonUtil.array2JsonString(list)); | |
87 | + } | |
84 | 88 | synclist.clear(); |
85 | 89 | } |
86 | 90 | } |
87 | 91 | if (synclist.size() > 0) { |
88 | - postser(synclist, cla.getName()); | |
92 | + boolean boo = postser(synclist, cla.getName()); | |
93 | + if (!boo) { | |
94 | + System.out.println(cla.getName()); | |
95 | + System.out.println(JsonUtil.array2JsonString(list)); | |
96 | + } | |
89 | 97 | } |
90 | 98 | } |
91 | 99 | return sb.toString(); |
92 | 100 | } |
93 | 101 | |
94 | - private void postser(List<String> synclist, String claName) { | |
102 | + private boolean postser(List<String> synclist, String claName) { | |
95 | 103 | try { |
96 | 104 | HttpClient client = new HttpClient(); |
97 | 105 | client.getHttpConnectionManager().getParams().setConnectionTimeout(30000); |
98 | 106 | |
... | ... | @@ -110,8 +118,13 @@ |
110 | 118 | if (200 == statusCode) { |
111 | 119 | |
112 | 120 | } |
121 | + if (!"success".equals(json)) { | |
122 | + return false; | |
123 | + } | |
124 | + return true; | |
113 | 125 | } catch (Exception e) { |
114 | 126 | e.printStackTrace(); |
127 | + return false; | |
115 | 128 | } |
116 | 129 | } |
117 | 130 | |
... | ... | @@ -123,6 +136,8 @@ |
123 | 136 | Class cla = Class.forName(className); |
124 | 137 | List<String> synclist = JsonUtil.toList(json, String.class); |
125 | 138 | for (String s:synclist) { |
139 | + System.out.println(className); | |
140 | + System.out.println(s); | |
126 | 141 | Object obj = SerializUtils.byteToObj(Base64.decodeBase64(s)); |
127 | 142 | String id = cla.getMethod("getId").invoke(obj).toString(); |
128 | 143 | if (StringUtils.isNotEmpty(id)) { |