瀏覽代碼

点位添加,修改

DESKTOP-SADJPBG\47462 5 年之前
父節點
當前提交
19ce1f09f7

二進制
.idea/caches/build_file_checksums.ser


二進制
.idea/caches/gradle_models.ser


+ 3 - 0
app/src/main/AndroidManifest.xml

xqd
@@ -88,6 +88,9 @@
         <activity
             android:name=".ui.activity.QuestionTypeActivity"
             android:screenOrientation="portrait"></activity>
+        <activity
+            android:name=".ui.activity.InfoUploadActivity"
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".ui.activity.MyTaskActivity"
             android:screenOrientation="portrait"></activity>

+ 36 - 0
app/src/main/java/com/zhilin/patrol/bean/AddressAreaEntity.java

xqd xqd
@@ -16,6 +16,38 @@ public class AddressAreaEntity extends BaseEntity<List<AddressAreaEntity.InfoLis
         /** 巡点与上传者之间的距离 */
         private String distance;
 
+        public String getStreet() {
+            return street;
+        }
+
+        public void setStreet(String street) {
+            this.street = street;
+        }
+
+        /*街道*/
+        private String street;
+
+        public String getArea() {
+            return area;
+        }
+
+        public void setArea(String area) {
+            this.area = area;
+        }
+
+        public String getDisName() {
+            return disName;
+        }
+
+        public void setDisName(String disName) {
+            this.disName = disName;
+        }
+
+        /*社区*/
+        private String area;
+        /*区*/
+        private String disName;
+
         private boolean isSelected;
 
         public boolean isSelected() {
@@ -49,6 +81,10 @@ public class AddressAreaEntity extends BaseEntity<List<AddressAreaEntity.InfoLis
         public void setDistance(String distance) {
             this.distance = distance;
         }
+
+        public String toStingTv(){
+            return "原地址:"+disName+street+area+"·"+address;
+        }
     }
 
 

+ 3 - 0
app/src/main/java/com/zhilin/patrol/bean/MapLocationInfo.java

xqd
@@ -139,4 +139,7 @@ public class MapLocationInfo implements Serializable {
                 ", longitude=" + longitude +
                 '}';
     }
+    public String toStringTv(){
+        return address;
+    }
 }

+ 38 - 0
app/src/main/java/com/zhilin/patrol/bean/PointFormEntity.java

xqd
@@ -0,0 +1,38 @@
+package com.zhilin.patrol.bean;
+
+public class PointFormEntity {
+    /**
+     * 返回code
+     */
+    private String returnCode;
+    /**
+     * 返回信息
+     */
+    private String returnMsg;
+
+    public String getReturnCode() {
+        return returnCode;
+    }
+
+    public void setReturnCode(String returnCode) {
+        this.returnCode = returnCode;
+    }
+
+    public String getReturnMsg() {
+        return returnMsg;
+    }
+
+    public void setReturnMsg(String returnMsg) {
+        this.returnMsg = returnMsg;
+    }
+
+    public boolean isInfoList() {
+        return infoList;
+    }
+
+    public void setInfoList(boolean infoList) {
+        this.infoList = infoList;
+    }
+
+    private boolean infoList;
+}

+ 2 - 0
app/src/main/java/com/zhilin/patrol/http/HttpUrl.java

xqd
@@ -45,4 +45,6 @@ public class HttpUrl {
     public static final String RECTIFYIMG_POST = DOMAIN_URL + "rectifyImg";
     /** 图形验证码 */
     public static final String IMAGEPNG_GET = DOMAIN_URL+"getImgPng";
+    /** 添加点位*/
+    public static final String ADDADDRESS_POST=DOMAIN_URL+"addAddress";
 }

+ 76 - 0
app/src/main/java/com/zhilin/patrol/ui/activity/InfoUploadActivity.java

xqd
@@ -0,0 +1,76 @@
+package com.zhilin.patrol.ui.activity;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.Fragment;
+import android.support.v4.view.ViewPager;
+import android.view.View;
+
+import com.zhilin.patrol.R;
+import com.zhilin.patrol.adapter.FragmentAdapter;
+import com.zhilin.patrol.bean.LoginEntity;
+import com.zhilin.patrol.ui.fragment.PointRecordFragment;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class InfoUploadActivity extends BaseActivity implements View.OnClickListener{
+    @BindView(R.id.tab_layout)
+    TabLayout mTabLayout;
+    @BindView(R.id.view_pager)
+    ViewPager mViewPager;
+    private ArrayList<String> mListTitle;
+    private ArrayList<Fragment> mListFragment;
+    private FragmentAdapter mAdapter;
+    private LoginEntity.InfoListBean.UserInfoBean mUserInfo;
+    private int nNum;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_patrol_record);
+        mUserInfo = (LoginEntity.InfoListBean.UserInfoBean) getIntent().getSerializableExtra("userInfo");
+        nNum=getIntent().getIntExtra("num",0);
+        ButterKnife.bind(this);
+        setTitle("巡查点位问题上报");
+//        request();
+        init();
+    }
+
+    private void init() {
+        mListTitle = new ArrayList<>();
+        mListTitle.add("现有点位修改");
+        mListTitle.add("新增点位");
+
+        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
+
+        mTabLayout.addTab(mTabLayout.newTab().setText(mListTitle.get(0)));
+        mTabLayout.addTab(mTabLayout.newTab().setText(mListTitle.get(1)));
+
+        mListFragment = new ArrayList<>();
+
+        mListFragment.add(PointRecordFragment.newInstance(1));
+        mListFragment.add(PointRecordFragment.newInstance(2));
+
+        mAdapter = new FragmentAdapter(getSupportFragmentManager(), this, mListFragment, mListTitle);
+        //设置适配器
+        mViewPager.setAdapter(mAdapter);
+        mViewPager.setOffscreenPageLimit(2);
+        mTabLayout.setupWithViewPager(mViewPager);
+
+    }
+
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+    }
+
+    @Override
+    public void onClick(View view) {
+
+    }
+}

