Browse Source

Merge branch 'v1.0' of http://192.168.2.241:3000/zhaoqiang/TYuan into v1.0

# Conflicts:
#	app/build.gradle
yuanck 3 years ago
parent
commit
874af24a43
31 changed files with 754 additions and 189 deletions
  1. 1 11
      app/src/main/AndroidManifest.xml
  2. 0 14
      app/src/main/java/com/tofly/route/base/BaseMapController.java
  3. 1 1
      app/src/main/java/com/tofly/route/base/url/NetRequestURL.java
  4. 188 0
      app/src/main/java/com/tofly/route/module/das/data/TroubleLevelBean.java
  5. 2 1
      app/src/main/java/com/tofly/route/module/log/data/api/LogService.java
  6. 18 2
      app/src/main/java/com/tofly/route/module/log/data/source/remote/LogFileRemoteSource.java
  7. 5 0
      app/src/main/java/com/tofly/route/module/log/ui/UiLogUpload.java
  8. 1 1
      app/src/main/java/com/tofly/route/module/map/contract/MapPresenter.java
  9. 4 1
      app/src/main/java/com/tofly/route/module/sign/ui/contract/SignPresenter.java
  10. 20 1
      app/src/main/java/com/tofly/route/module/trouble/data/TroubleBean.java
  11. 10 0
      app/src/main/java/com/tofly/route/module/trouble/data/api/TroubleService.java
  12. 6 0
      app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleCallback.java
  13. 4 0
      app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleRepository.java
  14. 14 9
      app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleSource.java
  15. 6 0
      app/src/main/java/com/tofly/route/module/trouble/data/source/local/TroubleLocalSource.java
  16. 58 3
      app/src/main/java/com/tofly/route/module/trouble/data/source/remote/TroubleRemoteSource.java
  17. 2 0
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/UiTroubleList.java
  18. 0 3
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/contract/ListContract.java
  19. 1 1
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/contract/ListPresenter.java
  20. 74 17
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/UiTroubleReport.java
  21. 7 0
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/contract/ReportContract.java
  22. 34 0
      app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/contract/ReportPresenter.java
  23. 0 1
      app/src/main/java/com/tofly/route/ui/activity/UiMapTool.java
  24. 164 118
      app/src/main/res/layout/ui_trouble_report.xml
  25. 2 0
      app/src/main/res/values/custom_strings.xml
  26. 1 1
      build.gradle
  27. 1 1
      gradle.properties
  28. 2 2
      gradle/wrapper/gradle-wrapper.properties
  29. 0 1
      latte-core/src/main/java/com/tofly/latte_core/net/base/NetWorkApi.java
  30. 3 0
      latte-core/src/main/java/com/tofly/latte_core/net/interceptor/CommonRequestInterceptor.java
  31. 125 0
      latte-core/src/main/java/com/tofly/latte_core/utils/NetworkStatus.java

+ 1 - 11
app/src/main/AndroidManifest.xml

@@ -82,7 +82,7 @@
         <meta-data
             android:name="com.amap.api.v2.apikey"
             android:value="01cc03991dccae9b6770e3f09fde2e4a" />
-        <!--            android:value="e336f58e7588150eac9e5ad31beca5bd" />-->
+<!--            android:value="e336f58e7588150eac9e5ad31beca5bd" />-->
         <!--android:value="ea9860ec7317534b1052354ef95556b3" -->
 
         <service android:name="com.amap.api.location.APSService" />
@@ -130,7 +130,6 @@
             android:screenOrientation="portrait" />
         <activity
             android:name="com.tofly.route.ui.activity.UiBuildFound"
-            android:windowSoftInputMode="adjustPan"
             android:label="@string/build_found_title"
             android:screenOrientation="portrait" />
         <activity
@@ -167,9 +166,7 @@
             android:screenOrientation="portrait" />
         <activity
             android:name="com.tofly.route.ui.activity.UiRepairFound"
-            android:windowSoftInputMode="adjustPan"
             android:label="@string/repair_found_title"
-
             android:screenOrientation="portrait" />
         <activity
             android:name="com.tofly.route.ui.activity.UiRepairJobDispatch"
@@ -239,7 +236,6 @@
         <activity
             android:name="com.tofly.route.module.routeLog.ui.UiRouteLog"
             android:label="@string/route_log_report_title"
-            android:windowSoftInputMode="adjustPan"
             android:screenOrientation="portrait" />
         <activity
             android:name="com.tofly.route.module.trouble.ui.troubleClear.UiTroubleClear"
@@ -502,12 +498,6 @@
         <activity
             android:name=".ui.activity.PrintActivity"
             android:label="选择打印设备" />
-        <activity
-            android:name=".ui.activity.MeterkgjlListActivity"
-            android:label="用户列表" />
-        <activity
-            android:name=".ui.activity.MeterKgjlActivity"
-            android:label="开关记录" />
 
     </application>
 

+ 0 - 14
app/src/main/java/com/tofly/route/base/BaseMapController.java

@@ -422,20 +422,6 @@ public class BaseMapController {
     }
 
 
