diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 013d036..74a19fe 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -48,7 +48,11 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning"> - + mFragments = new ArrayList<>(); + private List mFragments = new ArrayList<>(); @Override protected int setLayoutId() { @@ -75,25 +76,8 @@ public class BuildingViewPageActivity extends BaseActivity { */ private void onAddPage() { int currentItem = mVpContent.getCurrentItem(); - Intent intent = new Intent(); - switch (currentItem) { - case 0://小区 - intent.setClass(mActivity, NewCommunityAddActivity.class); - intent.putExtra("title", "小区信息录入"); - startActivityForResult(intent,123); - break; - case 1://楼宇 - intent.setClass(mActivity, NewBuildingAddActivity.class); - intent.putExtra("title", "楼/排信息录入"); - startActivityForResult(intent,123); - break; - case 2://房屋 + mFragments.get(currentItem).startAddActivity(""); - break; - case 3://出租房 - - break; - } } @Override diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingAddActivity.java b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingAddActivity.java index 40f40d3..9d52464 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingAddActivity.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingAddActivity.java @@ -453,9 +453,14 @@ public class NewBuildingAddActivity extends BaseActivity { StreetBean bean = mArea4List.get(options1); mTvStreet.setText(bean.getName()); mSelArea4 = bean; + mSelArea5 = null; mTvCommunity.setText(""); mArea5List = null; + + mCommunityList = null; + mSelCommunity = null; + mTvCommunityArea.setText(""); }) .setTitleText("请选择区域") .isDialog(false) @@ -528,7 +533,10 @@ public class NewBuildingAddActivity extends BaseActivity { CommunityBean bean = mArea5List.get(options1); mTvCommunity.setText(bean.getCommunityName()); mSelArea5 = bean; + mCommunityList = null; + mSelCommunity = null; + mTvCommunityArea.setText(""); }) .setTitleText("请选择社区") .isDialog(false) diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingDetailActivity.java b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingDetailActivity.java index 65fd852..8b11ae2 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingDetailActivity.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewBuildingDetailActivity.java @@ -96,9 +96,6 @@ public class NewBuildingDetailActivity extends BaseActivity { private LatLng mDefaultPoint; private BitmapDescriptor mBitmapDescriptor; private List mPhotos = new ArrayList<>(); - private AddPhotoBean mCurrentBean; - private String mPicPath; - private String mPhotoIds = "";//相片Id private AddPhotoAdapter mPhotoAdapter; private String mId; diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseAddActivity.java b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseAddActivity.java index 94f3d69..bb8f1fa 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseAddActivity.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseAddActivity.java @@ -1,67 +1,39 @@ package com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys; import android.app.ProgressDialog; -import android.content.Intent; -import android.database.Cursor; import android.graphics.Color; -import android.net.Uri; -import android.os.Build; -import android.os.Environment; -import android.provider.MediaStore; -import android.support.annotation.Nullable; -import android.support.v4.content.FileProvider; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; import android.text.TextUtils; -import android.view.Gravity; -import android.view.View; import android.widget.Button; import android.widget.EditText; -import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.Switch; import android.widget.TextView; -import android.widget.ZoomControls; -import com.baidu.location.LocationClient; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.MapStatus; -import com.baidu.mapapi.map.MapStatusUpdate; -import com.baidu.mapapi.map.MapStatusUpdateFactory; -import com.baidu.mapapi.map.MarkerOptions; -import com.baidu.mapapi.map.OverlayOptions; -import com.baidu.mapapi.map.TextureMapView; -import com.baidu.mapapi.model.LatLng; import com.bigkoo.pickerview.builder.OptionsPickerBuilder; +import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.view.OptionsPickerView; +import com.bigkoo.pickerview.view.TimePickerView; import com.google.gson.Gson; import com.sucstepsoft.cm_utils.constant.PathConfig; -import com.sucstepsoft.cm_utils.core.beans.AddPhotoBean; -import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi; import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager; -import com.sucstepsoft.cm_utils.core.widget.base.AddPhotoAdapter; import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity; -import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView; -import com.sucstepsoft.cm_utils.utils.ProiderUtil; import com.sucstepsoft.cm_utils.utils.ToastUtils; import com.sucstepsoft.cm_utils.utils.UIUtil; import com.sucstepsoft.cm_utils.utils.UserLgUtils; import com.sucstepsoft.realtimelocation.R; -import com.sucstepsoft.realtimelocation.activitys.common.PhotoActivity; -import com.sucstepsoft.realtimelocation.activitys.issue.TakePointActivity; -import com.sucstepsoft.realtimelocation.beans.BaseUserBean; import com.sucstepsoft.realtimelocation.beans.CommunityBean; import com.sucstepsoft.realtimelocation.beans.DicBean; +import com.sucstepsoft.realtimelocation.beans.NewBuildingBean; import com.sucstepsoft.realtimelocation.beans.NewBuildingDetailBean; import com.sucstepsoft.realtimelocation.beans.NewCommunityDetailBean; -import com.sucstepsoft.realtimelocation.beans.SaveNewBuildingBean; +import com.sucstepsoft.realtimelocation.beans.NewHouseDetailBean; +import com.sucstepsoft.realtimelocation.beans.SaveNewHouseBean; import com.sucstepsoft.realtimelocation.beans.StreetBean; import com.sucstepsoft.realtimelocation.beans.SuccessBean; import com.sucstepsoft.realtimelocation.net.LocationApiService; import com.sucstepsoft.realtimelocation.utils.ExceptionHandler; -import java.io.File; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @@ -74,50 +46,83 @@ import io.reactivex.annotations.NonNull; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; import okhttp3.MediaType; -import okhttp3.MultipartBody; import okhttp3.RequestBody; -import top.zibin.luban.Luban; -import top.zibin.luban.OnCompressListener; /** * 房屋添加 */ public class NewHouseAddActivity extends BaseActivity { + @BindView(R.id.tv_street) TextView mTvStreet; @BindView(R.id.tv_community) TextView mTvCommunity; @BindView(R.id.tv_community_area) TextView mTvCommunityArea; - @BindView(R.id.et_name) - EditText mEtName; - @BindView(R.id.et_num) - EditText mEtNum; - @BindView(R.id.et_floor) - EditText mEtFloor; - @BindView(R.id.et_unit_num) - EditText mEtUnitNum; - @BindView(R.id.et_address) - EditText mEtAddress; - @BindView(R.id.tv_loc_lng) - TextView mTvLocLng; - @BindView(R.id.mp_view) - TextureMapView mMpView; - @BindView(R.id.tv_point) - TextView mTvPoint; - @BindView(R.id.rlv_photo) - RecyclerView mRlvPhoto; + @BindView(R.id.tv_building_num) + TextView mTvBuildingNum; + @BindView(R.id.tv_unit_num) + TextView mTvUnitNum; + @BindView(R.id.tv_floor_num) + TextView mTvFloorNum; + @BindView(R.id.et_door) + EditText mEtDoor; + @BindView(R.id.tv_house_type) + TextView mTvHouseType; + @BindView(R.id.tv_house_property) + TextView mTvHouseProperty; + @BindView(R.id.tv_house_kind) + TextView mTvHouseKind; + @BindView(R.id.tv_house_frame) + TextView mTvHouseFrame; + @BindView(R.id.tv_build_use) + TextView mTvBuildUse; + @BindView(R.id.tv_house_use) + TextView mTvHouseUse; + @BindView(R.id.tv_trouble) + TextView mTvTrouble; + @BindView(R.id.et_house_number) + EditText mEtHouseNumber; + @BindView(R.id.et_house_area) + EditText mEtHouseArea; + @BindView(R.id.et_right_num) + EditText mEtRightNum; + @BindView(R.id.tv_register_date) + TextView mTvRegisterDate; + @BindView(R.id.et_dept) + EditText mEtDept; + @BindView(R.id.sw_is_hire) + Switch mSwIsHire; + @BindView(R.id.sw_is_empty) + Switch mSwIsEmpty; + @BindView(R.id.tv_renting_type) + TextView mTvRentingType; + @BindView(R.id.et_hire_use) + EditText mEtHireUse; + @BindView(R.id.et_owner_name) + EditText mEtOwnerName; + @BindView(R.id.tv_owner_id_card_type) + TextView mTvOwnerIdCardType; + @BindView(R.id.et_owner_id_card) + EditText mEtOwnerIdCard; + @BindView(R.id.et_owner_phone) + EditText mEtOwnerPhone; + @BindView(R.id.et_manage_name) + EditText mEtManageName; + @BindView(R.id.tv_manage_id_card_type) + TextView mTvManageIdCardType; + @BindView(R.id.et_manage_id_card) + EditText mEtManageIdCard; + @BindView(R.id.et_manage_phone) + EditText mEtManagePhone; + @BindView(R.id.et_manage_relation) + EditText mEtManageRelation; @BindView(R.id.btn_confirm) Button mBtnConfirm; @BindView(R.id.ll_content) LinearLayout mLlContent; private Unbinder mBind; - private String mSelCommunityId = ""; - private LocationClient mLocationClient; - private String mSelLat; - private String mSelLng; - private OptionsPickerView mArea4Picker; private OptionsPickerView mArea5Picker; @@ -127,16 +132,32 @@ public class NewHouseAddActivity extends BaseActivity { private CommunityBean mSelArea5; private OptionsPickerView mDicPicker; private List mDicBeanList; - private BaiduMap mBaiduMap; - private LatLng mDefaultPoint; - private BitmapDescriptor mBitmapDescriptor; - private List mPhotos = new ArrayList<>(); - private AddPhotoBean mCurrentBean; - private String mPicPath; - private String mPhotoIds = "";//相片Id - private AddPhotoAdapter mPhotoAdapter; + private List mCommunityList; + private OptionsPickerView mCommunityPicker; + private NewCommunityDetailBean mSelCommunity; + + private List mUnitList; + private List mFloorList; + private DicBean mSelUnit; + private DicBean mSelFloor; + private OptionsPickerView mUnitPicker; + private OptionsPickerView mFloorPicker; + private NewBuildingBean.RowsBean mSelBuilding; + private List mBuildingList; + private OptionsPickerView mBuildingPicker; + private SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd"); private String mId = ""; + private DicBean mSelHouseType; + private DicBean mHouseProperty; + private DicBean mSelHouseKind; + private DicBean mSelHouseFrame; + private DicBean mSelBuildUse; + private DicBean mSelHouseUse; + private DicBean mSelTrouble; + private DicBean mSelRentingType; + private DicBean mSelOwner; + private DicBean mSelManage; @Override protected int setLayoutId() { @@ -157,7 +178,6 @@ public class NewHouseAddActivity extends BaseActivity { } initContentView(); - initBaiduMap(); } private void doSubmit() { @@ -181,7 +201,7 @@ public class NewHouseAddActivity extends BaseActivity { RequestBody body = buildParams(); RetrofitManager.getInstance() .create(LocationApiService.class) - .doEditNewBuilding(mId, body, UserLgUtils.getToken()) + .doEditNewHouse(mId, body, UserLgUtils.getToken()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @@ -212,95 +232,200 @@ public class NewHouseAddActivity extends BaseActivity { } private void initContentView() { - mPhotos.add(new AddPhotoBean()); - mPhotoAdapter = new AddPhotoAdapter(mActivity, mPhotos); - mRlvPhoto.setLayoutManager(new GridLayoutManager(mActivity, 4)); - mRlvPhoto.setAdapter(mPhotoAdapter); - //删除上传的相片 - mPhotoAdapter.addOnDeleteListener(((bean, i) -> { - mPhotoAdapter.removeItem(bean); - mPhotoIds = mPhotoIds.replace(bean.getId() + ",", ""); - })); - mPhotoAdapter.addOnItemClickListener(bean -> { - if (TextUtils.isEmpty(bean.getPath())) { - //空数据 - showSelectPhoto(bean); - } else { - //预览 - ArrayList list = new ArrayList<>(); - list.add(bean.getPath()); - Intent intent = new Intent(); - intent.putExtra(PhotoActivity.TAG_IMGURL, list); - intent.setClass(mActivity, PhotoActivity.class); - startActivity(intent); - } - }); mTvStreet.setOnClickListener(v -> onShowArea4()); mTvCommunity.setOnClickListener(v -> onShowArea5()); mTvCommunityArea.setOnClickListener(v -> onShowCommunity()); + mTvBuildingNum.setOnClickListener(v -> onShowBuildNum());//楼排 + mTvUnitNum.setOnClickListener(v -> onShowUnit()); + mTvFloorNum.setOnClickListener(v -> onShowFloor()); + mTvHouseType.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_TYPE, 2, 1));//房屋类别 + mTvHouseProperty.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_PROPERTY, 2, 2));//房屋性质 + mTvHouseKind.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_KIND, 2, 3));//房屋种类 + mTvHouseFrame.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_FRAME, 2, 4));//房屋结构 + mTvBuildUse.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_BUILD_USE, 2, 5));//建筑用途 + mTvHouseUse.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_USE, 2, 6));//房屋用途 + mTvTrouble.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_BUILDING_HOUSE_TROUBLE, 2, 7));//隐患类型 + mTvRentingType.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_RENTING_TYPE, 2, 8));//租住类型 + mTvOwnerIdCardType.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_CARD_TYPE, 2, 9)); + mTvManageIdCardType.setOnClickListener(v -> onShowDicPicker(PathConfig.DIC_CARD_TYPE, 2, 10)); + mTvRegisterDate.setOnClickListener(v -> onShowDate(mTvRegisterDate)); mBtnConfirm.setOnClickListener(v -> doSubmit()); } + private void onShowDate(TextView tvItem) { + hideSoftKeyboard(); + TimePickerView mTimePickerView = new TimePickerBuilder(mActivity, (date, v) -> { + tvItem.setText(mDateFormat.format(date)); + }) + .setTitleText("请选日期") + .setCancelColor(Color.parseColor("#1189FF")) + .setSubmitColor(Color.parseColor("#1189FF")) + .setType(new boolean[]{true, true, true, false, false, false}) + .setTitleColor(Color.parseColor("#1189FF")) + .build(); + mTimePickerView.show(); + } + + /** + * 显示楼排选择 + */ + private void onShowBuildNum() { + if (mSelCommunity == null) { + ToastUtils.showShort("请选择所在小区"); + } else { + if (mBuildingList == null) { + getAllUnitNum(mSelCommunity.getResidentialId()); + } else { + mBuildingPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> { + mSelBuilding = mBuildingList.get(options1); + mTvBuildingNum.setText(mSelCommunity.getName()); + + mSelUnit = null; + mUnitList = null; + mTvUnitNum.setText(""); + + mSelFloor = null; + mFloorList = null; + mTvFloorNum.setText(""); + //构建单元 层数 + buildBuildingData(mSelBuilding); + }) + .setTitleText("楼/排") + .isDialog(false) + .setCancelColor(Color.parseColor("#1189FF")) + .setSubmitColor(Color.parseColor("#1189FF")) + .setTitleColor(Color.parseColor("#1189FF")) + .build(); + mBuildingPicker.setPicker(mBuildingList); + mBuildingPicker.show(); + } + } + } + + private void onShowUnit() { + if (mUnitList == null) { + ToastUtils.showShort("所选楼/排未录入单元数量"); + } else { + mUnitPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> { + mSelUnit = mUnitList.get(options1); + mTvUnitNum.setText(mSelUnit.getDictionaryName()); + }) + .setTitleText("楼/排") + .isDialog(false) + .setCancelColor(Color.parseColor("#1189FF")) + .setSubmitColor(Color.parseColor("#1189FF")) + .setTitleColor(Color.parseColor("#1189FF")) + .build(); + mUnitPicker.setPicker(mUnitList); + mUnitPicker.show(); + } + } + + private void onShowFloor() { + if (mFloorList == null) { + ToastUtils.showShort("所选楼/排未录入层院数量"); + } else { + mFloorPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> { + mSelFloor = mFloorList.get(options1); + mTvFloorNum.setText(mSelFloor.getDictionaryName()); + }) + .setTitleText("层/院") + .isDialog(false) + .setCancelColor(Color.parseColor("#1189FF")) + .setSubmitColor(Color.parseColor("#1189FF")) + .setTitleColor(Color.parseColor("#1189FF")) + .build(); + mFloorPicker.setPicker(mFloorList); + mFloorPicker.show(); + } + } + /** - * 显示选择图片 + * 构建单元 层 * - * @param bean + * @param selBuilding */ - private void showSelectPhoto(AddPhotoBean bean) { - hideSoftKeyboard(); - ButtomDialogView buttomDialogView = new ButtomDialogView.DialogBuilder(mActivity) - .setIsBackCancelable(true) - .setIscancelable(true) - .setShowLocation(Gravity.BOTTOM) - .setIsShowFile(false) - .build(); - buttomDialogView.addOnChoseListener(new ButtomDialogView.OnChoseListener() { - @Override - public void choseFile() { - } - - @Override - public void choseAlbum() { - mCurrentBean = bean; - Intent intent = new Intent(Intent.ACTION_PICK, null); - intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, - "image/*"); - startActivityForResult(intent, BaseUrlApi.PHOTO_REQUEST); - buttomDialogView.dismiss(); - } - - @Override - public void choseShoot() { - mCurrentBean = bean; - String pathStr = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + PathConfig.CATCH_PATH; - mPicPath = pathStr + System.currentTimeMillis() + ".jpg"; - File file = new File(mPicPath); - Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); - // 下面这句指定调用相机拍照后的照片存储的路径 - Uri uri; - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - uri = Uri.fromFile(file); - } else { - uri = FileProvider.getUriForFile(mActivity, ProiderUtil.getFileProviderName(mActivity), file); + private void buildBuildingData(NewBuildingBean.RowsBean selBuilding) { + String unitNum = selBuilding.getUnitNum(); + String floorNum = selBuilding.getFloorsNum(); + if (!TextUtils.isEmpty(unitNum)) { + mUnitList = new ArrayList<>(); + try { + int unitInt = Integer.parseInt(unitNum); + for (int i = 0; i < unitInt; i++) { + DicBean b = new DicBean(); + b.setDictionaryName(i + 1 + ""); + mUnitList.add(b); } - intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); - startActivityForResult(intent, BaseUrlApi.CAMERA_REQUEST); + } catch (Exception e) { + e.printStackTrace(); } - - @Override - public void loginOut() { - + } + if (!TextUtils.isEmpty(floorNum)) { + try { + mFloorList = new ArrayList<>(); + int floorInt = Integer.parseInt(floorNum); + for (int i = 0; i < floorInt; i++) { + DicBean b = new DicBean(); + b.setDictionaryName(i + 1 + ""); + mFloorList.add(b); + } + } catch (Exception e) { + e.printStackTrace(); } - - @Override - public void changePwd() { - - } - }); - buttomDialogView.show(); + } } + + /** + * 根据小区获取楼 + * + * @param residentialId + */ + private void getAllUnitNum(String residentialId) { + ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中..."); + dialog.show(); + RetrofitManager.getInstance() + .create(LocationApiService.class) + .getAllBuilding(residentialId, UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer>() { + @Override + public void onSubscribe(Disposable d) { + + } + + @Override + public void onNext(List newCommunityDetailBeans) { + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + if (newCommunityDetailBeans != null && newCommunityDetailBeans.size() > 0) { + mBuildingList = newCommunityDetailBeans; + onShowBuildNum(); + } else { + ToastUtils.showShort("所选小区下,暂无楼/排信息"); + } + } + + @Override + public void onError(Throwable e) { + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + ExceptionHandler.handleException(e); + } + + @Override + public void onComplete() { + + } + }); + } + + private boolean checkParams() { if (mSelArea4 == null) { ToastUtils.showShort("请选择所在街道"); @@ -314,133 +439,41 @@ public class NewHouseAddActivity extends BaseActivity { ToastUtils.showShort("请选择所在小区"); return false; } - String name = mEtName.getText().toString().trim(); - if (TextUtils.isEmpty(name)) { - ToastUtils.showShort("请输入楼排名称"); + if (mSelBuilding == null) { + ToastUtils.showShort("请选择所在楼/排"); + return false; + } + if (mSelHouseType == null) { + ToastUtils.showShort("请选择房屋类别"); + return false; + } + if (mHouseProperty == null) { + ToastUtils.showShort("请选择房屋性质"); + return false; + } + if (mSelHouseKind == null) { + ToastUtils.showShort("请选择房屋种类"); + return false; + } + if (mSelHouseFrame == null) { + ToastUtils.showShort("请选择房屋结构"); + return false; + } + if (mSelBuildUse == null) { + ToastUtils.showShort("请选择建筑用途"); + return false; + } + if (mSelHouseUse == null) { + ToastUtils.showShort("请选择房屋用途"); + return false; + } + if (mSelTrouble == null) { + ToastUtils.showShort("请选择隐患类型"); return false; } return true; } - private void initBaiduMap() { - mDefaultPoint = new LatLng(PathConfig.LA, PathConfig.LO); - mBaiduMap = mMpView.getMap(); - MapStatus ms = new MapStatus.Builder().zoom(14).target(mDefaultPoint).build(); - MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms); - View child = mMpView.getChildAt(1); - if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) { - child.setVisibility(View.GONE); - } - mMpView.showZoomControls(false); - mBaiduMap.animateMapStatus(u); - mTvLocLng.setOnClickListener(v -> { - Intent intent = new Intent(mActivity, TakePointActivity.class); - startActivityForResult(intent, 1234); - }); - } - - /** - * 添加marker - * - * @param latLng - */ - private void addMarker(LatLng latLng) { - mBaiduMap.clear(); - mBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_marker); - OverlayOptions option = new MarkerOptions() - .position(latLng) - .icon(mBitmapDescriptor) - .animateType(MarkerOptions.MarkerAnimateType.drop); - mBaiduMap.addOverlay(option); - MapStatus ms = new MapStatus.Builder().zoom(14).target(latLng).build(); - MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms); - mBaiduMap.animateMapStatus(u); - } - - /** - * 上传文件 - * - * @param picPath - */ - private void uploadImg(String picPath, int src) { - File file = new File(picPath); - if (!file.exists()) { - showToast("图片路径错误."); - return; - } - ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "正在上传..."); - progressDialog.show(); - String pathStr = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + PathConfig.CATCH_PATH; - Luban.with(mActivity) - .load(picPath) - .ignoreBy(100) - .setTargetDir(pathStr) - .filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"))) - .setCompressListener(new OnCompressListener() { - @Override - public void onStart() { - - } - - @Override - public void onSuccess(File file) { - RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file); - MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile); - RetrofitManager.getInstance() - .create(LocationApiService.class) - .uploadImage(body, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onNext(BaseUserBean baseUserBean) { - if (progressDialog != null && progressDialog.isShowing()) { - progressDialog.dismiss(); - } - ToastUtils.showShort("上传成功"); - mPhotoIds += (baseUserBean.getData() + ","); - mCurrentBean.setId(baseUserBean.getData()); - mCurrentBean.setPath(picPath); - if (mPhotos.size() < 4) { - mPhotos.add(new AddPhotoBean()); - } - mPhotoAdapter.notifyDataSetChanged(); - mCurrentBean = null; - } - - @Override - public void onError(Throwable e) { - if (progressDialog != null && progressDialog.isShowing()) { - progressDialog.dismiss(); - } - ToastUtils.showShort("上传失败,请稍后重试."); - if (file.exists()) { - file.delete(); - } - } - - @Override - public void onComplete() { - - } - }); - } - - @Override - public void onError(Throwable e) { - if (progressDialog.isShowing()) { - progressDialog.dismiss(); - } - ToastUtils.showShort("图片上传失败,请稍后重试"); - } - }) - .launch(); - } /** * area4 @@ -453,9 +486,27 @@ public class NewHouseAddActivity extends BaseActivity { StreetBean bean = mArea4List.get(options1); mTvStreet.setText(bean.getName()); mSelArea4 = bean; + mSelArea5 = null; mTvCommunity.setText(""); mArea5List = null; + + mSelCommunity = null; + mCommunityList = null; + mTvCommunityArea.setText(""); + + mSelBuilding = null; + mBuildingList = null; + mTvBuildingNum.setText(""); + + mSelUnit = null; + mUnitList = null; + mTvUnitNum.setText(""); + + mSelFloor = null; + mFloorList = null; + mTvFloorNum.setText(""); + }) .setTitleText("请选择区域") .isDialog(false) @@ -528,7 +579,24 @@ public class NewHouseAddActivity extends BaseActivity { CommunityBean bean = mArea5List.get(options1); mTvCommunity.setText(bean.getCommunityName()); mSelArea5 = bean; + + mSelCommunity = null; mCommunityList = null; + mTvCommunityArea.setText(""); + + mSelBuilding = null; + mBuildingList = null; + mTvBuildingNum.setText(""); + + mSelUnit = null; + mUnitList = null; + mTvUnitNum.setText(""); + + mSelFloor = null; + mFloorList = null; + mTvFloorNum.setText(""); + + }) .setTitleText("请选择社区") .isDialog(false) @@ -580,9 +648,6 @@ public class NewHouseAddActivity extends BaseActivity { }); } - private List mCommunityList; - private OptionsPickerView mCommunityPicker; - private NewCommunityDetailBean mSelCommunity; /** * 小区选择 @@ -597,6 +662,20 @@ public class NewHouseAddActivity extends BaseActivity { mCommunityPicker = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> { mSelCommunity = mCommunityList.get(options1); mTvCommunityArea.setText(mSelCommunity.getName()); + + mSelBuilding = null; + mBuildingList = null; + mTvBuildingNum.setText(""); + + + mSelUnit = null; + mUnitList = null; + mTvUnitNum.setText(""); + + mSelFloor = null; + mFloorList = null; + mTvFloorNum.setText(""); + }) .setTitleText("请选择小区") .isDialog(false) @@ -663,6 +742,8 @@ public class NewHouseAddActivity extends BaseActivity { hideSoftKeyboard(); if (type == 1) { mDicPicker = new OptionsPickerBuilder(mActivity, (o1, o2, o3, v) -> { + DicBean bean = mDicBeanList.get(o1); + chooseDic(bean, source); }) .setTitleText("请选择") .setCancelColor(Color.parseColor("#1189FF")) @@ -676,6 +757,56 @@ public class NewHouseAddActivity extends BaseActivity { } } + private void chooseDic(DicBean bean, int source) { + switch (source) { + case 1://房屋类别 + mSelHouseType = bean; + mTvHouseType.setText(bean.getDictionaryName()); + break; + case 2://房屋性质 + mHouseProperty = bean; + mTvHouseProperty.setText(bean.getDictionaryName()); + break; + case 3://房屋种类 + mSelHouseKind = bean; + mTvHouseKind.setText(bean.getDictionaryName()); + break; + case 4: + //房屋结构 + mSelHouseFrame = bean; + mTvHouseFrame.setText(bean.getDictionaryName()); + break; + case 5: + //建筑用途 + mSelBuildUse = bean; + mTvBuildUse.setText(bean.getDictionaryName()); + break; + case 6: + //房屋用途 + mSelHouseUse = bean; + mTvHouseUse.setText(bean.getDictionaryName()); + break; + case 7: + //隐患类型 + mSelTrouble = bean; + mTvTrouble.setText(bean.getDictionaryName()); + break; + case 8: + //租住类型 + mSelRentingType = bean; + mTvRentingType.setText(bean.getDictionaryName()); + break; + case 9://房主证件种类 + mSelOwner = bean; + mTvOwnerIdCardType.setText(bean.getDictionaryName()); + break; + case 10://托管人证件种类 + mSelManage = bean; + mTvManageIdCardType.setText(bean.getDictionaryName()); + break; + } + } + private void getDicListByType(String pId, int i, int source) { ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中..."); @@ -727,7 +858,7 @@ public class NewHouseAddActivity extends BaseActivity { progressDialog.show(); RetrofitManager.getInstance() .create(LocationApiService.class) - .doSaveNewBuilding(bean, UserLgUtils.getToken()) + .doSaveNewHouse(bean, UserLgUtils.getToken()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @@ -761,17 +892,17 @@ public class NewHouseAddActivity extends BaseActivity { private void getDetailById() { RetrofitManager.getInstance() .create(LocationApiService.class) - .getNewBuildingDetail(mId, UserLgUtils.getToken()) + .getNewHouseDetail(mId, UserLgUtils.getToken()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { + .subscribe(new Observer() { @Override public void onSubscribe(Disposable d) { } @Override - public void onNext(NewBuildingDetailBean newCommunityDetailBean) { + public void onNext(NewHouseDetailBean newCommunityDetailBean) { setDataToView(newCommunityDetailBean); } @@ -788,89 +919,274 @@ public class NewHouseAddActivity extends BaseActivity { }); } - private void setDataToView(NewBuildingDetailBean bean) { + private void setDataToView(NewHouseDetailBean bean) { if (!TextUtils.isEmpty(bean.getStreet())) { mSelArea4 = new StreetBean(); mSelArea4.setId(bean.getStreet()); mSelArea4.setName(bean.getStreetName()); mTvStreet.setText(bean.getStreetName()); } - if (!TextUtils.isEmpty(bean.getCommunity())) { mSelArea5 = new CommunityBean(); mSelArea5.setCommunityId(bean.getCommunity()); mSelArea5.setCommunityName(bean.getCommunityName()); mTvCommunity.setText(bean.getCommunityName()); } - mEtName.setText(bean.getName()); - mEtNum.setText(bean.getBuildNum()); - mEtFloor.setText(bean.getFloorsNum()); - mEtUnitNum.setText(bean.getUnitNum()); - mEtAddress.setText(bean.getAddress()); - if (!TextUtils.isEmpty(bean.getLatitude())) { - mSelLat = bean.getLatitude(); - mSelLng = bean.getLongitude(); - Double lat = Double.parseDouble(bean.getLatitude()); - Double lng = Double.parseDouble(bean.getLongitude()); - mTvPoint.setText("经纬度:" + mSelLat + "-" + mSelLng); - addMarker(new LatLng(lat, lng)); + if (!TextUtils.isEmpty(bean.getBuildingId())) { + mSelCommunity = new NewCommunityDetailBean(); + mSelCommunity.setResidentialId(bean.getResidentialId()); + mSelCommunity.setName(bean.getResidentialName()); + mTvCommunityArea.setText(bean.getResidentialName()); } - if (!TextUtils.isEmpty(bean.getImage())) { - String[] photos = bean.getImage().split(","); - mPhotos.clear(); - for (int i = 0; i < photos.length; i++) { - AddPhotoBean pBean = new AddPhotoBean(); - pBean.setId(photos[i]); - pBean.setPath(BaseUrlApi.BASE_IMG_URL + photos[i]); - mPhotos.add(pBean); - } - if (mPhotos.size() < 9) { - mPhotos.add(new AddPhotoBean()); - } - mPhotoAdapter.setData(mPhotos); + if (!TextUtils.isEmpty(bean.getBuildingId())) { + mSelBuilding = new NewBuildingBean.RowsBean(); + mSelBuilding.setBuildingId(bean.getBuildingId()); + mSelBuilding.setName(bean.getBuildingName()); + mTvBuildingNum.setText(bean.getBuildingName()); + } + if (!TextUtils.isEmpty(bean.getStructureId())) { + mSelHouseFrame = new DicBean(); + mSelHouseFrame.setDictionaryName(bean.getStructureName()); + mSelHouseFrame.setDictionaryId(bean.getStructureId()); + mTvHouseFrame.setText(bean.getStructureName()); + } + mTvUnitNum.setText(bean.getAffiliationUnit() + ""); + mTvFloorNum.setText(bean.getAffiliationFloors() + ""); + mEtDoor.setText(bean.getHouseNum() + ""); + if (!TextUtils.isEmpty(bean.getCategoryId())) { + mSelHouseType = new DicBean(); + mSelHouseType.setDictionaryId(bean.getCategoryId()); + mSelHouseType.setDictionaryName(bean.getCategoryName()); + mTvHouseType.setText(mSelHouseType.getDictionaryName()); + } + if (!TextUtils.isEmpty(bean.getNatureId())) { + mHouseProperty = new DicBean(); + mHouseProperty.setDictionaryName(bean.getNatureId()); + mHouseProperty.setDictionaryName(bean.getNatureName()); + mTvHouseProperty.setText(bean.getNatureName()); + } + if (!TextUtils.isEmpty(bean.getTypeId())) { + mSelHouseKind = new DicBean(); + mSelHouseKind.setDictionaryId(bean.getTypeId()); + mSelHouseKind.setDictionaryName(bean.getTypeName()); + mTvHouseKind.setText(bean.getTypeName()); + } + if (!TextUtils.isEmpty(bean.getBuildingPurposeId())) { + mSelBuildUse = new DicBean(); + mSelBuildUse.setDictionaryName(bean.getBuildingPurposeName()); + mSelBuildUse.setDictionaryId(bean.getBuildingPurposeId()); + mTvBuildUse.setText(bean.getBuildingPurposeName()); } + if (!TextUtils.isEmpty(bean.getRoomUseId())) { + mSelHouseUse = new DicBean(); + mSelHouseUse.setDictionaryId(bean.getRoomUseId()); + mSelHouseUse.setDictionaryName(bean.getRoomUseName()); + mTvHouseUse.setText(bean.getRoomUseName()); + } + + if (!TextUtils.isEmpty(bean.getDangerId())) { + mSelTrouble = new DicBean(); + mSelTrouble.setDictionaryName(bean.getDangerName()); + mSelTrouble.setDictionaryId(bean.getDangerId()); + mTvTrouble.setText(bean.getDangerName()); + } + mEtHireUse.setText(bean.getRentalPurposes()); + mEtHouseNumber.setText(bean.getRoomNum() + ""); + mEtHouseArea.setText(bean.getRoomArea()); + mEtRightNum.setText(bean.getCertificateNum()); + mTvRegisterDate.setText(bean.getRegistrationDate()); + mEtDept.setText(bean.getAffiliatedUnit()); + mSwIsEmpty.setChecked(1 == bean.getIsVacant()); + mSwIsHire.setChecked(1 == bean.getIsRental()); + if (!TextUtils.isEmpty(bean.getLodgeTypeId())) { + mSelRentingType = new DicBean(); + mSelRentingType.setDictionaryName(bean.getLodgeTypeName()); + mSelRentingType.setDictionaryId(bean.getLodgeTypeId()); + mTvRentingType.setText(bean.getLodgeTypeName()); + } + mEtOwnerName.setText(bean.getHomeowner()); + if (!TextUtils.isEmpty(bean.getDocumentId())) { + mSelOwner = new DicBean(); + mSelOwner.setDictionaryId(bean.getDocumentId()); + mSelOwner.setDictionaryName(bean.getDocumentName()); + mTvOwnerIdCardType.setText(bean.getDocumentName()); + } + mEtOwnerIdCard.setText(bean.getDocumentNum()); + mEtOwnerPhone.setText(bean.getPhone()); + mEtManageName.setText(bean.getCustodian()); + + if (!TextUtils.isEmpty(bean.getCustodianDocumentId())) { + mSelManage = new DicBean(); + mSelManage.setDictionaryId(bean.getCustodianDocumentId()); + mSelManage.setDictionaryName(bean.getCustodianDocumentName()); + mTvManageIdCardType.setText(bean.getCustodianDocumentName()); + } + mEtManageIdCard.setText(bean.getCustodianDocumentNum()); + mEtManagePhone.setText(bean.getCustodianPhone()); + mEtManageRelation.setText(bean.getRelationshipHomeowner()); + getBuildingDetail(bean.getBuildingId()); refreshView(STATE_LOAD_SUCCESS); } + /** + * 获取楼宇详情 + * + * @param buildingId + */ + private void getBuildingDetail(String buildingId) { + ProgressDialog dialog = UIUtil.initDialog(mActivity, "加载中..."); + dialog.show(); + RetrofitManager.getInstance() + .create(LocationApiService.class) + .getNewBuildingDetail(buildingId, UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(Disposable d) { + + } + + @Override + public void onNext(NewBuildingDetailBean newBuildingDetailBean) { + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + String unitNum = newBuildingDetailBean.getUnitNum(); + String floorNum = newBuildingDetailBean.getFloorsNum(); + if (!TextUtils.isEmpty(unitNum)) { + mUnitList = new ArrayList<>(); + try { + int unitInt = Integer.parseInt(unitNum); + for (int i = 0; i < unitInt; i++) { + DicBean b = new DicBean(); + b.setDictionaryName(i + 1 + ""); + mUnitList.add(b); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + if (!TextUtils.isEmpty(floorNum)) { + try { + mFloorList = new ArrayList<>(); + int floorInt = Integer.parseInt(floorNum); + for (int i = 0; i < floorInt; i++) { + DicBean b = new DicBean(); + b.setDictionaryName(i + 1 + ""); + mFloorList.add(b); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Override + public void onError(Throwable e) { + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + ExceptionHandler.handleException(e); + } + + @Override + public void onComplete() { + + } + }); + } + /** * 构建提交参数 * * @return */ private RequestBody buildParams() { - SaveNewBuildingBean bean = new SaveNewBuildingBean(); + SaveNewHouseBean bean = new SaveNewHouseBean(); bean.setStreet(mSelArea4.getId()); bean.setStreetName(mSelArea4.getName()); + bean.setCommunity(mSelArea5.getCommunityId()); bean.setCommunityName(mSelArea5.getCommunityName()); - String name = mEtName.getText().toString().trim(); - bean.setName(name); - String address = mEtAddress.getText().toString().trim(); - bean.setAddress(address); - bean.setLatitude(mSelLat); - bean.setLongitude(mSelLng); - String ids = ""; - for (int i = 0; i < mPhotoAdapter.getData().size(); i++) { - if (!TextUtils.isEmpty(mPhotoAdapter.getData().get(i).getId())) { - ids += mPhotoAdapter.getData().get(i).getId() + ","; - } - } - if (ids.endsWith(",")) { - ids = ids.substring(0, ids.length() - 1); - } - bean.setImage(ids); - - String floor = mEtFloor.getText().toString().trim(); - bean.setFloorsNum(floor); - String num = mEtNum.getText().toString().trim(); - bean.setBuildNum(num); - String unitNum = mEtUnitNum.getText().toString().trim(); - bean.setUnitNum(unitNum); bean.setResidentialId(mSelCommunity.getResidentialId()); bean.setResidentialName(mSelCommunity.getName()); + bean.setBuildingId(mSelBuilding.getBuildingId()); + bean.setBuildingName(mSelBuilding.getName()); + + String unitNum = mTvUnitNum.getText().toString().trim(); + bean.setAffiliationUnit(Integer.parseInt(unitNum)); + String floorNum = mTvFloorNum.getText().toString().trim(); + bean.setAffiliationFloors(Integer.parseInt(floorNum)); + String door = mEtDoor.getText().toString().trim(); + bean.setHouseNum(Integer.parseInt(door)); + + bean.setCategoryId(mSelHouseType.getDictionaryId()); + bean.setCategoryName(mSelHouseType.getDictionaryName()); + + bean.setNatureId(mHouseProperty.getDictionaryId()); + bean.setNatureName(mHouseProperty.getDictionaryName()); + + bean.setStructureId(mSelHouseFrame.getDictionaryId()); + bean.setStructureName(mSelHouseFrame.getDictionaryName()); + + bean.setTypeId(mSelHouseKind.getDictionaryId()); + bean.setTypeName(mSelHouseKind.getDictionaryName()); + + bean.setBuildingPurposeId(mSelBuildUse.getDictionaryId()); + bean.setBuildingPurposeName(mSelBuildUse.getDictionaryName()); + + bean.setRoomUseId(mSelHouseUse.getDictionaryId()); + bean.setRoomUseName(mSelHouseUse.getDictionaryName()); + + bean.setDangerId(mSelTrouble.getDictionaryId()); + bean.setDangerName(mSelTrouble.getDictionaryName()); + String houseNumber = mEtHouseNumber.getText().toString().trim(); + if (!TextUtils.isEmpty(houseNumber)) { + bean.setRoomNum(Integer.parseInt(houseNumber)); + } + String houseArea = mEtHouseArea.getText().toString().trim(); + bean.setRoomArea(houseArea); + String rightNum = mEtRightNum.getText().toString().trim(); + bean.setCertificateNum(rightNum); + String registerDate = mTvRegisterDate.getText().toString().trim(); + bean.setRegistrationDate(registerDate); + String dept = mEtDept.getText().toString().trim(); + bean.setAffiliatedUnit(dept); + bean.setIsRental(mSwIsHire.isChecked() ? 1 : 0); + bean.setIsVacant(mSwIsEmpty.isChecked() ? 1 : 0); + String hireUse = mEtHireUse.getText().toString().trim(); + bean.setRentalPurposes(hireUse); + if (mSelRentingType != null) { + bean.setLodgeTypeId(mSelRentingType.getDictionaryId()); + bean.setLodgeTypeName(mSelRentingType.getDictionaryName()); + } + String ownerName = mEtOwnerName.getText().toString().trim(); + bean.setHomeowner(ownerName); + String ownerCardType = mTvOwnerIdCardType.getText().toString().trim(); + if (!TextUtils.isEmpty(ownerCardType)) { + bean.setDocumentId(mSelOwner.getDictionaryId()); + bean.setDocumentName(mSelOwner.getDictionaryName()); + } + String ownerIdCard = mEtOwnerIdCard.getText().toString().trim(); + bean.setDocumentNum(ownerIdCard); + String ownerPhone = mEtOwnerPhone.getText().toString().trim(); + bean.setPhone(ownerPhone); + String mName = mEtManageName.getText().toString().trim(); + bean.setCustodian(mName); + if (mSelManage != null) { + bean.setCustodianDocumentId(mSelManage.getDictionaryId()); + bean.setCustodianDocumentName(mSelManage.getDictionaryName()); + } + String mIdCard = mEtManageIdCard.getText().toString().trim(); + bean.setCustodianDocumentNum(mIdCard); + String managePhone = mEtManagePhone.getText().toString().trim(); + bean.setCustodianPhone(managePhone); + String relation = mEtManageRelation.getText().toString().trim(); + bean.setRelationshipHomeowner(relation); Gson gson = new Gson(); String obj = gson.toJson(bean); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj); @@ -878,41 +1194,4 @@ public class NewHouseAddActivity extends BaseActivity { } - @Override - protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if (resultCode == RESULT_OK) { - switch (requestCode) { - case BaseUrlApi.CAMERA_REQUEST://相机 - uploadImg(mPicPath, 1); - break; - case BaseUrlApi.PHOTO_REQUEST://相册 - try { - if (data == null) return; - Uri uri = data.getData(); - String[] proj = {MediaStore.Images.Media.DATA}; - Cursor cursor = managedQuery(uri, proj, null, null, null); - int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); - cursor.moveToFirst(); - String srcPath = cursor.getString(column_index); - uploadImg(srcPath, 2); - } catch (Exception e) { - e.printStackTrace(); - } - break; - case 1234: - String lo = data.getStringExtra("lo"); - String la = data.getStringExtra("la"); - String address = data.getStringExtra("address"); - mSelLat = la; - mSelLng = lo; - mTvPoint.setText("经纬度:" + mSelLat + "-" + mSelLng); - Double laD = Double.parseDouble(la); - Double loD = Double.parseDouble(lo); - addMarker(new LatLng(laD, loD)); - mEtAddress.setText(address); - break; - } - } - super.onActivityResult(requestCode, resultCode, data); - } } \ No newline at end of file diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseDetailActivity.java b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseDetailActivity.java index f924b20..fb6b122 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseDetailActivity.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/activitys/NewHouseDetailActivity.java @@ -4,40 +4,29 @@ import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Intent; import android.support.annotation.Nullable; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.view.View; import android.widget.Button; -import android.widget.ImageView; -import android.widget.LinearLayout; +import android.widget.Switch; import android.widget.TextView; -import com.google.gson.Gson; import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager; import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity; -import com.sucstepsoft.cm_utils.core.widget.views.CenterInputDialogView; import com.sucstepsoft.cm_utils.utils.ToastUtils; import com.sucstepsoft.cm_utils.utils.UIUtil; import com.sucstepsoft.cm_utils.utils.UserLgUtils; import com.sucstepsoft.realtimelocation.R; -import com.sucstepsoft.realtimelocation.adapters.NewHousePersonAdapter; -import com.sucstepsoft.realtimelocation.beans.BuildHouseDetailBean; +import com.sucstepsoft.realtimelocation.beans.NewHouseDetailBean; import com.sucstepsoft.realtimelocation.beans.SuccessBean; import com.sucstepsoft.realtimelocation.net.LocationApiService; import com.sucstepsoft.realtimelocation.utils.ExceptionHandler; -import java.util.ArrayList; -import java.util.List; - import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import io.reactivex.Observer; import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.annotations.NonNull; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; -import okhttp3.MediaType; -import okhttp3.RequestBody; /** * 作者: Adam @@ -46,33 +35,76 @@ import okhttp3.RequestBody; * 描述: 房屋详情 */ public class NewHouseDetailActivity extends BaseActivity { - - - @BindView(R.id.iv_del) - ImageView mIvDel; - @BindView(R.id.tv_build_num) - TextView mTvBuildNum; + @BindView(R.id.tv_street) + TextView mTvStreet; + @BindView(R.id.tv_community) + TextView mTvCommunity; + @BindView(R.id.tv_community_area) + TextView mTvCommunityArea; + @BindView(R.id.tv_building_num) + TextView mTvBuildingNum; + @BindView(R.id.tv_unit_num) + TextView mTvUnitNum; + @BindView(R.id.tv_floor_num) + TextView mTvFloorNum; + @BindView(R.id.tv_door) + TextView mTvDoor; + @BindView(R.id.tv_house_type) + TextView mTvHouseType; + @BindView(R.id.tv_house_property) + TextView mTvHouseProperty; + @BindView(R.id.tv_house_kind) + TextView mTvHouseKind; + @BindView(R.id.tv_house_frame) + TextView mTvHouseFrame; + @BindView(R.id.tv_build_use) + TextView mTvBuildUse; + @BindView(R.id.tv_house_use) + TextView mTvHouseUse; + @BindView(R.id.tv_trouble) + TextView mTvTrouble; + @BindView(R.id.tv_house_number) + TextView mTvHouseNumber; + @BindView(R.id.tv_house_area) + TextView mTvHouseArea; + @BindView(R.id.tv_right_num) + TextView mTvRightNum; + @BindView(R.id.tv_register_date) + TextView mTvRegisterDate; + @BindView(R.id.tv_dept) + TextView mTvDept; + @BindView(R.id.sw_is_hire) + Switch mSwIsHire; + @BindView(R.id.sw_is_empty) + Switch mSwIsEmpty; + @BindView(R.id.tv_renting_type) + TextView mTvRentingType; + @BindView(R.id.tv_hire_use) + TextView mTvHireUse; @BindView(R.id.tv_owner_name) TextView mTvOwnerName; + @BindView(R.id.tv_owner_id_card_type) + TextView mTvOwnerIdCardType; + @BindView(R.id.tv_owner_id_card) + TextView mTvOwnerIdCard; @BindView(R.id.tv_owner_phone) TextView mTvOwnerPhone; - @BindView(R.id.tv_type) - TextView mTvType; - @BindView(R.id.ll_content) - LinearLayout mLlContent; - @BindView(R.id.btn_confirm) - Button mBtnConfirm; - @BindView(R.id.tv_hint) - TextView mTvHint; - @BindView(R.id.rlv_person) - RecyclerView mRlvPerson; - @BindView(R.id.ll_person) - LinearLayout mLlPerson; - private Unbinder mBind; + @BindView(R.id.tv_manage_name) + TextView mTvManageName; + @BindView(R.id.tv_manage_id_card_type) + TextView mTvManageIdCardType; + @BindView(R.id.tv_manage_id_card) + TextView mTvManageIdCard; + @BindView(R.id.tv_manage_phone) + TextView mTvManagePhone; + @BindView(R.id.tv_manage_relation) + TextView mTvManageRelation; + @BindView(R.id.btn_del) + Button mBtnDel; + @BindView(R.id.btn_edit) + Button mBtnEdit; private String mId; - private BuildHouseDetailBean mDetailBean; - private List mPersons; - private NewHousePersonAdapter mAdapter; + private Unbinder mBind; @Override protected int setLayoutId() { @@ -82,337 +114,147 @@ public class NewHouseDetailActivity extends BaseActivity { @Override public void initData() { mBind = ButterKnife.bind(this); - mTvBaseTitle.setText("房屋详情"); - mTvPublish.setVisibility(View.VISIBLE); - mTvPublish.setText("编辑"); - mTvPublish.setOnClickListener(v -> { - Intent intent = new Intent(); - intent.putExtra("id", mId); - intent.setClass(mActivity, NewEditHouseActivity.class); - startActivityForResult(intent, 12); - }); + mTvBaseTitle.setText("详情"); refreshView(STATE_LOAD_LOADING); mId = getIntent().getStringExtra("id"); - getHouseDetail(); - mPersons = new ArrayList<>(); - mAdapter = new NewHousePersonAdapter(mActivity, mPersons); - mRlvPerson.setLayoutManager(new LinearLayoutManager(mActivity)); - mRlvPerson.setAdapter(mAdapter); - mAdapter.addOnEditListener(new NewHousePersonAdapter.OnEditListener() { - @Override - public void onDel(com.sucstepsoft.cm_utils.core.retrofit_net.bean.BindPersonBean.RowsBean bean, int pos) { - doDelPerson(bean, pos); - } - - @Override - public void onEdit(com.sucstepsoft.cm_utils.core.retrofit_net.bean.BindPersonBean.RowsBean b, int pos) { - - } - }); - mBtnConfirm.setOnClickListener(v -> { - Intent intent = new Intent(mActivity, NewBindPersonActivity.class); - intent.putExtra("id", mId); - startActivityForResult(intent, 12); - }); - mIvDel.setOnClickListener(v -> doDelHose()); + initContentView(); + getDetailById(); } /** - * 删除绑定人员 + * 获取详情 */ - private void doDelPerson(com.sucstepsoft.cm_utils.core.retrofit_net.bean.BindPersonBean.RowsBean bean, int pos) { - new AlertDialog.Builder(mActivity) - .setTitle("警告") - .setMessage("确定要删除该人员吗?") - .setPositiveButton("确定", (dialog, which) -> { - dialog.dismiss(); - confirmDel(bean, pos); - }) - .setNegativeButton("取消", (dialog, which) -> dialog.dismiss()) - .create().show(); - } - - /** - * 确认删除 - */ - private void confirmDel(com.sucstepsoft.cm_utils.core.retrofit_net.bean.BindPersonBean.RowsBean bean, int pos) { - ProgressDialog dialog = UIUtil.initDialog(mActivity, "删除中..."); - dialog.dismiss(); - com.sucstepsoft.realtimelocation.beans.BindPersonBean saveBean = new com.sucstepsoft.realtimelocation.beans.BindPersonBean(); - saveBean.setBuildingHouseId(mId); - saveBean.setIdCardNumber(bean.getIdCardNumber()); - Gson gson = new Gson(); - String obj = gson.toJson(saveBean); - RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj); + private void getDetailById() { RetrofitManager.getInstance() - .create(LocationApiService.class) - .doDelNewBindPerson(body, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { - @Override - public void onSubscribe(Disposable d) { + .create(LocationApiService.class) + .getNewHouseDetail(mId, UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(Disposable d) { - } + } - @Override - public void onNext(SuccessBean successBean) { - dialog.dismiss(); - ToastUtils.showShort("删除成功"); - getBindPersonList(); - } + @Override + public void onNext(NewHouseDetailBean newCommunityDetailBean) { + setDataToView(newCommunityDetailBean); + } - @Override - public void onError(Throwable e) { - dialog.dismiss(); - ExceptionHandler.handleException(e); - } + @Override + public void onError(Throwable e) { + refreshView(STATE_LOAD_ERROR); + ExceptionHandler.handleException(e); + } - @Override - public void onComplete() { + @Override + public void onComplete() { - } - }); + } + }); } + /** + * 显示内容 + */ + private void setDataToView(NewHouseDetailBean bean) { + mTvStreet.setText(bean.getStreetName()); + mTvCommunity.setText(bean.getCommunityName()); + mTvCommunityArea.setText(bean.getResidentialName()); + mTvBuildingNum.setText(bean.getBuildingName()); + mTvUnitNum.setText(bean.getAffiliationUnit() + ""); + mTvFloorNum.setText(bean.getAffiliationFloors() + ""); + mTvDoor.setText(bean.getHouseNum() + ""); + mTvHouseType.setText(bean.getCategoryName()); + mTvHouseProperty.setText(bean.getNatureName()); + mTvHouseKind.setText(bean.getTypeName()); + mTvBuildUse.setText(bean.getBuildingPurposeName()); + mTvHouseUse.setText(bean.getRoomUseName()); + mTvTrouble.setText(bean.getDangerName()); + mTvHouseNumber.setText(bean.getRoomNum() + ""); + mTvHouseArea.setText(bean.getRoomArea()); + mTvRightNum.setText(bean.getCertificateNum() + ""); + mTvHouseFrame.setText(bean.getStructureName()); + mTvRegisterDate.setText(bean.getRegistrationDate()); + mTvDept.setText(bean.getAffiliatedUnit()); + mSwIsEmpty.setChecked(1 == bean.getIsVacant()); + mTvHireUse.setText(bean.getRentalPurposes()); + mSwIsHire.setChecked(1 == bean.getIsRental()); + mTvRentingType.setText(bean.getLodgeTypeName()); + mTvOwnerName.setText(bean.getHomeowner()); + mTvOwnerIdCardType.setText(bean.getDocumentName()); + mTvOwnerIdCard.setText(bean.getDocumentNum() + ""); + mTvOwnerPhone.setText(bean.getPhone()); + mTvManageName.setText(bean.getCustodian()); + mTvManageIdCardType.setText(bean.getCustodianDocumentName()); + mTvManageIdCard.setText(bean.getCustodianDocumentNum()); + mTvManagePhone.setText(bean.getCustodianPhone()); + mTvManageRelation.setText(bean.getRelationshipHomeowner()); + refreshView(STATE_LOAD_SUCCESS); + } + + private void initContentView() { + + mBtnEdit.setOnClickListener(v -> { + Intent intent = new Intent(mActivity, NewHouseAddActivity.class); + intent.putExtra("id", mId); + intent.putExtra("title", "房屋信息编辑"); + startActivityForResult(intent, 1234); + }); + mBtnDel.setOnClickListener(v -> doDel()); + } + + private void doDel() { + AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); + builder.setTitle("提示") + .setMessage("确定要删除该小区信息吗?") + .setPositiveButton("确定", (dialog, which) -> { + dialog.dismiss(); + ProgressDialog dialog1 = UIUtil.initDialog(mActivity, "删除中..."); + dialog1.show(); + RetrofitManager.getInstance() + .create(LocationApiService.class) + .doDelNewHouse(mId, UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(@NonNull Disposable d) { + + } + + @Override + public void onNext(@NonNull SuccessBean successBean) { + ToastUtils.showShort("删除成功"); + dialog1.dismiss(); + setResult(RESULT_OK); + finish(); + } + + @Override + public void onError(@NonNull Throwable e) { + dialog1.dismiss(); + ExceptionHandler.handleException(e); + } + + @Override + public void onComplete() { + + } + }); + }) + .setNegativeButton("取消", (dialog, which) -> dialog.dismiss()) + .create() + .show(); + } + + @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if (requestCode == 12) { - if (resultCode == 123) { - refreshView(STATE_LOAD_LOADING); - getHouseDetail(); - } + if (resultCode == RESULT_OK) { + refreshView(STATE_LOAD_LOADING); + getDetailById(); } super.onActivityResult(requestCode, resultCode, data); } - - /** - * 删除 - */ - private void doDelHose() { - AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); - builder.setTitle("警告") - .setMessage("确定要删除该房屋吗?") - .setPositiveButton("确定", (dialog, which) -> { - dialog.dismiss(); - ProgressDialog pDialog = UIUtil.initDialog(mActivity, "删除中..."); - pDialog.show(); - RetrofitManager.getInstance() - .create(LocationApiService.class) - .doDelHouseTenement(mId, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onNext(SuccessBean successBean) { - Intent intent = new Intent(); - intent.putExtra("isRefresh", true); - setResult(123, intent); - pDialog.dismiss(); - ToastUtils.showShort("删除成功"); - finish(); - } - - @Override - public void onError(Throwable e) { - pDialog.dismiss(); - ExceptionHandler.handleException(e); - } - - @Override - public void onComplete() { - - } - }); - }) - .setNegativeButton("取消", (dialog, which) -> dialog.dismiss()) - .create() - .show(); - - } - - /** - * 显示绑定弹窗 - */ - private void showBindDialog() { - CenterInputDialogView build = new CenterInputDialogView.DialogBuilder(mActivity) - .setIscancelable(true) - .setIsBackCancelable(true) - .build(); - build.addOnChoseListener(new CenterInputDialogView.OnChoseListener() { - @Override - public void choseFile() { - } - - @Override - public void choseAlbum() { - } - - @Override - public void choseShoot() { - } - - @Override - public void loginOut() { - - } - - @Override - public void changePwd() { - } - - @Override - public void bindPerson(String name, String gender, String phone, String idCard) { - doBindPerson(name, gender, phone, idCard); - build.dismiss(); - } - }); - build.show(); - } - - /** - * 绑定人员 - */ - private void doBindPerson(String name, String gender, String phone, String idCard) { -// ProgressDialog dialog = UIUtil.initDialog(mActivity, "添加中..."); -// dialog.show(); -// BindPersonBean bean = new BindPersonBean(); -// bean.setBuildingHouseId(mId); -// bean.setName(name); -// bean.setSex(gender); -// bean.setPhone(phone); -// bean.setCardNumber(idCard); -// Gson gson = new Gson(); -// String obj = gson.toJson(bean); -// RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj); -// RetrofitManager.getInstance() -// .create(LocationApiService.class) -// .doBindPerson(body, UserLgUtils.getToken()) -// .subscribeOn(Schedulers.io()) -// .observeOn(AndroidSchedulers.mainThread()) -// .subscribe(new Observer() { -// @Override -// public void onSubscribe(Disposable d) { -// -// } -// -// @Override -// public void onNext(SuccessBean successBean) { -// mTvHint.setVisibility(View.GONE); -// mRlvPerson.setVisibility(View.VISIBLE); -// HousePersonListBean.RowsBean rowsBean = new HousePersonListBean.RowsBean(); -// rowsBean.setName(name); -// rowsBean.setPhone(phone); -// rowsBean.setSex(gender); -// mPersons.add(rowsBean); -// mAdapter.setData(mPersons); -// dialog.dismiss(); -// ToastUtils.showShort("添加成功"); -// } -// -// @Override -// public void onError(Throwable e) { -// dialog.dismiss(); -// ExceptionHandler.handleException(e); -// } -// -// @Override -// public void onComplete() { -// -// } -// }); - } - - private void getHouseDetail() { - RetrofitManager.getInstance() - .create(LocationApiService.class) - .getHouseDetailById(mId, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onNext(BuildHouseDetailBean bean) { - mDetailBean = bean; - //获取绑定的人员 - getBindPersonList(); - setDataToView(); - } - - @Override - public void onError(Throwable e) { - - } - - @Override - public void onComplete() { - - } - }); - } - - private void getBindPersonList() { - ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中..."); - dialog.show(); - RetrofitManager.getInstance() - .create(LocationApiService.class) - .getBindPersonList(mId, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer>() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onNext(List rowsBeans) { - mPersons = rowsBeans; - if (mPersons != null && mPersons.size() > 0) { - mTvHint.setVisibility(View.GONE); - mRlvPerson.setVisibility(View.VISIBLE); - } else { - mTvHint.setVisibility(View.VISIBLE); - mRlvPerson.setVisibility(View.GONE); - } - mAdapter.setData(mPersons); - dialog.dismiss(); - } - - @Override - public void onError(Throwable e) { - dialog.dismiss(); - ExceptionHandler.handleException(e); - } - - @Override - public void onComplete() { - - } - }); - } - - @Override - protected void onStart() { - super.onStart(); - refreshView(STATE_LOAD_LOADING); - getHouseDetail(); - } - - private void setDataToView() { - refreshView(STATE_LOAD_SUCCESS); - mTvBuildNum.setText(mDetailBean.getHouseName());//房屋编号(名称) - mTvOwnerName.setText(mDetailBean.getOwnerName());//户主姓名 - mTvOwnerPhone.setText(mDetailBean.getOwnerPhone());//户主联系电话 - mTvType.setText(mDetailBean.getHouseStatus());//房屋状态 - } } \ No newline at end of file diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/fragments/HouseManageNewFragment.java b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/fragments/HouseManageNewFragment.java index 42a6e45..3af0a6f 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/fragments/HouseManageNewFragment.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/activitys/census/newhouse/fragments/HouseManageNewFragment.java @@ -1,16 +1,35 @@ package com.sucstepsoft.realtimelocation.activitys.census.newhouse.fragments; import android.app.Activity; -import android.content.Context; +import android.content.Intent; import android.os.Bundle; +import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; +import com.jcodecraeer.xrecyclerview.ProgressStyle; +import com.jcodecraeer.xrecyclerview.XRecyclerView; +import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager; import com.sucstepsoft.cm_utils.core.widget.base.LazyFragment; +import com.sucstepsoft.cm_utils.utils.ToastUtils; +import com.sucstepsoft.cm_utils.utils.UserLgUtils; import com.sucstepsoft.realtimelocation.R; +import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewHouseAddActivity; +import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewHouseDetailActivity; +import com.sucstepsoft.realtimelocation.adapters.NewHouseAdapter; +import com.sucstepsoft.realtimelocation.beans.NewHouseBean; +import com.sucstepsoft.realtimelocation.net.LocationApiService; +import java.util.ArrayList; +import java.util.List; + +import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; +import io.reactivex.Observer; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; +import io.reactivex.schedulers.Schedulers; /** * 作者: adam @@ -19,6 +38,14 @@ import butterknife.Unbinder; * 描述: 房屋管理 */ public class HouseManageNewFragment extends LazyFragment { + + @BindView(R.id.rlv_items) + XRecyclerView mRlvItems; + private List mDatas; + private NewHouseAdapter mAdapter; + private int mCurPage = 1; + private Disposable mDisposable; + private Activity mActivity; private Unbinder mBind; @@ -28,12 +55,154 @@ public class HouseManageNewFragment extends LazyFragment { View view = LayoutInflater.from(mActivity).inflate(R.layout.fragment_house_manage_new, null); setContentView(view); mBind = ButterKnife.bind(this, view); + mDatas = new ArrayList<>(); + mAdapter = new NewHouseAdapter(mActivity, mDatas, 2); + LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity); + layoutManager.setOrientation(LinearLayoutManager.VERTICAL); + mRlvItems.setLayoutManager(layoutManager); + mRlvItems.setAdapter(mAdapter); + mAdapter.addOnItemClickListener(bean -> showIssueDetail(bean)); + mRlvItems.setNoMore(true); + mRlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat); + mRlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman); + mRlvItems.setLoadingListener(new XRecyclerView.LoadingListener() { + @Override + public void onRefresh() { + refresh(); + } + + @Override + public void onLoadMore() { + loadMore(); + } + }); + getHouseList(1); + } + + /** + * 显示详情 + * + * @param bean + */ + private void showIssueDetail(NewHouseBean.RowsBean bean) { + Intent intent = new Intent(); + intent.putExtra("id", bean.getHouseId()); + intent.setClass(mActivity, NewHouseDetailActivity.class); + startActivityForResult(intent, 1234); + } + + @Override + protected void onFragmentStartLazy() { + super.onFragmentStartLazy(); + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + this.mActivity = activity; } @Override - public void onAttach(Context context) { - super.onAttach(context); - this.mActivity = getActivity(); + protected void onDestroyViewLazy() { + super.onDestroyViewLazy(); + mRlvItems.destroy(); + if (mDisposable != null && !mDisposable.isDisposed()) { + mDisposable.dispose(); + } + mRlvItems = null; + mBind.unbind(); + mAdapter = null; + mDatas = null; + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode == Activity.RESULT_OK) { + refresh(); + } + super.onActivityResult(requestCode, resultCode, data); + } + + + @Override + public void startAddActivity(String id) { + Intent intent = new Intent(mActivity, NewHouseAddActivity.class); + intent.putExtra("title", "房屋信息录入"); + startActivityForResult(intent, 1234); + } + + /** + * 待下派 + */ + private void getHouseList(int page) { + mCurPage = page; + RetrofitManager.getInstance() + .create(LocationApiService.class) + .getNewHouseList(page + "", "", UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(Disposable d) { + mDisposable = d; + } + + @Override + public void onNext(NewHouseBean newsListBean) { + if (newsListBean != null && newsListBean.getRows() != null && newsListBean.getRows().size() > 0) { + ++mCurPage; + if (page == 1) { + mDatas.clear(); + mDatas.addAll(newsListBean.getRows()); + } else { + mDatas.addAll(newsListBean.getRows()); + } + mAdapter.notifyDataSetChanged(); + mRlvItems.refreshComplete(); + if (mDatas.size() >= newsListBean.getTotal()) { + mRlvItems.loadMoreComplete(); + mRlvItems.setNoMore(true); + } else { + mRlvItems.loadMoreComplete(); + mRlvItems.setNoMore(false); + } + } else { + if (page > 1) { + mRlvItems.loadMoreComplete(); + mRlvItems.setNoMore(true); + } else { + //无数据 + mRlvItems.refreshComplete(); + mRlvItems.setNoMore(true); + ToastUtils.showShort("暂无数据"); + } + } + } + + @Override + public void onError(Throwable e) { + e.printStackTrace(); + if (mRlvItems != null) { + mRlvItems.refreshComplete(); + mRlvItems.loadMoreComplete(); + } + ToastUtils.showShort("数据加载失败,请稍后重试"); + } + + @Override + public void onComplete() { + + } + }); + } + + + private void refresh() { + getHouseList(1); + } + + private void loadMore() { + getHouseList(mCurPage); } } diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/NewHouseAdapter.java b/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/NewHouseAdapter.java new file mode 100644 index 0000000..c29a6be --- /dev/null +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/NewHouseAdapter.java @@ -0,0 +1,69 @@ +package com.sucstepsoft.realtimelocation.adapters; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter; +import com.sucstepsoft.realtimelocation.R; +import com.sucstepsoft.realtimelocation.adapters.holders.NewHouseHolder; +import com.sucstepsoft.realtimelocation.beans.NewHouseBean; + +import java.util.List; + +/** + * 作者: adam + * 日期: 2020/11/17 - 1:22 PM + * 邮箱: itgaojian@163.com + * 描述: 人口adapter + */ +public class NewHouseAdapter extends BaseRecyclerAdapter { + private int mType = 1; + + public NewHouseAdapter(Context ctx, List list) { + super(ctx, list); + } + + public NewHouseAdapter(Context ctx, List list, int type) { + super(ctx, list); + this.mType = type; + } + + + @Override + public NewHouseHolder createHolder(ViewGroup parent, int viewType) { + View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_community_sel_new, parent, false); + return new NewHouseHolder(itemView); + } + + @Override + public void bindHolder(NewHouseHolder censusPersonHolder, int i) { + NewHouseBean.RowsBean bean = mData.get(i); + censusPersonHolder.mTvAreaName.setText(bean.getStreetName()); + censusPersonHolder.mTvDistrictName.setText(bean.getBuildingName() + "(" + bean.getHouseNum() + ")"); + censusPersonHolder.mTvCommunityName.setText(bean.getCommunityName()); + censusPersonHolder.mTvUnit.setVisibility(View.VISIBLE); + censusPersonHolder.mTvUnit.setText(bean.getResidentialName()); + censusPersonHolder.mTvBuilding.setVisibility(View.GONE); + censusPersonHolder.mTvAddress.setVisibility(View.GONE); + if (mType == 1) { + censusPersonHolder.mBtnConfirm.setVisibility(View.VISIBLE); + censusPersonHolder.mBtnConfirm.setOnClickListener(v -> mEditListener.onEdit(bean, i)); + } else { + censusPersonHolder.mBtnConfirm.setVisibility(View.GONE); + } + } + + private OnEditListener mEditListener; + + public void addOnEditListener(OnEditListener mListener) { + this.mEditListener = mListener; + } + + public interface OnEditListener { + void onDel(NewHouseBean.RowsBean bean, int pos); + + void onEdit(NewHouseBean.RowsBean bean, int pos); + } +} diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/holders/NewHouseHolder.java b/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/holders/NewHouseHolder.java new file mode 100644 index 0000000..c0ea7fb --- /dev/null +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/adapters/holders/NewHouseHolder.java @@ -0,0 +1,36 @@ +package com.sucstepsoft.realtimelocation.adapters.holders; + +import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.sucstepsoft.realtimelocation.R; + +/** + * 作者: adam + * 日期: 2021/7/9 - 3:22 下午 + * 邮箱: itgaojian@163.com + * 描述: + */ +public class NewHouseHolder extends RecyclerView.ViewHolder { + public TextView mTvAreaName;//街道名称 + public TextView mTvCommunityName;//社区名称 + public TextView mTvDistrictName;//小区名称 + public Button mBtnConfirm;//选择 + public TextView mTvAddress;//详细地址 + public TextView mTvUnit;//小区 + public TextView mTvBuilding; + + public NewHouseHolder(@NonNull View itemView) { + super(itemView); + mTvAreaName = itemView.findViewById(R.id.tv_area); + mTvCommunityName = itemView.findViewById(R.id.tv_community); + mTvDistrictName = itemView.findViewById(R.id.tv_district); + mBtnConfirm = itemView.findViewById(R.id.btn_confirm); + mTvAddress = itemView.findViewById(R.id.tv_location); + mTvUnit = itemView.findViewById(R.id.tv_unit); + mTvBuilding = itemView.findViewById(R.id.tv_building); + } +} diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewBuildingBean.java b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewBuildingBean.java index 7824745..ee22250 100644 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewBuildingBean.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewBuildingBean.java @@ -1,5 +1,7 @@ package com.sucstepsoft.realtimelocation.beans; +import com.contrarywind.interfaces.IPickerViewData; + import java.util.List; public class NewBuildingBean { @@ -32,14 +34,14 @@ public class NewBuildingBean { this.total = total; } - public static class RowsBean { + public static class RowsBean implements IPickerViewData { private String address; - private int buildNum; + private String buildNum; private String buildingId; private String community; private String communityName; private String creator; - private int floorsNum; + private String floorsNum; private String gmtCreate; private String gmtModified; private String image; @@ -52,7 +54,7 @@ public class NewBuildingBean { private String residentialName; private String street; private String streetName; - private int unitNum; + private String unitNum; public String getAddress() { return address; @@ -62,13 +64,6 @@ public class NewBuildingBean { this.address = address; } - public int getBuildNum() { - return buildNum; - } - - public void setBuildNum(int buildNum) { - this.buildNum = buildNum; - } public String getBuildingId() { return buildingId; @@ -102,13 +97,6 @@ public class NewBuildingBean { this.creator = creator; } - public int getFloorsNum() { - return floorsNum; - } - - public void setFloorsNum(int floorsNum) { - this.floorsNum = floorsNum; - } public String getGmtCreate() { return gmtCreate; @@ -206,12 +194,33 @@ public class NewBuildingBean { this.streetName = streetName; } - public int getUnitNum() { + public String getBuildNum() { + return buildNum; + } + + public void setBuildNum(String buildNum) { + this.buildNum = buildNum; + } + + public String getFloorsNum() { + return floorsNum; + } + + public void setFloorsNum(String floorsNum) { + this.floorsNum = floorsNum; + } + + public String getUnitNum() { return unitNum; } - public void setUnitNum(int unitNum) { + public void setUnitNum(String unitNum) { this.unitNum = unitNum; } + + @Override + public String getPickerViewText() { + return name; + } } } diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseBean.java b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseBean.java new file mode 100644 index 0000000..e21b537 --- /dev/null +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseBean.java @@ -0,0 +1,532 @@ +package com.sucstepsoft.realtimelocation.beans; + +import java.util.List; + +public class NewHouseBean { + + private int page; + private List rows; + private int total; + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String affiliatedUnit; + private int affiliationFloors; + private int affiliationUnit; + private String buildingId; + private String buildingName; + private String buildingPurposeId; + private String buildingPurposeName; + private String categoryId; + private String categoryName; + private String certificateNum; + private String community; + private String communityName; + private String creator; + private String custodian; + private String custodianDocumentId; + private String custodianDocumentName; + private String custodianDocumentNum; + private String custodianPhone; + private String dangerId; + private String dangerName; + private String documentId; + private String documentName; + private String documentNum; + private int floorsNum; + private String gmtCreate; + private String gmtModified; + private String homeowner; + private String houseId; + private int houseNum; + private String houseType; + private int isDelete; + private int isRental; + private int isVacant; + private String lodgeTypeId; + private String lodgeTypeName; + private String modifier; + private String natureId; + private String natureName; + private String phone; + private String registrationDate; + private String relationshipHomeowner; + private String rentalPurposes; + private String residentialId; + private String residentialName; + private String roomArea; + private int roomNum; + private String roomUseId; + private String roomUseName; + private String street; + private String streetName; + private String structureId; + private String structureName; + private String typeId; + private String typeName; + private int unitNum; + + public String getAffiliatedUnit() { + return affiliatedUnit; + } + + public void setAffiliatedUnit(String affiliatedUnit) { + this.affiliatedUnit = affiliatedUnit; + } + + public int getAffiliationFloors() { + return affiliationFloors; + } + + public void setAffiliationFloors(int affiliationFloors) { + this.affiliationFloors = affiliationFloors; + } + + public int getAffiliationUnit() { + return affiliationUnit; + } + + public void setAffiliationUnit(int affiliationUnit) { + this.affiliationUnit = affiliationUnit; + } + + public String getBuildingId() { + return buildingId; + } + + public void setBuildingId(String buildingId) { + this.buildingId = buildingId; + } + + public String getBuildingName() { + return buildingName; + } + + public void setBuildingName(String buildingName) { + this.buildingName = buildingName; + } + + public String getBuildingPurposeId() { + return buildingPurposeId; + } + + public void setBuildingPurposeId(String buildingPurposeId) { + this.buildingPurposeId = buildingPurposeId; + } + + public String getBuildingPurposeName() { + return buildingPurposeName; + } + + public void setBuildingPurposeName(String buildingPurposeName) { + this.buildingPurposeName = buildingPurposeName; + } + + public String getCategoryId() { + return categoryId; + } + + public void setCategoryId(String categoryId) { + this.categoryId = categoryId; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCertificateNum() { + return certificateNum; + } + + public void setCertificateNum(String certificateNum) { + this.certificateNum = certificateNum; + } + + public String getCommunity() { + return community; + } + + public void setCommunity(String community) { + this.community = community; + } + + public String getCommunityName() { + return communityName; + } + + public void setCommunityName(String communityName) { + this.communityName = communityName; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCustodian() { + return custodian; + } + + public void setCustodian(String custodian) { + this.custodian = custodian; + } + + public String getCustodianDocumentId() { + return custodianDocumentId; + } + + public void setCustodianDocumentId(String custodianDocumentId) { + this.custodianDocumentId = custodianDocumentId; + } + + public String getCustodianDocumentName() { + return custodianDocumentName; + } + + public void setCustodianDocumentName(String custodianDocumentName) { + this.custodianDocumentName = custodianDocumentName; + } + + public String getCustodianDocumentNum() { + return custodianDocumentNum; + } + + public void setCustodianDocumentNum(String custodianDocumentNum) { + this.custodianDocumentNum = custodianDocumentNum; + } + + public String getCustodianPhone() { + return custodianPhone; + } + + public void setCustodianPhone(String custodianPhone) { + this.custodianPhone = custodianPhone; + } + + public String getDangerId() { + return dangerId; + } + + public void setDangerId(String dangerId) { + this.dangerId = dangerId; + } + + public String getDangerName() { + return dangerName; + } + + public void setDangerName(String dangerName) { + this.dangerName = dangerName; + } + + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public String getDocumentName() { + return documentName; + } + + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + public String getDocumentNum() { + return documentNum; + } + + public void setDocumentNum(String documentNum) { + this.documentNum = documentNum; + } + + public int getFloorsNum() { + return floorsNum; + } + + public void setFloorsNum(int floorsNum) { + this.floorsNum = floorsNum; + } + + public String getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(String gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public String getGmtModified() { + return gmtModified; + } + + public void setGmtModified(String gmtModified) { + this.gmtModified = gmtModified; + } + + public String getHomeowner() { + return homeowner; + } + + public void setHomeowner(String homeowner) { + this.homeowner = homeowner; + } + + public String getHouseId() { + return houseId; + } + + public void setHouseId(String houseId) { + this.houseId = houseId; + } + + public int getHouseNum() { + return houseNum; + } + + public void setHouseNum(int houseNum) { + this.houseNum = houseNum; + } + + public String getHouseType() { + return houseType; + } + + public void setHouseType(String houseType) { + this.houseType = houseType; + } + + public int getIsDelete() { + return isDelete; + } + + public void setIsDelete(int isDelete) { + this.isDelete = isDelete; + } + + public int getIsRental() { + return isRental; + } + + public void setIsRental(int isRental) { + this.isRental = isRental; + } + + public int getIsVacant() { + return isVacant; + } + + public void setIsVacant(int isVacant) { + this.isVacant = isVacant; + } + + public String getLodgeTypeId() { + return lodgeTypeId; + } + + public void setLodgeTypeId(String lodgeTypeId) { + this.lodgeTypeId = lodgeTypeId; + } + + public String getLodgeTypeName() { + return lodgeTypeName; + } + + public void setLodgeTypeName(String lodgeTypeName) { + this.lodgeTypeName = lodgeTypeName; + } + + public String getModifier() { + return modifier; + } + + public void setModifier(String modifier) { + this.modifier = modifier; + } + + public String getNatureId() { + return natureId; + } + + public void setNatureId(String natureId) { + this.natureId = natureId; + } + + public String getNatureName() { + return natureName; + } + + public void setNatureName(String natureName) { + this.natureName = natureName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getRegistrationDate() { + return registrationDate; + } + + public void setRegistrationDate(String registrationDate) { + this.registrationDate = registrationDate; + } + + public String getRelationshipHomeowner() { + return relationshipHomeowner; + } + + public void setRelationshipHomeowner(String relationshipHomeowner) { + this.relationshipHomeowner = relationshipHomeowner; + } + + public String getRentalPurposes() { + return rentalPurposes; + } + + public void setRentalPurposes(String rentalPurposes) { + this.rentalPurposes = rentalPurposes; + } + + public String getResidentialId() { + return residentialId; + } + + public void setResidentialId(String residentialId) { + this.residentialId = residentialId; + } + + public String getResidentialName() { + return residentialName; + } + + public void setResidentialName(String residentialName) { + this.residentialName = residentialName; + } + + public String getRoomArea() { + return roomArea; + } + + public void setRoomArea(String roomArea) { + this.roomArea = roomArea; + } + + public int getRoomNum() { + return roomNum; + } + + public void setRoomNum(int roomNum) { + this.roomNum = roomNum; + } + + public String getRoomUseId() { + return roomUseId; + } + + public void setRoomUseId(String roomUseId) { + this.roomUseId = roomUseId; + } + + public String getRoomUseName() { + return roomUseName; + } + + public void setRoomUseName(String roomUseName) { + this.roomUseName = roomUseName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getStreetName() { + return streetName; + } + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + + public String getStructureId() { + return structureId; + } + + public void setStructureId(String structureId) { + this.structureId = structureId; + } + + public String getStructureName() { + return structureName; + } + + public void setStructureName(String structureName) { + this.structureName = structureName; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public int getUnitNum() { + return unitNum; + } + + public void setUnitNum(int unitNum) { + this.unitNum = unitNum; + } + } +} diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseDetailBean.java b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseDetailBean.java new file mode 100644 index 0000000..b6ddf93 --- /dev/null +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/NewHouseDetailBean.java @@ -0,0 +1,500 @@ +package com.sucstepsoft.realtimelocation.beans; + +public class NewHouseDetailBean { + + private String affiliatedUnit; + private int affiliationFloors; + private int affiliationUnit; + private String buildingId; + private String buildingName; + private String buildingPurposeId; + private String buildingPurposeName; + private String categoryId; + private String categoryName; + private String certificateNum; + private String community; + private String communityName; + private String creator; + private String custodian; + private String custodianDocumentId; + private String custodianDocumentName; + private String custodianDocumentNum; + private String custodianPhone; + private String dangerId; + private String dangerName; + private String documentId; + private String documentName; + private String documentNum; + private int floorsNum; + private String gmtCreate; + private String gmtModified; + private String homeowner; + private String houseId; + private int houseNum; + private String houseType; + private int isDelete; + private int isRental; + private int isVacant; + private String lodgeTypeId; + private String lodgeTypeName; + private String modifier; + private String natureId; + private String natureName; + private String phone; + private String registrationDate; + private String relationshipHomeowner; + private String rentalPurposes; + private String residentialId; + private String residentialName; + private String roomArea; + private int roomNum; + private String roomUseId; + private String roomUseName; + private String street; + private String streetName; + private String structureId; + private String structureName; + private String typeId; + private String typeName; + private int unitNum; + + public String getAffiliatedUnit() { + return affiliatedUnit; + } + + public void setAffiliatedUnit(String affiliatedUnit) { + this.affiliatedUnit = affiliatedUnit; + } + + public int getAffiliationFloors() { + return affiliationFloors; + } + + public void setAffiliationFloors(int affiliationFloors) { + this.affiliationFloors = affiliationFloors; + } + + public int getAffiliationUnit() { + return affiliationUnit; + } + + public void setAffiliationUnit(int affiliationUnit) { + this.affiliationUnit = affiliationUnit; + } + + public String getBuildingId() { + return buildingId; + } + + public void setBuildingId(String buildingId) { + this.buildingId = buildingId; + } + + public String getBuildingName() { + return buildingName; + } + + public void setBuildingName(String buildingName) { + this.buildingName = buildingName; + } + + public String getBuildingPurposeId() { + return buildingPurposeId; + } + + public void setBuildingPurposeId(String buildingPurposeId) { + this.buildingPurposeId = buildingPurposeId; + } + + public String getBuildingPurposeName() { + return buildingPurposeName; + } + + public void setBuildingPurposeName(String buildingPurposeName) { + this.buildingPurposeName = buildingPurposeName; + } + + public String getCategoryId() { + return categoryId; + } + + public void setCategoryId(String categoryId) { + this.categoryId = categoryId; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCertificateNum() { + return certificateNum; + } + + public void setCertificateNum(String certificateNum) { + this.certificateNum = certificateNum; + } + + public String getCommunity() { + return community; + } + + public void setCommunity(String community) { + this.community = community; + } + + public String getCommunityName() { + return communityName; + } + + public void setCommunityName(String communityName) { + this.communityName = communityName; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCustodian() { + return custodian; + } + + public void setCustodian(String custodian) { + this.custodian = custodian; + } + + public String getCustodianDocumentId() { + return custodianDocumentId; + } + + public void setCustodianDocumentId(String custodianDocumentId) { + this.custodianDocumentId = custodianDocumentId; + } + + public String getCustodianDocumentName() { + return custodianDocumentName; + } + + public void setCustodianDocumentName(String custodianDocumentName) { + this.custodianDocumentName = custodianDocumentName; + } + + public String getCustodianDocumentNum() { + return custodianDocumentNum; + } + + public void setCustodianDocumentNum(String custodianDocumentNum) { + this.custodianDocumentNum = custodianDocumentNum; + } + + public String getCustodianPhone() { + return custodianPhone; + } + + public void setCustodianPhone(String custodianPhone) { + this.custodianPhone = custodianPhone; + } + + public String getDangerId() { + return dangerId; + } + + public void setDangerId(String dangerId) { + this.dangerId = dangerId; + } + + public String getDangerName() { + return dangerName; + } + + public void setDangerName(String dangerName) { + this.dangerName = dangerName; + } + + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public String getDocumentName() { + return documentName; + } + + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + public String getDocumentNum() { + return documentNum; + } + + public void setDocumentNum(String documentNum) { + this.documentNum = documentNum; + } + + public int getFloorsNum() { + return floorsNum; + } + + public void setFloorsNum(int floorsNum) { + this.floorsNum = floorsNum; + } + + public String getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(String gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public String getGmtModified() { + return gmtModified; + } + + public void setGmtModified(String gmtModified) { + this.gmtModified = gmtModified; + } + + public String getHomeowner() { + return homeowner; + } + + public void setHomeowner(String homeowner) { + this.homeowner = homeowner; + } + + public String getHouseId() { + return houseId; + } + + public void setHouseId(String houseId) { + this.houseId = houseId; + } + + public int getHouseNum() { + return houseNum; + } + + public void setHouseNum(int houseNum) { + this.houseNum = houseNum; + } + + public String getHouseType() { + return houseType; + } + + public void setHouseType(String houseType) { + this.houseType = houseType; + } + + public int getIsDelete() { + return isDelete; + } + + public void setIsDelete(int isDelete) { + this.isDelete = isDelete; + } + + public int getIsRental() { + return isRental; + } + + public void setIsRental(int isRental) { + this.isRental = isRental; + } + + public int getIsVacant() { + return isVacant; + } + + public void setIsVacant(int isVacant) { + this.isVacant = isVacant; + } + + public String getLodgeTypeId() { + return lodgeTypeId; + } + + public void setLodgeTypeId(String lodgeTypeId) { + this.lodgeTypeId = lodgeTypeId; + } + + public String getLodgeTypeName() { + return lodgeTypeName; + } + + public void setLodgeTypeName(String lodgeTypeName) { + this.lodgeTypeName = lodgeTypeName; + } + + public String getModifier() { + return modifier; + } + + public void setModifier(String modifier) { + this.modifier = modifier; + } + + public String getNatureId() { + return natureId; + } + + public void setNatureId(String natureId) { + this.natureId = natureId; + } + + public String getNatureName() { + return natureName; + } + + public void setNatureName(String natureName) { + this.natureName = natureName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getRegistrationDate() { + return registrationDate; + } + + public void setRegistrationDate(String registrationDate) { + this.registrationDate = registrationDate; + } + + public String getRelationshipHomeowner() { + return relationshipHomeowner; + } + + public void setRelationshipHomeowner(String relationshipHomeowner) { + this.relationshipHomeowner = relationshipHomeowner; + } + + public String getRentalPurposes() { + return rentalPurposes; + } + + public void setRentalPurposes(String rentalPurposes) { + this.rentalPurposes = rentalPurposes; + } + + public String getResidentialId() { + return residentialId; + } + + public void setResidentialId(String residentialId) { + this.residentialId = residentialId; + } + + public String getResidentialName() { + return residentialName; + } + + public void setResidentialName(String residentialName) { + this.residentialName = residentialName; + } + + public String getRoomArea() { + return roomArea; + } + + public void setRoomArea(String roomArea) { + this.roomArea = roomArea; + } + + public int getRoomNum() { + return roomNum; + } + + public void setRoomNum(int roomNum) { + this.roomNum = roomNum; + } + + public String getRoomUseId() { + return roomUseId; + } + + public void setRoomUseId(String roomUseId) { + this.roomUseId = roomUseId; + } + + public String getRoomUseName() { + return roomUseName; + } + + public void setRoomUseName(String roomUseName) { + this.roomUseName = roomUseName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getStreetName() { + return streetName; + } + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + + public String getStructureId() { + return structureId; + } + + public void setStructureId(String structureId) { + this.structureId = structureId; + } + + public String getStructureName() { + return structureName; + } + + public void setStructureName(String structureName) { + this.structureName = structureName; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public int getUnitNum() { + return unitNum; + } + + public void setUnitNum(int unitNum) { + this.unitNum = unitNum; + } +} diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/beans/SaveNewHouseBean.java b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/SaveNewHouseBean.java new file mode 100644 index 0000000..6f034a6 --- /dev/null +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/beans/SaveNewHouseBean.java @@ -0,0 +1,419 @@ +package com.sucstepsoft.realtimelocation.beans; + +public class SaveNewHouseBean { + + private String affiliatedUnit; + private int affiliationFloors; + private int affiliationUnit; + private String buildingId; + private String buildingName; + private String buildingPurposeId; + private String buildingPurposeName; + private String categoryId; + private String categoryName; + private String certificateNum; + private String community; + private String communityName; + private String custodian; + private String custodianDocumentId; + private String custodianDocumentName; + private String custodianDocumentNum; + private String custodianPhone; + private String dangerId; + private String dangerName; + private String documentId; + private String documentName; + private String documentNum; + private String homeowner; + private int houseNum; + private int isRental; + private int isVacant; + private String lodgeTypeId; + private String lodgeTypeName; + private String natureId; + private String natureName; + private String phone; + private String registrationDate; + private String relationshipHomeowner; + private String rentalPurposes; + private String residentialId; + private String residentialName; + private String roomArea; + private int roomNum; + private String roomUseId; + private String roomUseName; + private String street; + private String streetName; + private String structureId; + private String structureName; + private String typeId; + private String typeName; + + public String getAffiliatedUnit() { + return affiliatedUnit; + } + + public void setAffiliatedUnit(String affiliatedUnit) { + this.affiliatedUnit = affiliatedUnit; + } + + public int getAffiliationFloors() { + return affiliationFloors; + } + + public void setAffiliationFloors(int affiliationFloors) { + this.affiliationFloors = affiliationFloors; + } + + public int getAffiliationUnit() { + return affiliationUnit; + } + + public void setAffiliationUnit(int affiliationUnit) { + this.affiliationUnit = affiliationUnit; + } + + public String getBuildingId() { + return buildingId; + } + + public void setBuildingId(String buildingId) { + this.buildingId = buildingId; + } + + public String getBuildingName() { + return buildingName; + } + + public void setBuildingName(String buildingName) { + this.buildingName = buildingName; + } + + public String getBuildingPurposeId() { + return buildingPurposeId; + } + + public void setBuildingPurposeId(String buildingPurposeId) { + this.buildingPurposeId = buildingPurposeId; + } + + public String getBuildingPurposeName() { + return buildingPurposeName; + } + + public void setBuildingPurposeName(String buildingPurposeName) { + this.buildingPurposeName = buildingPurposeName; + } + + public String getCategoryId() { + return categoryId; + } + + public void setCategoryId(String categoryId) { + this.categoryId = categoryId; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCertificateNum() { + return certificateNum; + } + + public void setCertificateNum(String certificateNum) { + this.certificateNum = certificateNum; + } + + public String getCommunity() { + return community; + } + + public void setCommunity(String community) { + this.community = community; + } + + public String getCommunityName() { + return communityName; + } + + public void setCommunityName(String communityName) { + this.communityName = communityName; + } + + public String getCustodian() { + return custodian; + } + + public void setCustodian(String custodian) { + this.custodian = custodian; + } + + public String getCustodianDocumentId() { + return custodianDocumentId; + } + + public void setCustodianDocumentId(String custodianDocumentId) { + this.custodianDocumentId = custodianDocumentId; + } + + public String getCustodianDocumentName() { + return custodianDocumentName; + } + + public void setCustodianDocumentName(String custodianDocumentName) { + this.custodianDocumentName = custodianDocumentName; + } + + public String getCustodianDocumentNum() { + return custodianDocumentNum; + } + + public void setCustodianDocumentNum(String custodianDocumentNum) { + this.custodianDocumentNum = custodianDocumentNum; + } + + public String getCustodianPhone() { + return custodianPhone; + } + + public void setCustodianPhone(String custodianPhone) { + this.custodianPhone = custodianPhone; + } + + public String getDangerId() { + return dangerId; + } + + public void setDangerId(String dangerId) { + this.dangerId = dangerId; + } + + public String getDangerName() { + return dangerName; + } + + public void setDangerName(String dangerName) { + this.dangerName = dangerName; + } + + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public String getDocumentName() { + return documentName; + } + + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + public String getDocumentNum() { + return documentNum; + } + + public void setDocumentNum(String documentNum) { + this.documentNum = documentNum; + } + + public String getHomeowner() { + return homeowner; + } + + public void setHomeowner(String homeowner) { + this.homeowner = homeowner; + } + + public int getHouseNum() { + return houseNum; + } + + public void setHouseNum(int houseNum) { + this.houseNum = houseNum; + } + + public int getIsRental() { + return isRental; + } + + public void setIsRental(int isRental) { + this.isRental = isRental; + } + + public int getIsVacant() { + return isVacant; + } + + public void setIsVacant(int isVacant) { + this.isVacant = isVacant; + } + + public String getLodgeTypeId() { + return lodgeTypeId; + } + + public void setLodgeTypeId(String lodgeTypeId) { + this.lodgeTypeId = lodgeTypeId; + } + + public String getLodgeTypeName() { + return lodgeTypeName; + } + + public void setLodgeTypeName(String lodgeTypeName) { + this.lodgeTypeName = lodgeTypeName; + } + + public String getNatureId() { + return natureId; + } + + public void setNatureId(String natureId) { + this.natureId = natureId; + } + + public String getNatureName() { + return natureName; + } + + public void setNatureName(String natureName) { + this.natureName = natureName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getRegistrationDate() { + return registrationDate; + } + + public void setRegistrationDate(String registrationDate) { + this.registrationDate = registrationDate; + } + + public String getRelationshipHomeowner() { + return relationshipHomeowner; + } + + public void setRelationshipHomeowner(String relationshipHomeowner) { + this.relationshipHomeowner = relationshipHomeowner; + } + + public String getRentalPurposes() { + return rentalPurposes; + } + + public void setRentalPurposes(String rentalPurposes) { + this.rentalPurposes = rentalPurposes; + } + + public String getResidentialId() { + return residentialId; + } + + public void setResidentialId(String residentialId) { + this.residentialId = residentialId; + } + + public String getResidentialName() { + return residentialName; + } + + public void setResidentialName(String residentialName) { + this.residentialName = residentialName; + } + + public String getRoomArea() { + return roomArea; + } + + public void setRoomArea(String roomArea) { + this.roomArea = roomArea; + } + + public int getRoomNum() { + return roomNum; + } + + public void setRoomNum(int roomNum) { + this.roomNum = roomNum; + } + + public String getRoomUseId() { + return roomUseId; + } + + public void setRoomUseId(String roomUseId) { + this.roomUseId = roomUseId; + } + + public String getRoomUseName() { + return roomUseName; + } + + public void setRoomUseName(String roomUseName) { + this.roomUseName = roomUseName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getStreetName() { + return streetName; + } + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + + public String getStructureId() { + return structureId; + } + + public void setStructureId(String structureId) { + this.structureId = structureId; + } + + public String getStructureName() { + return structureName; + } + + public void setStructureName(String structureName) { + this.structureName = structureName; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } +} diff --git a/app/src/main/java/com/sucstepsoft/realtimelocation/net/LocationApiService.java b/app/src/main/java/com/sucstepsoft/realtimelocation/net/LocationApiService.java index 007e942..2147ec9 100755 --- a/app/src/main/java/com/sucstepsoft/realtimelocation/net/LocationApiService.java +++ b/app/src/main/java/com/sucstepsoft/realtimelocation/net/LocationApiService.java @@ -27,6 +27,8 @@ import com.sucstepsoft.realtimelocation.beans.NewBuildingBean; import com.sucstepsoft.realtimelocation.beans.NewBuildingDetailBean; import com.sucstepsoft.realtimelocation.beans.NewCommunityBean; import com.sucstepsoft.realtimelocation.beans.NewCommunityDetailBean; +import com.sucstepsoft.realtimelocation.beans.NewHouseBean; +import com.sucstepsoft.realtimelocation.beans.NewHouseDetailBean; import com.sucstepsoft.realtimelocation.beans.NewsListBean; import com.sucstepsoft.realtimelocation.beans.PenLineBean; import com.sucstepsoft.realtimelocation.beans.PenNewLineBean; @@ -1516,6 +1518,49 @@ public interface LocationApiService { @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) @PUT("app/residential/updateresidential/{residentialId}") Observable doEditNewComunity(@Path("residentialId") String id, @Body RequestBody body, @Header("token") String token); + /*==================================TODO=========房屋===========================================*/ + + /** + * 保存楼宇信息 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @POST("app/house/save") + Observable doSaveNewHouse(@Body RequestBody body, @Header("token") String token); + + /** + * 获取楼宇详情 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @GET("app/house/get/{houseId}") + Observable getNewHouseDetail(@Path("houseId") String id, @Header("token") String token); + + + /** + * 获取楼宇列表 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @GET("app/house/listpage") + Observable getNewHouseList( + @Query("page") String page, + @Query("keywords") String keywords, + @Header("token") String token); + + + /** + * 删除楼宇 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @DELETE("app/house/remove/{ids}") + Observable doDelNewHouse(@Path("ids") String id, @Header("token") String token); + + + /** + * 修改楼宇信息 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @PUT("app/house/updatehouse/{houseId}") + Observable doEditNewHouse(@Path("houseId") String id, @Body RequestBody body, @Header("token") String token); + /*==================================TODO=========楼宇管理===========================================*/ @@ -1534,6 +1579,13 @@ public interface LocationApiService { @GET("app/building/get/{buildingId}") Observable getNewBuildingDetail(@Path("buildingId") String id, @Header("token") String token); + /** + * 根据小区获取楼宇列表 + */ + @Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"}) + @GET("app/building/list") + Observable> getAllBuilding(@Query("residentialId") String id, @Header("token") String token); + /** * 获取楼宇列表 */ diff --git a/app/src/main/res/layout/activity_add_new_house.xml b/app/src/main/res/layout/activity_add_new_house.xml index 399e043..0014d43 100644 --- a/app/src/main/res/layout/activity_add_new_house.xml +++ b/app/src/main/res/layout/activity_add_new_house.xml @@ -1,290 +1,666 @@ + + + android:background="@color/white" + android:orientation="vertical" + android:paddingLeft="20dp" + android:paddingRight="20dp"> - - - - - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + + + - + + + + + + + + - - - - - - - - + - + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - + - - - - - - - - - - + - + - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -