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,11 +17,11 @@ trash: | ||
| 17 | # 验证码类型 math 数组计算 char 字符验证 | 17 | # 验证码类型 math 数组计算 char 字符验证 |
| 18 | captchaType: math | 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 | #remotePath: http://cszhatu.natapp1.cc | 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,7 +666,7 @@ public class RemoteServerUtils { | ||
| 666 | if (token.contains("durable:")) { | 666 | if (token.contains("durable:")) { |
| 667 | token = "Bearer " + token; | 667 | token = "Bearer " + token; |
| 668 | } else { | 668 | } else { |
| 669 | - token = "Bearer auth:token:" + token; | 669 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | String param = JSON.toJSON(obj).toString(); | 672 | String param = JSON.toJSON(obj).toString(); |
| @@ -708,7 +708,7 @@ public class RemoteServerUtils { | @@ -708,7 +708,7 @@ public class RemoteServerUtils { | ||
| 708 | if (token.contains("durable:")) { | 708 | if (token.contains("durable:")) { |
| 709 | token = "Bearer " + token; | 709 | token = "Bearer " + token; |
| 710 | } else { | 710 | } else { |
| 711 | - token = "Bearer auth:token:" + token; | 711 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); |
| 712 | } | 712 | } |
| 713 | 713 | ||
| 714 | String params = ""; | 714 | String params = ""; |
| @@ -755,7 +755,11 @@ public class RemoteServerUtils { | @@ -755,7 +755,11 @@ public class RemoteServerUtils { | ||
| 755 | okHttpClient = getOkClient(); | 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 | String param = JSON.toJSON(obj).toString(); | 765 | String param = JSON.toJSON(obj).toString(); |
| @@ -812,8 +816,11 @@ public class RemoteServerUtils { | @@ -812,8 +816,11 @@ public class RemoteServerUtils { | ||
| 812 | if (okHttpClient == null) { | 816 | if (okHttpClient == null) { |
| 813 | okHttpClient = getOkClient(); | 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 | String params = ""; | 825 | String params = ""; |
| 819 | 826 | ||
| @@ -883,7 +890,7 @@ public class RemoteServerUtils { | @@ -883,7 +890,7 @@ public class RemoteServerUtils { | ||
| 883 | if (token.contains("durable:")) { | 890 | if (token.contains("durable:")) { |
| 884 | token = "Bearer " + token; | 891 | token = "Bearer " + token; |
| 885 | } else { | 892 | } else { |
| 886 | - token = "Bearer auth:token:" + token; | 893 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); |
| 887 | } | 894 | } |
| 888 | 895 | ||
| 889 | String param = JSON.toJSON(map).toString(); | 896 | String param = JSON.toJSON(map).toString(); |
| @@ -1316,7 +1323,7 @@ public class RemoteServerUtils { | @@ -1316,7 +1323,7 @@ public class RemoteServerUtils { | ||
| 1316 | if (token.contains("durable:")) { | 1323 | if (token.contains("durable:")) { |
| 1317 | token = "Bearer " + token; | 1324 | token = "Bearer " + token; |
| 1318 | } else { | 1325 | } else { |
| 1319 | - token = "Bearer auth:token:" + token; | 1326 | + token = "Bearer auth:token:" + token.replace("auth:token:", ""); |
| 1320 | } | 1327 | } |
| 1321 | Request request = new Request.Builder().url(remote + AREAS).addHeader("Authorization", token).get().build(); | 1328 | Request request = new Request.Builder().url(remote + AREAS).addHeader("Authorization", token).get().build(); |
| 1322 | try { | 1329 | try { |
trash-ui/vue.config.js
| @@ -41,13 +41,13 @@ module.exports = { | @@ -41,13 +41,13 @@ module.exports = { | ||
| 41 | } | 41 | } |
| 42 | }, | 42 | }, |
| 43 | ['/voice']: { | 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 | changeOrigin: true, | 46 | changeOrigin: true, |
| 47 | }, | 47 | }, |
| 48 | ['/api']: { | 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 | changeOrigin: true, | 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,8 +115,8 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | ||
| 115 | i = companyCreditMapper.insertCompanyCredit(companyCredit); | 115 | i = companyCreditMapper.insertCompanyCredit(companyCredit); |
| 116 | SendSms(companyCredit); | 116 | SendSms(companyCredit); |
| 117 | } | 117 | } |
| 118 | - | ||
| 119 | - updateRemoteCompanyAndTruck(companyCredit, null); | 118 | + String token = SecurityUtils.getLoginUser().getToken(); |
| 119 | + updateRemoteCompanyAndTruck(companyCredit, token); | ||
| 120 | 120 | ||
| 121 | return i; | 121 | return i; |
| 122 | } | 122 | } |
| @@ -208,18 +208,36 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | @@ -208,18 +208,36 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | ||
| 208 | map.put("valid", 0); | 208 | map.put("valid", 0); |
| 209 | map.put("size", 99999); | 209 | map.put("size", 99999); |
| 210 | JSONArray turckList = null; | 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 | if (turckList != null) { | 235 | if (turckList != null) { |
| 236 | + | ||
| 237 | + List<Map> updateList = new ArrayList(); | ||
| 238 | + | ||
| 220 | for (Object objec : turckList) { | 239 | for (Object objec : turckList) { |
| 221 | 240 | ||
| 222 | - List<Map> updateList = new ArrayList(); | ||
| 223 | JSONObject truck = (JSONObject) objec; | 241 | JSONObject truck = (JSONObject) objec; |
| 224 | 242 | ||
| 225 | String truckId = truck.getString("id"); | 243 | String truckId = truck.getString("id"); |
| @@ -242,13 +260,6 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | @@ -242,13 +260,6 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | ||
| 242 | upParam.put("creditStatus", credit); | 260 | upParam.put("creditStatus", credit); |
| 243 | upParam.put("id", truckId); | 261 | upParam.put("id", truckId); |
| 244 | updateList.add(upParam); | 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 | } else { | 265 | } else { |
| @@ -280,13 +291,29 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | @@ -280,13 +291,29 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { | ||
| 280 | upParam.put("creditStatus", credit); | 291 | upParam.put("creditStatus", credit); |
| 281 | upParam.put("id", truckId); | 292 | upParam.put("id", truckId); |
| 282 | updateList.add(upParam); | 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 | } |