Commit 7c3580d166b3a14eb4a95271f36c295b53e0a00d

Authored by youxiw2000
2 parents 4c23c208 946fbbae

m

trash-common/src/main/java/com/trash/common/utils/RemoteServerUtils.java
1   -package com.trash.common.utils;
2   -
3   -import java.io.File;
4   -import java.io.FileInputStream;
5   -import java.io.FileNotFoundException;
6   -import java.io.IOException;
7   -import java.io.InputStream;
8   -import java.security.GeneralSecurityException;
9   -import java.security.KeyStore;
10   -import java.security.SecureRandom;
11   -import java.security.cert.Certificate;
12   -import java.security.cert.CertificateException;
13   -import java.security.cert.CertificateFactory;
14   -import java.security.cert.X509Certificate;
15   -import java.util.ArrayList;
16   -import java.util.Arrays;
17   -import java.util.Collection;
18   -import java.util.HashMap;
19   -import java.util.List;
20   -import java.util.Map;
21   -import java.util.concurrent.TimeUnit;
22   -
23   -import javax.net.ssl.HostnameVerifier;
24   -import javax.net.ssl.KeyManagerFactory;
25   -import javax.net.ssl.SSLContext;
26   -import javax.net.ssl.SSLSession;
27   -import javax.net.ssl.SSLSocketFactory;
28   -import javax.net.ssl.TrustManager;
29   -import javax.net.ssl.TrustManagerFactory;
30   -import javax.net.ssl.X509TrustManager;
31   -
32   -import com.alibaba.fastjson.JSON;
33   -import com.alibaba.fastjson.JSONArray;
34   -import com.alibaba.fastjson.JSONObject;
35   -import com.trash.common.utils.spring.SpringUtils;
36   -import com.trash.common.utils.util.PostSms;
37   -import com.trash.common.utils.vo.mt.JsonSmsSend;
38   -import com.trash.common.utils.vo.mt.Mobile;
39   -
40   -import okhttp3.MediaType;
41   -import okhttp3.OkHttpClient;
42   -import okhttp3.Request;
43   -import okhttp3.RequestBody;
44   -
45   -public class RemoteServerUtils {
46   -
47   - // public static String remote = "http://183.66.242.6:14601/";
48   -
49   - // public static String remote = "http://175.6.47.84:8008/";
50   -
51   - public static String remote;
52   -
53   - public static OkHttpClient okHttpClient;
54   -
55   - public static String TruckListRequestPath = "/api/gpsservice/cs/basevehicle/ledger/list";
56   -
57   - public static String UpdateTruckRequestPath = "/api/gpsservice/cs/basevehicle/credit/status";
58   -
59   - public static String TruckStatusListRequestPath = "/api/gpsservice/cs/basevehicle/statusquery";
60   -
61   - public static String TruckInfo = "/api/gpsservice/cs/basevehicle/";
62   - public static String EarthSitesInfo = "/api/siteservice/cs/earthsites/";
63   -
64   - public static String EarthSitesList = "/api/siteservice/cs/earthsites/ledger/list";
65   -
66   - public static String ConstructionInfo = "/api/siteservice/cs/constructionsites/";
67   -
68   - // license/ 留一下...
69   - public static String constructionLicenseById = "/api/siteservice/cs/constructionsites/";
70   -
71   - public static String ConstructionList = "/api/siteservice/cs/constructionsites/search";
72   - public static String ConstructionLedgerList = "/api/siteservice/cs/constructionsites/ledger/list";
73   -
74   - public static String UpdateConstruction = "/api/siteservice/cs/constructionsites/status";
75   -
76   - public static String UpdateSupervision = "/api/gpsservice/cs/supervision/status/update";
77   -
78   - public static String CompanyListRequestPath = "/api/gpsservice/cs/companies/ledger/list";
79   -
80   - public static String UpdateCompanyRequestPath = "/api/gpsservice/cs/companies/credit/status";
81   -
82   - public static String UpdateEarthSiteRequestPath = "/api/siteservice/cs/earthsites/status";
83   -
84   - public static String UpdateConractRequestPath = "/api/siteservice/cs/sitecontract/audit/status";
85   -
86   - public static String DriverListPath = "/api/gpsservice/v1/drivers/search";
87   -
88   - public static String CompanyUpdateAudit = "/api/gpsservice/cs/companies/audit/status";
89   -
90   - public static String TruckUpdateAudit = "/api/gpsservice/cs/basevehicle/audit/status";
91   -
92   - public static String DriverUpdateAudit = "/api/gpsservice/v1/drivers/audit/status";
93   -
94   - public static String BasevehicleInfo = "/api/gpsservice/cs/basevehicle/";
95   -
96   - public static String ContractList = "/api/siteservice/cs/sitecontract/ledger/list";
97   -
98   - public static String Unitetransport = "/api/siteservice/cs/unitetransport/bysite/";
99   -
100   - public static String GETAUTH = "/api/gpsservice/cs/authority";
101   -
102   - public static JSONArray getUnitetransport(String id) {
103   - JSONArray list = null;
104   - try {
105   - list = (JSONArray) get(Unitetransport + id, null);
106   - } catch (Exception e) {
107   - // TODO: handle exception
108   - }
109   -
110   - return list;
111   - }
112   -
113   - public static JSONArray getContractList(Map map) {
114   - JSONArray list = null;
115   - Object object = post(ContractList, map);
116   -
117   - if (object != null) {
118   - JSONObject jsonObject = JSON.parseObject(object.toString());
119   - list = jsonObject.getJSONArray("list");
120   - }
121   -
122   - return list;
123   - }
124   -
125   - public static JSONArray getContractList(Map map, String token) {
126   -
127   - JSONArray list = null;
128   - Object object = post(ContractList, map, token);
129   -
130   - if (object != null) {
131   - JSONObject jsonObject = JSON.parseObject(object.toString());
132   - list = jsonObject.getJSONArray("list");
133   - }
134   -
135   - return list;
136   - }
137   -
138   - public static JSONArray getEarthSitesList(Map map) {
139   - JSONArray list = null;
140   - Object object = post(EarthSitesList, map);
141   -
142   - if (object != null) {
143   - JSONObject jsonObject = JSON.parseObject(object.toString());
144   - list = jsonObject.getJSONArray("list");
145   - }
146   -
147   - return list;
148   - }
149   -
150   - public static JSONArray getEarthSitesList(Map map, String token) {
151   - JSONArray list = null;
152   - Object object = post(EarthSitesList, map, token);
153   -
154   - if (object != null) {
155   - JSONObject jsonObject = JSON.parseObject(object.toString());
156   - list = jsonObject.getJSONArray("list");
157   - }
158   -
159   - return list;
160   - }
161   -
162   - public static JSONArray getConstructionLedgerList(Map map) {
163   - JSONArray list = null;
164   - Object object = post(ConstructionLedgerList, map);
165   -
166   - if (object != null) {
167   - JSONObject jsonObject = JSON.parseObject(object.toString());
168   - list = jsonObject.getJSONArray("list");
169   - }
170   -
171   - return list;
172   - }
173   -
174   - public static JSONArray getConstructionList(Map map) {
175   - JSONArray list = null;
176   - Object object = post(ConstructionList, map);
177   -
178   - if (object != null) {
179   - JSONObject jsonObject = JSON.parseObject(object.toString());
180   - list = jsonObject.getJSONArray("list");
181   - }
182   -
183   - return list;
184   - }
185   -
186   - public static JSONArray getConstructionLedgerList(Map map, String token) {
187   - JSONArray list = null;
188   - Object object = post(ConstructionLedgerList, map,token);
189   -
190   - if (object != null) {
191   - JSONObject jsonObject = JSON.parseObject(object.toString());
192   - list = jsonObject.getJSONArray("list");
193   - }
194   -
195   - return list;
196   - }
197   -
198   - public static JSONArray getConstructionList(Map map, String token) {
199   - JSONArray list = null;
200   - Object object = post(ConstructionList, map, token);
201   -
202   - if (object != null) {
203   - JSONObject jsonObject = JSON.parseObject(object.toString());
204   - list = jsonObject.getJSONArray("list");
205   - }
206   -
207   - return list;
208   - }
209   -
210   - public static JSONArray getTruckOnline(Map map) {
211   - JSONArray turckList = null;
212   - Object object = post(TruckStatusListRequestPath, map);
213   -
214   - if (object != null) {
215   - JSONObject jsonObject = JSON.parseObject(object.toString());
216   - turckList = jsonObject.getJSONArray("list");
217   - }
218   -
219   - return turckList;
220   - }
221   -
222   - public static Object updateConstationCreditAndStatus(List<Map> map) {
223   - JSONArray turckList = null;
224   - Object object = post(UpdateConstruction, map);
225   -
226   - return object;
227   - }
228   -
229   - public static Object UpdateSupervisionStatus(List<Map> map) {
230   - Object object = post(UpdateSupervision, map);
231   -
232   - return object;
233   - }
234   -
235   - public static Object updateCompanyAudit(List<Map> map, String token) {
236   - Object object = post(CompanyUpdateAudit, map, token);
237   - return object;
238   - }
239   -
240   - public static Object updateTruckAudit(List<Map> map, String token) {
241   - Object object = post(TruckUpdateAudit, map, token);
242   - return object;
243   - }
244   -
245   - public static Object updateDriverAudit(List<Map> map, String token) {
246   - Object object = post(DriverUpdateAudit, map, token);
247   - return object;
248   - }
249   -
250   - public static Object updateCompanyAudit(List<Map> map) {
251   - Object object = post(CompanyUpdateAudit, map);
252   - return object;
253   - }
254   -
255   - public static Object updateTruckAudit(List<Map> map) {
256   - Object object = post(TruckUpdateAudit, map);
257   - return object;
258   - }
259   -
260   - public static Object updateDriverAudit(List<Map> map) {
261   - Object object = post(DriverUpdateAudit, map);
262   - return object;
263   - }
264   -
265   - public static Object updateEarthSitesCreditAndStatus(List<Map> map) {
266   - JSONArray turckList = null;
267   - Object object = post(UpdateEarthSiteRequestPath, map);
268   -
269   - return object;
270   - }
271   -
272   - public static Object updateConractStatus(List<Map> map) {
273   - JSONArray turckList = null;
274   - Object object = post(UpdateConractRequestPath, map);
275   -
276   - return object;
277   - }
278   -
279   - public static JSONObject getEarthSitesInfo(String id) {
280   - JSONObject json = null;
281   - Object object = get(EarthSitesInfo + id, null);
282   -
283   - if (object != null) {
284   - json = JSON.parseObject(object.toString());
285   - return json;
286   - }
287   -
288   - return json;
289   - }
290   -
291   - public static JSONObject getTruckInfo(String id) {
292   - JSONObject turckList = null;
293   - Object object = get(TruckInfo + id, null);
294   -
295   - if (object != null) {
296   - turckList = JSON.parseObject(object.toString());
297   - return turckList;
298   - }
299   -
300   - return turckList;
301   - }
302   -
303   - public static JSONObject getConstructionLicenseById(String id) {
304   - JSONObject turckList = null;
305   - Object object = get(constructionLicenseById + id, null);
306   -
307   - if (object != null) {
308   - turckList = JSON.parseObject(object.toString());
309   - return turckList;
310   - }
311   -
312   - return turckList;
313   -
314   - }
315   -
316   - public static JSONObject getConstructionLicenseById(String id, String token) {
317   - JSONObject turckList = null;
318   - Object object = get(constructionLicenseById + id, null, token);
319   -
320   - if (object != null) {
321   - turckList = JSON.parseObject(object.toString());
322   - return turckList;
323   - }
324   -
325   - return turckList;
326   -
327   - }
328   -
329   - public static JSONObject getConstructionInfo(String id) {
330   - JSONObject turckList = null;
331   - Object object = get(ConstructionInfo + id, null);
332   -
333   - if (object != null) {
334   - turckList = JSON.parseObject(object.toString());
335   - return turckList;
336   - }
337   -
338   - return turckList;
339   -
340   - }
341   -
342   - public static JSONArray getCompanyList(Map params) {
343   - JSONArray turckList = null;
344   - Object object = post(CompanyListRequestPath, params);
345   -
346   - if (object != null) {
347   - JSONObject jsonObject = JSON.parseObject(object.toString());
348   - turckList = jsonObject.getJSONArray("list");
349   - }
350   -
351   - return turckList;
352   - }
353   -
354   - public static Object updateCompanyList(List<Map> updateList) {
355   - JSONArray turckList = null;
356   - Object object = post(UpdateCompanyRequestPath, updateList);
357   -
358   - return object;
359   - }
360   -
361   - public static JSONArray getAreas() {
362   - JSONArray array = null;
363   - Object object = get("/api/gpsservice/cs/area", null);
364   -
365   - if (object != null) {
366   - array = JSON.parseArray(object.toString());
367   - }
368   -
369   - return array;
370   - }
371   -
372   - public static JSONArray getDict(Map params) {
373   - JSONArray array = null;
374   - Object object = get("/api/gpsservice/cs/dataDict", params);
375   -
376   - if (object != null) {
377   - array = JSON.parseArray(object.toString());
378   - }
379   -
380   - return array;
381   - }
382   -
383   - public static JSONArray getTruckList(Map params) {
384   - JSONArray turckList = null;
385   - Object object = post(TruckListRequestPath, params);
386   -
387   - if (object != null) {
388   - JSONObject jsonObject = JSON.parseObject(object.toString());
389   - turckList = jsonObject.getJSONArray("list");
390   - }
391   -
392   - return turckList;
393   - }
394   -
395   - public static Object updateTruckList(List<Map> updateList) {
396   - JSONArray turckList = null;
397   - Object object = post(UpdateTruckRequestPath, updateList);
398   -
399   - return object;
400   - }
401   -
402   - public static JSONArray getTruckOnline(Map map, String token) {
403   - JSONArray turckList = null;
404   - Object object = post(TruckStatusListRequestPath, map, token);
405   -
406   - if (object != null) {
407   - JSONObject jsonObject = JSON.parseObject(object.toString());
408   - turckList = jsonObject.getJSONArray("list");
409   - }
410   -
411   - return turckList;
412   - }
413   -
414   - public static Object updateConstationCreditAndStatus(List<Map> map, String token) {
415   - JSONArray turckList = null;
416   - Object object = post(UpdateConstruction, map, token);
417   -
418   - return object;
419   - }
420   -
421   - public static Object updateEarthSitesCreditAndStatus(List<Map> map, String token) {
422   - JSONArray turckList = null;
423   - Object object = post(UpdateEarthSiteRequestPath, map, token);
424   -
425   - return object;
426   - }
427   -
428   - public static Object updateConractStatus(List<Map> map, String token) {
429   - JSONArray turckList = null;
430   - Object object = post(UpdateConractRequestPath, map, token);
431   -
432   - return object;
433   - }
434   -
435   - public static JSONObject getEarthSitesInfo(String id, String token) {
436   - JSONObject json = null;
437   - Object object = get(EarthSitesInfo + id, null, token);
438   -
439   - if (object != null) {
440   - json = JSON.parseObject(object.toString());
441   - return json;
442   - }
443   -
444   - return json;
445   - }
446   -
447   - public static JSONObject getTruckInfo(String id, String token) {
448   - JSONObject turckList = null;
449   - Object object = get(TruckInfo + id, null, token);
450   -
451   - if (object != null) {
452   - turckList = JSON.parseObject(object.toString());
453   - return turckList;
454   - }
455   -
456   - return turckList;
457   - }
458   -
459   - public static JSONObject getConstructionInfo(String id, String token) {
460   - JSONObject turckList = null;
461   - Object object = get(ConstructionInfo + id, null, token);
462   -
463   - if (object != null) {
464   - turckList = JSON.parseObject(object.toString());
465   - return turckList;
466   - }
467   -
468   - return turckList;
469   -
470   - }
471   -
472   - public static JSONArray getCompanyList(Map params, String token) {
473   - JSONArray turckList = null;
474   - Object object = post(CompanyListRequestPath, params, token);
475   -
476   - if (object != null) {
477   - JSONObject jsonObject = JSON.parseObject(object.toString());
478   - turckList = jsonObject.getJSONArray("list");
479   - }
480   -
481   - return turckList;
482   - }
483   -
484   - public static Object updateCompanyList(List<Map> updateList, String token) {
485   - JSONArray turckList = null;
486   - Object object = post(UpdateCompanyRequestPath, updateList, token);
487   -
488   - return object;
489   - }
490   -
491   - public static JSONArray getAreas(String token) {
492   - JSONArray array = null;
493   - Object object = get("/api/gpsservice/cs/area", null, token);
494   -
495   - if (object != null) {
496   - array = JSON.parseArray(object.toString());
497   - }
498   -
499   - return array;
500   - }
501   -
502   - public static JSONArray getDict(Map params, String token) {
503   - JSONArray array = null;
504   - Object object = get("/api/gpsservice/cs/dataDict", params, token);
505   -
506   - if (object != null) {
507   - array = JSON.parseArray(object.toString());
508   - }
509   -
510   - return array;
511   - }
512   -
513   - public static JSONArray getTruckList(Map params, String token) {
514   - JSONArray turckList = null;
515   - Object object = post(TruckListRequestPath, params, token);
516   -
517   - if (object != null) {
518   - JSONObject jsonObject = JSON.parseObject(object.toString());
519   - turckList = jsonObject.getJSONArray("list");
520   - }
521   -
522   - return turckList;
523   - }
524   -
525   - public static Object updateTruckList(List<Map> updateList, String token) {
526   - JSONArray turckList = null;
527   - Object object = post(UpdateTruckRequestPath, updateList, token);
528   -
529   - return object;
530   - }
531   -
532   - // 实现X509TrustManager接口
533   - public static class MyTrustManager implements X509TrustManager {
534   - @Override
535   - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
536   - }
537   -
538   - @Override
539   - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
540   - }
541   -
542   - @Override
543   - public X509Certificate[] getAcceptedIssuers() {
544   - return new X509Certificate[0];
545   - }
546   - }
547   -
548   - private static SSLSocketFactory createSSLSocketFactory() {
549   - SSLSocketFactory ssfFactory = null;
550   - try {
551   - MyTrustManager mMyTrustManager = new MyTrustManager();
552   - SSLContext sc = SSLContext.getInstance("TLS");
553   - sc.init(null, new TrustManager[] { mMyTrustManager }, new SecureRandom());
554   - ssfFactory = sc.getSocketFactory();
555   - } catch (Exception ignored) {
556   - ignored.printStackTrace();
557   - }
558   -
559   - return ssfFactory;
560   - }
561   -
562   - // 实现HostnameVerifier接口
563   - private class TrustAllHostnameVerifier implements HostnameVerifier {
564   - @Override
565   - public boolean verify(String hostname, SSLSession session) {
566   - return true;
567   - }
568   - }
569   -
570   - /**
571   - * 获去信任自签证书的trustManager
572   - *
573   - * @param ins
574   - * 自签证书输入流
575   - * @return 信任自签证书的trustManager
576   - * @throws GeneralSecurityException
577   - */
578   - private static X509TrustManager trustManagerForCertificates(InputStream... ins) throws GeneralSecurityException {
579   - // 创建证书工厂
580   - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
581   -
582   - // 通过证书工厂得到自签证书对象集合
583   - Collection<Certificate> certificates = new ArrayList<>();
584   -
585   - for (InputStream inputStream : ins) {
586   - certificates.addAll(certificateFactory.generateCertificates(inputStream));
587   - }
588   -
589   - if (certificates.isEmpty()) {
590   - throw new IllegalArgumentException("expected non-empty set of trusted certificates");
591   - }
592   -
593   - // 为证书设置一个keyStore
594   - char[] password = "password".toCharArray(); // Any password will work.
595   - KeyStore keyStore = newEmptyKeyStore(password);
596   - int index = 0;
597   - // 将所有证书放入证书放入keystore中
598   - for (Certificate certificate : certificates) {
599   - String certificateAlias = Integer.toString(index++);
600   - keyStore.setCertificateEntry(certificateAlias, certificate);
601   - }
602   -
603   - // Use it to build an X509 trust manager.
604   - // 使用包含自签证书信息的keyStore去构建一个X509TrustManager
605   - KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
606   - keyManagerFactory.init(keyStore, password);
607   - TrustManagerFactory trustManagerFactory = TrustManagerFactory
608   - .getInstance(TrustManagerFactory.getDefaultAlgorithm());
609   - trustManagerFactory.init(keyStore);
610   - TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
611   - if (trustManagers.length == 0) {
612   - throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
613   - }
614   - return ((X509TrustManager) trustManagers[0]);
615   - }
616   -
617   - private static KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
618   - try {
619   - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
620   - InputStream in = null; // By convention, 'null' creates an empty key
621   - // store.
622   - keyStore.load(null, password);
623   - return keyStore;
624   - } catch (IOException e) {
625   - throw new AssertionError(e);
626   - }
627   - }
628   -
629   - public static Object post(String url, Object obj) {
630   - if (okHttpClient == null) {
631   -
632   - okHttpClient = getOkClient();
633   - }
634   - String token = SecurityUtils.getLoginUser().getToken();
635   -
636   - if (token.contains("durable:")) {
637   - token = token.replace("durable:", "Bearer durable:auth:token:");
638   - } else {
639   - token = "Bearer auth:token:" + token;
640   - }
641   -
642   - String param = JSON.toJSON(obj).toString();
643   -
644   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
645   -
646   - Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).post(body).build();
647   -
648   - try {
649   - okhttp3.Response response = okHttpClient.newCall(request).execute();
650   - String result = response.body().string();
651   -
652   - if (result != null) {
653   - JSONObject json = JSON.parseObject(result);
654   - if (json.getInteger("code") == 200) {
655   - return json.get("result");
656   - }
657   -
658   - } else {
659   - return null;
660   - }
661   -
662   - } catch (Exception e) {
663   - e.printStackTrace();
664   - return null;
665   - }
666   -
667   - return null;
668   - }
669   -
670   - public static Object get(String url, Map<String, String> obj) {
671   - if (okHttpClient == null) {
672   - okHttpClient = getOkClient();
673   - }
674   -
675   - String token = SecurityUtils.getLoginUser().getToken();
676   -
677   - if (token.contains("durable:")) {
678   - token = token.replace("durable:", "Bearer durable:auth:token:");
679   - } else {
680   - token = "Bearer auth:token:" + token;
681   - }
682   -
683   - String params = "";
684   -
685   - if (obj != null) {
686   -
687   - params += "?";
688   -
689   - for (String key : obj.keySet()) {
690   - params += key + "=" + obj.get(key) + "&";
691   - }
692   -
693   - params = params.substring(0, params.length() - 1);
694   - }
695   -
696   - url += params;
697   -
698   - Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).get().build();
699   -
700   - try {
701   - okhttp3.Response response = okHttpClient.newCall(request).execute();
702   - String result = response.body().string();
703   -
704   - if (result != null) {
705   - JSONObject json = JSON.parseObject(result);
706   - if ("success".equals(json.getString("message"))) {
707   - return json.get("result");
708   - }
709   - } else {
710   - return null;
711   - }
712   -
713   - } catch (Exception e) {
714   - e.printStackTrace();
715   - return null;
716   - }
717   -
718   - return null;
719   - }
720   -
721   - public static Object post(String url, Object obj, String token) {
722   - if (okHttpClient == null) {
723   -
724   - okHttpClient = getOkClient();
725   - }
726   -
727   -
728   - if (token.contains("durable:")) {
729   - token = "Bearer " + token.replaceAll("durable:", "");
730   - } else {
731   - token = "Bearer auth:token:" + token;
732   - }
733   -
734   -
735   - String param = JSON.toJSON(obj).toString();
736   -
737   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
738   -
739   - Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).post(body).build();
740   -
741   - try {
742   - okhttp3.Response response = okHttpClient.newCall(request).execute();
743   - String result = response.body().string();
744   -
745   - if (result != null) {
746   - JSONObject json = JSON.parseObject(result);
747   - if (json.getInteger("code") == 200) {
748   - return json.get("result");
749   - }
750   -
751   - } else {
752   - return null;
753   - }
754   -
755   - } catch (Exception e) {
756   - e.printStackTrace();
757   - return null;
758   - }
759   -
760   - return null;
761   - }
762   -
763   - public static OkHttpClient getOkClient() {
764   -// X509TrustManager x509TrustManager = null;
765   -// try {
766   -// File file = new File("src/main/resources/183.66.242.6.crt");
767   -// x509TrustManager = trustManagerForCertificates(new FileInputStream(file));
768   -// } catch (FileNotFoundException e) {
769   -// // TODO Auto-generated catch block
770   -// e.printStackTrace();
771   -// } catch (GeneralSecurityException e) {
772   -// // TODO Auto-generated catch blockxiashuo
773   -// e.printStackTrace();
774   -// }
775   -
776   -// .sslSocketFactory(createSSLSocketFactory(), x509TrustManager)
777   -
778   - okHttpClient = new OkHttpClient.Builder()
779   - .connectTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS)
780   - .readTimeout(30, TimeUnit.SECONDS).build();
781   -
782   - return okHttpClient;
783   - }
784   -
785   - public static Object get(String url, Map<String, String> obj, String token) {
786   - if (okHttpClient == null) {
787   -
788   -
789   - okHttpClient = getOkClient();
790   - }
791   -
792   - if (token.contains("durable:")) {
793   - token = "Bearer " + token.replaceAll("durable:", "");
794   - } else {
795   - token = "Bearer auth:token:" + token;
796   - }
797   -
798   - String params = "";
799   -
800   - if (obj != null) {
801   -
802   - params += "?";
803   -
804   - for (String key : obj.keySet()) {
805   - params += key + "=" + obj.get(key) + "&";
806   - }
807   -
808   - params = params.substring(0, params.length() - 1);
809   - }
810   -
811   - url += params;
812   -
813   - Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).get().build();
814   -
815   - try {
816   - okhttp3.Response response = okHttpClient.newCall(request).execute();
817   - String result = response.body().string();
818   -
819   - if (result != null) {
820   - JSONObject json = JSON.parseObject(result);
821   - if ("success".equals(json.getString("message"))) {
822   - return json.get("result");
823   - }
824   - } else {
825   - return null;
826   - }
827   -
828   - } catch (Exception e) {
829   - e.printStackTrace();
830   - return null;
831   - }
832   -
833   - return null;
834   - }
835   -
836   - public static JSONObject getBasevehicleInfo(String id, String token) {
837   - JSONObject turckList = null;
838   - Object object = get(BasevehicleInfo + id, null, token);
839   -
840   - if (object != null) {
841   - turckList = JSON.parseObject(object.toString());
842   - return turckList;
843   - }
844   -
845   - return turckList;
846   - }
847   -
848   -
849   - public static JSONArray getDriverList() {
850   -
851   - try {
852   - Map map = new HashMap<>();
853   - Object result = get(DriverListPath, null);
854   -
855   - if (result != null) {
856   - JSONObject json = JSON.parseObject(result.toString());
857   - return json.getJSONArray("list");
858   -
859   - } else {
860   - return null;
861   - }
862   -
863   - } catch (Exception e) {
864   - e.printStackTrace();
865   - return null;
866   - }
867   - }
868   -
869   - public static JSONArray getDriverList(String token) {
870   -
871   - if (okHttpClient == null) {
872   - okHttpClient = getOkClient();
873   - }
874   -
875   - token = "Bearer " + token;
876   -
877   - String param = JSON.toJSON(new HashMap<>()).toString();
878   -
879   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
880   -
881   - Request request = new Request.Builder().url(remote + DriverListPath).addHeader("Authorization", token)
882   - .post(body).build();
883   -
884   - try {
885   - okhttp3.Response response = okHttpClient.newCall(request).execute();
886   - String result = response.body().string();
887   -
888   - if (result != null) {
889   - JSONObject json = JSON.parseObject(result);
890   - return json.getJSONArray("list");
891   -
892   - } else {
893   - return null;
894   - }
895   -
896   - } catch (Exception e) {
897   - e.printStackTrace();
898   - return null;
899   - }
900   - }
901   -
902   - static String upUrl = "https://cszgf.tyykj.com:37251/";
903   -
904   - public static boolean updateUpCase(Map map) {
905   - if (okHttpClient == null) {
906   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
907   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
908   - }
909   -
910   - String param = JSON.toJSON(map).toString();
911   -
912   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
913   -
914   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/query/callback")
915   - .addHeader("Authorization", getUpUser()).post(body).build();
916   -
917   - okhttp3.Response response;
918   - String result;
919   - try {
920   - response = okHttpClient.newCall(request).execute();
921   -
922   - result = response.body().string();
923   - JSONObject json = JSON.parseObject(result);
924   - if (json.getBoolean("success")) {
925   - return json.getBoolean("success");
926   - }
927   - } catch (IOException e) {
928   - // TODO Auto-generated catch block
929   - e.printStackTrace();
930   - }
931   -
932   - return false;
933   -
934   - }
935   -
936   - public static String getUpUser() {
937   - if (okHttpClient == null) {
938   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
939   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
940   - }
941   -
942   - Map map = new HashMap<>();
943   -
944   - map.put("userName", "市渣土管理系统");
945   - map.put("password", "mwcfVIiTfWttBJL02O+CGw==");
946   - String param = JSON.toJSON(map).toString();
947   -
948   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
949   -
950   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/token").post(body).build();
951   -
952   - try {
953   - okhttp3.Response response = okHttpClient.newCall(request).execute();
954   - String result = response.body().string();
955   -
956   - if (result != null) {
957   - JSONObject json = JSON.parseObject(result);
958   - if (json.getBoolean("success")) {
959   - return json.getString("data");
960   - }
961   - } else {
962   - return null;
963   - }
964   -
965   - } catch (Exception e) {
966   - e.printStackTrace();
967   - return null;
968   - }
969   - return null;
970   - }
971   -
972   - public static JSONArray getUpArea() {
973   - if (okHttpClient == null) {
974   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
975   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
976   - }
977   -
978   - Map map = new HashMap<>();
979   -
980   - String param = JSON.toJSON(map).toString();
981   -
982   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
983   -
984   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/areaList")
985   - .addHeader("Authorization", getUpUser()).post(body).build();
986   -
987   - try {
988   - okhttp3.Response response = okHttpClient.newCall(request).execute();
989   - String result = response.body().string();
990   -
991   - if (result != null) {
992   - JSONObject json = JSON.parseObject(result);
993   - if (json.getBoolean("success")) {
994   - return json.getJSONArray("data");
995   - }
996   - }
997   -
998   - } catch (Exception e) {
999   - e.printStackTrace();
1000   -
1001   - }
1002   - return null;
1003   - }
1004   -
1005   - public static boolean replyUpCase(Map params) {
1006   - if (okHttpClient == null) {
1007   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1008   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1009   - }
1010   -
1011   - Map map = new HashMap<>();
1012   -
1013   - String param = JSON.toJSON(params).toString();
1014   -
1015   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1016   -
1017   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/push/handleResult")
1018   - .addHeader("Authorization", getUpUser()).post(body).build();
1019   -
1020   - try {
1021   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1022   - String result = response.body().string();
1023   -
1024   - if (result != null) {
1025   - JSONObject json = JSON.parseObject(result);
1026   - return json.getBoolean("success");
1027   - }
1028   -
1029   - } catch (Exception e) {
1030   - e.printStackTrace();
1031   -
1032   - }
1033   - return false;
1034   - }
1035   -
1036   - public static boolean insertUpCase(Map params) {
1037   - if (okHttpClient == null) {
1038   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1039   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1040   - }
1041   -
1042   - Map map = new HashMap<>();
1043   -
1044   - String param = JSON.toJSON(params).toString();
1045   -
1046   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1047   -
1048   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/push/acceptEvt")
1049   - .addHeader("Authorization", getUpUser()).post(body).build();
1050   -
1051   - try {
1052   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1053   - String result = response.body().string();
1054   -
1055   - if (result != null) {
1056   - JSONObject json = JSON.parseObject(result);
1057   - return json.getBoolean("success");
1058   - }
1059   -
1060   - } catch (Exception e) {
1061   - e.printStackTrace();
1062   -
1063   - }
1064   - return false;
1065   - }
1066   -
1067   - public static JSONObject getUpClass() {
1068   - if (okHttpClient == null) {
1069   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1070   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1071   - }
1072   -
1073   - Map map = new HashMap<>();
1074   -
1075   - map.put("industryType", "01");
1076   -
1077   - String param = JSON.toJSON(map).toString();
1078   -
1079   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1080   -
1081   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/classList")
1082   - .addHeader("Authorization", getUpUser()).post(body).build();
1083   -
1084   - try {
1085   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1086   - String result = response.body().string();
1087   -
1088   - if (result != null) {
1089   - JSONObject json = JSON.parseObject(result);
1090   - if (json.getBoolean("success")) {
1091   -
1092   - for (Object object : json.getJSONArray("data")) {
1093   - JSONObject jsonObj = (JSONObject) object;
1094   -
1095   - if (jsonObj.getString("name").equals("")) {
1096   -
1097   - }
1098   -
1099   - }
1100   -
1101   - }
1102   - } else {
1103   - return null;
1104   - }
1105   -
1106   - } catch (Exception e) {
1107   - e.printStackTrace();
1108   - return null;
1109   - }
1110   - return null;
1111   - }
1112   -
1113   -
1114   - public static boolean delayUpCase(Map map) {
1115   - if (okHttpClient == null) {
1116   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1117   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1118   - }
1119   -
1120   -
1121   - String param = JSON.toJSON(map).toString();
1122   -
1123   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1124   -
1125   - Request request = new Request.Builder().url(upUrl + "/api/thirdApi/push/delayApply")
1126   - .addHeader("Authorization", getUpUser()).post(body).build();
1127   -
1128   - try {
1129   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1130   - String result = response.body().string();
1131   -
1132   - if (result != null) {
1133   - JSONObject json = JSON.parseObject(result);
1134   - if (json.getBoolean("success")) {
1135   - return json.getBoolean("success");
1136   - }
1137   - } else {
1138   - return false;
1139   - }
1140   -
1141   - } catch (Exception e) {
1142   - e.printStackTrace();
1143   - return false;
1144   - }
1145   - return false;
1146   - }
1147   -
1148   -
1149   - public static boolean deleteUpCase(Map map) {
1150   - if (okHttpClient == null) {
1151   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1152   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1153   - }
1154   -
1155   -
1156   - String param = JSON.toJSON(map).toString();
1157   -
1158   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1159   -
1160   - Request request = new Request.Builder().url(upUrl + "/api/thirdApi/push/rollbackApply")
1161   - .addHeader("Authorization", getUpUser()).post(body).build();
1162   -
1163   - try {
1164   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1165   - String result = response.body().string();
1166   -
1167   - if (result != null) {
1168   - JSONObject json = JSON.parseObject(result);
1169   - if (json.getBoolean("success")) {
1170   - return json.getBoolean("success");
1171   - }
1172   - } else {
1173   - return false;
1174   - }
1175   -
1176   - } catch (Exception e) {
1177   - e.printStackTrace();
1178   - return false;
1179   - }
1180   - return false;
1181   - }
1182   -
1183   -
1184   -
1185   - public static JSONArray getUpCaseResult() {
1186   - if (okHttpClient == null) {
1187   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1188   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1189   - }
1190   -
1191   - Map map = new HashMap<>();
1192   -
1193   - String param = JSON.toJSON(map).toString();
1194   -
1195   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1196   -
1197   - Request request = new Request.Builder().url(upUrl + "/api/thirdApi/query/handleResultList")
1198   - .addHeader("Authorization", getUpUser()).post(body).build();
1199   -
1200   - try {
1201   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1202   - String result = response.body().string();
1203   -
1204   - if (result != null) {
1205   - JSONObject json = JSON.parseObject(result);
1206   - if (json.getBoolean("success")) {
1207   - return json.getJSONArray("data");
1208   - }
1209   - } else {
1210   - return null;
1211   - }
1212   -
1213   - } catch (Exception e) {
1214   - e.printStackTrace();
1215   - return null;
1216   - }
1217   - return null;
1218   -}
1219   -
1220   - public static JSONArray getUpCaseState(String url) {
1221   - if (okHttpClient == null) {
1222   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1223   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1224   - }
1225   -
1226   - Map map = new HashMap<>();
1227   -
1228   - String param = JSON.toJSON(map).toString();
1229   -
1230   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1231   -
1232   - Request request = new Request.Builder().url(upUrl + url)
1233   - .addHeader("Authorization", getUpUser()).post(body).build();
1234   -
1235   - try {
1236   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1237   - String result = response.body().string();
1238   -
1239   - if (result != null) {
1240   - JSONObject json = JSON.parseObject(result);
1241   - if (json.getBoolean("success")) {
1242   - return json.getJSONArray("data");
1243   - }
1244   - } else {
1245   - return null;
1246   - }
1247   -
1248   - } catch (Exception e) {
1249   - e.printStackTrace();
1250   - return null;
1251   - }
1252   - return null;
1253   - }
1254   -
1255   -
1256   - public static JSONArray getCaseList() {
1257   - if (okHttpClient == null) {
1258   - okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
1259   - .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
1260   - }
1261   -
1262   - Map map = new HashMap<>();
1263   -
1264   - String param = JSON.toJSON(map).toString();
1265   -
1266   - RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
1267   -
1268   - Request request = new Request.Builder().url(upUrl + "api/thirdApi/query/dispatchEvtList")
1269   - .addHeader("Authorization", getUpUser()).post(body).build();
1270   -
1271   - try {
1272   - okhttp3.Response response = okHttpClient.newCall(request).execute();
1273   - String result = response.body().string();
1274   -
1275   - if (result != null) {
1276   - JSONObject json = JSON.parseObject(result);
1277   - if (json.getBoolean("success")) {
1278   - return json.getJSONArray("data");
1279   - }
1280   - } else {
1281   - return null;
1282   - }
1283   -
1284   - } catch (Exception e) {
1285   - e.printStackTrace();
1286   - return null;
1287   - }
1288   - return null;
1289   - }
1290   -
1291   - public static Object getAuth(String token) {
1292   -
1293   - return get(GETAUTH, null, token.replace("Bearer ", ""));
1294   - }
1295   -
1296   -
1297   -
1298   -
1299   -
1300   -}
  1 +package com.trash.common.utils;
  2 +
  3 +import java.io.File;
  4 +import java.io.FileInputStream;
  5 +import java.io.FileNotFoundException;
  6 +import java.io.IOException;
  7 +import java.io.InputStream;
  8 +import java.security.GeneralSecurityException;
  9 +import java.security.KeyStore;
  10 +import java.security.SecureRandom;
  11 +import java.security.cert.Certificate;
  12 +import java.security.cert.CertificateException;
  13 +import java.security.cert.CertificateFactory;
  14 +import java.security.cert.X509Certificate;
  15 +import java.util.ArrayList;
  16 +import java.util.Arrays;
  17 +import java.util.Collection;
  18 +import java.util.HashMap;
  19 +import java.util.List;
  20 +import java.util.Map;
  21 +import java.util.concurrent.TimeUnit;
  22 +
  23 +import javax.net.ssl.HostnameVerifier;
  24 +import javax.net.ssl.KeyManagerFactory;
  25 +import javax.net.ssl.SSLContext;
  26 +import javax.net.ssl.SSLSession;
  27 +import javax.net.ssl.SSLSocketFactory;
  28 +import javax.net.ssl.TrustManager;
  29 +import javax.net.ssl.TrustManagerFactory;
  30 +import javax.net.ssl.X509TrustManager;
  31 +
  32 +import com.alibaba.fastjson.JSON;
  33 +import com.alibaba.fastjson.JSONArray;
  34 +import com.alibaba.fastjson.JSONObject;
  35 +import com.trash.common.utils.spring.SpringUtils;
  36 +import com.trash.common.utils.util.PostSms;
  37 +import com.trash.common.utils.vo.mt.JsonSmsSend;
  38 +import com.trash.common.utils.vo.mt.Mobile;
  39 +
  40 +import okhttp3.MediaType;
  41 +import okhttp3.OkHttpClient;
  42 +import okhttp3.Request;
  43 +import okhttp3.RequestBody;
  44 +
  45 +public class RemoteServerUtils {
  46 +
  47 + // public static String remote = "http://183.66.242.6:14601/";
  48 +
  49 + // public static String remote = "http://175.6.47.84:8008/";
  50 +
  51 + public static String remote;
  52 +
  53 + public static OkHttpClient okHttpClient;
  54 +
  55 + public static String TruckListRequestPath = "/api/gpsservice/cs/basevehicle/ledger/list";
  56 +
  57 + public static String UpdateTruckRequestPath = "/api/gpsservice/cs/basevehicle/credit/status";
  58 +
  59 + public static String TruckStatusListRequestPath = "/api/gpsservice/cs/basevehicle/statusquery";
  60 +
  61 + public static String TruckInfo = "/api/gpsservice/cs/basevehicle/";
  62 + public static String EarthSitesInfo = "/api/siteservice/cs/earthsites/";
  63 +
  64 + public static String EarthSitesList = "/api/siteservice/cs/earthsites/ledger/list";
  65 +
  66 + public static String ConstructionInfo = "/api/siteservice/cs/constructionsites/";
  67 +
  68 + // license/ 留一下...
  69 + public static String constructionLicenseById = "/api/siteservice/cs/constructionsites/";
  70 +
  71 + public static String ConstructionList = "/api/siteservice/cs/constructionsites/search";
  72 + public static String ConstructionLedgerList = "/api/siteservice/cs/constructionsites/ledger/list";
  73 +
  74 + public static String UpdateConstruction = "/api/siteservice/cs/constructionsites/status";
  75 +
  76 + public static String UpdateSupervision = "/api/gpsservice/cs/supervision/status/update";
  77 +
  78 + public static String CompanyListRequestPath = "/api/gpsservice/cs/companies/ledger/list";
  79 +
  80 + public static String UpdateCompanyRequestPath = "/api/gpsservice/cs/companies/credit/status";
  81 +
  82 + public static String UpdateEarthSiteRequestPath = "/api/siteservice/cs/earthsites/status";
  83 +
  84 + public static String UpdateConractRequestPath = "/api/siteservice/cs/sitecontract/audit/status";
  85 +
  86 + public static String DriverListPath = "/api/gpsservice/v1/drivers/search";
  87 +
  88 + public static String CompanyUpdateAudit = "/api/gpsservice/cs/companies/audit/status";
  89 +
  90 + public static String TruckUpdateAudit = "/api/gpsservice/cs/basevehicle/audit/status";
  91 +
  92 + public static String DriverUpdateAudit = "/api/gpsservice/v1/drivers/audit/status";
  93 +
  94 + public static String BasevehicleInfo = "/api/gpsservice/cs/basevehicle/";
  95 +
  96 + public static String ContractList = "/api/siteservice/cs/sitecontract/ledger/list";
  97 +
  98 + public static String Unitetransport = "/api/siteservice/cs/unitetransport/bysite/";
  99 +
  100 + public static String GETAUTH = "/api/gpsservice/cs/authority";
  101 +
  102 + public static JSONArray getUnitetransport(String id) {
  103 + JSONArray list = null;
  104 + try {
  105 + list = (JSONArray) get(Unitetransport + id, null);
  106 + } catch (Exception e) {
  107 + // TODO: handle exception
  108 + }
  109 +
  110 + return list;
  111 + }
  112 +
  113 + public static JSONArray getContractList(Map map) {
  114 + JSONArray list = null;
  115 + Object object = post(ContractList, map);
  116 +
  117 + if (object != null) {
  118 + JSONObject jsonObject = JSON.parseObject(object.toString());
  119 + list = jsonObject.getJSONArray("list");
  120 + }
  121 +
  122 + return list;
  123 + }
  124 +
  125 + public static JSONArray getContractList(Map map, String token) {
  126 +
  127 + JSONArray list = null;
  128 + Object object = post(ContractList, map, token);
  129 +
  130 + if (object != null) {
  131 + JSONObject jsonObject = JSON.parseObject(object.toString());
  132 + list = jsonObject.getJSONArray("list");
  133 + }
  134 +
  135 + return list;
  136 + }
  137 +
  138 + public static JSONArray getEarthSitesList(Map map) {
  139 + JSONArray list = null;
  140 + Object object = post(EarthSitesList, map);
  141 +
  142 + if (object != null) {
  143 + JSONObject jsonObject = JSON.parseObject(object.toString());
  144 + list = jsonObject.getJSONArray("list");
  145 + }
  146 +
  147 + return list;
  148 + }
  149 +
  150 + public static JSONArray getEarthSitesList(Map map, String token) {
  151 + JSONArray list = null;
  152 + Object object = post(EarthSitesList, map, token);
  153 +
  154 + if (object != null) {
  155 + JSONObject jsonObject = JSON.parseObject(object.toString());
  156 + list = jsonObject.getJSONArray("list");
  157 + }
  158 +
  159 + return list;
  160 + }
  161 +
  162 + public static JSONArray getConstructionLedgerList(Map map) {
  163 + JSONArray list = null;
  164 + Object object = post(ConstructionLedgerList, map);
  165 +
  166 + if (object != null) {
  167 + JSONObject jsonObject = JSON.parseObject(object.toString());
  168 + list = jsonObject.getJSONArray("list");
  169 + }
  170 +
  171 + return list;
  172 + }
  173 +
  174 + public static JSONArray getConstructionList(Map map) {
  175 + JSONArray list = null;
  176 + Object object = post(ConstructionList, map);
  177 +
  178 + if (object != null) {
  179 + JSONObject jsonObject = JSON.parseObject(object.toString());
  180 + list = jsonObject.getJSONArray("list");
  181 + }
  182 +
  183 + return list;
  184 + }
  185 +
  186 + public static JSONArray getConstructionLedgerList(Map map, String token) {
  187 + JSONArray list = null;
  188 + Object object = post(ConstructionLedgerList, map,token);
  189 +
  190 + if (object != null) {
  191 + JSONObject jsonObject = JSON.parseObject(object.toString());
  192 + list = jsonObject.getJSONArray("list");
  193 + }
  194 +
  195 + return list;
  196 + }
  197 +
  198 + public static JSONArray getConstructionList(Map map, String token) {
  199 + JSONArray list = null;
  200 + Object object = post(ConstructionList, map, token);
  201 +
  202 + if (object != null) {
  203 + JSONObject jsonObject = JSON.parseObject(object.toString());
  204 + list = jsonObject.getJSONArray("list");
  205 + }
  206 +
  207 + return list;
  208 + }
  209 +
  210 + public static JSONArray getTruckOnline(Map map) {
  211 + JSONArray turckList = null;
  212 + Object object = post(TruckStatusListRequestPath, map);
  213 +
  214 + if (object != null) {
  215 + JSONObject jsonObject = JSON.parseObject(object.toString());
  216 + turckList = jsonObject.getJSONArray("list");
  217 + }
  218 +
  219 + return turckList;
  220 + }
  221 +
  222 + public static Object updateConstationCreditAndStatus(List<Map> map) {
  223 + JSONArray turckList = null;
  224 + Object object = post(UpdateConstruction, map);
  225 +
  226 + return object;
  227 + }
  228 +
  229 + public static Object UpdateSupervisionStatus(List<Map> map) {
  230 + Object object = post(UpdateSupervision, map);
  231 +
  232 + return object;
  233 + }
  234 +
  235 + public static Object updateCompanyAudit(List<Map> map, String token) {
  236 + Object object = post(CompanyUpdateAudit, map, token);
  237 + return object;
  238 + }
  239 +
  240 + public static Object updateTruckAudit(List<Map> map, String token) {
  241 + Object object = post(TruckUpdateAudit, map, token);
  242 + return object;
  243 + }
  244 +
  245 + public static Object updateDriverAudit(List<Map> map, String token) {
  246 + Object object = post(DriverUpdateAudit, map, token);
  247 + return object;
  248 + }
  249 +
  250 + public static Object updateCompanyAudit(List<Map> map) {
  251 + Object object = post(CompanyUpdateAudit, map);
  252 + return object;
  253 + }
  254 +
  255 + public static Object updateTruckAudit(List<Map> map) {
  256 + Object object = post(TruckUpdateAudit, map);
  257 + return object;
  258 + }
  259 +
  260 + public static Object updateDriverAudit(List<Map> map) {
  261 + Object object = post(DriverUpdateAudit, map);
  262 + return object;
  263 + }
  264 +
  265 + public static Object updateEarthSitesCreditAndStatus(List<Map> map) {
  266 + JSONArray turckList = null;
  267 + Object object = post(UpdateEarthSiteRequestPath, map);
  268 +
  269 + return object;
  270 + }
  271 +
  272 + public static Object updateConractStatus(List<Map> map) {
  273 + JSONArray turckList = null;
  274 + Object object = post(UpdateConractRequestPath, map);
  275 +
  276 + return object;
  277 + }
  278 +
  279 + public static JSONObject getEarthSitesInfo(String id) {
  280 + JSONObject json = null;
  281 + Object object = get(EarthSitesInfo + id, null);
  282 +
  283 + if (object != null) {
  284 + json = JSON.parseObject(object.toString());
  285 + return json;
  286 + }
  287 +
  288 + return json;
  289 + }
  290 +
  291 + public static JSONObject getTruckInfo(String id) {
  292 + JSONObject turckList = null;
  293 + Object object = get(TruckInfo + id, null);
  294 +
  295 + if (object != null) {
  296 + turckList = JSON.parseObject(object.toString());
  297 + return turckList;
  298 + }
  299 +
  300 + return turckList;
  301 + }
  302 +
  303 + public static JSONObject getConstructionLicenseById(String id) {
  304 + JSONObject turckList = null;
  305 + Object object = get(constructionLicenseById + id, null);
  306 +
  307 + if (object != null) {
  308 + turckList = JSON.parseObject(object.toString());
  309 + return turckList;
  310 + }
  311 +
  312 + return turckList;
  313 +
  314 + }
  315 +
  316 + public static JSONObject getConstructionLicenseById(String id, String token) {
  317 + JSONObject turckList = null;
  318 + Object object = get(constructionLicenseById + id, null, token);
  319 +
  320 + if (object != null) {
  321 + turckList = JSON.parseObject(object.toString());
  322 + return turckList;
  323 + }
  324 +
  325 + return turckList;
  326 +
  327 + }
  328 +
  329 + public static JSONObject getConstructionInfo(String id) {
  330 + JSONObject turckList = null;
  331 + Object object = get(ConstructionInfo + id, null);
  332 +
  333 + if (object != null) {
  334 + turckList = JSON.parseObject(object.toString());
  335 + return turckList;
  336 + }
  337 +
  338 + return turckList;
  339 +
  340 + }
  341 +
  342 + public static JSONArray getCompanyList(Map params) {
  343 + JSONArray turckList = null;
  344 + Object object = post(CompanyListRequestPath, params);
  345 +
  346 + if (object != null) {
  347 + JSONObject jsonObject = JSON.parseObject(object.toString());
  348 + turckList = jsonObject.getJSONArray("list");
  349 + }
  350 +
  351 + return turckList;
  352 + }
  353 +
  354 + public static Object updateCompanyList(List<Map> updateList) {
  355 + JSONArray turckList = null;
  356 + Object object = post(UpdateCompanyRequestPath, updateList);
  357 +
  358 + return object;
  359 + }
  360 +
  361 + public static JSONArray getAreas() {
  362 + JSONArray array = null;
  363 + Object object = get("/api/gpsservice/cs/area", null);
  364 +
  365 + if (object != null) {
  366 + array = JSON.parseArray(object.toString());
  367 + }
  368 +
  369 + return array;
  370 + }
  371 +
  372 + public static JSONArray getDict(Map params) {
  373 + JSONArray array = null;
  374 + Object object = get("/api/gpsservice/cs/dataDict", params);
  375 +
  376 + if (object != null) {
  377 + array = JSON.parseArray(object.toString());
  378 + }
  379 +
  380 + return array;
  381 + }
  382 +
  383 + public static JSONArray getTruckList(Map params) {
  384 + JSONArray turckList = null;
  385 + Object object = post(TruckListRequestPath, params);
  386 +
  387 + if (object != null) {
  388 + JSONObject jsonObject = JSON.parseObject(object.toString());
  389 + turckList = jsonObject.getJSONArray("list");
  390 + }
  391 +
  392 + return turckList;
  393 + }
  394 +
  395 + public static Object updateTruckList(List<Map> updateList) {
  396 + JSONArray turckList = null;
  397 + Object object = post(UpdateTruckRequestPath, updateList);
  398 +
  399 + return object;
  400 + }
  401 +
  402 + public static JSONArray getTruckOnline(Map map, String token) {
  403 + JSONArray turckList = null;
  404 + Object object = post(TruckStatusListRequestPath, map, token);
  405 +
  406 + if (object != null) {
  407 + JSONObject jsonObject = JSON.parseObject(object.toString());
  408 + turckList = jsonObject.getJSONArray("list");
  409 + }
  410 +
  411 + return turckList;
  412 + }
  413 +
  414 + public static Object updateConstationCreditAndStatus(List<Map> map, String token) {
  415 + JSONArray turckList = null;
  416 + Object object = post(UpdateConstruction, map, token);
  417 +
  418 + return object;
  419 + }
  420 +
  421 + public static Object updateEarthSitesCreditAndStatus(List<Map> map, String token) {
  422 + JSONArray turckList = null;
  423 + Object object = post(UpdateEarthSiteRequestPath, map, token);
  424 +
  425 + return object;
  426 + }
  427 +
  428 + public static Object updateConractStatus(List<Map> map, String token) {
  429 + JSONArray turckList = null;
  430 + Object object = post(UpdateConractRequestPath, map, token);
  431 +
  432 + return object;
  433 + }
  434 +
  435 + public static JSONObject getEarthSitesInfo(String id, String token) {
  436 + JSONObject json = null;
  437 + Object object = get(EarthSitesInfo + id, null, token);
  438 +
  439 + if (object != null) {
  440 + json = JSON.parseObject(object.toString());
  441 + return json;
  442 + }
  443 +
  444 + return json;
  445 + }
  446 +
  447 + public static JSONObject getTruckInfo(String id, String token) {
  448 + JSONObject turckList = null;
  449 + Object object = get(TruckInfo + id, null, token);
  450 +
  451 + if (object != null) {
  452 + turckList = JSON.parseObject(object.toString());
  453 + return turckList;
  454 + }
  455 +
  456 + return turckList;
  457 + }
  458 +
  459 + public static JSONObject getConstructionInfo(String id, String token) {
  460 + JSONObject turckList = null;
  461 + Object object = get(ConstructionInfo + id, null, token);
  462 +
  463 + if (object != null) {
  464 + turckList = JSON.parseObject(object.toString());
  465 + return turckList;
  466 + }
  467 +
  468 + return turckList;
  469 +
  470 + }
  471 +
  472 + public static JSONArray getCompanyList(Map params, String token) {
  473 + JSONArray turckList = null;
  474 + Object object = post(CompanyListRequestPath, params, token);
  475 +
  476 + if (object != null) {
  477 + JSONObject jsonObject = JSON.parseObject(object.toString());
  478 + turckList = jsonObject.getJSONArray("list");
  479 + }
  480 +
  481 + return turckList;
  482 + }
  483 +
  484 + public static Object updateCompanyList(List<Map> updateList, String token) {
  485 + JSONArray turckList = null;
  486 + Object object = post(UpdateCompanyRequestPath, updateList, token);
  487 +
  488 + return object;
  489 + }
  490 +
  491 + public static JSONArray getAreas(String token) {
  492 + JSONArray array = null;
  493 + Object object = get("/api/gpsservice/cs/area", null, token);
  494 +
  495 + if (object != null) {
  496 + array = JSON.parseArray(object.toString());
  497 + }
  498 +
  499 + return array;
  500 + }
  501 +
  502 + public static JSONArray getDict(Map params, String token) {
  503 + JSONArray array = null;
  504 + Object object = get("/api/gpsservice/cs/dataDict", params, token);
  505 +
  506 + if (object != null) {
  507 + array = JSON.parseArray(object.toString());
  508 + }
  509 +
  510 + return array;
  511 + }
  512 +
  513 + public static JSONArray getTruckList(Map params, String token) {
  514 + JSONArray turckList = null;
  515 + Object object = post(TruckListRequestPath, params, token);
  516 +
  517 + if (object != null) {
  518 + JSONObject jsonObject = JSON.parseObject(object.toString());
  519 + turckList = jsonObject.getJSONArray("list");
  520 + }
  521 +
  522 + return turckList;
  523 + }
  524 +
  525 + public static Object updateTruckList(List<Map> updateList, String token) {
  526 + JSONArray turckList = null;
  527 + Object object = post(UpdateTruckRequestPath, updateList, token);
  528 +
  529 + return object;
  530 + }
  531 +
  532 + // 实现X509TrustManager接口
  533 + public static class MyTrustManager implements X509TrustManager {
  534 + @Override
  535 + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
  536 + }
  537 +
  538 + @Override
  539 + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
  540 + }
  541 +
  542 + @Override
  543 + public X509Certificate[] getAcceptedIssuers() {
  544 + return new X509Certificate[0];
  545 + }
  546 + }
  547 +
  548 + private static SSLSocketFactory createSSLSocketFactory() {
  549 + SSLSocketFactory ssfFactory = null;
  550 + try {
  551 + MyTrustManager mMyTrustManager = new MyTrustManager();
  552 + SSLContext sc = SSLContext.getInstance("TLS");
  553 + sc.init(null, new TrustManager[] { mMyTrustManager }, new SecureRandom());
  554 + ssfFactory = sc.getSocketFactory();
  555 + } catch (Exception ignored) {
  556 + ignored.printStackTrace();
  557 + }
  558 +
  559 + return ssfFactory;
  560 + }
  561 +
  562 + // 实现HostnameVerifier接口
  563 + private class TrustAllHostnameVerifier implements HostnameVerifier {
  564 + @Override
  565 + public boolean verify(String hostname, SSLSession session) {
  566 + return true;
  567 + }
  568 + }
  569 +
  570 + /**
  571 + * 获去信任自签证书的trustManager
  572 + *
  573 + * @param ins
  574 + * 自签证书输入流
  575 + * @return 信任自签证书的trustManager
  576 + * @throws GeneralSecurityException
  577 + */
  578 + private static X509TrustManager trustManagerForCertificates(InputStream... ins) throws GeneralSecurityException {
  579 + // 创建证书工厂
  580 + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
  581 +
  582 + // 通过证书工厂得到自签证书对象集合
  583 + Collection<Certificate> certificates = new ArrayList<>();
  584 +
  585 + for (InputStream inputStream : ins) {
  586 + certificates.addAll(certificateFactory.generateCertificates(inputStream));
  587 + }
  588 +
  589 + if (certificates.isEmpty()) {
  590 + throw new IllegalArgumentException("expected non-empty set of trusted certificates");
  591 + }
  592 +
  593 + // 为证书设置一个keyStore
  594 + char[] password = "password".toCharArray(); // Any password will work.
  595 + KeyStore keyStore = newEmptyKeyStore(password);
  596 + int index = 0;
  597 + // 将所有证书放入证书放入keystore中
  598 + for (Certificate certificate : certificates) {
  599 + String certificateAlias = Integer.toString(index++);
  600 + keyStore.setCertificateEntry(certificateAlias, certificate);
  601 + }
  602 +
  603 + // Use it to build an X509 trust manager.
  604 + // 使用包含自签证书信息的keyStore去构建一个X509TrustManager
  605 + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
  606 + keyManagerFactory.init(keyStore, password);
  607 + TrustManagerFactory trustManagerFactory = TrustManagerFactory
  608 + .getInstance(TrustManagerFactory.getDefaultAlgorithm());
  609 + trustManagerFactory.init(keyStore);
  610 + TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
  611 + if (trustManagers.length == 0) {
  612 + throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
  613 + }
  614 + return ((X509TrustManager) trustManagers[0]);
  615 + }
  616 +
  617 + private static KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
  618 + try {
  619 + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
  620 + InputStream in = null; // By convention, 'null' creates an empty key
  621 + // store.
  622 + keyStore.load(null, password);
  623 + return keyStore;
  624 + } catch (IOException e) {
  625 + throw new AssertionError(e);
  626 + }
  627 + }
  628 +
  629 + public static Object post(String url, Object obj) {
  630 + if (okHttpClient == null) {
  631 +
  632 + okHttpClient = getOkClient();
  633 + }
  634 + String token = SecurityUtils.getLoginUser().getToken();
  635 +
  636 + if (token.contains("durable:")) {
  637 + token = token.replace("durable:", "Bearer durable:auth:token:");
  638 + } else {
  639 + token = "Bearer auth:token:" + token;
  640 + }
  641 +
  642 + String param = JSON.toJSON(obj).toString();
  643 +
  644 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  645 +
  646 + Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).post(body).build();
  647 +
  648 + try {
  649 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  650 + String result = response.body().string();
  651 +
  652 + if (result != null) {
  653 + JSONObject json = JSON.parseObject(result);
  654 + if (json.getInteger("code") == 200) {
  655 + return json.get("result");
  656 + }
  657 +
  658 + } else {
  659 + return null;
  660 + }
  661 +
  662 + } catch (Exception e) {
  663 + e.printStackTrace();
  664 + return null;
  665 + }
  666 +
  667 + return null;
  668 + }
  669 +
  670 + public static Object get(String url, Map<String, String> obj) {
  671 + if (okHttpClient == null) {
  672 + okHttpClient = getOkClient();
  673 + }
  674 +
  675 + String token = SecurityUtils.getLoginUser().getToken();
  676 +
  677 + if (token.contains("durable:")) {
  678 + token = token.replace("durable:", "Bearer durable:auth:token:");
  679 + } else {
  680 + token = "Bearer auth:token:" + token;
  681 + }
  682 +
  683 + String params = "";
  684 +
  685 + if (obj != null) {
  686 +
  687 + params += "?";
  688 +
  689 + for (String key : obj.keySet()) {
  690 + params += key + "=" + obj.get(key) + "&";
  691 + }
  692 +
  693 + params = params.substring(0, params.length() - 1);
  694 + }
  695 +
  696 + url += params;
  697 +
  698 + Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).get().build();
  699 +
  700 + try {
  701 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  702 + String result = response.body().string();
  703 +
  704 + if (result != null) {
  705 + JSONObject json = JSON.parseObject(result);
  706 + if ("success".equals(json.getString("message"))) {
  707 + return json.get("result");
  708 + }
  709 + } else {
  710 + return null;
  711 + }
  712 +
  713 + } catch (Exception e) {
  714 + e.printStackTrace();
  715 + return null;
  716 + }
  717 +
  718 + return null;
  719 + }
  720 +
  721 + public static Object post(String url, Object obj, String token) {
  722 + if (okHttpClient == null) {
  723 +
  724 + okHttpClient = getOkClient();
  725 + }
  726 +
  727 +
  728 + if (token.contains("durable:")) {
  729 + token = "Bearer " + token.replaceAll("durable:", "");
  730 + } else {
  731 + token = "Bearer auth:token:" + token;
  732 + }
  733 +
  734 +
  735 + String param = JSON.toJSON(obj).toString();
  736 +
  737 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  738 +
  739 + Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).post(body).build();
  740 +
  741 + try {
  742 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  743 + String result = response.body().string();
  744 +
  745 + if (result != null) {
  746 + JSONObject json = JSON.parseObject(result);
  747 + if (json.getInteger("code") == 200) {
  748 + return json.get("result");
  749 + }
  750 +
  751 + } else {
  752 + return null;
  753 + }
  754 +
  755 + } catch (Exception e) {
  756 + e.printStackTrace();
  757 + return null;
  758 + }
  759 +
  760 + return null;
  761 + }
  762 +
  763 + public static OkHttpClient getOkClient() {
  764 +// X509TrustManager x509TrustManager = null;
  765 +// try {
  766 +// File file = new File("src/main/resources/183.66.242.6.crt");
  767 +// x509TrustManager = trustManagerForCertificates(new FileInputStream(file));
  768 +// } catch (FileNotFoundException e) {
  769 +// // TODO Auto-generated catch block
  770 +// e.printStackTrace();
  771 +// } catch (GeneralSecurityException e) {
  772 +// // TODO Auto-generated catch blockxiashuo
  773 +// e.printStackTrace();
  774 +// }
  775 +
  776 +// .sslSocketFactory(createSSLSocketFactory(), x509TrustManager)
  777 +
  778 + okHttpClient = new OkHttpClient.Builder()
  779 + .connectTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS)
  780 + .readTimeout(30, TimeUnit.SECONDS).build();
  781 +
  782 + return okHttpClient;
  783 + }
  784 +
  785 + public static Object get(String url, Map<String, String> obj, String token) {
  786 + if (okHttpClient == null) {
  787 +
  788 +
  789 + okHttpClient = getOkClient();
  790 + }
  791 + if (token.contains("durable:")) {
  792 + token = "Bearer " + token.replaceAll("durable:", "");
  793 + } else {
  794 + token = "Bearer auth:token:" + token;
  795 + }
  796 + String params = "";
  797 +
  798 + if (obj != null) {
  799 +
  800 + params += "?";
  801 +
  802 + for (String key : obj.keySet()) {
  803 + params += key + "=" + obj.get(key) + "&";
  804 + }
  805 +
  806 + params = params.substring(0, params.length() - 1);
  807 + }
  808 +
  809 + url += params;
  810 +
  811 + Request request = new Request.Builder().url(remote + url).addHeader("Authorization", token).get().build();
  812 +
  813 + try {
  814 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  815 + String result = response.body().string();
  816 +
  817 + if (result != null) {
  818 + JSONObject json = JSON.parseObject(result);
  819 + if ("success".equals(json.getString("message"))) {
  820 + return json.get("result");
  821 + }
  822 + } else {
  823 + return null;
  824 + }
  825 +
  826 + } catch (Exception e) {
  827 + e.printStackTrace();
  828 + return null;
  829 + }
  830 +
  831 + return null;
  832 + }
  833 +
  834 + public static JSONObject getBasevehicleInfo(String id, String token) {
  835 + JSONObject turckList = null;
  836 + Object object = get(BasevehicleInfo + id, null, token);
  837 +
  838 + if (object != null) {
  839 + turckList = JSON.parseObject(object.toString());
  840 + return turckList;
  841 + }
  842 +
  843 + return turckList;
  844 + }
  845 +
  846 +
  847 + public static JSONArray getDriverList() {
  848 +
  849 + try {
  850 + Map map = new HashMap<>();
  851 + Object result = get(DriverListPath, null);
  852 +
  853 + if (result != null) {
  854 + JSONObject json = JSON.parseObject(result.toString());
  855 + return json.getJSONArray("list");
  856 +
  857 + } else {
  858 + return null;
  859 + }
  860 +
  861 + } catch (Exception e) {
  862 + e.printStackTrace();
  863 + return null;
  864 + }
  865 + }
  866 +
  867 + public static JSONArray getDriverList(String token) {
  868 +
  869 + if (okHttpClient == null) {
  870 + okHttpClient = getOkClient();
  871 + }
  872 +
  873 + token = "Bearer " + token;
  874 +
  875 + String param = JSON.toJSON(new HashMap<>()).toString();
  876 +
  877 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  878 +
  879 + Request request = new Request.Builder().url(remote + DriverListPath).addHeader("Authorization", token)
  880 + .post(body).build();
  881 +
  882 + try {
  883 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  884 + String result = response.body().string();
  885 +
  886 + if (result != null) {
  887 + JSONObject json = JSON.parseObject(result);
  888 + return json.getJSONArray("list");
  889 +
  890 + } else {
  891 + return null;
  892 + }
  893 +
  894 + } catch (Exception e) {
  895 + e.printStackTrace();
  896 + return null;
  897 + }
  898 + }
  899 +
  900 + static String upUrl = "https://cszgf.tyykj.com:37251/";
  901 +
  902 + public static boolean updateUpCase(Map map) {
  903 + if (okHttpClient == null) {
  904 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  905 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  906 + }
  907 +
  908 + String param = JSON.toJSON(map).toString();
  909 +
  910 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  911 +
  912 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/query/callback")
  913 + .addHeader("Authorization", getUpUser()).post(body).build();
  914 +
  915 + okhttp3.Response response;
  916 + String result;
  917 + try {
  918 + response = okHttpClient.newCall(request).execute();
  919 +
  920 + result = response.body().string();
  921 + JSONObject json = JSON.parseObject(result);
  922 + if (json.getBoolean("success")) {
  923 + return json.getBoolean("success");
  924 + }
  925 + } catch (IOException e) {
  926 + // TODO Auto-generated catch block
  927 + e.printStackTrace();
  928 + }
  929 +
  930 + return false;
  931 +
  932 + }
  933 +
  934 + public static String getUpUser() {
  935 + if (okHttpClient == null) {
  936 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  937 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  938 + }
  939 +
  940 + Map map = new HashMap<>();
  941 +
  942 + map.put("userName", "市渣土管理系统");
  943 + map.put("password", "mwcfVIiTfWttBJL02O+CGw==");
  944 + String param = JSON.toJSON(map).toString();
  945 +
  946 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  947 +
  948 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/token").post(body).build();
  949 +
  950 + try {
  951 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  952 + String result = response.body().string();
  953 +
  954 + if (result != null) {
  955 + JSONObject json = JSON.parseObject(result);
  956 + if (json.getBoolean("success")) {
  957 + return json.getString("data");
  958 + }
  959 + } else {
  960 + return null;
  961 + }
  962 +
  963 + } catch (Exception e) {
  964 + e.printStackTrace();
  965 + return null;
  966 + }
  967 + return null;
  968 + }
  969 +
  970 + public static JSONArray getUpArea() {
  971 + if (okHttpClient == null) {
  972 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  973 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  974 + }
  975 +
  976 + Map map = new HashMap<>();
  977 +
  978 + String param = JSON.toJSON(map).toString();
  979 +
  980 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  981 +
  982 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/areaList")
  983 + .addHeader("Authorization", getUpUser()).post(body).build();
  984 +
  985 + try {
  986 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  987 + String result = response.body().string();
  988 +
  989 + if (result != null) {
  990 + JSONObject json = JSON.parseObject(result);
  991 + if (json.getBoolean("success")) {
  992 + return json.getJSONArray("data");
  993 + }
  994 + }
  995 +
  996 + } catch (Exception e) {
  997 + e.printStackTrace();
  998 +
  999 + }
  1000 + return null;
  1001 + }
  1002 +
  1003 + public static boolean replyUpCase(Map params) {
  1004 + if (okHttpClient == null) {
  1005 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1006 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1007 + }
  1008 +
  1009 + Map map = new HashMap<>();
  1010 +
  1011 + String param = JSON.toJSON(params).toString();
  1012 +
  1013 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1014 +
  1015 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/push/handleResult")
  1016 + .addHeader("Authorization", getUpUser()).post(body).build();
  1017 +
  1018 + try {
  1019 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1020 + String result = response.body().string();
  1021 +
  1022 + if (result != null) {
  1023 + JSONObject json = JSON.parseObject(result);
  1024 + return json.getBoolean("success");
  1025 + }
  1026 +
  1027 + } catch (Exception e) {
  1028 + e.printStackTrace();
  1029 +
  1030 + }
  1031 + return false;
  1032 + }
  1033 +
  1034 + public static boolean insertUpCase(Map params) {
  1035 + if (okHttpClient == null) {
  1036 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1037 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1038 + }
  1039 +
  1040 + Map map = new HashMap<>();
  1041 +
  1042 + String param = JSON.toJSON(params).toString();
  1043 +
  1044 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1045 +
  1046 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/push/acceptEvt")
  1047 + .addHeader("Authorization", getUpUser()).post(body).build();
  1048 +
  1049 + try {
  1050 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1051 + String result = response.body().string();
  1052 +
  1053 + if (result != null) {
  1054 + JSONObject json = JSON.parseObject(result);
  1055 + return json.getBoolean("success");
  1056 + }
  1057 +
  1058 + } catch (Exception e) {
  1059 + e.printStackTrace();
  1060 +
  1061 + }
  1062 + return false;
  1063 + }
  1064 +
  1065 + public static JSONObject getUpClass() {
  1066 + if (okHttpClient == null) {
  1067 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1068 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1069 + }
  1070 +
  1071 + Map map = new HashMap<>();
  1072 +
  1073 + map.put("industryType", "01");
  1074 +
  1075 + String param = JSON.toJSON(map).toString();
  1076 +
  1077 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1078 +
  1079 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/basic/classList")
  1080 + .addHeader("Authorization", getUpUser()).post(body).build();
  1081 +
  1082 + try {
  1083 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1084 + String result = response.body().string();
  1085 +
  1086 + if (result != null) {
  1087 + JSONObject json = JSON.parseObject(result);
  1088 + if (json.getBoolean("success")) {
  1089 +
  1090 + for (Object object : json.getJSONArray("data")) {
  1091 + JSONObject jsonObj = (JSONObject) object;
  1092 +
  1093 + if (jsonObj.getString("name").equals("")) {
  1094 +
  1095 + }
  1096 +
  1097 + }
  1098 +
  1099 + }
  1100 + } else {
  1101 + return null;
  1102 + }
  1103 +
  1104 + } catch (Exception e) {
  1105 + e.printStackTrace();
  1106 + return null;
  1107 + }
  1108 + return null;
  1109 + }
  1110 +
  1111 +
  1112 + public static boolean delayUpCase(Map map) {
  1113 + if (okHttpClient == null) {
  1114 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1115 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1116 + }
  1117 +
  1118 +
  1119 + String param = JSON.toJSON(map).toString();
  1120 +
  1121 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1122 +
  1123 + Request request = new Request.Builder().url(upUrl + "/api/thirdApi/push/delayApply")
  1124 + .addHeader("Authorization", getUpUser()).post(body).build();
  1125 +
  1126 + try {
  1127 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1128 + String result = response.body().string();
  1129 +
  1130 + if (result != null) {
  1131 + JSONObject json = JSON.parseObject(result);
  1132 + if (json.getBoolean("success")) {
  1133 + return json.getBoolean("success");
  1134 + }
  1135 + } else {
  1136 + return false;
  1137 + }
  1138 +
  1139 + } catch (Exception e) {
  1140 + e.printStackTrace();
  1141 + return false;
  1142 + }
  1143 + return false;
  1144 + }
  1145 +
  1146 +
  1147 + public static boolean deleteUpCase(Map map) {
  1148 + if (okHttpClient == null) {
  1149 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1150 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1151 + }
  1152 +
  1153 +
  1154 + String param = JSON.toJSON(map).toString();
  1155 +
  1156 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1157 +
  1158 + Request request = new Request.Builder().url(upUrl + "/api/thirdApi/push/rollbackApply")
  1159 + .addHeader("Authorization", getUpUser()).post(body).build();
  1160 +
  1161 + try {
  1162 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1163 + String result = response.body().string();
  1164 +
  1165 + if (result != null) {
  1166 + JSONObject json = JSON.parseObject(result);
  1167 + if (json.getBoolean("success")) {
  1168 + return json.getBoolean("success");
  1169 + }
  1170 + } else {
  1171 + return false;
  1172 + }
  1173 +
  1174 + } catch (Exception e) {
  1175 + e.printStackTrace();
  1176 + return false;
  1177 + }
  1178 + return false;
  1179 + }
  1180 +
  1181 +
  1182 +
  1183 + public static JSONArray getUpCaseResult() {
  1184 + if (okHttpClient == null) {
  1185 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1186 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1187 + }
  1188 +
  1189 + Map map = new HashMap<>();
  1190 +
  1191 + String param = JSON.toJSON(map).toString();
  1192 +
  1193 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1194 +
  1195 + Request request = new Request.Builder().url(upUrl + "/api/thirdApi/query/handleResultList")
  1196 + .addHeader("Authorization", getUpUser()).post(body).build();
  1197 +
  1198 + try {
  1199 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1200 + String result = response.body().string();
  1201 +
  1202 + if (result != null) {
  1203 + JSONObject json = JSON.parseObject(result);
  1204 + if (json.getBoolean("success")) {
  1205 + return json.getJSONArray("data");
  1206 + }
  1207 + } else {
  1208 + return null;
  1209 + }
  1210 +
  1211 + } catch (Exception e) {
  1212 + e.printStackTrace();
  1213 + return null;
  1214 + }
  1215 + return null;
  1216 +}
  1217 +
  1218 + public static JSONArray getUpCaseState(String url) {
  1219 + if (okHttpClient == null) {
  1220 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1221 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1222 + }
  1223 +
  1224 + Map map = new HashMap<>();
  1225 +
  1226 + String param = JSON.toJSON(map).toString();
  1227 +
  1228 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1229 +
  1230 + Request request = new Request.Builder().url(upUrl + url)
  1231 + .addHeader("Authorization", getUpUser()).post(body).build();
  1232 +
  1233 + try {
  1234 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1235 + String result = response.body().string();
  1236 +
  1237 + if (result != null) {
  1238 + JSONObject json = JSON.parseObject(result);
  1239 + if (json.getBoolean("success")) {
  1240 + return json.getJSONArray("data");
  1241 + }
  1242 + } else {
  1243 + return null;
  1244 + }
  1245 +
  1246 + } catch (Exception e) {
  1247 + e.printStackTrace();
  1248 + return null;
  1249 + }
  1250 + return null;
  1251 + }
  1252 +
  1253 +
  1254 + public static JSONArray getCaseList() {
  1255 + if (okHttpClient == null) {
  1256 + okHttpClient = new OkHttpClient.Builder().connectTimeout(20, TimeUnit.SECONDS)
  1257 + .writeTimeout(20, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();
  1258 + }
  1259 +
  1260 + Map map = new HashMap<>();
  1261 +
  1262 + String param = JSON.toJSON(map).toString();
  1263 +
  1264 + RequestBody body = RequestBody.create(MediaType.parse("application/json"), param);
  1265 +
  1266 + Request request = new Request.Builder().url(upUrl + "api/thirdApi/query/dispatchEvtList")
  1267 + .addHeader("Authorization", getUpUser()).post(body).build();
  1268 +
  1269 + try {
  1270 + okhttp3.Response response = okHttpClient.newCall(request).execute();
  1271 + String result = response.body().string();
  1272 +
  1273 + if (result != null) {
  1274 + JSONObject json = JSON.parseObject(result);
  1275 + if (json.getBoolean("success")) {
  1276 + return json.getJSONArray("data");
  1277 + }
  1278 + } else {
  1279 + return null;
  1280 + }
  1281 +
  1282 + } catch (Exception e) {
  1283 + e.printStackTrace();
  1284 + return null;
  1285 + }
  1286 + return null;
  1287 + }
  1288 +
  1289 + public static Object getAuth(String token) {
  1290 +
  1291 + return get(GETAUTH, null, token.replace("Bearer ", ""));
  1292 + }
  1293 +
  1294 +
  1295 +
  1296 +
  1297 +
  1298 +}