-    public void cleanPreSection(){
-
-
-//        if (mapView != null) {
-//
-//            if (overlay != null) {
-//                overlay.getGraphics().clear();
-//                mapView.getGraphicsOverlays().remove(overlay);
-//            }
-//
-//            overlay = null;
-//        }
-
-    }
 
     public void clearMapData() {
         arcgisUtils.clearAllMpaData();

+ 1 - 1
app/src/main/java/com/tofly/route/base/url/NetRequestURL.java

@@ -26,7 +26,7 @@ public class NetRequestURL {
     public static String EXPORT_HTTP_URL_TEST = "http://192.168.15.5:8094/";//深信服地址测试
     public static String EXPORT_HTTP_URL = "http://192.168.15.5:8094/";//深信服地址
 
-    private static Boolean isExternalAddr = false;
+    private static Boolean isExternalAddr = null;  // null为测试环境, true 为正式环境
 
     public static String getServerAddr() {
         return isExternalAddr == null ? SERVER_ADDR_W : (isExternalAddr ? SERVER_ADDR_EXTERNAL : SERVER_ADDR);

+ 188 - 0
app/src/main/java/com/tofly/route/module/das/data/TroubleLevelBean.java

@@ -0,0 +1,188 @@
+package com.tofly.route.module.das.data;
+
+import java.util.List;
+
+public class TroubleLevelBean {
+
+
+    public static class ResultDTO {
+        private int current;
+        private boolean hitCount;
+        private boolean optimizeCountSql;
+        private List<OrdersDTO> orders;
+        private int pages;
+        private List<RecordsDTO> records;
+        private boolean searchCount;
+        private int size;
+        private int total;
+
+
+        @Override
+        public String toString() {
+            return "ResultDTO{" +
+                    "current=" + current +
+                    ", hitCount=" + hitCount +
+                    ", optimizeCountSql=" + optimizeCountSql +
+                    ", orders=" + orders +
+                    ", pages=" + pages +
+                    ", records=" + records +
+                    ", searchCount=" + searchCount +
+                    ", size=" + size +
+                    ", total=" + total +
+                    '}';
+        }
+
+        public int getCurrent() {
+            return current;
+        }
+
+        public void setCurrent(int current) {
+            this.current = current;
+        }
+
+        public boolean isHitCount() {
+            return hitCount;
+        }
+
+        public void setHitCount(boolean hitCount) {
+            this.hitCount = hitCount;
+        }
+
+        public boolean isOptimizeCountSql() {
+            return optimizeCountSql;
+        }
+
+        public void setOptimizeCountSql(boolean optimizeCountSql) {
+            this.optimizeCountSql = optimizeCountSql;
+        }
+
+        public List<OrdersDTO> getOrders() {
+            return orders;
+        }
+
+        public void setOrders(List<OrdersDTO> orders) {
+            this.orders = orders;
+        }
+
+        public int getPages() {
+            return pages;
+        }
+
+        public void setPages(int pages) {
+            this.pages = pages;
+        }
+
+        public List<RecordsDTO> getRecords() {
+            return records;
+        }
+
+        public void setRecords(List<RecordsDTO> records) {
+            this.records = records;
+        }
+
+        public boolean isSearchCount() {
+            return searchCount;
+        }
+
+        public void setSearchCount(boolean searchCount) {
+            this.searchCount = searchCount;
+        }
+
+        public int getSize() {
+            return size;
+        }
+
+        public void setSize(int size) {
+            this.size = size;
+        }
+
+        public int getTotal() {
+            return total;
+        }
+
+        public void setTotal(int total) {
+            this.total = total;
+        }
+
+        public static class OrdersDTO {
+            private boolean asc;
+            private String column;
+
+            public boolean isAsc() {
+                return asc;
+            }
+
+            public void setAsc(boolean asc) {
+                this.asc = asc;
+            }
+
+            public String getColumn() {
+                return column;
+            }
+
+            public void setColumn(String column) {
+                this.column = column;
+            }
+        }
+
+        public static class RecordsDTO {
+            private String createTime;
+            private int createUser;
+            private int id;
+            private String name;
+            private String notes;
+
+
+            @Override
+            public String toString() {
+                return "RecordsDTO{" +
+                        "createTime='" + createTime + '\'' +
+                        ", createUser=" + createUser +
+                        ", id=" + id +
+                        ", name='" + name + '\'' +
+                        ", notes='" + notes + '\'' +
+                        '}';
+            }
+
+            public String getCreateTime() {
+                return createTime;
+            }
+
+            public void setCreateTime(String createTime) {
+                this.createTime = createTime;
+            }
+
+            public int getCreateUser() {
+                return createUser;
+            }
+
+            public void setCreateUser(int createUser) {
+                this.createUser = createUser;
+            }
+
+            public int getId() {
+                return id;
+            }
+
+            public void setId(int id) {
+                this.id = id;
+            }
+
+            public String getName() {
+                return name;
+            }
+
+            public void setName(String name) {
+                this.name = name;
+            }
+
+            public String getNotes() {
+                return notes;
+            }
+
+            public void setNotes(String notes) {
+                this.notes = notes;
+            }
+        }
+    }
+}

+ 2 - 1
app/src/main/java/com/tofly/route/module/log/data/api/LogService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 
 import io.reactivex.Observable;
 import okhttp3.RequestBody;
+import retrofit2.http.Header;
 import retrofit2.http.Multipart;
 import retrofit2.http.POST;
 import retrofit2.http.PartMap;
@@ -14,5 +15,5 @@ public interface LogService {
 
     @Multipart
     @POST("base/log/manuallyAdd")
-    Observable<BaseResponse> uploadLogFiles(@PartMap Map<String, RequestBody> map);
+    Observable<BaseResponse> uploadLogFiles(@Header("X-Real-IP") String IP , @PartMap Map<String, RequestBody> map);
 }

+ 18 - 2
app/src/main/java/com/tofly/route/module/log/data/source/remote/LogFileRemoteSource.java

@@ -1,10 +1,14 @@
 package com.tofly.route.module.log.data.source.remote;
 
 import android.content.Context;
+import android.os.Build;
+
+import androidx.annotation.RequiresApi;
 
 import com.tofly.latte_core.net.LatteNetWorkApi;
 import com.tofly.latte_core.net.helper.RxHelper;
 import com.tofly.latte_core.net.observer.MyObserver;
+import com.tofly.latte_core.utils.NetworkStatus;
 import com.tofly.route.base.api.Transformer;
 import com.tofly.route.module.log.data.api.LogService;
 import com.tofly.route.module.log.data.source.LogFileSource;
@@ -22,14 +26,24 @@ public class LogFileRemoteSource implements LogFileSource {
 
     private static LogFileRemoteSource INSTANCE;
 
-    public static synchronized LogFileRemoteSource getInstance(){
+    public static synchronized LogFileRemoteSource getInstance() {
         if (INSTANCE == null)
             INSTANCE = new LogFileRemoteSource();
         return INSTANCE;
     }
 
+    @RequiresApi(api = Build.VERSION_CODES.M)
     @Override
     public void uploadLogFiles(Context context, List<TroubleFileBean> files, ILogFileCallback fileCallback) {
+        String ip = "未知";
+
+        boolean networkConnected = com.tofly.latte_core.utils.NetworkStatus.isNetworkConnected(context);
+
+        if (networkConnected) {
+
+            ip = NetworkStatus.getIP(context);
+        }
+
         Map<String, RequestBody> params = new HashMap<>();
         if (files != null && files.size() > 0) {
             for (int i = 0; i < files.size(); i++) {
@@ -40,8 +54,10 @@ public class LogFileRemoteSource implements LogFileSource {
                 }
             }
         }
+
+
         LatteNetWorkApi.getApiService(LogService.class)
-                .uploadLogFiles(params)
+                .uploadLogFiles(ip, params)
                 .compose(Transformer.bTransformer())
                 .compose(RxHelper.observableIO2Main(context))
                 .subscribe(new MyObserver<Boolean>(context) {

+ 5 - 0
app/src/main/java/com/tofly/route/module/log/ui/UiLogUpload.java

@@ -104,6 +104,11 @@ public class UiLogUpload extends BaseActivity<LogFileContract.Presenter> impleme
 
     }
 
+
+    /**
+     * 获取当天日志
+     * @param date
+     */
     private void getLogFiles(String date){
         mDatePicked = date;
         textDateSelected.setText(date);

+ 1 - 1
app/src/main/java/com/tofly/route/module/map/contract/MapPresenter.java

@@ -151,7 +151,7 @@ public class MapPresenter extends BasePresenter<MapContract.View> implements Map
 
 
             final ListenableFuture<IdentifyLayerResult> identifyFuture = mapView.identifyLayerAsync(
-                    onlinePipeMap, screenPoint, 15, false,10);
+                    onlinePipeMap, screenPoint, 10, false,10);
             identifyFuture.addDoneListener(() -> {
                 getView().hideLoading();
                 try {

+ 4 - 1
app/src/main/java/com/tofly/route/module/sign/ui/contract/SignPresenter.java

@@ -58,7 +58,10 @@ public class SignPresenter extends BasePresenter<SignContract.View> implements S
             signRepository.getSignListToday(new SignCallback() {
                 @Override
                 public void onGetSignList(List<SignHistoryDataBean> signList) {
-                    getView().showSignList(signList);
+                    if (signList != null) {
+                        //避免网络卡顿造成空指针 闪退
+                        getView().showSignList(signList);
+                    }
                 }
 
                 @Override

+ 20 - 1
app/src/main/java/com/tofly/route/module/trouble/data/TroubleBean.java

@@ -28,8 +28,10 @@ public class TroubleBean implements Serializable {
     private int id;
     private String pipeName;   //管线名称
     private String location;    //隐患部位(管线或设施)
-    private String typeId;     //隐患原因ID
+    private String typeId ;     //隐患原因ID
     private String typeName;   //隐患原因
+    private String toubleRangeId = "1";     //隐患等级ID
+    private String toubleRangeName ="";   //隐患等级
     private String regionId;   //所属抄表区域编码
     private String regionName;  //片区名称
     private double lgtd;        //上报位置经度
@@ -48,6 +50,23 @@ public class TroubleBean implements Serializable {
     private String auditNotes;  //审核意见,备注
     private List<String> filePathList;  //附件
 
+
+    public String getToubleRangeId() {
+        return toubleRangeId;
+    }
+
+    public void setToubleRangeId(String toubleRangeId) {
+        this.toubleRangeId = toubleRangeId;
+    }
+
+    public String getToubleRangeName() {
+        return toubleRangeName;
+    }
+
+    public void setToubleRangeName(String toubleRangeName) {
+        this.toubleRangeName = toubleRangeName;
+    }
+
     public int getId() {
         return id;
     }

+ 10 - 0
app/src/main/java/com/tofly/route/module/trouble/data/api/TroubleService.java

@@ -3,6 +3,7 @@ package com.tofly.route.module.trouble.data.api;
 import com.tofly.route.base.api.BaseResponse;
 import com.tofly.route.base.api.ResultBean;
 import com.tofly.route.bean.builds.BuildEntity;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.trouble.data.TroubleBean;
 import com.tofly.route.module.trouble.data.TroubleDetailBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
@@ -54,4 +55,13 @@ public interface TroubleService {
     @Headers("Content-Type:application/json")
     @POST("gps/audit/auditDispose")
     Observable<BaseResponse> troubleClearVerify(@Body RequestBody requestBody, @Query("templateServiceType") String type );
+
+
+    /**
+     * 获取隐患等级
+     */
+    @GET("gps/toublerange/page")
+    Observable<BaseResponse<TroubleLevelBean.ResultDTO>> getTroublesRange2();
+
+
 }

+ 6 - 0
app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleCallback.java

@@ -1,6 +1,7 @@
 package com.tofly.route.module.trouble.data.source;
 
 import com.tofly.route.bean.builds.BuildEntity;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.trouble.data.TroubleBean;
 import com.tofly.route.module.trouble.data.TroubleDetailBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
@@ -43,6 +44,11 @@ public class TroubleCallback implements TroubleSource.ITroubleCallback {
 
     }
 
+    @Override
+    public void onTroubleLevel(TroubleLevelBean.ResultDTO levelBean) {
+
+    }
+
     @Override
     public void onDispatchTrouble() {
 

+ 4 - 0
app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleRepository.java

@@ -188,4 +188,8 @@ public class TroubleRepository implements TroubleSource {
             }
         });
     }
+
+    public void getTroubleLevel(ITroubleCallback troubleCallback) {
+        remoteSource.getTroubleLevel(troubleCallback);
+    }
 }

+ 14 - 9
app/src/main/java/com/tofly/route/module/trouble/data/source/TroubleSource.java

@@ -3,7 +3,7 @@ package com.tofly.route.module.trouble.data.source;
 import android.content.Context;
 
 import com.tofly.route.bean.builds.BuildEntity;
-import com.tofly.route.module.monitor.data.DeviceUploadBean;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.plan.data.PlanBean;
 import com.tofly.route.module.routeLog.data.RouteLogBean;
 import com.tofly.route.module.trouble.data.ClearVerifyBean;
@@ -11,12 +11,9 @@ import com.tofly.route.module.trouble.data.TroubleBean;
 import com.tofly.route.module.trouble.data.TroubleDetailBean;
 import com.tofly.route.module.trouble.data.TroubleFileBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
-import com.tofly.route.util.Location.LocationUtil_xu;
 
 import java.util.List;
 
-import retrofit2.http.Path;
-
 public interface TroubleSource {
 
     interface ITroubleCallback {
@@ -34,6 +31,9 @@ public interface TroubleSource {
 
         void onTroubleClear();
 
+
+        void onTroubleLevel(TroubleLevelBean.ResultDTO levelBean);
+
         void onDispatchTrouble();
 
         void onGetTroubleDetail(TroubleDetailBean troubleDetail);
@@ -43,9 +43,13 @@ public interface TroubleSource {
         void onError(String errMsg);
     }
 
+
+    /*获取隐患等级*/
+    void getTroubleLevel(ITroubleCallback troubleCallback);
+
     /**
      * 隐患上报
-     * */
+     */
     /*获取隐患类型列表*/
     void getTroubleTypes(Context context, ITroubleCallback troubleCallback);
 
@@ -60,17 +64,18 @@ public interface TroubleSource {
 
     /**
      * 隐患列表
-     * */
+     */
     /*获取隐患列表*/
     void getTroubles(Context context, int audit_result, int state, String keyword, int audit_user, int page, ITroubleCallback troubleCallback);
-    void getTroubles(Context context, int audit_result, int state, String keyword, int audit_user, int page,int inspectUsers, ITroubleCallback troubleCallback);
+
+    void getTroubles(Context context, int audit_result, int state, String keyword, int audit_user, int page, int inspectUsers, ITroubleCallback troubleCallback);
 
     /*获取隐患详情*/
     void getTroubleInfo(Context context, int trouble_id, ITroubleCallback troubleCallback);
 
     /**
      * 隐患巡查
-     * */
+     */
 
     /*隐患消除申请*/
     void troubleClear(Context context, int troubleId, RouteLogBean routeLogBean,
@@ -78,7 +83,7 @@ public interface TroubleSource {
 
     /**
      * 隐患审核
-     * */
+     */
     /*隐患审核派工*/
     void troubleDispatch(Context context, TroubleBean troubleBean, PlanBean planBean, ITroubleCallback troubleCallback);
 

+ 6 - 0
app/src/main/java/com/tofly/route/module/trouble/data/source/local/TroubleLocalSource.java

@@ -31,6 +31,12 @@ public class TroubleLocalSource implements TroubleSource {
         troubleTypeDaoUtils = DaoUtilsStore.getInstance().getTroubleTypeDaoUtils();
     }
 
+
+    @Override
+    public void getTroubleLevel(ITroubleCallback troubleCallback) {
+      //  troubleCallback.onTroubleLevel();
+    }
+
     @Override
     public void getTroubleTypes(Context context, ITroubleCallback troubleCallback) {
         List<TroubleTypeBean> troubleTypeBeans = troubleTypeDaoUtils.queryAll();

+ 58 - 3
app/src/main/java/com/tofly/route/module/trouble/data/source/remote/TroubleRemoteSource.java

@@ -1,9 +1,11 @@
 package com.tofly.route.module.trouble.data.source.remote;
 
 import android.content.Context;
+import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.tofly.latte_core.config.Latte;
 import com.tofly.latte_core.net.LatteNetWorkApi;
 import com.tofly.latte_core.net.helper.RxHelper;
 import com.tofly.latte_core.net.observer.BaseObserver;
@@ -14,6 +16,7 @@ import com.tofly.route.base.api.BaseServerApi;
 import com.tofly.route.base.api.ResultBean;
 import com.tofly.route.base.api.Transformer;
 import com.tofly.route.bean.builds.BuildEntity;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.plan.data.PlanBean;
 import com.tofly.route.module.routeLog.data.RouteLogBean;
 import com.tofly.route.module.trouble.data.ClearVerifyBean;
@@ -22,6 +25,7 @@ import com.tofly.route.module.trouble.data.TroubleDetailBean;
 import com.tofly.route.module.trouble.data.TroubleFileBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
 import com.tofly.route.module.trouble.data.api.TroubleService;
+import com.tofly.route.module.trouble.data.source.TroubleCallback;
 import com.tofly.route.module.trouble.data.source.TroubleSource;
 import com.tofly.route.util.Location.LocationUtil;
 import com.tofly.tyuan.utils.RequestBodyUtils;
@@ -31,6 +35,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.security.auth.login.LoginException;
+
 import okhttp3.RequestBody;
 
 public class TroubleRemoteSource implements TroubleSource {
@@ -47,6 +53,7 @@ public class TroubleRemoteSource implements TroubleSource {
 
     }
 
+
     /**
      * 隐患上报
      */
@@ -126,6 +133,8 @@ public class TroubleRemoteSource implements TroubleSource {
         params.put("notes", RequestBodyUtils.toRequestBodyString(troubleBean.getNotes()));
         params.put("suggest", RequestBodyUtils.toRequestBodyString(troubleBean.getSuggest()));
         params.put("typeId", RequestBodyUtils.toRequestBodyString(troubleBean.getTypeId()));
+        params.put("toubleRangeId", RequestBodyUtils.toRequestBodyString(troubleBean.getToubleRangeId()));
+        params.put("toubleRangeName", RequestBodyUtils.toRequestBodyString(troubleBean.getToubleRangeName()));
         params.put("auditUser", RequestBodyUtils.toRequestBodyString(troubleBean.getAuditUser() + ""));
         if (files != null && files.size() > 0) {
             for (int i = 0; i < files.size(); i++) {
@@ -183,8 +192,10 @@ public class TroubleRemoteSource implements TroubleSource {
         params.put("size", size + "");
 
 
-        if (flag ==8){
-            params.put("flag", 1+"");
+        Log.e("yjl","当前flag:" +flag);
+        if (flag == 8) {
+
+            params.put("flag", 1 + "");
         }
         BaseServerApi.getApiService(TroubleService.class)
                 .getTroubles(params)
@@ -244,7 +255,7 @@ public class TroubleRemoteSource implements TroubleSource {
         if (isrespect.equals("1")) {
             if (planBean != null) {
                 JSONObject jsonPlan = (JSONObject) JSON.toJSON(planBean);
-                jsonPlan.put("isDispatching" , "1");
+                jsonPlan.put("isDispatching", "1");
                 jsonRoot.put("planDto", jsonPlan);
 
 
@@ -356,4 +367,48 @@ public class TroubleRemoteSource implements TroubleSource {
                     }
                 });
     }
+
+
+    /**
+     * 获取隐患等级
+     */
+
+    @Override
+    public void getTroubleLevel(ITroubleCallback troubleCallback) {
+
+        Context context = Latte.getApplicationContext();
+        BaseServerApi.getApiService(TroubleService.class)
+                .getTroublesRange2()
+                .compose(Transformer.sTransformer())
+                .compose(RxHelper.observableIO2Main(context))
+                .subscribe(new BaseObserver<TroubleLevelBean.ResultDTO>() {
+                    @Override
+                    public void onSuccess(TroubleLevelBean.ResultDTO demo) {
+                        troubleCallback.onTroubleLevel(demo);
+                    }
+
+                    @Override
+                    public void onFailure(Throwable e, String errorMsg) {
+
+                        troubleCallback.onError(errorMsg);
+                    }
+                });
+//        BaseServerApi.getApiService(TroubleService.class)
+//                .getTroublesRange()
+//                .compose(Transformer.bTransformer())
+//                .compose(RxHelper.observableIO2Main(context))
+//                .subscribe(new BaseObserver<TroubleLevelBean>(){
+//
+//                    @Override
+//                    public void onSuccess(TroubleLevelBean demo) {
+//
+//                    }
+//
+//                    @Override
+//                    public void onFailure(Throwable e, String errorMsg) {
+//
+//                    }
+//                });
+
+    }
 }

+ 2 - 0
app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/UiTroubleList.java

@@ -224,11 +224,13 @@ public class UiTroubleList extends BaseActivity<ListContract.Presenter> implemen
     void onClickBack(View view) {
         switch (view.getId()) {
             case R.id.layout_trouble_upload_module: {
+                //隐患上报
                 Intent intent = new Intent(this, UiTroubleReport.class);
                 startActivity(intent);
             }
             break;
             case R.id.layout_trouble_query_module: {
+                //隐患查询
                 Intent intent = new Intent(this, UiTroubleQueryList.class);
                 startActivity(intent);
             }

+ 0 - 3
app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/contract/ListContract.java

@@ -5,9 +5,6 @@ import android.content.Context;
 import com.tofly.latte_core.base.BaseView;
 import com.tofly.latte_core.base.IPresenter;
 import com.tofly.route.module.trouble.data.TroubleBean;
-import com.tofly.route.module.trouble.data.TroubleTypeBean;
-import com.tofly.route.module.trouble.data.source.TroubleSource;
-import com.tofly.route.module.trouble.ui.troubleList.UiTroubleQueryList;
 
 import java.util.List;
 

+ 1 - 1
app/src/main/java/com/tofly/route/module/trouble/ui/troubleList/contract/ListPresenter.java

@@ -58,7 +58,7 @@ public class ListPresenter extends BasePresenter<ListContract.View> implements L
      */
     @Override
     public void getHandleTroubleList(Context context, int page ,int inspectUsers) {
-        getTroubleList(context, 1, 1, null, inspectUsers, page,8);
+        getTroubleList(context, -1, -1, null, -1, page,8);
     }
 
 

+ 74 - 17
app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/UiTroubleReport.java

@@ -4,6 +4,7 @@ import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -13,7 +14,6 @@ import android.widget.CompoundButton;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.RadioGroup;
-import android.widget.SpinnerAdapter;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -28,6 +28,7 @@ import com.tofly.route.base.C;
 import com.tofly.route.bean.XjzBean;
 import com.tofly.route.bean.builds.BuildEntity;
 import com.tofly.route.module.das.data.JSFieldBean;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.map.data.RegionAttributeBean;
 import com.tofly.route.module.trouble.data.MyTroubleEvent;
 import com.tofly.route.module.trouble.data.TroubleBean;
@@ -35,17 +36,12 @@ import com.tofly.route.module.trouble.data.TroubleFileBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
 import com.tofly.route.module.trouble.ui.troubleReport.contract.ReportContract;
 import com.tofly.route.module.trouble.ui.troubleReport.contract.ReportPresenter;
-import com.tofly.route.module.user.ui.adatper.SingleDepartUserListAdapter;
-import com.tofly.route.module.user.ui.adatper.SingleUserListAdapter;
 import com.tofly.route.util.AmapUtils.AmapLocationHelper;
-import com.tofly.route.util.CheckUtil;
 import com.tofly.route.util.Location.LocationUtil;
 import com.tofly.route.util.Location.LocationUtil_xu;
 import com.tofly.route.util.dialog.DialogUtil;
 import com.tofly.route.util.progressdialog.ProgressManager;
-import com.tofly.route.util.toast.ToastUtil;
 import com.tofly.tyuan.R;
-import com.tofly.tyuan.entity.UserEntity;
 import com.tofly.tyuan.entity.messageEntity.DepartmentBean;
 import com.tofly.tyuan.utils.SpinnerUtils;
 
@@ -53,14 +49,16 @@ import org.greenrobot.eventbus.EventBus;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.UUID;
 
-import butterknife.BindArray;
 import butterknife.BindView;
+import butterknife.ButterKnife;
 import butterknife.OnCheckedChanged;
 import butterknife.OnClick;
 import butterknife.OnItemSelected;
 
+/**
+ * 隐患上报
+ */
 public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter> implements ReportContract.View {
     @BindView(R.id.toolbar_layout)
     CollapsingToolbarLayout collapsingToolbarLayout;
@@ -94,6 +92,10 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
     EditText editSuggest;
     @BindView(R.id.photo_gallery)
     LinearLayout fileGallery;
+    @BindView(R.id.layout_trouble_name)
+    LinearLayout layoutTroubleName;
+    @BindView(R.id.spinner_trouble_level)
+    AppCompatSpinner spinnerTroubleLevel; //隐患等级
 
     private String mDateVerify = "";
 
@@ -105,6 +107,8 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
 
     private List<TroubleTypeBean> mTroubleTypes = null;
 
+    private List<TroubleLevelBean.ResultDTO.RecordsDTO> mTroubleLevels = null;
+
     private List<JSFieldBean> mTroubleParts = null;
 
 /*    private List<DepartmentBean> mDepartUsers = null;
@@ -127,13 +131,14 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
 
     private int indexDepart = -1;
 
-    private int indexUser = - 1;
+    private int indexUser = -1;
 
-    private int indexBuildId = - 1;
+    private int indexBuildId = -1;
 
     private boolean isInBuild = false;
 
     private TroubleBean mTroubleBean;
+    private int indexTroubleLevel = -1;
 
     @Override
     protected ReportPresenter createPresenter() {
@@ -177,9 +182,10 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
         mPresenter.getTroubleType(this);
         mPresenter.getTroublePart(this);
         mPresenter.getSpecGroupUserMap(this);
+        mPresenter.getTroubleLevel(this);//获取隐患等级
     }
 
-    private void  initListener() {
+    private void initListener() {
         amapLocationHelper.setMapLocationListener((location, addr, projLoc) -> {
             mTappedCoordinate = new LocationUtil_xu.CoordinateClass(projLoc.getX(), projLoc.getY(), addr);
             editReportAddr.setText(addr);
@@ -214,8 +220,8 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
         }
     }
 
-    @OnItemSelected({R.id.spinner_trouble_part, R.id.spinner_trouble_reason, R.id.spinner_build, R.id.spinner_depart, R.id.spinner_user})
-    public void onItemSelected(AdapterView<?> parent, int position){
+    @OnItemSelected({R.id.spinner_trouble_part, R.id.spinner_trouble_reason, R.id.spinner_trouble_level, R.id.spinner_build, R.id.spinner_depart, R.id.spinner_user})
+    public void onItemSelected(AdapterView<?> parent, int position) {
         switch (parent.getId()) {
             case R.id.spinner_trouble_part: {
                 indexTroublePart = position;
@@ -225,6 +231,11 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
                 indexTroubleType = position;
             }
             break;
+
+            case R.id.spinner_trouble_level: {
+                indexTroubleLevel = position;
+            }
+            break;
             case R.id.spinner_build: {
                 indexBuildId = position;
             }
@@ -243,7 +254,7 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
     }
 
     @OnCheckedChanged({R.id.radio_btn_build_sure, R.id.radio_btn_build_no})
-    public void onRadioCheck(CompoundButton view, boolean ischanged){
+    public void onRadioCheck(CompoundButton view, boolean ischanged) {
         switch (view.getId()) {
             case R.id.radio_btn_build_sure:
                 if (ischanged) {
@@ -302,6 +313,10 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
             onError(getString(R.string.trouble_report_empty_trotype));
             return false;
         }
+//        if (mTroubleLevels == null || mTroubleLevels.isEmpty() || indexTroubleLevel == -1) {
+//            onError(getString(R.string.trouble_report_empty_tro_level));
+//            return false;
+//        }
 
         if (editTroubleName.getText().toString().isEmpty()) {
             editTroubleName.requestFocus();
@@ -368,6 +383,13 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
         /*隐患原因*/
         TroubleTypeBean troubleType = mTroubleTypes.get(indexTroubleType);
         mTroubleBean.setTypeId(troubleType.getId());
+
+
+        /*隐患等级*/
+//        TroubleLevelBean.ResultDTO.RecordsDTO recordsDTO = mTroubleLevels.get(indexTroubleLevel);
+//        mTroubleBean.setToubleRangeName(recordsDTO.getName());
+//        mTroubleBean.setToubleRangeId(recordsDTO.getId()+"");
+
         /*隐患片区*/
         if (mRegionAttrs != null && indexTroubleRegion != -1) {
             RegionAttributeBean attributeBean = mRegionAttrs.get(indexTroubleRegion);
@@ -418,7 +440,9 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
     }
 
 
-    /** Presenter处理回调 */
+    /**
+     * Presenter处理回调
+     */
     @Override
     public void onGetRegions(List<RegionAttributeBean> regions) {
         List<String> regionNames = new ArrayList<>();
@@ -455,7 +479,7 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
         if (index >= 0) {
             indexTroubleRegion = index;
             spinnerTroubleRegion.setSelection(index);
-        }else {
+        } else {
             onError("当前位置没有对应的片区,请手动选择");
         }
     }
@@ -529,7 +553,7 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
     }
 
     private void setXjz() {
-        if (xjzBeanList != null && xjzBeanList.size()>0) {
+        if (xjzBeanList != null && xjzBeanList.size() > 0) {
             xczId = xjzBeanList.get(indexDepart).getGroupId();
             xjrBeanList = xjzBeanList.get(indexDepart).getUser();
             if (xjrBeanList != null && xjrBeanList.size() > 0) {
@@ -571,6 +595,32 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
         showUploadFinishedDialog();
     }
 
+    /**
+     * 获取隐患等级成功回调
+     *
+     * @param resultDTOList
+     */
+    @Override
+    public void onGetTroubleLevel(TroubleLevelBean.ResultDTO resultDTOList) {
+
+
+        Log.e("TAG", "onGetTroubleLevel: ----获取隐患等级成功回调----" + resultDTOList.toString());
+        List<String> typeNames = new ArrayList<>();
+        List<TroubleLevelBean.ResultDTO.RecordsDTO> records = resultDTOList.getRecords();
+
+        Log.e("TAG", "onGetTroubleLevel: ----获取隐患等级成功回调----" + records.size());
+        for (TroubleLevelBean.ResultDTO.RecordsDTO troubleType : records) {
+            typeNames.add(troubleType.getName());
+        }
+        ArrayAdapter<String> adapterReason = new ArrayAdapter<>(this,
+                R.layout.my_simple_spinner_item, typeNames);
+        adapterReason.setDropDownViewResource(R.layout.dropdown_spinner_single_item);
+        spinnerTroubleLevel.setAdapter(adapterReason);
+
+        mTroubleLevels = records;
+
+    }
+
     private void showUploadFinishedDialog() {
         int title = R.string.trouble_report_title;
         int msg = R.string.trouble_report_upload_ok;
@@ -600,4 +650,11 @@ public class UiTroubleReport extends BaseFileActivity<ReportContract.Presenter>
             amapLocationHelper.onDestroy();
         }
     }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        // TODO: add setContentView(...) invocation
+        ButterKnife.bind(this);
+    }
 }

+ 7 - 0
app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/contract/ReportContract.java

@@ -8,6 +8,7 @@ import com.tofly.latte_core.base.IPresenter;
 import com.tofly.route.bean.XjzBean;
 import com.tofly.route.bean.builds.BuildEntity;
 import com.tofly.route.module.das.data.JSFieldBean;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.map.data.RegionAttributeBean;
 import com.tofly.route.module.trouble.data.TroubleBean;
 import com.tofly.route.module.trouble.data.TroubleFileBean;
@@ -38,6 +39,9 @@ public class ReportContract {
 
         /*隐患数据上传返回*/
         void onUploadTrouble();
+
+        /*获取隐患等级返回*/
+        void onGetTroubleLevel(TroubleLevelBean.ResultDTO resultDTOList);
     }
 
     public interface Presenter extends IPresenter<View> {
@@ -50,6 +54,9 @@ public class ReportContract {
         /*获取隐患类型*/
         void getTroubleType(Context context);
 
+        /*获取隐患类型*/
+        void getTroubleLevel(Context context);
+
         /*获取隐患部位*/
         void getTroublePart(Context context);
 

+ 34 - 0
app/src/main/java/com/tofly/route/module/trouble/ui/troubleReport/contract/ReportPresenter.java

@@ -9,6 +9,7 @@ import com.tofly.route.bean.XjzBean;
 import com.tofly.route.bean.builds.BuildEntity;
 import com.tofly.route.module.das.data.AssetBean;
 import com.tofly.route.module.das.data.JSFieldBean;
+import com.tofly.route.module.das.data.TroubleLevelBean;
 import com.tofly.route.module.das.data.source.DasCallback;
 import com.tofly.route.module.das.data.source.DasRepository;
 import com.tofly.route.module.das.data.source.local.DasLocalSource;
@@ -18,10 +19,12 @@ import com.tofly.route.module.map.data.RegionAttributeBean;
 import com.tofly.route.module.map.data.pipeAnalyze.PipeDetailQueryBean;
 import com.tofly.route.module.map.interfaces.MapServiceCallback;
 import com.tofly.route.module.trouble.data.TroubleBean;
+import com.tofly.route.module.trouble.data.TroubleDetailBean;
 import com.tofly.route.module.trouble.data.TroubleFileBean;
 import com.tofly.route.module.trouble.data.TroubleTypeBean;
 import com.tofly.route.module.trouble.data.source.TroubleCallback;
 import com.tofly.route.module.trouble.data.source.TroubleRepository;
+import com.tofly.route.module.trouble.data.source.TroubleSource;
 import com.tofly.route.module.trouble.data.source.local.TroubleLocalSource;
 import com.tofly.route.module.trouble.data.source.remote.TroubleRemoteSource;
 import com.tofly.route.module.user.data.source.UserCallback;
@@ -109,6 +112,37 @@ public class ReportPresenter extends BasePresenter<ReportContract.View> implemen
         }
     }
 
+    /**
+     * 获取隐患等级
+     * @param context
+     */
+    @Override
+    public void getTroubleLevel(Context context) {
+
+        if (isViewAttached()) {
+            getView().showLoading(context.getString(R.string.trouble_part_getting));
+
+            troubleRepository.getTroubleLevel(new TroubleCallback(){
+                @Override
+                public void onTroubleLevel(TroubleLevelBean.ResultDTO levelBean) {
+                  //  super.onTroubleLevel(levelBean);
+                    getView().hideLoading();
+                    getView().onGetTroubleLevel(levelBean);
+
+                }
+
+                @Override
+                public void onError(String errMsg) {
+                    //super.onError(errMsg);
+                    getView().hideLoading();
+                    getView().onError(errMsg);
+                }
+            });
+        }
+
+
+    }
+
     @Override
     public void getTroublePart(Context context) {
         if (isViewAttached()) {

+ 0 - 1
app/src/main/java/com/tofly/route/ui/activity/UiMapTool.java

@@ -446,7 +446,6 @@ public class UiMapTool extends BaseDelegate<MapPresenter> implements MapLoadHelp
             ArcGISMap arcMap = mapView.getMap();
             arcMap.getOperationalLayers().add(layer);
             analysisIndexList.add(layer);
-            setPipeAnalyzeCallback();
             if (resultBean != null) {
                 pipeAnalyzeResultBottomSheet.updateData(resultBean, statusBean, layer);
                 setPipeAnalyzeResultMapExtent(resultBean);

+ 164 - 118
app/src/main/res/layout/ui_trouble_report.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/bg"
@@ -12,18 +12,18 @@
     <com.google.android.material.appbar.AppBarLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:fitsSystemWindows="true"
         android:background="@color/white"
+        android:fitsSystemWindows="true"
         android:theme="@style/MyAppTheme.Light.AppBarOverlay">
 
         <com.google.android.material.appbar.CollapsingToolbarLayout
             android:id="@+id/toolbar_layout"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            app:titleEnabled="false"
             android:fitsSystemWindows="true"
+            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
             app:statusBarScrim="@android:color/transparent"
-            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
+            app:titleEnabled="false">
 
             <!-- 标题栏 -->
             <androidx.appcompat.widget.Toolbar
@@ -38,8 +38,8 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:padding="6dp"
         android:orientation="vertical"
+        android:padding="6dp"
         app:layout_behavior="@string/appbar_scrolling_view_behavior">
 
         <androidx.cardview.widget.CardView
@@ -60,6 +60,7 @@
                     android:padding="10dp">
 
                     <LinearLayout style="@style/ReportDetail.Section.LinearLayout">
+
                         <TextView
                             style="@style/ReportDetail.Header.Text"
                             android:text="位置信息" />
@@ -76,29 +77,29 @@
                                     style="@style/ReportDetail.Header.Text"
                                     android:layout_width="wrap_content"
                                     android:text="地址"
-                                    android:textColor="@color/black"/>
+                                    android:textColor="@color/black" />
 
                                 <Space
                                     android:layout_width="0dp"
-                                    android:layout_weight="1"
-                                    android:layout_height="wrap_content"/>
+                                    android:layout_height="wrap_content"
+                                    android:layout_weight="1" />
 
                                 <LinearLayout
                                     android:id="@+id/layout_select_addr"
                                     android:layout_width="wrap_content"
                                     android:layout_height="wrap_content"
-                                    android:gravity="center_vertical"
                                     android:foreground="?android:selectableItemBackground"
-                                    android:stateListAnimator="@anim/anim_touch_raise" >
+                                    android:gravity="center_vertical"
+                                    android:stateListAnimator="@anim/anim_touch_raise">
 
                                     <TextView
                                         android:id="@+id/text_select_addr"
-                                        android:text="指定地点"
-                                        android:textSize="14sp"
-                                        android:textColor="@color/black"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
-                                        android:layout_marginLeft="5dp" />
+                                        android:layout_marginLeft="5dp"
+                                        android:text="指定地点"
+                                        android:textColor="@color/black"
+                                        android:textSize="14sp" />
 
                                     <ImageView
                                         android:layout_width="18dp"
@@ -110,6 +111,7 @@
                             <LinearLayout
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content">
+
                                 <ImageView
                                     android:layout_width="18dp"
                                     android:layout_height="18dp"
@@ -118,17 +120,18 @@
 
                                 <EditText
                                     android:id="@+id/edit_report_addr"
-                                    android:hint="@string/trouble_report_addr_hint"
                                     style="@style/DangerReport.Content.EditText"
-                                    android:layout_height="wrap_content" />
+                                    android:layout_height="wrap_content"
+                                    android:hint="@string/trouble_report_addr_hint" />
                             </LinearLayout>
+
                             <View style="@style/ReportDetail.Line.Bottom" />
                         </LinearLayout>
 
                         <LinearLayout
                             style="@style/ReportDetail.Info.LinearLayout"
-                            android:paddingLeft="6dp"
-                            android:layout_marginTop="0dp">
+                            android:layout_marginTop="0dp"
+                            android:paddingLeft="6dp">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -137,20 +140,23 @@
                             <LinearLayout
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:gravity="center"
-                                android:background="@color/white">
+                                android:background="@color/white"
+                                android:gravity="center">
+
                                 <androidx.appcompat.widget.AppCompatSpinner
                                     android:id="@+id/spinner_trouble_region"
                                     style="@style/DangerReport.Content.Spinner"
-                                    android:paddingLeft="0dp"
                                     android:layout_height="26dp"
-                                    android:prompt="@string/trouble_region_select_prompt_hint"/>
+                                    android:paddingLeft="0dp"
+                                    android:prompt="@string/trouble_region_select_prompt_hint" />
                             </LinearLayout>
                         </LinearLayout>
                     </LinearLayout>
 
-                    <LinearLayout style="@style/ReportDetail.Section.LinearLayout"
+                    <LinearLayout
+                        style="@style/ReportDetail.Section.LinearLayout"
                         android:paddingTop="0dp">
+
                         <TextView
                             style="@style/ReportDetail.Header.Text"
                             android:text="数据信息" />
@@ -158,8 +164,8 @@
                         <LinearLayout
                             android:id="@+id/layout_trouble_name"
                             style="@style/ReportDetail.Info.LinearLayout"
-                            android:paddingLeft="6dp"
-                            android:gravity="bottom">
+                            android:gravity="bottom"
+                            android:paddingLeft="6dp">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -169,9 +175,10 @@
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
                                 android:orientation="vertical">
+
                                 <EditText
                                     android:id="@+id/edit_trouble_name"
-                                    style="@style/PointRepair.Content.EditText"/>
+                                    style="@style/PointRepair.Content.EditText" />
 
                                 <View style="@style/ReportDetail.Line.Bottom" />
                             </LinearLayout>
@@ -179,8 +186,8 @@
 
                         <LinearLayout
                             style="@style/ReportDetail.Info.LinearLayout"
-                            android:paddingLeft="6dp"
-                            android:gravity="center_vertical">
+                            android:gravity="center_vertical"
+                            android:paddingLeft="6dp">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -189,21 +196,22 @@
                             <LinearLayout
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:gravity="center"
-                                android:background="@color/white">
+                                android:background="@color/white"
+                                android:gravity="center">
+
                                 <androidx.appcompat.widget.AppCompatSpinner
                                     android:id="@+id/spinner_trouble_part"
                                     style="@style/DangerReport.Content.Spinner"
-                                    android:paddingLeft="0dp"
                                     android:layout_height="26dp"
-                                    android:prompt="@string/trouble_part_select_prompt_hint"/>
+                                    android:paddingLeft="0dp"
+                                    android:prompt="@string/trouble_part_select_prompt_hint" />
                             </LinearLayout>
                         </LinearLayout>
 
                         <LinearLayout
                             style="@style/ReportDetail.Info.LinearLayout"
-                            android:paddingLeft="6dp"
-                            android:gravity="center_vertical">
+                            android:gravity="center_vertical"
+                            android:paddingLeft="6dp">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -212,14 +220,42 @@
                             <LinearLayout
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:gravity="center"
-                                android:background="@color/white">
+                                android:background="@color/white"
+                                android:gravity="center">
+
                                 <androidx.appcompat.widget.AppCompatSpinner
                                     android:id="@+id/spinner_trouble_reason"
                                     style="@style/DangerReport.Content.Spinner"
+                                    android:layout_height="26dp"
                                     android:paddingLeft="0dp"
+                                    android:prompt="@string/trouble_type_select_prompt_hint" />
+                            </LinearLayout>
+                        </LinearLayout>
+
+
+
+                        <LinearLayout
+                            android:visibility="gone"
+                            style="@style/ReportDetail.Info.LinearLayout"
+                            android:gravity="center_vertical"
+                            android:paddingLeft="6dp">
+
+                            <TextView
+                                style="@style/ReportDetail.Info.Title"
+                                android:text="隐患等级:" />
+
+                            <LinearLayout
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:background="@color/white"
+                                android:gravity="center">
+
+                                <androidx.appcompat.widget.AppCompatSpinner
+                                    android:id="@+id/spinner_trouble_level"
+                                    style="@style/DangerReport.Content.Spinner"
                                     android:layout_height="26dp"
-                                    android:prompt="@string/trouble_type_select_prompt_hint"/>
+                                    android:paddingLeft="0dp"
+                                    android:prompt="@string/trouble_type_select_prompt_hint_level" />
                             </LinearLayout>
                         </LinearLayout>
 
@@ -229,107 +265,114 @@
                             android:paddingBottom="0dp">
 
                             <TextView
-                                android:paddingLeft="6dp"
                                 style="@style/ReportDetail.Header.Text"
-                                android:textColor="@color/black"
-                                android:text="隐患原因备注:" />
+                                android:paddingLeft="6dp"
+                                android:text="隐患原因备注:"
+                                android:textColor="@color/black" />
 
                             <EditText
                                 android:id="@+id/edit_trouble_reason_note"
                                 style="@style/DangerReport.Content.EditText"
                                 android:layout_height="0dp"
                                 android:layout_weight="1"
-                                android:hint="@string/trouble_report_empty_reason"/>
+                                android:hint="@string/trouble_report_empty_reason" />
 
                             <View style="@style/ReportDetail.Line.Bottom" />
                         </LinearLayout>
 
-                        <LinearLayout style="@style/ReportDetail.Section.LinearLayout"
+                        <LinearLayout
+                            style="@style/ReportDetail.Section.LinearLayout"
                             android:paddingBottom="0dp">
+
                             <TextView
                                 style="@style/ReportDetail.Header.Text"
                                 android:paddingLeft="6dp"
                                 android:text="消除隐患建议:"
-                                android:textColor="@color/black"/>
+                                android:textColor="@color/black" />
 
                             <EditText
                                 android:id="@+id/edit_report_suggest"
-                                android:hint="@string/trouble_report_empty_suggest"
                                 style="@style/DangerReport.Content.EditText"
                                 android:layout_height="0dp"
-                                android:layout_weight="1"/>
+                                android:layout_weight="1"
+                                android:hint="@string/trouble_report_empty_suggest" />
+
                             <View style="@style/ReportDetail.Line.Bottom" />
                         </LinearLayout>
                     </LinearLayout>
 
-                     <LinearLayout style="@style/ReportDetail.Section.LinearLayout"
+                    <LinearLayout
+                        style="@style/ReportDetail.Section.LinearLayout"
                         android:paddingTop="0dp">
+
                         <TextView
                             style="@style/ReportDetail.Header.Text"
                             android:text="审核人员" />
 
-                         <LinearLayout
-                             style="@style/ReportDetail.Section.LinearLayout"
-                             android:visibility="visible">
-
-                             <LinearLayout
-                                 android:layout_width="wrap_content"
-                                 android:layout_height="wrap_content"
-                                 android:layout_marginLeft="10dp"
-                                 android:gravity="center">
-
-                                 <LinearLayout
-                                     android:layout_width="200dp"
-                                     android:layout_height="wrap_content"
-                                     android:layout_marginRight="5dp"
-                                     android:layout_weight="1"
-                                     android:background="@color/white"
-                                     android:gravity="center"
-                                     android:padding="2dp">
-
-                                     <androidx.appcompat.widget.AppCompatSpinner
-                                         android:id="@+id/spinner_depart"
-                                         style="@style/DangerReport.Content.Spinner"
-                                         android:layout_height="26dp"
-                                         android:prompt="@string/depart_spinner_prompt" />
-                                 </LinearLayout>
-
-                                 <TextView
-                                     android:layout_width="wrap_content"
-                                     android:layout_height="wrap_content"
-                                     android:text="~"
-                                     android:textColor="@color/black"
-                                     android:textStyle="bold" />
-
-                                 <LinearLayout
-                                     android:layout_width="200dp"
-                                     android:layout_height="wrap_content"
-                                     android:layout_marginLeft="5dp"
-                                     android:layout_weight="1"
-                                     android:background="@color/white"
-                                     android:gravity="center"
-                                     android:padding="2dp">
-
-                                     <androidx.appcompat.widget.AppCompatSpinner
-                                         android:id="@+id/spinner_user"
-                                         style="@style/DangerReport.Content.Spinner"
-                                         android:layout_height="26dp"
-                                         android:prompt="@string/user_spinner_prompt" />
-                                 </LinearLayout>
-                             </LinearLayout>
-                         </LinearLayout>
-                     </LinearLayout>
-
-                    <LinearLayout style="@style/ReportDetail.Section.LinearLayout"
+                        <LinearLayout
+                            style="@style/ReportDetail.Section.LinearLayout"
+                            android:visibility="visible">
+
+                            <LinearLayout
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginLeft="10dp"
+                                android:gravity="center">
+
+                                <LinearLayout
+                                    android:layout_width="200dp"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginRight="5dp"
+                                    android:layout_weight="1"
+                                    android:background="@color/white"
+                                    android:gravity="center"
+                                    android:padding="2dp">
+
+                                    <androidx.appcompat.widget.AppCompatSpinner
+                                        android:id="@+id/spinner_depart"
+                                        style="@style/DangerReport.Content.Spinner"
+                                        android:layout_height="26dp"
+                                        android:prompt="@string/depart_spinner_prompt" />
+                                </LinearLayout>
+
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="~"
+                                    android:textColor="@color/black"
+                                    android:textStyle="bold" />
+
+                                <LinearLayout
+                                    android:layout_width="200dp"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginLeft="5dp"
+                                    android:layout_weight="1"
+                                    android:background="@color/white"
+                                    android:gravity="center"
+                                    android:padding="2dp">
+
+                                    <androidx.appcompat.widget.AppCompatSpinner
+                                        android:id="@+id/spinner_user"
+                                        style="@style/DangerReport.Content.Spinner"
+                                        android:layout_height="26dp"
+                                        android:prompt="@string/user_spinner_prompt" />
+                                </LinearLayout>
+                            </LinearLayout>
+                        </LinearLayout>
+                    </LinearLayout>
+
+                    <LinearLayout
+                        style="@style/ReportDetail.Section.LinearLayout"
                         android:paddingTop="0dp">
+
                         <TextView
                             style="@style/ReportDetail.Header.Text"
                             android:text="施工信息" />
 
                         <LinearLayout
                             style="@style/ReportDetail.Info.LinearLayout"
-                            android:paddingLeft="6dp"
-                            android:gravity="center">
+                            android:gravity="center"
+                            android:paddingLeft="6dp">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -357,18 +400,18 @@
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_marginStart="10dp"
-                                        android:text="否"
-                                        android:checked="true"/>
+                                        android:checked="true"
+                                        android:text="否" />
                                 </RadioGroup>
                             </LinearLayout>
                         </LinearLayout>
 
                         <LinearLayout
-                            android:visibility="gone"
                             android:id="@+id/layout_select_build"
                             style="@style/ReportDetail.Info.LinearLayout"
+                            android:gravity="center_vertical"
                             android:paddingLeft="6dp"
-                            android:gravity="center_vertical">
+                            android:visibility="gone">
 
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
@@ -377,32 +420,35 @@
                             <LinearLayout
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:gravity="center"
-                                android:background="@color/white">
+                                android:background="@color/white"
+                                android:gravity="center">
+
                                 <androidx.appcompat.widget.AppCompatSpinner
                                     android:id="@+id/spinner_build"
                                     style="@style/DangerReport.Content.Spinner"
-                                    android:paddingLeft="0dp"
                                     android:layout_height="26dp"
-                                    android:prompt="@string/build_select_prompt_hint"/>
+                                    android:paddingLeft="0dp"
+                                    android:prompt="@string/build_select_prompt_hint" />
                             </LinearLayout>
                         </LinearLayout>
                     </LinearLayout>
 
-                    <LinearLayout
-                        style="@style/ReportDetail.Section.LinearLayout">
+                    <LinearLayout style="@style/ReportDetail.Section.LinearLayout">
+
                         <TextView
                             android:id="@+id/text_add_photo"
                             style="@style/ReportDetail.Header.Text"
                             android:layout_width="wrap_content"
                             android:layout_centerVertical="true"
-                            android:text="附件上传"/>
+                            android:text="附件上传" />
+
                         <LinearLayout
                             android:id="@+id/layout_btn_add"
                             android:layout_width="match_parent"
                             android:layout_height="36dp"
                             android:gravity="center_vertical"
                             android:paddingLeft="6dp">
+
                             <TextView
                                 style="@style/ReportDetail.Info.Title"
                                 android:layout_width="wrap_content"
@@ -414,8 +460,8 @@
                                 android:layout_height="24dp"
                                 android:layout_centerVertical="true"
                                 android:layout_marginLeft="6dp"
-                                android:background="@mipmap/btn_add_file"
                                 android:layout_toRightOf="@id/text_add_photo"
+                                android:background="@mipmap/btn_add_file"
                                 android:textColor="@color/white" />
                         </LinearLayout>
 
@@ -423,11 +469,11 @@
                             android:id="@+id/layout_addpic_area"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:paddingLeft="10dp"
-                            android:paddingRight="10dp"
                             android:layout_gravity="center_vertical"
                             android:background="@color/white"
-                            android:orientation="vertical">
+                            android:orientation="vertical"
+                            android:paddingLeft="10dp"
+                            android:paddingRight="10dp">
 
                             <View
                                 android:layout_width="match_parent"
@@ -437,8 +483,8 @@
                             <HorizontalScrollView
                                 android:layout_width="match_parent"
                                 android:layout_height="100dp"
-                                android:layout_marginBottom="5dp"
-                                android:layout_marginTop="5dp">
+                                android:layout_marginTop="5dp"
+                                android:layout_marginBottom="5dp">
 
                                 <LinearLayout
                                     android:id="@+id/photo_gallery"

+ 2 - 0
app/src/main/res/values/custom_strings.xml

@@ -307,6 +307,7 @@
     <string name="trouble_report_empty_suggest">请输入消除隐患建议的说明</string>
     <string name="trouble_report_empty_addr">请输入地址信息</string>
     <string name="trouble_report_empty_trotype">请选择隐患原因</string>
+    <string name="trouble_report_empty_tro_level">请选择隐患等级</string>
     <string name="trouble_report_empty_user">请选择审核人员</string>
     <string name="trouble_report_empty_build">请选择工地</string>
     <string name="trouble_report_empty_depart">请选择指定的部门</string>
@@ -318,6 +319,7 @@
     <string name="trouble_report_trolevel_spinner_prompt">请选择隐患风险等级</string>
     <string name="trouble_report_trotype_spinner_prompt">请选择隐患类型</string>
     <string name="trouble_type_select_prompt_hint">选择隐患原因</string>
+    <string name="trouble_type_select_prompt_hint_level">选择隐患等级</string>
     <string name="trouble_part_select_prompt_hint">选择隐患部位</string>
     <string name="trouble_region_select_prompt_hint">选择隐患所在片区</string>
     <string name="build_select_prompt_hint">选择工地</string>

+ 1 - 1
build.gradle

@@ -7,7 +7,7 @@ buildscript {
         mavenCentral() // add repository
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.5.1'
+        classpath "com.android.tools.build:gradle:4.0.0"
         classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' // add plugin
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files

+ 1 - 1
gradle.properties

@@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1536m
 android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
-
+android.injected.testOnly=false
 COMPILE_SDK_VERSION=29
 BUILD_TOOLS_VERSION=29.0.3
 MIN_SDK_VERSION=21

+ 2 - 2
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Fri Oct 09 18:49:07 PDT 2020
+#Thu Jul 22 16:30:57 CST 2021
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

+ 0 - 1
latte-core/src/main/java/com/tofly/latte_core/net/base/NetWorkApi.java

@@ -3,7 +3,6 @@ package com.tofly.latte_core.net.base;
 import com.tofly.latte_core.config.ConfigKeys;
 import com.tofly.latte_core.config.Constants;
 import com.tofly.latte_core.config.Latte;
-import com.tofly.latte_core.net.interceptor.CommonRequestInterceptor;
 import com.tofly.latte_core.net.interceptor.CommonResponseInterceptor;
 
 import java.util.LinkedHashMap;

+ 3 - 0
latte-core/src/main/java/com/tofly/latte_core/net/interceptor/CommonRequestInterceptor.java

@@ -1,6 +1,7 @@
 package com.tofly.latte_core.net.interceptor;
 
 import com.tofly.latte_core.utils.LattePreference;
+import com.tofly.latte_core.utils.LogUtils;
 
 import java.io.IOException;
 
@@ -24,6 +25,8 @@ public class CommonRequestInterceptor implements Interceptor {
 //        builder.addHeader("appVersion", Latte.getConfiguration(ConfigKeys.INTERCEPTOR.name()));
         builder.addHeader("Source", "source");
         builder.addHeader("Authorization", "bearer " + LattePreference.getString("token"));
+
+        LogUtils.e("token","bearer " + LattePreference.getString("token"));
         return chain.proceed(builder.build());
     }
 }

+ 125 - 0
latte-core/src/main/java/com/tofly/latte_core/utils/NetworkStatus.java

@@ -0,0 +1,125 @@
+/**
+ * 文件名:NetStatus.java
+ * 描述:网络连接状态
+ * 包名:cn.com.kmlt.monstarBase.utils.net
+ * 作者:WENJQ
+ * 创建日期:20160526
+ */
+package com.tofly.latte_core.utils;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Build;
+import android.util.Log;
+
+import androidx.annotation.RequiresApi;
+
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+
+import static android.content.Context.CONNECTIVITY_SERVICE;
+
+/**
+ * 类名:NetworkStatus
+ * 描述:判断网络是否连接
+ */
+public class NetworkStatus {
+
+
+    /**
+     * 方法名: isNetworkConnected
+     * 功能:判断网络是否连接,当登陆模式为离线时候,自动返回false
+     * 参数:
+     * 返回值: 是否联网操作
+     * 异常:
+     */
+    public static boolean isNetworkConnected(Context context) {
+        if (context != null) {
+            ConnectivityManager mConnectivityManager = (ConnectivityManager) context
+                    .getSystemService(CONNECTIVITY_SERVICE);
+            NetworkInfo mNetworkInfo = mConnectivityManager
+                    .getActiveNetworkInfo();
+            if (mNetworkInfo != null) {
+                return mNetworkInfo.isAvailable();
+            }
+        }
+        return false;
+    }
+
+    private static ConnectivityManager mConnectivityManager = null;
+    private NetworkInfo mActiveNetInfo = null;
+
+    @RequiresApi(api = Build.VERSION_CODES.M)
+    public static String getIP(Context context) {
+
+        String ip = "";
+
+        mConnectivityManager = (ConnectivityManager)context.getSystemService(CONNECTIVITY_SERVICE);//获取系统的连接服务
+        if (isInternetReachable()) {
+
+            NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
+            if (info != null && info.isConnected()) {
+                if ((info.getType() == ConnectivityManager.TYPE_MOBILE) || (info.getType() == ConnectivityManager.TYPE_WIFI)) {//当前使用2G/3G/4G网络
+                    try {
+                        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
+                            NetworkInterface intf = en.nextElement();
+                            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
+                                InetAddress inetAddress = enumIpAddr.nextElement();
+                                if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) {
+                                    return inetAddress.getHostAddress();
+                                }
+                            }
+                        }
+                    } catch (SocketException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+
+
+        return ip;
+    }
+
+
+    /**
+     * @return
+     * @category 判断是否有外网连接(普通方法不能判断外网的网络是否连接,比如连接上局域网)
+     */
+    public static final boolean isInternetReachable() {
+        String result = null;
+        try {
+            String ip = "www.baidu.com";// ping 的地址,可以换成任何一种可靠的外网
+            Process p = Runtime.getRuntime().exec("ping -c 3 -w 100 " + ip);// ping网址3次
+            // 读取ping的内容,可以不加
+/*			InputStream input = p.getInputStream();
+			BufferedReader in = new BufferedReader(new InputStreamReader(input));
+			StringBuffer stringBuffer = new StringBuffer();
+			String content;
+			while ((content = in.readLine()) != null) {
+				stringBuffer.append(content);
+			}
+			Log.d("------ping-----", "result content : " + stringBuffer.toString());*/
+            // ping的状态
+            int status = p.waitFor();
+            if (status == 0) {
+                result = "success";
+                return true;
+            } else {
+                result = "failed";
+            }
+        } catch (IOException e) {
+            result = "IOException";
+        } catch (InterruptedException e) {
+            result = "InterruptedException";
+        } finally {
+            Log.d("----result---", "result = " + result);
+        }
+        return false;
+    }
+}