Commit ea9986513c23f467d37b114b6504e03a2f58aed0
1 parent
93c6f0d8
m
Showing
4 changed files
with
70 additions
and
36 deletions
trash-admin/src/main/resources/application-dev.yml
| ... | ... | @@ -17,11 +17,11 @@ trash: |
| 17 | 17 | # 验证码类型 math 数组计算 char 字符验证 |
| 18 | 18 | captchaType: math |
| 19 | 19 | # 远程服务器地址 |
| 20 | - #remotePath: http://175.6.47.84:8008 | |
| 21 | - #token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJkdXJhYmxlIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg1NDE2NjEzMzU1fQ.58-J0KKfsK2pQhDQAzaBaUj-oFWMbYF1YzMAcshmcfidIkW16TZWIVhAVKPvCJvWfG54x7xB-ETxKCDLFnSctQ | |
| 20 | + remotePath: http://175.6.47.84:8008 | |
| 21 | + token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJkdXJhYmxlIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg1NDE2NjEzMzU1fQ.58-J0KKfsK2pQhDQAzaBaUj-oFWMbYF1YzMAcshmcfidIkW16TZWIVhAVKPvCJvWfG54x7xB-ETxKCDLFnSctQ | |
| 22 | 22 | #remotePath: http://cszhatu.natapp1.cc |
| 23 | - remotePath: http://175.178.228.30:8008 | |
| 24 | - token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJjc3poIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg0NDU5MjEzNzQ2fQ.85oIrOnU7cz7L_-IGt4Bt1LXDTkFtyrdqNt05K0v9-4nsrrzzpbjbemK-yMlbnUpe4Fx2FFES-Wbw8Yr8ML69w | |
| 23 | + # remotePath: http://175.178.228.30:8008 | |
| 24 | + # token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJjc3poIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg0NDU5MjEzNzQ2fQ.85oIrOnU7cz7L_-IGt4Bt1LXDTkFtyrdqNt05K0v9-4nsrrzzpbjbemK-yMlbnUpe4Fx2FFES-Wbw8Yr8ML69w | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | # 数据源配置 | ... | ... |
trash-common/src/main/java/com/trash/common/utils/RemoteServerUtils.java
| ... | ... | @@ -666,7 +666,7 @@ public class RemoteServerUtils { |
| 666 | 666 | if (token.contains("durable:")) { |
| 667 | 667 | token = "Bearer " + token; |
| 668 | 668 | } else { |
| 669 | - token = "Bearer auth:token:" + token; | |
| 669 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | String param = JSON.toJSON(obj).toString(); |
| ... | ... | @@ -708,7 +708,7 @@ public class RemoteServerUtils { |
| 708 | 708 | if (token.contains("durable:")) { |
| 709 | 709 | token = "Bearer " + token; |
| 710 | 710 | } else { |
| 711 | - token = "Bearer auth:token:" + token; | |
| 711 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | String params = ""; |
| ... | ... | @@ -755,7 +755,11 @@ public class RemoteServerUtils { |
| 755 | 755 | okHttpClient = getOkClient(); |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - token = "Bearer " + token; | |
| 758 | + if (token.contains("durable:")) { | |
| 759 | + token = "Bearer " + token; | |
| 760 | + } else { | |
| 761 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 762 | + } | |
| 759 | 763 | |
| 760 | 764 | |
| 761 | 765 | String param = JSON.toJSON(obj).toString(); |
| ... | ... | @@ -812,8 +816,11 @@ public class RemoteServerUtils { |
| 812 | 816 | if (okHttpClient == null) { |
| 813 | 817 | okHttpClient = getOkClient(); |
| 814 | 818 | } |
| 815 | - | |
| 816 | - token = "Bearer " + token; | |
| 819 | + if (token.contains("durable:")) { | |
| 820 | + token = "Bearer " + token; | |
| 821 | + } else { | |
| 822 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 823 | + } | |
| 817 | 824 | |
| 818 | 825 | String params = ""; |
| 819 | 826 | |
| ... | ... | @@ -883,7 +890,7 @@ public class RemoteServerUtils { |
| 883 | 890 | if (token.contains("durable:")) { |
| 884 | 891 | token = "Bearer " + token; |
| 885 | 892 | } else { |
| 886 | - token = "Bearer auth:token:" + token; | |
| 893 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 887 | 894 | } |
| 888 | 895 | |
| 889 | 896 | String param = JSON.toJSON(map).toString(); |
| ... | ... | @@ -1316,7 +1323,7 @@ public class RemoteServerUtils { |
| 1316 | 1323 | if (token.contains("durable:")) { |
| 1317 | 1324 | token = "Bearer " + token; |
| 1318 | 1325 | } else { |
| 1319 | - token = "Bearer auth:token:" + token; | |
| 1326 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); | |
| 1320 | 1327 | } |
| 1321 | 1328 | Request request = new Request.Builder().url(remote + AREAS).addHeader("Authorization", token).get().build(); |
| 1322 | 1329 | try { | ... | ... |
trash-ui/vue.config.js
| ... | ... | @@ -41,13 +41,13 @@ module.exports = { |
| 41 | 41 | } |
| 42 | 42 | }, |
| 43 | 43 | ['/voice']: { |
| 44 | - target: `http://127.0.0.1:15001/`, | |
| 45 | - // target: `http://175.6.47.84:8008`, | |
| 44 | + // target: `http://127.0.0.1:15001/`, | |
| 45 | + target: `http://175.6.47.84:8008`, | |
| 46 | 46 | changeOrigin: true, |
| 47 | 47 | }, |
| 48 | 48 | ['/api']: { |
| 49 | - target: `http://175.178.228.30:8008`, | |
| 50 | - // target: `http://175.6.47.84:8008`, | |
| 49 | + // target: `http://175.178.228.30:8008`, | |
| 50 | + target: `http://175.6.47.84:8008`, | |
| 51 | 51 | changeOrigin: true, |
| 52 | 52 | } |
| 53 | 53 | ... | ... |
trash-workFlow/src/main/java/com/trash/business/service/impl/CompanyCreditServiceImpl.java
| ... | ... | @@ -115,8 +115,8 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 115 | 115 | i = companyCreditMapper.insertCompanyCredit(companyCredit); |
| 116 | 116 | SendSms(companyCredit); |
| 117 | 117 | } |
| 118 | - | |
| 119 | - updateRemoteCompanyAndTruck(companyCredit, null); | |
| 118 | + String token = SecurityUtils.getLoginUser().getToken(); | |
| 119 | + updateRemoteCompanyAndTruck(companyCredit, token); | |
| 120 | 120 | |
| 121 | 121 | return i; |
| 122 | 122 | } |
| ... | ... | @@ -208,18 +208,36 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 208 | 208 | map.put("valid", 0); |
| 209 | 209 | map.put("size", 99999); |
| 210 | 210 | JSONArray turckList = null; |
| 211 | - if (token == null) { | |
| 212 | - RemoteServerUtils.updateCompanyList(cpcList); | |
| 213 | - turckList = RemoteServerUtils.getTruckList(map); | |
| 214 | - } else { | |
| 215 | - RemoteServerUtils.updateCompanyList(cpcList, token); | |
| 216 | - turckList = RemoteServerUtils.getTruckList(map, token); | |
| 217 | - } | |
| 211 | + new Thread(new Runnable() { | |
| 212 | + | |
| 213 | + @Override | |
| 214 | + public void run() { | |
| 215 | + while(true){ | |
| 216 | + Object object = RemoteServerUtils.updateCompanyList(cpcList, token); | |
| 217 | + if(object != null && ((boolean)object) == true){ | |
| 218 | + break; | |
| 219 | + } | |
| 220 | + | |
| 221 | + try { | |
| 222 | + Thread.sleep(5000); | |
| 223 | + } catch (InterruptedException e) { | |
| 224 | + // TODO Auto-generated catch block | |
| 225 | + e.printStackTrace(); | |
| 226 | + } | |
| 227 | + } | |
| 228 | + } | |
| 229 | + }).start(); | |
| 230 | + | |
| 231 | + | |
| 232 | + turckList = RemoteServerUtils.getTruckList(map, token); | |
| 233 | + | |
| 218 | 234 | |
| 219 | 235 | if (turckList != null) { |
| 236 | + | |
| 237 | + List<Map> updateList = new ArrayList(); | |
| 238 | + | |
| 220 | 239 | for (Object objec : turckList) { |
| 221 | 240 | |
| 222 | - List<Map> updateList = new ArrayList(); | |
| 223 | 241 | JSONObject truck = (JSONObject) objec; |
| 224 | 242 | |
| 225 | 243 | String truckId = truck.getString("id"); |
| ... | ... | @@ -242,13 +260,6 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 242 | 260 | upParam.put("creditStatus", credit); |
| 243 | 261 | upParam.put("id", truckId); |
| 244 | 262 | updateList.add(upParam); |
| 245 | - | |
| 246 | - if (token != null) | |
| 247 | - RemoteServerUtils.updateTruckList(updateList, token); | |
| 248 | - else | |
| 249 | - RemoteServerUtils.updateTruckList(updateList); | |
| 250 | - | |
| 251 | - continue; | |
| 252 | 263 | } |
| 253 | 264 | } |
| 254 | 265 | } else { |
| ... | ... | @@ -280,13 +291,29 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 280 | 291 | upParam.put("creditStatus", credit); |
| 281 | 292 | upParam.put("id", truckId); |
| 282 | 293 | updateList.add(upParam); |
| 283 | - if (token != null) | |
| 284 | - RemoteServerUtils.updateTruckList(updateList, token); | |
| 285 | - else | |
| 286 | - RemoteServerUtils.updateTruckList(updateList); | |
| 287 | 294 | |
| 288 | 295 | } |
| 289 | 296 | } |
| 297 | + | |
| 298 | + new Thread(new Runnable() { | |
| 299 | + | |
| 300 | + @Override | |
| 301 | + public void run() { | |
| 302 | + while(true){ | |
| 303 | + Object object = RemoteServerUtils.updateTruckList(updateList, token); | |
| 304 | + if(object != null && ((boolean)object) == true){ | |
| 305 | + break; | |
| 306 | + } | |
| 307 | + | |
| 308 | + try { | |
| 309 | + Thread.sleep(5000); | |
| 310 | + } catch (InterruptedException e) { | |
| 311 | + // TODO Auto-generated catch block | |
| 312 | + e.printStackTrace(); | |
| 313 | + } | |
| 314 | + } | |
| 315 | + } | |
| 316 | + }).start(); | |
| 290 | 317 | } |
| 291 | 318 | |
| 292 | 319 | } | ... | ... |