... ...
trash-ui/src/api/unit/dropPointInfo.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 查询投放点信息管理列表
  4 +export function listDropPointInfo(query) {
  5 + return request({
  6 + url: '/unit/dropPointInfo/list',
  7 + method: 'get',
  8 + params: query
  9 + })
  10 +}
  11 +
  12 +// 查询投放点信息管理详细
  13 +export function getDropPointInfo(id) {
  14 + return request({
  15 + url: '/unit/dropPointInfo/' + id,
  16 + method: 'get'
  17 + })
  18 +}
  19 +
  20 +// 新增投放点信息管理
  21 +export function addDropPointInfo(data) {
  22 + return request({
  23 + url: '/unit/dropPointInfo',
  24 + method: 'post',
  25 + data: data
  26 + })
  27 +}
  28 +
  29 +// 修改投放点信息管理
  30 +export function updateDropPointInfo(data) {
  31 + return request({
  32 + url: '/unit/dropPointInfo',
  33 + method: 'put',
  34 + data: data
  35 + })
  36 +}
  37 +
  38 +// 删除投放点信息管理
  39 +export function delDropPointInfo(id) {
  40 + return request({
  41 + url: '/unit/dropPointInfo/' + id,
  42 + method: 'delete'
  43 + })
  44 +}
  45 +
  46 +// 导出投放点信息管理
  47 +export function exportDropPointInfo(query) {
  48 + return request({
  49 + url: '/unit/dropPointInfo/export',
  50 + method: 'get',
  51 + params: query
  52 + })
  53 +}