+ 4 - 1
app/src/main/java/com/zhilin/patrol/ui/activity/MainActivity.java

xqd xqd
@@ -214,7 +214,7 @@ public class MainActivity extends BaseActivity {
 
     @OnClick({ R.id.rl_record, R.id.rl_my_task, R.id.tv_logout,R.id.rl_rectify_task,//,R.id.rl_upload
             R.id.ll_un_complete, R.id.ll_examine, R.id.ll_complete, R.id.rl_task_upload,R.id.ll_un_pass,
-            R.id.rl_sample_task, R.id.rl_overdue_task, R.id.tv_tip})
+            R.id.rl_sample_task, R.id.rl_overdue_task, R.id.tv_tip,R.id.rl_upload_info})
     public void onClick(View v) {
         switch (v.getId()) {
             case R.id.rl_task_upload://巡查上报
@@ -259,6 +259,9 @@ public class MainActivity extends BaseActivity {
             case R.id.rl_rectify_task://整改不通过任务
                 toTaskTypeActivity(infoList.getUnReChangePlanCode(), 7);
                 break;
+            case R.id.rl_upload_info:
+                toActivityNum(InfoUploadActivity.class,mUserInfo,111);
+                break;
             case R.id.tv_logout://注销
                 new AlertDialog(this).builder()
                         .setTitle(getString(R.string.tv_tishi))

+ 1 - 52
app/src/main/java/com/zhilin/patrol/ui/activity/PatrolUploadActivity.java

xqd xqd
@@ -615,57 +615,7 @@ public class PatrolUploadActivity extends BaseActivity implements View.OnClickLi
         Log.i("street==",mapLocationInfo.getStreet());
         Log.i("aoi==",mapLocationInfo.getAoi());
         Log.i("addrCode==",mapLocationInfo.getPoi());
-        if(maddress.equals(address)){//||maddress.equals("fir")
-            /*if(mpCode.equals("fir")){
-                mProgressDialog.showDialog("正在提交...");
-                OkHttpUtils.post()
-                        .url(HttpUrl.PUBLISH_URL)
-                        .addParams("userCode", mUserInfo.getUserCode())
-                        .addParams("userRole", mUserInfo.getUserRole() + "")
-                        .addParams("isAssign", mIsAssign + "")
-                        .addParams("isProblem", hasProblem + "")
-                        .addParams("qCode", questionKind)
-                        .addParams("infoExt", remark)
-                        .addParams("userIP", ipAddress)
-                        .addParams("address", isNull ? "定位失败" : mapLocationInfo.getAddress()+"-"+address)
-                        .addParams("longitude", isNull ? "0" : mapLocationInfo.getLongitude() + "")
-                        .addParams("latitude", isNull ? "0" : mapLocationInfo.getLatitude() + "")
-                        .addParams("disName", isNull ? "" : mapLocationInfo.getDistrict())
-                        .addParams("street", isNull ? "定位失败" : mapLocationInfo.getStreet())
-                        .addParams("aoi", isNull ? "定位失败" : mapLocationInfo.getAoi())
-                        .addParams("poi", isNull ? "定位失败" : mapLocationInfo.getPoi())
-//                        .addParams("pCode",mpCode)
-//                .addParams("cCode",mcCode)
-                        .addParams("addrCode", mListBean == null ? "" : mListBean.getAddrCode())
-                        .build().execute(new Callback<PatrolFormEntity>() {
-                    @Override
-                    public PatrolFormEntity parseNetworkResponse(Response response, int id) throws Exception {
-                        String jsonStr = response.body().string();
-                        return (PatrolFormEntity) JsonUtils.parseJson2Obj(jsonStr, PatrolFormEntity.class);
-                    }
-
-                    @Override
-                    public void onError(Call call, Exception e, int id) {
-                        mProgressDialog.dismiss();
-                        DialogUtil.showNetFailDialog(PatrolUploadActivity.this);
-                    }
-
-                    @Override
-                    public void onResponse(PatrolFormEntity entity, int id) {
-                        if (entity == null) {
-                            DialogUtil.showErrDialog(PatrolUploadActivity.this, "返回信息为空");
-                            return;
-                        }
-                        if (!"1000".endsWith(entity.getReturnCode())) {
-                            DialogUtil.showErrDialog(PatrolUploadActivity.this, entity.getReturnMsg());
-                            return;
-                        }
-                        saveLastData(mapLocationInfo);
-                        PatrolFormEntity.InfoListBean bean = entity.getInfoList();
-                        mTkCode = bean.getTkCode();
-                        postPatrolImage(mTkCode);
-                    }
-                });*/
+        if(maddress.equals(address)){
             if(mpbCode.equals("null")){
                 mProgressDialog.showDialog("正在提交...");
                 OkHttpUtils.post()
@@ -685,7 +635,6 @@ public class PatrolUploadActivity extends BaseActivity implements View.OnClickLi
                         .addParams("aoi", isNull ? "定位失败" : mapLocationInfo.getAoi())
                         .addParams("poi", isNull ? "定位失败" : mapLocationInfo.getPoi())
                         .addParams("pCode", mpCode)
-//                .addParams("cCode",mcCode)
                         .addParams("addrCode", mListBean == null ? "" : mListBean.getAddrCode())
                         .build().execute(new Callback<PatrolFormEntity>() {
                     @Override

+ 2 - 0
app/src/main/java/com/zhilin/patrol/ui/fragment/PatrolRecordFragment.java

xqd xqd
@@ -8,6 +8,7 @@ import android.support.v4.app.FragmentActivity;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -71,6 +72,7 @@ public class PatrolRecordFragment extends Fragment {
         super.onCreate(savedInstanceState);
         Bundle arguments = getArguments();
         mType = arguments.getInt(TYPE);
+        Log.i("aaa","aaa"+mType);
     }
 
     @Nullable

+ 542 - 0
app/src/main/java/com/zhilin/patrol/ui/fragment/PointRecordFragment.java

xqd
@@ -0,0 +1,542 @@
+package com.zhilin.patrol.ui.fragment;
+
+import android.Manifest;
+import android.annotation.TargetApi;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.zhilin.patrol.R;
+import com.zhilin.patrol.bean.AddressAreaEntity;
+import com.zhilin.patrol.bean.LoginEntity;
+import com.zhilin.patrol.bean.MapLocationInfo;
+import com.zhilin.patrol.bean.PatrolFormEntity;
+import com.zhilin.patrol.bean.PointFormEntity;
+import com.zhilin.patrol.bean.QuestionKindEntity;
+import com.zhilin.patrol.http.HttpUrl;
+import com.zhilin.patrol.tool.CheckPermissionUtils;
+import com.zhilin.patrol.tool.DialogUtil;
+import com.zhilin.patrol.tool.IpUtils;
+import com.zhilin.patrol.tool.JsonUtils;
+import com.zhilin.patrol.tool.LocationUtils;
+import com.zhilin.patrol.tool.Utils;
+import com.zhilin.patrol.ui.activity.AddressSelectActivity;
+import com.zhilin.patrol.ui.activity.InfoUploadActivity;
+import com.zhilin.patrol.ui.activity.MainActivity;
+import com.zhilin.patrol.ui.activity.PatrolUploadActivity;
+import com.zhilin.patrol.views.AlertDialog;
+import com.zhilin.patrol.views.CustomProgressDialog;
+import com.zhy.http.okhttp.OkHttpUtils;
+import com.zhy.http.okhttp.callback.Callback;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import okhttp3.Call;
+import okhttp3.Response;
+
+public class PointRecordFragment extends Fragment {
+
+    public static final String TYPE = "type";
+    public String TAG="PointRecordFragment";
+    private int mType;
+    @BindView(R.id.ll_point)
+    LinearLayout mPointLayout;
+    @BindView(R.id.et_content)
+    EditText mRemarkEt;//备注
+    @BindView(R.id.et_district)
+    EditText mDistrictEt;
+    @BindView(R.id.et_stree)
+    EditText mStreeEt;
+    @BindView(R.id.tv_default_community)
+    TextView mDefCommTv;
+    @BindView(R.id.tv_actual_point)
+    TextView mActualTv;
+    @BindView(R.id.et_shequ)
+    EditText mShequEt;
+    @BindView(R.id.et_community)
+    EditText mCummEt;
+    @BindView(R.id.tv_default_address)
+    TextView mAddressTv;
+    @BindView(R.id.tv_content_num)
+    TextView mContentNumTv;//备注长度
+    @BindView(R.id.btn_submit)
+    Button btnSubmit;
+
+    /** 客户文件目录 */
+    private String mImageDir = Environment.getExternalStorageDirectory() + "/patrol/";
+
+    String[] mPermissions = {
+            Manifest.permission.ACCESS_COARSE_LOCATION,
+            Manifest.permission.ACCESS_FINE_LOCATION,
+            Manifest.permission.WRITE_EXTERNAL_STORAGE,
+            Manifest.permission.READ_EXTERNAL_STORAGE,
+            Manifest.permission.CAMERA,
+            Manifest.permission.READ_PHONE_STATE};
+    /** 附近小区集合 */
+    private ArrayList mAddressAreaList;
+    private LocationUtils mLocationUtils;
+    private CustomProgressDialog mProgressDialog;
+    /** 选中的小区 */
+    private AddressAreaEntity.InfoListBean mListBean;
+    /** 定位信息 */
+    private MapLocationInfo mMapLocationInfo;
+    private LoginEntity.InfoListBean.UserInfoBean mUserInfo;
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Bundle arguments = getArguments();
+        mType = arguments.getInt(TYPE);
+        Log.i("111","aaarrra"+mType);
+    }
+    @Nullable
+    @Override
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        View view = inflater.inflate(R.layout.fragment_point_upload, container, false);
+        ButterKnife.bind(this, view);
+        mUserInfo = (LoginEntity.InfoListBean.UserInfoBean) getActivity().getIntent().getSerializableExtra("userInfo");
+        mRemarkEt.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+            }
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+            }
+            @Override
+            public void afterTextChanged(Editable editable) {
+                mContentNumTv.setText(mRemarkEt.getText().length() + "/200");
+            }
+        });
+        mProgressDialog = new CustomProgressDialog(getActivity());
+//        mLocationUtils = LocationUtils.getInstance();
+        mLocationUtils=new LocationUtils();
+        Log.i(TAG,"去定位");
+        mLocationUtils.onCreate(new LocationUtils.LocationListener() {
+            @Override
+            public void locationSuccess(MapLocationInfo mapLocationInfo, String message) {
+                if (TextUtils.isEmpty(mapLocationInfo.getAddress())) {
+
+                } else {
+                    mMapLocationInfo = mapLocationInfo;
+                }
+                mProgressDialog.dismiss();
+                Log.i(TAG,"定位ok");
+                Log.i(TAG,mMapLocationInfo.toString());
+                defalutAddress();//确定默认小区
+            }
+            @Override
+            public void locationFail(String message) {
+                mProgressDialog.dismiss();
+            }
+        });
+        checkPermissions();
+
+        return view;
+    }
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        for (int i = 0; i < grantResults.length; i++) {
+            if (PackageManager.PERMISSION_GRANTED != grantResults[i]) {
+                new AlertDialog(getActivity()).builder()
+                        .setTitle(PointRecordFragment.this.getString(R.string.tv_tishi))
+                        .setMsg("获取权限失败,是否重新尝试?")
+                        .setPositiveButton("重试", new View.OnClickListener() {
+                            @Override
+                            public void onClick(View view) {
+                                checkPermissions();
+                            }
+                        })
+                        .setNegativeButton("取消", new View.OnClickListener() {
+                            @Override
+                            public void onClick(View v) {
+
+                            }
+                        }).show();
+                return;
+            }
+        }
+        locationAddress();
+        //申请权限后创建图片文件夹
+        Utils.createDir(mImageDir);
+    }
+
+    public void requestAddress2() {
+        Log.i(TAG,"requestAddress2");
+        mProgressDialog.showDialog("正在获取附近小区...");
+        Log.i(TAG,"getIpAddress");
+        String ipAddress = IpUtils.getIpAddress(getActivity());
+        Log.i(TAG,"post");
+        OkHttpUtils.post()
+                .url(HttpUrl.GET_NEAR_ADDRESS_URL)
+                .addParams("userCode", mUserInfo.getUserCode())
+                .addParams("userRole", mUserInfo.getUserRole() + "")
+                .addParams("userIP", ipAddress)
+                .addParams("disName", mMapLocationInfo.getDistrict())
+                .addParams("longitude", mMapLocationInfo.getLongitude() + "")
+                .addParams("latitude", mMapLocationInfo.getLatitude() + "")
+                .build().execute(new Callback<AddressAreaEntity>() {
+            @Override
+            public AddressAreaEntity parseNetworkResponse(Response response, int id) throws Exception {
+                Log.i(TAG,"jsonStr");
+                String jsonStr = response.body().string();
+                Log.i(TAG,jsonStr);
+                return (AddressAreaEntity) JsonUtils.parseJson2Obj(jsonStr, AddressAreaEntity.class);
+            }
+
+            @Override
+            public void onError(Call call, Exception e, int id) {
+                mProgressDialog.dismiss();
+                DialogUtil.showNetFailDialog(getActivity());
+            }
+
+            @Override
+            public void onResponse(AddressAreaEntity entity, int id) {
+                mProgressDialog.dismiss();
+                List<AddressAreaEntity.InfoListBean> infoList = entity.getInfoList();
+                int mindDistancenumber=0;
+                String addressdefault="附近没有小区";
+                Log.i(TAG,"循环遍历");
+                Log.i(TAG, infoList.toString());
+                Log.i(TAG, infoList.size()+" ");
+                if(infoList.size()!=0) {
+                    int[] arr=new int[infoList.size()];
+                    for (int i = 0; i <= infoList.size()-1; i++) {
+                        arr[i]=Integer.parseInt(infoList.get(i).getDistance());
+                        Log.i(TAG, infoList.get(i).getDistance()+"distance");
+                    }
+                    Log.i(TAG, arr+"arr1");
+                    for(int i=0;i<=infoList.size()-1;i++){
+                        for (int j = 0; j <= infoList.size() - i-2; j++) {
+                            if (arr[j]>arr[j+1]) {
+                                int itemp3=arr[j];
+                                arr[j]= arr[j+1];
+                                arr[j+1]=itemp3;
+                            }
+                        }
+                    }
+                    Log.i(TAG, arr+"arr");
+                    int minddistance=0;
+                    Log.i(TAG, "得到最小距离");
+                    for (int n = 0; n <= infoList.size()-1; n++) {
+                        int Distancenumber = arr[0];
+                        if (Integer.parseInt(infoList.get(n).getDistance())==Distancenumber) {
+                            mindDistancenumber=Distancenumber;
+                            addressdefault = infoList.get(n).getAddress();
+                            infoList.get(n).setSelected(true);
+                            mListBean=infoList.get(n);
+                            Log.i(TAG, infoList.get(n).isSelected() +"==isSelected");
+                            Log.i(TAG, addressdefault+"addressdefault");
+                        }
+                    }
+                }
+
+                if(infoList.size()==0&&mindDistancenumber==0) {
+                    Log.i(TAG,"附近没有小区");
+//                    mDefCommTv.setText(addressdefault);
+                    init();
+                }else{
+
+                    Log.i(TAG,"默认小区地址");
+                    mDefCommTv.setText(addressdefault+"   "+mindDistancenumber+"m");
+                    mAddressTv.setText(mListBean.toStingTv());
+                    if(!mAddressTv.getText().toString().isEmpty()){
+                        mAddressTv.setVisibility(View.VISIBLE);
+                    }
+                    mShequEt.setText(mListBean.getArea());
+                    mDistrictEt.setText(mListBean.getDisName());
+                    mStreeEt.setText(mListBean.getStreet());
+//                    mCummEt.setText(mListBean.getAddress());
+                    init();
+                }
+            }
+        });
+        Log.i(TAG, "退出requestAddress2");
+        mProgressDialog.dismiss();
+    }
+    private void defalutAddress(){
+        Log.i(TAG,"准备获取小区");
+        Log.i(TAG,mMapLocationInfo.toString());
+        requestAddress2();
+        Log.i(TAG,"获取到小区");
+//
+    }
+    private void toAddressSelect() {
+        if (mAddressAreaList == null) {
+            requestAddress();
+        } else {
+            Log.i(TAG,mAddressAreaList.toString()+"附近小区list");
+            toAddressSelectActivity();
+        }
+    }
+    /**
+     * 跳转到选择小区页面
+     */
+    private void toAddressSelectActivity() {
+        Intent intent = new Intent(getActivity(), AddressSelectActivity.class);
+        intent.putExtra("userInfo", mUserInfo);
+        intent.putExtra("AddressAreaList", mAddressAreaList);
+        startActivityForResult(intent, 2);
+    }
+    /**
+     * 请求地址
+     */
+    public void requestAddress() {
+        Log.i(TAG,"requestAddress");
+        mProgressDialog.showDialog("正在获取附近小区...");
+        String ipAddress = IpUtils.getIpAddress(getActivity());
+        Log.i(TAG,mUserInfo.getUserCode());
+        Log.i(TAG,mUserInfo.getUserRole() + "");
+        Log.i(TAG,ipAddress);
+        Log.i(TAG,mMapLocationInfo.getDistrict());
+        Log.i(TAG,mMapLocationInfo.getLongitude() + "");
+        Log.i(TAG,mMapLocationInfo.getLatitude() + "");
+
+        OkHttpUtils.post()
+                .url(HttpUrl.GET_NEAR_ADDRESS_URL)
+                .addParams("userCode", mUserInfo.getUserCode())
+                .addParams("userRole", mUserInfo.getUserRole() + "")
+                .addParams("userIP", ipAddress)
+                .addParams("disName", mMapLocationInfo.getDistrict())
+                .addParams("longitude", mMapLocationInfo.getLongitude() + "")
+                .addParams("latitude", mMapLocationInfo.getLatitude() + "")
+                .build().execute(new Callback<AddressAreaEntity>() {
+            @Override
+            public AddressAreaEntity parseNetworkResponse(Response response, int id) throws Exception {
+                String jsonStr = response.body().string();
+                return (AddressAreaEntity) JsonUtils.parseJson2Obj(jsonStr, AddressAreaEntity.class);
+            }
+
+            @Override
+            public void onError(Call call, Exception e, int id) {
+                mProgressDialog.dismiss();
+                DialogUtil.showNetFailDialog(getActivity());
+            }
+
+            @Override
+            public void onResponse(AddressAreaEntity entity, int id) {
+                mProgressDialog.dismiss();
+                if (entity == null) {
+                    DialogUtil.showErrDialog(getActivity(), "返回信息为空");
+                    return;
+                }
+                if (!"1000".endsWith(entity.getReturnCode())) {
+                    DialogUtil.showErrDialog(getActivity(), entity.getReturnMsg());
+                    return;
+                }
+                List<AddressAreaEntity.InfoListBean> infoList = entity.getInfoList();
+
+                if (infoList == null) {
+                    DialogUtil.showErrDialog(getActivity(), "返回数组为空");
+                    return;
+                }
+                if (infoList != null) {
+                    mAddressAreaList = new ArrayList();
+                    for (AddressAreaEntity.InfoListBean bean : infoList) {
+                        mAddressAreaList.add(bean);
+                    }
+                }
+                Log.i(TAG,mAddressAreaList.toString()+"得到附近小区list");
+                toAddressSelectActivity();
+            }
+        });
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == 2 && resultCode == 1) {//返回小区选择
+            mListBean = (AddressAreaEntity.InfoListBean) data.getSerializableExtra("ListBean");
+            mAddressAreaList = (ArrayList) data.getSerializableExtra("AddressAreaList");
+            mDefCommTv.setText(mListBean.getAddress() + "    " + mListBean.getDistance() + "m");
+            mAddressTv.setText(mListBean.toStingTv());
+            if(!mAddressTv.getText().toString().isEmpty()){
+                mAddressTv.setVisibility(View.VISIBLE);
+            }
+            mShequEt.setText(mListBean.getArea());
+            mDistrictEt.setText(mListBean.getDisName());
+            mStreeEt.setText(mListBean.getStreet());
+        }
+    }
+    /**
+     * 定位
+     */
+    private void locationAddress() {
+//        mProgressDialog.showDialog("正在定位...");
+        mLocationUtils.startLocationInfo();
+    }
+    @TargetApi(Build.VERSION_CODES.M)
+    private void checkPermissions() {
+        mPermissions = CheckPermissionUtils.getNeededPermission(getActivity(), mPermissions);
+        if (mPermissions.length > 0) {
+            requestPermissions(mPermissions, 999);
+        }
+        if (mPermissions.length == 0) {
+            //申请过一次这里的permissions.length就为0 了
+            //申请权限后创建图片文件夹
+            Utils.createDir(mImageDir);
+            locationAddress();
+        }
+    }
+    private void init() {
+        Log.i("111","aaaa"+mType);
+
+        if(mType==1){
+            mPointLayout.setVisibility(View.VISIBLE);
+                Log.i("111","aaaa"+mMapLocationInfo.toStringTv());
+                mProgressDialog.dismiss();
+
+                mDistrictEt.setText(mMapLocationInfo.getDistrict());
+                mStreeEt.setText(mMapLocationInfo.getStreet());
+        }
+        else if(mType==2){
+            mPointLayout.setVisibility(View.GONE);
+            mActualTv.setText("新增点位信息:");
+                Log.i("111","aaaa"+mMapLocationInfo.toStringTv());
+                mProgressDialog.dismiss();
+                mDistrictEt.setText(mMapLocationInfo.getDistrict());
+                mStreeEt.setText(mMapLocationInfo.getStreet());
+
+        }
+
+    }
+    @OnClick({R.id.tv_default_community,R.id.btn_submit})
+    public void onClick(View view) {
+        if (view.getId() == R.id.tv_default_community) {//选择小区
+            Log.i("1","1");
+            toAddressSelect();
+        }
+        if (view.getId() == R.id.btn_submit) {//提交
+            String cummEt = mCummEt.getText().toString().trim();
+            String shequEt=mShequEt.getText().toString().trim();
+            String streetEt=mStreeEt.getText().toString().trim();
+            String districtEt=mDistrictEt.getText().toString().trim();
+            if (TextUtils.isEmpty(districtEt)) {
+                Utils.showToast(getActivity(), "请输入区名");
+                return;
+            }
+
+            if (TextUtils.isEmpty(streetEt)) {
+                Utils.showToast(getActivity(), "请输入街道名");
+                return;
+            }
+            if (TextUtils.isEmpty(shequEt)) {
+                Utils.showToast(getActivity(), "请输入社区名");
+                return;
+            }
+            if (TextUtils.isEmpty(cummEt)) {
+                Utils.showToast(getActivity(), "请输入小区名");
+                return;
+            }
+            postPoint();
+        }
+
+    }
+    private void postPoint(){
+        mProgressDialog.showDialog("正在提交...");
+        if(mType==1){
+            OkHttpUtils.post()
+                    .url(HttpUrl.ADDADDRESS_POST)
+                    .addParams("district", mListBean == null ? "" : mListBean.getDisName())
+                    .addParams("street", mListBean == null ? "" : mListBean.getStreet())
+                    .addParams("area", mListBean == null ? "" : mListBean.getArea())
+                    .addParams("addrCode", mListBean == null ? "" : mListBean.getAddrCode())
+                    .addParams("longitude", mMapLocationInfo.getLongitude() + "")
+                    .addParams("latitude", mMapLocationInfo.getLatitude() + "")
+                    .addParams("address", mCummEt.getText().toString().trim()+"")
+                    .build().execute(new Callback<PointFormEntity>() {
+                @Override
+                public PointFormEntity parseNetworkResponse(Response response, int id) throws Exception {
+                    String jsonStr = response.body().string();
+                    return (PointFormEntity) JsonUtils.parseJson2Obj(jsonStr, PointFormEntity.class);
+                }
+
+                @Override
+                public void onError(Call call, Exception e, int id) {
+                    mProgressDialog.dismiss();
+                    DialogUtil.showNetFailDialog(getActivity());
+                }
+
+                @Override
+                public void onResponse(PointFormEntity entity, int id) {
+                    mProgressDialog.dismiss();
+                    if (entity == null) {
+                        DialogUtil.showErrDialog(getActivity(), "返回信息为空");
+                        return;
+                    }
+                    if (!"1000".endsWith(entity.getReturnCode())) {
+                        DialogUtil.showErrDialog(getActivity(), entity.getReturnMsg());
+                        return;
+                    }
+                    DialogUtil.showErrDialog(getActivity(), "点位修改成功!");
+
+                }
+            });
+        }else if(mType==2){
+            OkHttpUtils.post()
+                    .url(HttpUrl.ADDADDRESS_POST)
+                    .addParams("district", mDistrictEt.getText().toString().trim()+"")
+                    .addParams("street", mStreeEt.getText().toString().trim()+"")
+                    .addParams("area", mShequEt.getText().toString().trim()+"")
+                    .addParams("longitude", mMapLocationInfo.getLongitude() + "")
+                    .addParams("latitude", mMapLocationInfo.getLatitude() + "")
+                    .addParams("address", mCummEt.getText().toString().trim()+"")
+                    .build().execute(new Callback<PatrolFormEntity>() {
+                @Override
+                public PatrolFormEntity parseNetworkResponse(Response response, int id) throws Exception {
+                    String jsonStr = response.body().string();
+                    return (PatrolFormEntity) JsonUtils.parseJson2Obj(jsonStr, PatrolFormEntity.class);
+                }
+
+                @Override
+                public void onError(Call call, Exception e, int id) {
+                    mProgressDialog.dismiss();
+                    DialogUtil.showNetFailDialog(getActivity());
+                }
+
+                @Override
+                public void onResponse(PatrolFormEntity entity, int id) {
+                    mProgressDialog.dismiss();
+                    if (entity == null) {
+                        DialogUtil.showErrDialog(getActivity(), "返回信息为空");
+                        return;
+                    }
+                    if (!"1000".endsWith(entity.getReturnCode())) {
+                        DialogUtil.showErrDialog(getActivity(), entity.getReturnMsg());
+                        return;
+                    }
+                    DialogUtil.showErrDialog(getActivity(), "新增点位成功!");
+
+                }
+            });
+        }
+
+    }
+    public static PointRecordFragment newInstance(int type) {
+        PointRecordFragment fragment = new PointRecordFragment();
+        Bundle bundle = new Bundle();
+        bundle.putInt(TYPE, type);
+        fragment.setArguments(bundle);
+        return fragment;
+    }
+
+}