0 54 \ No newline at end of file
... ...
trash-ui/src/views/unit/businessUnit/index.vue
... ... @@ -264,7 +264,7 @@ export default {
264 264 }).then(function() {
265 265 return exportEnterprise(queryParams);
266 266 }).then(response => {
267   - this.download(response.msg);
  267 + this.download(response.message);
268 268 })
269 269 }
270 270 }
... ...
trash-ui/src/views/unit/carInfo/index.vue
... ... @@ -281,7 +281,7 @@ export default {
281 281 }).then(function() {
282 282 return exportCarInfo(queryParams);
283 283 }).then(response => {
284   - this.download(response.msg);
  284 + this.download(response.message);
285 285 })
286 286 }
287 287 }
... ...
trash-ui/src/views/unit/carInfo/info.vue
... ... @@ -677,6 +677,12 @@ export default {
677 677 });
678 678 return;
679 679 }
  680 + if(this.drivers.length===0){
  681 + return this.$message({
  682 + message: '请选择驾驶员!',
  683 + type: 'warning'
  684 + });
  685 + }
680 686 this.form.drivers = this.drivers.join(",");
681 687 this.roadTransport.forEach(item => {
682 688 if (item.raw != null) {
... ...
trash-ui/src/views/unit/disposalSite/index.vue
... ... @@ -290,7 +290,7 @@ export default {
290 290 }).then(function() {
291 291 return exportDisposalSite(queryParams);
292 292 }).then(response => {
293   - this.download(response.msg);
  293 + this.download(response.message);
294 294 })
295 295 }
296 296 }
... ...
trash-ui/src/views/unit/driver/index.vue
... ... @@ -258,7 +258,7 @@ export default {
258 258 }).then(function() {
259 259 return exportDriver(queryParams);
260 260 }).then(response => {
261   - this.download(response.msg);
  261 + this.download(response.message);
262 262 })
263 263 }
264 264 }
... ...
trash-ui/src/views/unit/dropPointInfo/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="108px">
  4 + <el-form-item label="投放点名称" prop="dropPointName">
  5 + <el-input
  6 + v-model="queryParams.dropPointName"
  7 + placeholder="请输入投放点名称"
  8 + clearable
  9 + size="small"
  10 + @keyup.enter.native="handleQuery"
  11 + />
  12 + </el-form-item>
  13 + <el-form-item label="详细地址" prop="address">
  14 + <el-input
  15 + v-model="queryParams.address"
  16 + placeholder="请输入详细地址"
  17 + clearable
  18 + size="small"
  19 + @keyup.enter.native="handleQuery"
  20 + />
  21 + </el-form-item>
  22 + <el-form-item label="投放点形式" prop="type">
  23 + <el-select v-model="queryParams.type" placeholder="请选择投放点形式" clearable size="small">
  24 + <el-option label="全部" value=""/>
  25 + <el-option label="固定" value="固定"/>
  26 + <el-option label="临时" value="临时"/>
  27 + </el-select>
  28 + </el-form-item>
  29 + <el-form-item>
  30 + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  31 + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  32 + </el-form-item>
  33 + </el-form>
  34 +
  35 + <el-row :gutter="10" class="mb8">
  36 + <el-col :span="1.5">
  37 + <el-button
  38 + type="primary"
  39 + icon="el-icon-plus"
  40 + size="mini"
  41 + @click="handleAdd"
  42 + v-hasPermi="['unit:dropPointInfo:add']"
  43 + >新增
  44 + </el-button>
  45 + </el-col>
  46 + <el-col :span="1.5">
  47 + <el-button
  48 + type="success"
  49 + icon="el-icon-edit"
  50 + size="mini"
  51 + :disabled="single"
  52 + @click="handleUpdate"
  53 + v-hasPermi="['unit:dropPointInfo:edit']"
  54 + >修改
  55 + </el-button>
  56 + </el-col>
  57 + <el-col :span="1.5">
  58 + <el-button
  59 + type="danger"
  60 + icon="el-icon-delete"
  61 + size="mini"
  62 + :disabled="multiple"
  63 + @click="handleDelete"
  64 + v-hasPermi="['unit:dropPointInfo:remove']"
  65 + >删除
  66 + </el-button>
  67 + </el-col>
  68 + <el-col :span="1.5">
  69 + <el-button
  70 + type="warning"
  71 + icon="el-icon-download"
  72 + size="mini"
  73 + @click="handleExport"
  74 + v-hasPermi="['unit:dropPointInfo:export']"
  75 + >导出
  76 + </el-button>
  77 + </el-col>
  78 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  79 + </el-row>
  80 +
  81 + <el-table v-loading="loading" :data="dropPointInfoList" @selection-change="handleSelectionChange">
  82 + <el-table-column type="selection" width="55" align="center"/>
  83 + <el-table-column label="投放点名称" align="center" prop="dropPointName"/>
  84 + <el-table-column label="所属区域" align="center" prop="district"/>
  85 + <el-table-column label="所属街道" align="center" prop="street"/>
  86 + <el-table-column label="社区" align="center" prop="community"/>
  87 + <el-table-column label="详细地址" align="center" prop="address"/>
  88 + <el-table-column label="投放点形式" align="center" prop="type"/>
  89 + <el-table-column label="投放点面积(m²)" align="center" prop="area"/>
  90 + <el-table-column label="投放点容量(m³)" align="center" prop="capacity"/>
  91 + <el-table-column label="管理单位" align="center" prop="managementUnit"/>
  92 + <el-table-column label="管理人" align="center" prop="custodian"/>
  93 + <el-table-column label="管理员电话" align="center" prop="custodianPhone"/>
  94 + <el-table-column label="投放时间" align="center" prop="dropTime" width="180"/>
  95 + <el-table-column label="投放点编号" align="center" prop="dropPointNo"/>
  96 + <el-table-column label="运营单位" align="center" prop="operatingUnit"/>
  97 + <el-table-column label="运输单位" align="center" prop="transportUnit"/>
  98 + <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  99 + <template slot-scope="scope">
  100 + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}-{i}-{s}') }}</span>
  101 + </template>
  102 + </el-table-column>
  103 + <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  104 + <template slot-scope="scope">
  105 + <el-button
  106 + size="mini"
  107 + type="text"
  108 + icon="el-icon-edit"
  109 + @click="handleUpdate(scope.row)"
  110 + v-hasPermi="['unit:dropPointInfo:edit']"
  111 + >修改
  112 + </el-button>
  113 + <el-button
  114 + size="mini"
  115 + type="text"
  116 + icon="el-icon-delete"
  117 + @click="handleDelete(scope.row)"
  118 + v-hasPermi="['unit:dropPointInfo:remove']"
  119 + >删除
  120 + </el-button>
  121 + </template>
  122 + </el-table-column>
  123 + </el-table>
  124 +
  125 + <pagination
  126 + v-show="total>0"
  127 + :total="total"
  128 + :page.sync="queryParams.pageNum"
  129 + :limit.sync="queryParams.pageSize"
  130 + @pagination="getList"
  131 + />
  132 +
  133 + <!-- 添加或修改投放点信息管理对话框 -->
  134 + <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  135 + <el-form ref="form" :model="form" :rules="rules" label-width="128px">
  136 + <el-row>
  137 + <el-col :span="12">
  138 + <el-form-item label="投放点编号" prop="dropPointNo">
  139 + <el-input v-model="form.dropPointNo" placeholder="请输入投放点编号" :disabled="true"/>
  140 + </el-form-item>
  141 + </el-col>
  142 + <el-col :span="12">
  143 + <el-form-item label="投放点名称" prop="dropPointName">
  144 + <el-input v-model="form.dropPointName" placeholder="请输入投放点名称"/>
  145 + </el-form-item>
  146 + </el-col>
  147 + </el-row>
  148 + <el-row>
  149 + <el-col :span="12">
  150 + <el-form-item label="所属区域" prop="street">
  151 + <el-select v-model="form.district" placeholder="请输入所属区域" style="width: 100%" clearable @change="getStreets">
  152 + <el-option v-for="(area,index) in areas" :label="area.name" :value="area.name" :key="index"/>
  153 + </el-select>
  154 + </el-form-item>
  155 + </el-col>
  156 + <el-col :span="12">
  157 + <el-form-item label="所属街道" prop="street">
  158 + <el-select v-model="form.street" placeholder="请输入所属街道" style="width: 100%" clearable>
  159 + <el-option v-for="(area,index) in streets" :label="area.name" :value="area.name" :key="area.code" @click.native="createDropPointNo(area)"/>
  160 + </el-select>
  161 + </el-form-item>
  162 +
  163 + </el-col>
  164 + </el-row>
  165 + <el-row>
  166 + <el-col :span="12">
  167 + <el-form-item label="社区" prop="community">
  168 + <el-input v-model="form.community" placeholder="请输入社区"/>
  169 + </el-form-item>
  170 +
  171 + </el-col>
  172 + <el-col :span="12">
  173 + <el-form-item label="详细地址" prop="address">
  174 + <el-input v-model="form.address" placeholder="请输入详细地址"/>
  175 + </el-form-item>
  176 + </el-col>
  177 + </el-row>
  178 + <el-row>
  179 + <el-col :span="12">
  180 + <el-form-item label="投放点形式" prop="type">
  181 + <el-select v-model="form.type" placeholder="请选择投放点形式" style="width: 100%">
  182 + <el-option label="固定" value="固定"/>
  183 + <el-option label="临时" value="临时"/>
  184 + </el-select>
  185 + </el-form-item>
  186 +
  187 + </el-col>
  188 + <el-col :span="12">
  189 + <el-form-item label="投放点面积(m²)" prop="area">
  190 + <el-input v-model="form.area" placeholder="请输入投放点面积"/>
  191 + </el-form-item>
  192 + </el-col>
  193 + </el-row>
  194 + <el-row>
  195 + <el-col :span="12">
  196 + <el-form-item label="投放点容量(m³)" prop="capacity">
  197 + <el-input v-model="form.capacity" placeholder="请输入投放点容量"/>
  198 + </el-form-item>
  199 + </el-col>
  200 + <el-col :span="12">
  201 + <el-form-item label="管理单位" prop="managementUnit">
  202 + <el-input v-model="form.managementUnit" placeholder="请输入管理单位"/>
  203 + </el-form-item>
  204 + </el-col>
  205 + </el-row>
  206 + <el-row>
  207 + <el-col :span="12">
  208 + <el-form-item label="管理人" prop="custodian">
  209 + <el-input v-model="form.custodian" placeholder="请输入管理人"/>
  210 + </el-form-item>
  211 + </el-col>
  212 + <el-col :span="12">
  213 + <el-form-item label="管理员电话" prop="custodianPhone">
  214 + <el-input v-model="form.custodianPhone" placeholder="请输入管理员联系电话" :maxlength="11" show-word-limit/>
  215 + </el-form-item>
  216 + </el-col>
  217 + </el-row>
  218 + <el-row>
  219 + <el-col :span="12">
  220 + <el-form-item label="投放时间" prop="dropTime">
  221 + <el-time-select
  222 + v-model="form.dropTime"
  223 + style="width: 100%"
  224 + :picker-options="{
  225 + start: '00:00',
  226 + step: '00:30',
  227 + end: '23:30'
  228 + }"
  229 + placeholder="选择时间">
  230 + </el-time-select>
  231 + </el-form-item>
  232 + </el-col>
  233 + <el-col :span="12">
  234 + <el-form-item label="运营单位" prop="operatingUnit">
  235 + <el-input v-model="form.operatingUnit" placeholder="请输入运营单位"/>
  236 + </el-form-item>
  237 + </el-col>
  238 + </el-row>
  239 + <el-row>
  240 + <el-col :span="12">
  241 + <el-form-item label="运输单位" prop="transportUnit">
  242 + <el-input v-model="form.transportUnit" placeholder="请输入运输单位"/>
  243 + </el-form-item>
  244 + </el-col>
  245 + </el-row>
  246 + </el-form>
  247 + <div slot="footer" class="dialog-footer">
  248 + <el-button type="primary" @click="submitForm">确 定</el-button>
  249 + <el-button @click="cancel">取 消</el-button>
  250 + </div>
  251 + </el-dialog>
  252 + </div>
  253 +</template>
  254 +
  255 +<script>
  256 +import {
  257 + listDropPointInfo,
  258 + getDropPointInfo,
  259 + delDropPointInfo,
  260 + addDropPointInfo,
  261 + updateDropPointInfo,
  262 + exportDropPointInfo
  263 +} from "@/api/unit/dropPointInfo";
  264 +import {getAreaList} from "@/api/casefile/remoteServer";
  265 +
  266 +export default {
  267 + name: "DropPointInfo",
  268 + data() {
  269 + return {
  270 + // 遮罩层
  271 + loading: true,
  272 + // 选中数组
  273 + ids: [],
  274 + // 非单个禁用
  275 + single: true,
  276 + // 非多个禁用
  277 + multiple: true,
  278 + // 显示搜索条件
  279 + showSearch: true,
  280 + // 总条数
  281 + total: 0,
  282 + // 投放点信息管理表格数据
  283 + dropPointInfoList: [],
  284 + // 弹出层标题
  285 + title: "",
  286 + // 是否显示弹出层
  287 + open: false,
  288 + // 查询参数
  289 + queryParams: {
  290 + pageNum: 1,
  291 + pageSize: 10,
  292 + dropPointName: null,
  293 + address: null,
  294 + type: null,
  295 + },
  296 + // 表单参数
  297 + form: {},
  298 + // 表单校验
  299 + rules: {
  300 + dropPointName: [
  301 + {required: true, message: "请输入投放点名称", trigger: "blur"}
  302 + ],
  303 + district: [
  304 + {required: true, message: "请输入所属区域", trigger: "blur"}
  305 + ],
  306 + street: [
  307 + {required: true, message: "请输入所属街道", trigger: "blur"}
  308 + ],
  309 + community: [
  310 + {required: true, message: "请输入社区", trigger: "blur"}
  311 + ],
  312 + address: [
  313 + {required: true, message: "请输入详细地址", trigger: "blur"}
  314 + ],
  315 + type: [
  316 + {required: true, message: "请选择投放点形式", trigger: "change"}
  317 + ],
  318 + area: [
  319 + {required: true, message: "请输入投放点面积", trigger: "blur"},
  320 + //只能填写数字、小数
  321 + {pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: "只能填写数字、小数,限制两位小数", trigger: "blur"}
  322 + ],
  323 + capacity: [
  324 + {required: true, message: "请输入投放点容量", trigger: "blur"},
  325 + //只能填写数字
  326 + {pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: "只能填写数字、小数,限制两位小数", trigger: "blur"}
  327 + ],
  328 + managementUnit: [
  329 + {required: true, message: "请输入管理单位", trigger: "blur"}
  330 + ],
  331 + custodian: [
  332 + {required: true, message: "请输入管理人", trigger: "blur"}
  333 + ],
  334 + custodianPhone: [
  335 + {required: true, message: "请输入管理员电话", trigger: "blur"},
  336 + {
  337 + pattern: /^1(3|4|5|7|8|9)\d{9}$/,
  338 + message: '手机号格式错误',
  339 + trigger: 'change'
  340 + }
  341 + ],
  342 + dropTime: [
  343 + {required: true, message: "请选择投放时间", trigger: "change"}
  344 + ],
  345 + operatingUnit: [
  346 + {required: true, message: "请输入运营单位", trigger: "blur"}
  347 + ],
  348 + transportUnit: [
  349 + {required: true, message: "请输入运输单位", trigger: "blur"}
  350 + ]
  351 + },
  352 + areas: [
  353 + {
  354 + name: "芙蓉区",
  355 + streets: [
  356 + {code: "F01", name: "湘湖"},
  357 + {code: "F02", name: "定王台街道"},
  358 + {code: "F03", name: "韭菜园街道"},
  359 + {code: "F04", name: "文艺路街道"},
  360 + {code: "F05", name: "朝阳街道"},
  361 + {code: "F06", name: "五里牌街道"},
  362 + {code: "F07", name: "马王堆街道"},
  363 + {code: "F08", name: "荷花园街道"},
  364 + {code: "F09", name: "东屯渡街道"},
  365 + {code: "F10", name: "火星街道"},
  366 + {code: "F11", name: "东岸街道"},
  367 + {code: "F12", name: "马坡岭街道"},
  368 + {code: "F13", name: "东湖街道"}
  369 + ]
  370 + },
  371 + {
  372 + name: "天心区",
  373 + streets: [
  374 + {code: "T01", name: "坡子街街道"},
  375 + {code: "T02", name: "城南路街道"},
  376 + {code: "T03", name: "裕南街街道"},
  377 + {code: "T04", name: "赤岭路街道"},
  378 + {code: "T05", name: "金盆岭街道"},
  379 + {code: "T06", name: "新开铺街道"},
  380 + {code: "T07", name: "文源街道"},
  381 + {code: "T08", name: "桂花坪街道"},
  382 + {code: "T09", name: "青园街道"},
  383 + {code: "T10", name: "黑石铺街道"},
  384 + {code: "T11", name: "大托铺街道"},
  385 + {code: "T12", name: "先锋街道"},
  386 + {code: "T13", name: "南托街道"},
  387 + {code: "T14", name: "暮云街道"}
  388 + ]
  389 + },
  390 + {
  391 + name: "开福区",
  392 + streets: [
  393 + {code: "K01", name: "望麓园街道"},
  394 + {code: "K02", name: "清水塘街道"},
  395 + {code: "K03", name: "湘雅路街道"},
  396 + {code: "K04", name: "伍家岭街道"},
  397 + {code: "K05", name: "新河街道"},
  398 + {code: "K06", name: "东风路街道"},
  399 + {code: "K07", name: "通泰街街道"},
  400 + {code: "K08", name: "四方坪街道"},
  401 + {code: "K09", name: "芙蓉北路街道"},
  402 + {code: "K10", name: "洪山街道"},
  403 + {code: "K11", name: "月湖街道"},
  404 + {code: "K12", name: "浏阳河街道"},
  405 + {code: "K13", name: "秀峰街道"},
  406 + {code: "K14", name: "捞刀河街道"},
  407 + {code: "K15", name: "沙坪街道"},
  408 + {code: "K16", name: "青竹湖街道"}
  409 + ]
  410 + },
  411 + {
  412 + name: "雨花区",
  413 + streets: [
  414 + {code: "Y01", name: "雨花亭街道"},
  415 + {code: "Y02", name: "高桥街道"},
  416 + {code: "Y03", name: "左家塘街道"},
  417 + {code: "Y04", name: "侯家塘街道"},
  418 + {code: "Y05", name: "砂子塘街道"},
  419 + {code: "Y06", name: "东塘街道"},
  420 + {code: "Y07", name: "圭塘街道"},
  421 + {code: "Y08", name: "黎托街道"},
  422 + {code: "Y09", name: "洞井街道"},
  423 + {code: "Y10", name: "井湾子街道"},
  424 + {code: "Y11", name: "东山街道"},
  425 + {code: "Y12", name: "同升街道"},
  426 + {code: "Y13", name: "跳马镇"}
  427 + ]
  428 + },
  429 + {
  430 + name: "长沙县",
  431 + streets: [
  432 + {code: "C01", name: "星沙街道"},
  433 + {code: "C02", name: "湘龙街道"},
  434 + {code: "C03", name: "泉塘街道"},
  435 + {code: "C04", name: "榔梨街道"}
  436 + ]
  437 + },
  438 + {
  439 + name: "望城",
  440 + streets: [
  441 + {code: "W01", name: "丁字湾街道"},
  442 + {code: "W02", name: "书堂山街道"},
  443 + {code: "W03", name: "高塘岭街道"},
  444 + {code: "W04", name: "喻家坡街道"},
  445 + {code: "W05", name: "白沙洲街道"},
  446 + {code: "W06", name: "大泽湖街道"},
  447 + {code: "W07", name: "月亮岛街道"},
  448 + {code: "W08", name: "廖家坪街道"}
  449 + ]
  450 + },
  451 + {
  452 + name: "浏阳",
  453 + streets: [
  454 + {code: "L01", name: "淮川街道"},
  455 + {code: "L02", name: "集里街道"},
  456 + {code: "L03", name: "荷花街道"},
  457 + {code: "L04", name: "关口街道"}
  458 + ]
  459 + },
  460 + {
  461 + name: "宁乡",
  462 + streets: [
  463 + {code: "N01", name: "玉潭街道"},
  464 + {code: "N02", name: "城郊街道"},
  465 + {code: "N03", name: "历经铺街道"},
  466 + {code: "N04", name: "白马桥街道"},
  467 + {code: "N05", name: "煤炭坝镇"},
  468 + {code: "N06", name: "双凫铺镇"},
  469 + {code: "N07", name: "双江口镇"},
  470 + {code: "N08", name: "回龙铺镇"},
  471 + {code: "N09", name: "夏铎铺镇"},
  472 + {code: "N10", name: "历经铺镇"}
  473 + ]
  474 + },
  475 + {
  476 + name: "湘江新区",
  477 + streets: [
  478 + {code: "X01", name: "岳麓街道"},
  479 + {code: "X02", name: "桔子洲街道"},
  480 + {code: "X03", name: "望月湖街道"},
  481 + {code: "X04", name: "银盆岭街道"},
  482 + {code: "X05", name: "观沙岭街道"},
  483 + {code: "X06", name: "西湖街道"},
  484 + {code: "X07", name: "望城坡街道"},
  485 + {code: "X08", name: "望岳街道"},
  486 + {code: "X09", name: "咸嘉湖街道"},
  487 + {code: "X10", name: "梅溪湖街道"},
  488 + {code: "X11", name: "天顶街道"},
  489 + {code: "X12", name: "坪塘街道"},
  490 + {code: "X13", name: "洋湖街道"},
  491 + {code: "X14", name: "含浦街道"},
  492 + {code: "X15", name: "学士街道"},
  493 + {code: "X16", name: "莲花镇"},
  494 + {code: "X17", name: "雨敞坪镇"},
  495 + {code: "X18", name: "麓谷街道"},
  496 + {code: "X19", name: "东方红街道"},
  497 + {code: "X20", name: "白马街道"},
  498 + {code: "X21", name: "雷锋街道"},
  499 + {code: "X22", name: "黄金园街道"},
  500 + {code: "X23", name: "金山桥街道"},
  501 + {code: "X24", name: "白箬铺镇"}
  502 + ]
  503 + }
  504 + ],
  505 + streets:[]
  506 + };
  507 + },
  508 + created() {
  509 + this.getList();
  510 + },
  511 + methods: {
  512 + createDropPointNo(area){
  513 + listDropPointInfo({dropPointNo: area.code}).then(response => {
  514 + const total = response.total+1;
  515 + this.form.dropPointNo = area.code+total.toString().padStart(3, '0');
  516 + });
  517 + },
  518 + getStreets(regionName) {
  519 + this.streets = [];
  520 + this.form.dropPointNo = null;
  521 + this.form.street = null;
  522 + const region = this.areas.find(region => region.name === regionName);
  523 + this.streets = region.streets;
  524 + },
  525 + /** 下载文件 */
  526 + /** 查询投放点信息管理列表 */
  527 + getList() {
  528 + this.loading = true;
  529 + listDropPointInfo(this.queryParams).then(response => {
  530 + this.dropPointInfoList = response.rows;
  531 + this.total = response.total;
  532 + this.loading = false;
  533 + });
  534 + },
  535 + // 取消按钮
  536 + cancel() {
  537 + this.open = false;
  538 + this.reset();
  539 + },
  540 + // 表单重置
  541 + reset() {
  542 + this.form = {
  543 + id: null,
  544 + dropPointName: null,
  545 + district: null,
  546 + street: null,
  547 + community: null,
  548 + address: null,
  549 + type: null,
  550 + area: null,
  551 + capacity: null,
  552 + managementUnit: null,
  553 + custodian: null,
  554 + custodianPhone: null,
  555 + dropTime: null,
  556 + dropPointNo: null,
  557 + operatingUnit: null,
  558 + transportUnit: null,
  559 + createTime: null,
  560 + createBy: null,
  561 + updateTime: null,
  562 + updateBy: null
  563 + };
  564 + this.resetForm("form");
  565 + },
  566 + /** 搜索按钮操作 */
  567 + handleQuery() {
  568 + this.queryParams.pageNum = 1;
  569 + this.getList();
  570 + },
  571 + /** 重置按钮操作 */
  572 + resetQuery() {
  573 + this.resetForm("queryForm");
  574 + this.handleQuery();
  575 + },
  576 + // 多选框选中数据
  577 + handleSelectionChange(selection) {
  578 + this.ids = selection.map(item => item.id)
  579 + this.single = selection.length !== 1
  580 + this.multiple = !selection.length
  581 + },
  582 + /** 新增按钮操作 */
  583 + handleAdd() {
  584 + this.reset();
  585 + this.open = true;
  586 + this.title = "添加投放点信息管理";
  587 + },
  588 + /** 修改按钮操作 */
  589 + handleUpdate(row) {
  590 + this.reset();
  591 + const id = row.id || this.ids
  592 + getDropPointInfo(id).then(response => {
  593 + this.form = response.data;
  594 + this.open = true;
  595 + this.title = "修改投放点信息管理";
  596 + });
  597 + },
  598 + /** 提交按钮 */
  599 + submitForm() {
  600 + this.$refs["form"].validate(valid => {
  601 + if (valid) {
  602 + if (this.form.id != null) {
  603 + updateDropPointInfo(this.form).then(response => {
  604 + this.msgSuccess("修改成功");
  605 + this.open = false;
  606 + this.getList();
  607 + });
  608 + } else {
  609 + addDropPointInfo(this.form).then(response => {
  610 + this.msgSuccess("新增成功");
  611 + this.open = false;
  612 + this.getList();
  613 + });
  614 + }
  615 + }
  616 + });
  617 + },
  618 + /** 删除按钮操作 */
  619 + handleDelete(row) {
  620 + const ids = row.id || this.ids;
  621 + this.$confirm('是否确认删除投放点信息管理编号为"' + ids + '"的数据项?', "警告", {
  622 + confirmButtonText: "确定",
  623 + cancelButtonText: "取消",
  624 + type: "warning"
  625 + }).then(function () {
  626 + return delDropPointInfo(ids);
  627 + }).then(() => {
  628 + this.getList();
  629 + this.msgSuccess("删除成功");
  630 + })
  631 + },
  632 + /** 导出按钮操作 */
  633 + handleExport() {
  634 + const queryParams = this.queryParams;
  635 + this.$confirm('是否确认导出所有投放点信息管理数据项?', "警告", {
  636 + confirmButtonText: "确定",
  637 + cancelButtonText: "取消",
  638 + type: "warning"
  639 + }).then(function () {
  640 + return exportDropPointInfo(queryParams);
  641 + }).then(response => {
  642 + this.download(response.message);
  643 + })
  644 + }
  645 + }
  646 +};
  647 +</script>
... ...
trash-ui/src/views/unit/enterprise/index.vue
... ... @@ -264,7 +264,7 @@ export default {
264 264 }).then(function() {
265 265 return exportEnterprise(queryParams);
266 266 }).then(response => {
267   - this.download(response.msg);
  267 + this.download(response.message);
268 268 })
269 269 }
270 270 }
... ...
trash-unit/src/main/java/com/trash/dropPointInfo/controller/DropPointInfoController.java 0 → 100644
  1 +package com.trash.dropPointInfo.controller;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.security.access.prepost.PreAuthorize;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.GetMapping;
  7 +import org.springframework.web.bind.annotation.PostMapping;
  8 +import org.springframework.web.bind.annotation.PutMapping;
  9 +import org.springframework.web.bind.annotation.DeleteMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.RequestBody;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +import com.trash.common.annotation.Log;
  15 +import com.trash.common.core.controller.BaseController;
  16 +import com.trash.common.core.domain.AjaxResult;
  17 +import com.trash.common.enums.BusinessType;
  18 +import com.trash.dropPointInfo.domain.DropPointInfo;
  19 +import com.trash.dropPointInfo.service.IDropPointInfoService;
  20 +import com.trash.common.utils.poi.ExcelUtil;
  21 +import com.trash.common.core.page.TableDataInfo;
  22 +
  23 +/**
  24 + * 投放点信息管理Controller
  25 + *
  26 + * @author trash
  27 + * @date 2024-11-14
  28 + */
  29 +@RestController
  30 +@RequestMapping("/unit/dropPointInfo")
  31 +public class DropPointInfoController extends BaseController
  32 +{
  33 + @Autowired
  34 + private IDropPointInfoService dropPointInfoService;
  35 +
  36 + /**
  37 + * 查询投放点信息管理列表
  38 + */
  39 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:list')")
  40 + @GetMapping("/list")
  41 + public TableDataInfo list(DropPointInfo dropPointInfo)
  42 + {
  43 + startPage();
  44 + List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoList(dropPointInfo);
  45 + return getDataTable(list);
  46 + }
  47 +
  48 + /**
  49 + * 导出投放点信息管理列表
  50 + */
  51 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:export')")
  52 + @Log(title = "投放点信息管理", businessType = BusinessType.EXPORT)
  53 + @GetMapping("/export")
  54 + public AjaxResult export(DropPointInfo dropPointInfo)
  55 + {
  56 + List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoList(dropPointInfo);
  57 + ExcelUtil<DropPointInfo> util = new ExcelUtil<DropPointInfo>(DropPointInfo.class);
  58 + return util.exportExcel(list, "投放点信息管理");
  59 + }
  60 +
  61 + /**
  62 + * 获取投放点信息管理详细信息
  63 + */
  64 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:query')")
  65 + @GetMapping(value = "/{id}")
  66 + public AjaxResult getInfo(@PathVariable("id") Long id)
  67 + {
  68 + return AjaxResult.success(dropPointInfoService.selectDropPointInfoById(id));
  69 + }
  70 +
  71 + /**
  72 + * 新增投放点信息管理
  73 + */
  74 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:add')")
  75 + @Log(title = "投放点信息管理", businessType = BusinessType.INSERT)
  76 + @PostMapping
  77 + public AjaxResult add(@RequestBody DropPointInfo dropPointInfo)
  78 + {
  79 + return toAjax(dropPointInfoService.insertDropPointInfo(dropPointInfo));
  80 + }
  81 +
  82 + /**
  83 + * 修改投放点信息管理
  84 + */
  85 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:edit')")
  86 + @Log(title = "投放点信息管理", businessType = BusinessType.UPDATE)
  87 + @PutMapping
  88 + public AjaxResult edit(@RequestBody DropPointInfo dropPointInfo)
  89 + {
  90 + return toAjax(dropPointInfoService.updateDropPointInfo(dropPointInfo));
  91 + }
  92 +
  93 + /**
  94 + * 删除投放点信息管理
  95 + */
  96 + @PreAuthorize("@ss.hasPermi('unit:dropPointInfo:remove')")
  97 + @Log(title = "投放点信息管理", businessType = BusinessType.DELETE)
  98 + @DeleteMapping("/{ids}")
  99 + public AjaxResult remove(@PathVariable Long[] ids)
  100 + {
  101 + return toAjax(dropPointInfoService.deleteDropPointInfoByIds(ids));
  102 + }
  103 +}