+ 17 - 5
app/src/main/res/layout/activity_main.xml

xqd xqd xqd xqd
@@ -356,7 +356,7 @@
                             android:padding="2dp"
                             android:textColor="@color/white"
                             android:textSize="@dimen/size_tip"
-                            android:visibility="visible" />
+                            android:visibility="gone" />
                     </RelativeLayout>
 
                     <RelativeLayout
@@ -439,7 +439,7 @@
                             android:padding="2dp"
                             android:textColor="@color/color_red"
                             android:textSize="@dimen/size_tip"
-                            android:visibility="visible" />
+                            android:visibility="gone" />
                     </RelativeLayout>
 
                     <RelativeLayout
@@ -473,7 +473,7 @@
                             android:padding="2dp"
                             android:textColor="@color/white"
                             android:textSize="@dimen/size_tip"
-                            android:visibility="visible" />
+                            android:visibility="gone" />
                     </RelativeLayout>
                 </LinearLayout>
 
@@ -513,15 +513,27 @@
                         android:padding="2dp"
                         android:textColor="@color/white"
                         android:textSize="@dimen/size_tip"
-                        android:visibility="visible" />
+                        android:visibility="gone" />
                 </RelativeLayout>
                 <RelativeLayout
-                    android:id="@+id/rl_null_task"
+                    android:id="@+id/rl_upload_info"
                     android:layout_width="0dp"
                     android:layout_height="match_parent"
                     android:layout_marginLeft="16dp"
                     android:layout_weight="1"