... ...
trash-unit/src/main/java/com/trash/dropPointInfo/domain/DropPointInfo.java 0 → 100644
  1 +package com.trash.dropPointInfo.domain;
  2 +
  3 +import java.math.BigDecimal;
  4 +import java.util.Date;
  5 +import com.fasterxml.jackson.annotation.JsonFormat;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.apache.commons.lang3.builder.ToStringStyle;
  8 +import com.trash.common.annotation.Excel;
  9 +import com.trash.common.core.domain.BaseEntity;
  10 +
  11 +/**
  12 + * 投放点信息管理对象 drop_point_info
  13 + *
  14 + * @author trash
  15 + * @date 2024-11-14
  16 + */
  17 +public class DropPointInfo extends BaseEntity
  18 +{
  19 + private static final long serialVersionUID = 1L;
  20 +
  21 + /** 主键 id */
  22 + private Long id;
  23 +
  24 + /** 投放点名称 */
  25 + @Excel(name = "投放点名称")
  26 + private String dropPointName;
  27 +
  28 + /** 所属区域 */
  29 + @Excel(name = "所属区域")
  30 + private String district;
  31 +
  32 + /** 所属街道 */
  33 + @Excel(name = "所属街道")
  34 + private String street;
  35 +
  36 + /** 社区 */
  37 + @Excel(name = "社区")
  38 + private String community;
  39 +
  40 + /** 详细地址 */
  41 + @Excel(name = "详细地址")
  42 + private String address;
  43 +
  44 + /** 投放点形式(固定、临时) */
  45 + @Excel(name = "投放点形式")
  46 + private String type;
  47 +
  48 + /** 投放点面积 */
  49 + @Excel(name = "投放点面积")
  50 + private BigDecimal area;
  51 +
  52 + /** 投放点容量 */
  53 + @Excel(name = "投放点容量")
  54 + private BigDecimal capacity;
  55 +
  56 + /** 管理单位 */
  57 + @Excel(name = "管理单位")
  58 + private String managementUnit;
  59 +
  60 + /** 管理人 */
  61 + @Excel(name = "管理人")
  62 + private String custodian;
  63 +
  64 + /** 管理员电话 */
  65 + @Excel(name = "管理员电话")
  66 + private String custodianPhone;
  67 +
  68 + /** 投放时间 */
  69 + @Excel(name = "投放时间")
  70 + private String dropTime;
  71 +
  72 + /** 投放点编号 */
  73 + @Excel(name = "投放点编号")
  74 + private String dropPointNo;
  75 +
  76 + /** 运营单位 */
  77 + @Excel(name = "运营单位")
  78 + private String operatingUnit;
  79 +
  80 + /** 运输单位 */
  81 + @Excel(name = "运输单位")
  82 + private String transportUnit;
  83 +
  84 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  85 + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
  86 + private Date createTime;
  87 +
  88 + @Override
  89 + public Date getCreateTime() {
  90 + return createTime;
  91 + }
  92 +
  93 + @Override
  94 + public void setCreateTime(Date createTime) {
  95 + this.createTime = createTime;
  96 + }
  97 +
  98 + public void setId(Long id)
  99 + {
  100 + this.id = id;
  101 + }
  102 +
  103 + public Long getId()
  104 + {
  105 + return id;
  106 + }
  107 + public void setDropPointName(String dropPointName)
  108 + {
  109 + this.dropPointName = dropPointName;
  110 + }
  111 +
  112 + public String getDropPointName()
  113 + {
  114 + return dropPointName;
  115 + }
  116 + public void setDistrict(String district)
  117 + {
  118 + this.district = district;
  119 + }
  120 +
  121 + public String getDistrict()
  122 + {
  123 + return district;
  124 + }
  125 + public void setStreet(String street)
  126 + {
  127 + this.street = street;
  128 + }
  129 +
  130 + public String getStreet()
  131 + {
  132 + return street;
  133 + }
  134 + public void setCommunity(String community)
  135 + {
  136 + this.community = community;
  137 + }
  138 +
  139 + public String getCommunity()
  140 + {
  141 + return community;
  142 + }
  143 + public void setAddress(String address)
  144 + {
  145 + this.address = address;
  146 + }
  147 +
  148 + public String getAddress()
  149 + {
  150 + return address;
  151 + }
  152 + public void setType(String type)
  153 + {
  154 + this.type = type;
  155 + }
  156 +
  157 + public String getType()
  158 + {
  159 + return type;
  160 + }
  161 + public void setArea(BigDecimal area)
  162 + {
  163 + this.area = area;
  164 + }
  165 +
  166 + public BigDecimal getArea()
  167 + {
  168 + return area;
  169 + }
  170 + public void setCapacity(BigDecimal capacity)
  171 + {
  172 + this.capacity = capacity;
  173 + }
  174 +
  175 + public BigDecimal getCapacity()
  176 + {
  177 + return capacity;
  178 + }
  179 + public void setManagementUnit(String managementUnit)
  180 + {
  181 + this.managementUnit = managementUnit;
  182 + }
  183 +
  184 + public String getManagementUnit()
  185 + {
  186 + return managementUnit;
  187 + }
  188 + public void setCustodian(String custodian)
  189 + {
  190 + this.custodian = custodian;
  191 + }
  192 +
  193 + public String getCustodian()
  194 + {
  195 + return custodian;
  196 + }
  197 + public void setCustodianPhone(String custodianPhone)
  198 + {
  199 + this.custodianPhone = custodianPhone;
  200 + }
  201 +
  202 + public String getCustodianPhone()
  203 + {
  204 + return custodianPhone;
  205 + }
  206 + public void setDropTime(String dropTime)
  207 + {
  208 + this.dropTime = dropTime;
  209 + }
  210 +
  211 + public String getDropTime()
  212 + {
  213 + return dropTime;
  214 + }
  215 + public void setDropPointNo(String dropPointNo)
  216 + {
  217 + this.dropPointNo = dropPointNo;
  218 + }
  219 +
  220 + public String getDropPointNo()
  221 + {
  222 + return dropPointNo;
  223 + }
  224 + public void setOperatingUnit(String operatingUnit)
  225 + {
  226 + this.operatingUnit = operatingUnit;
  227 + }
  228 +
  229 + public String getOperatingUnit()
  230 + {
  231 + return operatingUnit;
  232 + }
  233 + public void setTransportUnit(String transportUnit)
  234 + {
  235 + this.transportUnit = transportUnit;
  236 + }
  237 +
  238 + public String getTransportUnit()
  239 + {
  240 + return transportUnit;
  241 + }
  242 +
  243 + @Override
  244 + public String toString() {
  245 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  246 + .append("id", getId())
  247 + .append("dropPointName", getDropPointName())
  248 + .append("district", getDistrict())
  249 + .append("street", getStreet())
  250 + .append("community", getCommunity())
  251 + .append("address", getAddress())
  252 + .append("type", getType())
  253 + .append("area", getArea())
  254 + .append("capacity", getCapacity())
  255 + .append("managementUnit", getManagementUnit())
  256 + .append("custodian", getCustodian())
  257 + .append("custodianPhone", getCustodianPhone())
  258 + .append("dropTime", getDropTime())
  259 + .append("dropPointNo", getDropPointNo())
  260 + .append("operatingUnit", getOperatingUnit())
  261 + .append("transportUnit", getTransportUnit())
  262 + .append("createTime", getCreateTime())
  263 + .append("createBy", getCreateBy())
  264 + .append("updateTime", getUpdateTime())
  265 + .append("updateBy", getUpdateBy())
  266 + .toString();
  267 + }
  268 +}
... ...
trash-unit/src/main/java/com/trash/dropPointInfo/mapper/DropPointInfoMapper.java 0 → 100644
  1 +package com.trash.dropPointInfo.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.trash.dropPointInfo.domain.DropPointInfo;
  5 +
  6 +/**
  7 + * 投放点信息管理Mapper接口
  8 + *
  9 + * @author trash
  10 + * @date 2024-11-14
  11 + */
  12 +public interface DropPointInfoMapper
  13 +{
  14 + /**
  15 + * 查询投放点信息管理
  16 + *
  17 + * @param id 投放点信息管理ID
  18 + * @return 投放点信息管理
  19 + */
  20 + DropPointInfo selectDropPointInfoById(Long id);
  21 +
  22 + /**
  23 + * 查询投放点信息管理列表
  24 + *
  25 + * @param dropPointInfo 投放点信息管理
  26 + * @return 投放点信息管理集合
  27 + */
  28 + List<DropPointInfo> selectDropPointInfoList(DropPointInfo dropPointInfo);
  29 +
  30 + /**
  31 + * 新增投放点信息管理
  32 + *
  33 + * @param dropPointInfo 投放点信息管理
  34 + * @return 结果
  35 + */
  36 + int insertDropPointInfo(DropPointInfo dropPointInfo);
  37 +
  38 + /**
  39 + * 修改投放点信息管理
  40 + *
  41 + * @param dropPointInfo 投放点信息管理
  42 + * @return 结果
  43 + */
  44 + int updateDropPointInfo(DropPointInfo dropPointInfo);
  45 +
  46 + /**
  47 + * 删除投放点信息管理
  48 + *
  49 + * @param id 投放点信息管理ID
  50 + * @return 结果
  51 + */
  52 + int deleteDropPointInfoById(Long id);
  53 +
  54 + /**
  55 + * 批量删除投放点信息管理
  56 + *
  57 + * @param ids 需要删除的数据ID
  58 + * @return 结果
  59 + */
  60 + int deleteDropPointInfoByIds(Long[] ids);
  61 +}