+                    android:background="@drawable/selector_btn_rectangle_gray"
                     >
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_centerInParent="true"
+                        android:layout_weight="1"
+                        android:drawableTop="@mipmap/ic_upload"
+                        android:drawablePadding="5dp"
+                        android:gravity="center"
+                        android:text="上报信息"
+                        android:textColor="@color/text_black"
+                        android:textSize="@dimen/size_normal" />
                 </RelativeLayout>
             <!--    <RelativeLayout
                         android:id="@+id/rl_upload"

+ 295 - 0
app/src/main/res/layout/fragment_point_upload.xml

xqd
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    >
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:id="@+id/ll_point"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="visible"
+                >
+        <TextView
+            android:id="@+id/tv_now_point"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="现有点位信息:"
+            android:textColor="@color/text_black"
+            android:textSize="25dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="10dp"
+            />
+        <!--<LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            android:layout_marginLeft="40dp"
+            android:layout_marginRight="40dp"
+            android:layout_marginTop="50dp"
+            android:gravity="center_vertical"
+            android:orientation="horizontal"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="区名:"
+                android:gravity="center_vertical"
+                android:layout_marginLeft="50dp"
+                android:textColor="@color/text_black"
+                android:textSize="16dp"
+                />
+            <EditText
+                android:layout_width="180dp"
+                android:layout_height="wrap_content"
+                android:hint="**************2222"
+                android:background="#F2F2F2"
+                android:gravity="center_vertical|left"
+                android:textColor="@color/text_black"
+                android:textSize="16dp"
+
+                />
+    </LinearLayout>-->
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            android:layout_marginLeft="40dp"
+            android:layout_marginRight="40dp"
+            android:layout_marginTop="30dp"
+            android:background="#F2F2F2"
+            android:gravity="center_vertical"
+            android:orientation="horizontal">
+            <TextView
+                android:layout_width="80dp"
+                android:layout_height="match_parent"
+                android:layout_margin="8dp"
+                android:gravity="center_vertical"
+                android:text="原小区名:"
+                android:textColor="@color/color_login_text"
+                android:textSize="@dimen/size_normal"/>
+
+            <TextView
+                android:id="@+id/tv_default_community"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:drawableRight="@mipmap/ic_right_arrow"
+                android:drawablePadding="5dp"
+                android:gravity="right"
+                android:textColor="@color/text_dark_green"
+                android:textSize="14dp" />
+        </LinearLayout>
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_marginLeft="40dp"
+                    android:layout_marginRight="40dp"
+                    android:layout_marginTop="30dp"
+                    android:background="#F2F2F2"
+                    android:gravity="center_vertical"
+                    android:orientation="horizontal">
+                    <TextView
+                        android:id="@+id/tv_default_address"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:layout_margin="8dp"
+                        android:gravity="center_vertical"
+                        android:text="原地址:"
+                        android:textColor="@color/color_login_text"
+                        android:visibility="gone"
+                        android:textSize="@dimen/size_normal"/>
+
+
+                </LinearLayout>
+            </LinearLayout>
+
+
+            <TextView
+                android:id="@+id/tv_actual_point"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="实际点位信息:"
+                android:textColor="@color/text_black"
+                android:textSize="25dp"
+                android:layout_marginTop="30dp"
+                android:layout_gravity="center_horizontal"
+                />
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginLeft="40dp"
+                android:layout_marginRight="40dp"
+                android:layout_marginTop="30dp"
+                android:background="#F2F2F2"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="80dp"
+                    android:layout_height="match_parent"
+                    android:layout_margin="8dp"
+                    android:gravity="center_vertical"
+                    android:text="区名:"
+                    android:textColor="@color/color_login_text"
+                    android:textSize="@dimen/size_normal"/>
+
+                <EditText
+                    android:id="@+id/et_district"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:background="@null"
+                    android:gravity="center_vertical|left"
+                    android:hint="请输入"
+                    android:textSize="@dimen/size_normal"/>
+
+            </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginLeft="40dp"
+                android:layout_marginRight="40dp"
+                android:layout_marginTop="30dp"
+                android:background="#F2F2F2"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="80dp"
+                    android:layout_height="match_parent"
+                    android:layout_margin="8dp"
+                    android:gravity="center_vertical"
+                    android:text="街道名:"
+                    android:textColor="@color/color_login_text"
+                    android:textSize="@dimen/size_normal"/>
+
+                <EditText
+                    android:id="@+id/et_stree"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:background="@null"
+                    android:gravity="center_vertical|left"
+                    android:hint="请输入"
+                    android:textSize="@dimen/size_normal"/>
+
+            </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginLeft="40dp"
+                android:layout_marginRight="40dp"
+                android:layout_marginTop="30dp"
+                android:background="#F2F2F2"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="80dp"
+                    android:layout_height="match_parent"
+                    android:layout_margin="8dp"
+                    android:gravity="center_vertical"
+                    android:text="社区名:"
+                    android:textColor="@color/color_login_text"
+                    android:textSize="@dimen/size_normal"/>
+
+                <EditText
+                    android:id="@+id/et_shequ"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:background="@null"
+                    android:gravity="center_vertical|left"
+                    android:hint="请输入"
+                    android:textSize="@dimen/size_normal"/>
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginLeft="40dp"
+                android:layout_marginRight="40dp"
+                android:layout_marginTop="30dp"
+                android:background="#F2F2F2"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="80dp"
+                    android:layout_height="match_parent"
+                    android:layout_margin="8dp"
+                    android:gravity="center_vertical"
+                    android:text="小区名:"
+                    android:textColor="@color/color_login_text"
+                    android:textSize="@dimen/size_normal"/>
+
+                <EditText
+                    android:id="@+id/et_community"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:background="@null"
+                    android:gravity="center_vertical|left"
+                    android:hint="请输入"
+                    android:textSize="@dimen/size_normal"/>
+            </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:layout_marginLeft="40dp"
+                android:layout_marginRight="40dp"
+                android:background="#F2F2F2"
+                android:layout_marginTop="30dp">
+
+                <EditText
+                    android:id="@+id/et_content"
+                    android:layout_width="match_parent"
+                    android:layout_height="100dp"
+                    android:background="@null"
+                    android:gravity="left|top"
+                    android:hint="备注"
+                    android:maxLength="200"
+                    android:textColor="@color/text_black"
+                    android:textSize="14dp"/>
+
+                <TextView
+                    android:id="@+id/tv_content_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="right"
+                    android:text="0/200"
+                    android:textColor="@color/text_black"
+                    android:textSize="12dp" />
+            </LinearLayout>
+
+
+                <Button
+                    android:id="@+id/btn_submit"
+                    style="?android:attr/borderlessButtonStyle"
+                    android:layout_width="180dp"
+                    android:layout_height="50dp"
+                    android:layout_gravity="center_horizontal"
+                    android:layout_marginTop="30dp"
+                    android:background="#4976a7"
+                    android:gravity="center"
+                    android:text="提交"
+                    android:textColor="#fff"
+                    android:textSize="@dimen/size_big"/>
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="100dp"/>
+
+        </LinearLayout>
+    </ScrollView>
+
+</LinearLayout>