... ...
trash-unit/src/main/java/com/trash/dropPointInfo/service/IDropPointInfoService.java 0 → 100644
  1 +package com.trash.dropPointInfo.service;
  2 +
  3 +import java.util.List;
  4 +import com.trash.dropPointInfo.domain.DropPointInfo;
  5 +
  6 +/**
  7 + * 投放点信息管理Service接口
  8 + *
  9 + * @author trash
  10 + * @date 2024-11-14
  11 + */
  12 +public interface IDropPointInfoService
  13 +{
  14 + /**
  15 + * 查询投放点信息管理
  16 + *
  17 + * @param id 投放点信息管理ID
  18 + * @return 投放点信息管理
  19 + */
  20 + DropPointInfo selectDropPointInfoById(Long id);
  21 +
  22 + /**
  23 + * 查询投放点信息管理列表
  24 + *
  25 + * @param dropPointInfo 投放点信息管理
  26 + * @return 投放点信息管理集合
  27 + */
  28 + List<DropPointInfo> selectDropPointInfoList(DropPointInfo dropPointInfo);
  29 +
  30 + /**
  31 + * 新增投放点信息管理
  32 + *
  33 + * @param dropPointInfo 投放点信息管理
  34 + * @return 结果
  35 + */
  36 + int insertDropPointInfo(DropPointInfo dropPointInfo);
  37 +
  38 + /**
  39 + * 修改投放点信息管理
  40 + *
  41 + * @param dropPointInfo 投放点信息管理
  42 + * @return 结果
  43 + */
  44 + int updateDropPointInfo(DropPointInfo dropPointInfo);
  45 +
  46 + /**
  47 + * 批量删除投放点信息管理
  48 + *
  49 + * @param ids 需要删除的投放点信息管理ID
  50 + * @return 结果
  51 + */
  52 + int deleteDropPointInfoByIds(Long[] ids);
  53 +
  54 + /**
  55 + * 删除投放点信息管理信息
  56 + *
  57 + * @param id 投放点信息管理ID
  58 + * @return 结果
  59 + */
  60 + int deleteDropPointInfoById(Long id);
  61 +}
... ...
trash-unit/src/main/java/com/trash/dropPointInfo/service/impl/DropPointInfoServiceImpl.java 0 → 100644
  1 +package com.trash.dropPointInfo.service.impl;
  2 +
  3 +import java.util.List;
  4 +import com.trash.common.utils.DateUtils;
  5 +import com.trash.common.utils.SecurityUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +import com.trash.dropPointInfo.mapper.DropPointInfoMapper;
  9 +import com.trash.dropPointInfo.domain.DropPointInfo;
  10 +import com.trash.dropPointInfo.service.IDropPointInfoService;
  11 +
  12 +/**
  13 + * 投放点信息管理Service业务层处理
  14 + *
  15 + * @author trash
  16 + * @date 2024-11-14
  17 + */
  18 +@Service
  19 +public class DropPointInfoServiceImpl implements IDropPointInfoService
  20 +{
  21 + @Autowired
  22 + private DropPointInfoMapper dropPointInfoMapper;
  23 +
  24 + /**
  25 + * 查询投放点信息管理
  26 + *
  27 + * @param id 投放点信息管理ID
  28 + * @return 投放点信息管理
  29 + */
  30 + @Override
  31 + public DropPointInfo selectDropPointInfoById(Long id)
  32 + {
  33 + return dropPointInfoMapper.selectDropPointInfoById(id);
  34 + }
  35 +
  36 + /**
  37 + * 查询投放点信息管理列表
  38 + *
  39 + * @param dropPointInfo 投放点信息管理
  40 + * @return 投放点信息管理
  41 + */
  42 + @Override
  43 + public List<DropPointInfo> selectDropPointInfoList(DropPointInfo dropPointInfo)
  44 + {
  45 + return dropPointInfoMapper.selectDropPointInfoList(dropPointInfo);
  46 + }
  47 +
  48 + /**
  49 + * 新增投放点信息管理
  50 + *
  51 + * @param dropPointInfo 投放点信息管理
  52 + * @return 结果
  53 + */
  54 + @Override
  55 + public int insertDropPointInfo(DropPointInfo dropPointInfo)
  56 + {
  57 + dropPointInfo.setCreateTime(DateUtils.getNowDate());
  58 + dropPointInfo.setCreateBy(SecurityUtils.getUsername());
  59 + return dropPointInfoMapper.insertDropPointInfo(dropPointInfo);
  60 + }
  61 +
  62 + /**
  63 + * 修改投放点信息管理
  64 + *
  65 + * @param dropPointInfo 投放点信息管理
  66 + * @return 结果
  67 + */
  68 + @Override
  69 + public int updateDropPointInfo(DropPointInfo dropPointInfo)
  70 + {
  71 + dropPointInfo.setUpdateTime(DateUtils.getNowDate());
  72 + dropPointInfo.setUpdateBy(SecurityUtils.getUsername());
  73 + return dropPointInfoMapper.updateDropPointInfo(dropPointInfo);
  74 + }
  75 +
  76 + /**
  77 + * 批量删除投放点信息管理
  78 + *
  79 + * @param ids 需要删除的投放点信息管理ID
  80 + * @return 结果
  81 + */
  82 + @Override
  83 + public int deleteDropPointInfoByIds(Long[] ids)
  84 + {
  85 + return dropPointInfoMapper.deleteDropPointInfoByIds(ids);
  86 + }
  87 +
  88 + /**
  89 + * 删除投放点信息管理信息
  90 + *
  91 + * @param id 投放点信息管理ID
  92 + * @return 结果
  93 + */
  94 + @Override
  95 + public int deleteDropPointInfoById(Long id)
  96 + {
  97 + return dropPointInfoMapper.deleteDropPointInfoById(id);
  98 + }
  99 +}
... ...
trash-unit/src/main/resources/mapper/unit/DropPointInfoMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.trash.dropPointInfo.mapper.DropPointInfoMapper">
  6 +
  7 + <resultMap type="DropPointInfo" id="DropPointInfoResult">
  8 + <result property="id" column="id" />
  9 + <result property="dropPointName" column="drop_point_name" />
  10 + <result property="district" column="district" />
  11 + <result property="street" column="street" />
  12 + <result property="community" column="community" />
  13 + <result property="address" column="address" />
  14 + <result property="type" column="type" />
  15 + <result property="area" column="area" />
  16 + <result property="capacity" column="capacity" />
  17 + <result property="managementUnit" column="management_unit" />
  18 + <result property="custodian" column="custodian" />
  19 + <result property="custodianPhone" column="custodian_phone" />
  20 + <result property="dropTime" column="drop_time" />
  21 + <result property="dropPointNo" column="drop_point_no" />
  22 + <result property="operatingUnit" column="operating_unit" />
  23 + <result property="transportUnit" column="transport_unit" />
  24 + <result property="createTime" column="create_time" />
  25 + <result property="createBy" column="create_by" />
  26 + <result property="updateTime" column="update_time" />
  27 + <result property="updateBy" column="update_by" />
  28 + </resultMap>
  29 +
  30 + <sql id="selectDropPointInfoVo">
  31 + select id, drop_point_name, district, street, community, address, type, area, capacity, management_unit, custodian, custodian_phone, drop_time, drop_point_no, operating_unit, transport_unit, create_time, create_by, update_time, update_by from drop_point_info
  32 + </sql>
  33 +
  34 + <select id="selectDropPointInfoList" parameterType="DropPointInfo" resultMap="DropPointInfoResult">
  35 + <include refid="selectDropPointInfoVo"/>
  36 + <where>
  37 + <if test="dropPointName != null and dropPointName != ''"> and drop_point_name like concat('%', #{dropPointName}, '%')</if>
  38 + <if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
  39 + <if test="type != null and type != ''"> and type = #{type}</if>
  40 + <if test="dropPointNo != null and dropPointNo != ''"> and drop_point_no like concat(#{dropPointNo}, '%')</if>
  41 + </where>
  42 + </select>
  43 +
  44 + <select id="selectDropPointInfoById" parameterType="Long" resultMap="DropPointInfoResult">
  45 + <include refid="selectDropPointInfoVo"/>
  46 + where id = #{id}
  47 + </select>
  48 +
  49 + <insert id="insertDropPointInfo" parameterType="DropPointInfo" useGeneratedKeys="true" keyProperty="id">
  50 + insert into drop_point_info
  51 + <trim prefix="(" suffix=")" suffixOverrides=",">
  52 + <if test="dropPointName != null">drop_point_name,</if>
  53 + <if test="district != null">district,</if>
  54 + <if test="street != null">street,</if>
  55 + <if test="community != null">community,</if>
  56 + <if test="address != null">address,</if>
  57 + <if test="type != null">type,</if>
  58 + <if test="area != null">area,</if>
  59 + <if test="capacity != null">capacity,</if>
  60 + <if test="managementUnit != null">management_unit,</if>
  61 + <if test="custodian != null">custodian,</if>
  62 + <if test="custodianPhone != null">custodian_phone,</if>
  63 + <if test="dropTime != null">drop_time,</if>
  64 + <if test="dropPointNo != null">drop_point_no,</if>
  65 + <if test="operatingUnit != null">operating_unit,</if>
  66 + <if test="transportUnit != null">transport_unit,</if>
  67 + <if test="createTime != null">create_time,</if>
  68 + <if test="createBy != null">create_by,</if>
  69 + <if test="updateTime != null">update_time,</if>
  70 + <if test="updateBy != null">update_by,</if>
  71 + </trim>
  72 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  73 + <if test="dropPointName != null">#{dropPointName},</if>
  74 + <if test="district != null">#{district},</if>
  75 + <if test="street != null">#{street},</if>
  76 + <if test="community != null">#{community},</if>
  77 + <if test="address != null">#{address},</if>
  78 + <if test="type != null">#{type},</if>
  79 + <if test="area != null">#{area},</if>
  80 + <if test="capacity != null">#{capacity},</if>
  81 + <if test="managementUnit != null">#{managementUnit},</if>
  82 + <if test="custodian != null">#{custodian},</if>
  83 + <if test="custodianPhone != null">#{custodianPhone},</if>
  84 + <if test="dropTime != null">#{dropTime},</if>
  85 + <if test="dropPointNo != null">#{dropPointNo},</if>
  86 + <if test="operatingUnit != null">#{operatingUnit},</if>
  87 + <if test="transportUnit != null">#{transportUnit},</if>
  88 + <if test="createTime != null">#{createTime},</if>
  89 + <if test="createBy != null">#{createBy},</if>
  90 + <if test="updateTime != null">#{updateTime},</if>
  91 + <if test="updateBy != null">#{updateBy},</if>
  92 + </trim>
  93 + </insert>
  94 +
  95 + <update id="updateDropPointInfo" parameterType="DropPointInfo">
  96 + update drop_point_info
  97 + <trim prefix="SET" suffixOverrides=",">
  98 + <if test="dropPointName != null">drop_point_name = #{dropPointName},</if>
  99 + <if test="district != null">district = #{district},</if>
  100 + <if test="street != null">street = #{street},</if>
  101 + <if test="community != null">community = #{community},</if>
  102 + <if test="address != null">address = #{address},</if>
  103 + <if test="type != null">type = #{type},</if>
  104 + <if test="area != null">area = #{area},</if>
  105 + <if test="capacity != null">capacity = #{capacity},</if>
  106 + <if test="managementUnit != null">management_unit = #{managementUnit},</if>
  107 + <if test="custodian != null">custodian = #{custodian},</if>
  108 + <if test="custodianPhone != null">custodian_phone = #{custodianPhone},</if>
  109 + <if test="dropTime != null">drop_time = #{dropTime},</if>
  110 + <if test="dropPointNo != null">drop_point_no = #{dropPointNo},</if>
  111 + <if test="operatingUnit != null">operating_unit = #{operatingUnit},</if>
  112 + <if test="transportUnit != null">transport_unit = #{transportUnit},</if>
  113 + <if test="createTime != null">create_time = #{createTime},</if>
  114 + <if test="createBy != null">create_by = #{createBy},</if>
  115 + <if test="updateTime != null">update_time = #{updateTime},</if>
  116 + <if test="updateBy != null">update_by = #{updateBy},</if>
  117 + </trim>
  118 + where id = #{id}
  119 + </update>
  120 +
  121 + <delete id="deleteDropPointInfoById" parameterType="Long">
  122 + delete from drop_point_info where id = #{id}
  123 + </delete>
  124 +
  125 + <delete id="deleteDropPointInfoByIds" parameterType="String">
  126 + delete from drop_point_info where id in
  127 + <foreach item="id" collection="array" open="(" separator="," close=")">
  128 + #{id}
  129 + </foreach>
  130 + </delete>
  131 +
  132 +</mapper>
0 133 \ No newline at end of file
... ...