diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/res/layout/activity_pipe.xml b/app/src/main/res/layout/activity_pipe.xml index 3abfc61..126f3ca 100644 --- a/app/src/main/res/layout/activity_pipe.xml +++ b/app/src/main/res/layout/activity_pipe.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/res/layout/activity_pipe.xml b/app/src/main/res/layout/activity_pipe.xml index 3abfc61..126f3ca 100644 --- a/app/src/main/res/layout/activity_pipe.xml +++ b/app/src/main/res/layout/activity_pipe.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/res/layout/activity_well_list.xml b/app/src/main/res/layout/activity_well_list.xml index b827fc8..45222cd 100644 --- a/app/src/main/res/layout/activity_well_list.xml +++ b/app/src/main/res/layout/activity_well_list.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/res/layout/activity_pipe.xml b/app/src/main/res/layout/activity_pipe.xml index 3abfc61..126f3ca 100644 --- a/app/src/main/res/layout/activity_pipe.xml +++ b/app/src/main/res/layout/activity_pipe.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/res/layout/activity_well_list.xml b/app/src/main/res/layout/activity_well_list.xml index b827fc8..45222cd 100644 --- a/app/src/main/res/layout/activity_well_list.xml +++ b/app/src/main/res/layout/activity_well_list.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/res/layout/item_alarm_list_rv_l.xml b/app/src/main/res/layout/item_alarm_list_rv_l.xml new file mode 100644 index 0000000..f09f353 --- /dev/null +++ b/app/src/main/res/layout/item_alarm_list_rv_l.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d34c5fc..84c007b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -109,7 +109,7 @@ - + diff --git a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java index 4be4f26..b206072 100644 --- a/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java +++ b/app/src/main/java/com/casic/dcms/fragment/PhonePageFragment.java @@ -28,7 +28,7 @@ public class PhonePageFragment extends AndroidxBaseFragment { - private final List deptList = new ArrayList<>(); //部门名集合 + private final List deptCollection = new ArrayList<>(); //部门名集合 private final List> deptAndPersons = new ArrayList<>(); //个人信息集合的集合 private DeptTreeViewModel deptTreeViewModel; private PhoneBookViewModel phoneBookViewModel; @@ -61,11 +61,11 @@ //先获取部门树,在往树结构里面加人 if (resultBean.getCode() == 200) { List listBeans = resultBean.getData().getList(); - deptList.clear(); + deptCollection.clear(); for (DeptTreeBean.DataBean.ListBean bean : listBeans) { - deptList.add(bean.getName()); + deptCollection.add(bean.getName()); } - if (deptList.size() > 0) { + if (deptCollection.size() > 0) { phoneBookViewModel.getPhoneBook(requireContext(), StringHelper.getUserBean().getDeptId()); } } @@ -77,10 +77,10 @@ if (resultBean.getCode() == 200) { List dataBeans = resultBean.getData(); deptAndPersons.clear(); - for (String title : deptList) { + for (String deptName : deptCollection) { List beanList = new ArrayList<>(); for (PhoneBookBean.DataBean dataBean : dataBeans) { - if (title.equals(dataBean.getDeptName())) { + if (deptName.equals(dataBean.getDeptName())) { PersonBean personBean = new PersonBean(); personBean.setPersonDept(dataBean.getDeptName()); personBean.setPersonName(dataBean.getName()); @@ -91,7 +91,7 @@ deptAndPersons.add(beanList); } //展示部门树以及人员 - expandableAdapter.setData(deptList, deptAndPersons); + expandableAdapter.setData(deptCollection, deptAndPersons); getBinding().deptTreeView.setAdapter(expandableAdapter); //默认展开数据 for (int i = 0; i < expandableAdapter.getGroupCount(); i++) { diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java index 0bf806b..8baae67 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoMaster.java @@ -13,20 +13,25 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. + /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** Creates underlying database table using DAOs. */ + /** + * Creates underlying database table using DAOs. + */ public static void createAllTables(Database db, boolean ifNotExists) { MapConfigBeanDao.createTable(db, ifNotExists); NoticeLocaleBeanDao.createTable(db, ifNotExists); ToiletListBeanDao.createTable(db, ifNotExists); } - /** Drops underlying database table using DAOs. */ + /** + * Drops underlying database table using DAOs. + */ public static void dropAllTables(Database db, boolean ifExists) { MapConfigBeanDao.dropTable(db, ifExists); NoticeLocaleBeanDao.dropTable(db, ifExists); @@ -81,7 +86,9 @@ } } - /** WARNING: Drops all table on Upgrade! Use only during development. */ + /** + * WARNING: Drops all table on Upgrade! Use only during development. + */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java index cc981d3..6ccb715 100644 --- a/app/src/main/java/com/casic/dcms/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/dcms/greendao/DaoSession.java @@ -16,7 +16,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -50,7 +50,7 @@ registerDao(NoticeLocaleBean.class, noticeLocaleBeanDao); registerDao(ToiletListBean.class, toiletListBeanDao); } - + public void clear() { mapConfigBeanDaoConfig.clearIdentityScope(); noticeLocaleBeanDaoConfig.clearIdentityScope(); diff --git a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java deleted file mode 100644 index de23dd3..0000000 --- a/app/src/main/java/com/casic/dcms/model/AlarmDataBean.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.casic.dcms.model; - -import java.util.List; - -public class AlarmDataBean { - - private int code; - private DataBean data; - private String message; - private boolean success; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public DataBean getData() { - return data; - } - - public void setData(DataBean data) { - this.data = data; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public static class DataBean { - - private int total; - private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public static class RowsBean { - /** - * alarmContent : 1 - * deptName : 崇仁县城管局 - * jobStatus : 0 - * alarmContentName : 井盖开盖报警 - * wellCode : GX_WSD_4107_HLDD037 - * alarmTime : 2019-06-24 11:47:10 - * deptid : 24 - * alarmTypeName : 一次报警 - * alarmMessage : 井盖开盖报警 - * staff : 超级管理员 - * deviceId : 1356438698347016196 - * jobId : 1232266 - * jobStatusName : 待处理 - * alarmType : 1 - * alarmValue : -- - * devcode : 412020110003 - * statusName : 正在报警 - * alarmLevel : - * tel : 18200000000 - * id : 11409 - * wellId : 36962 - * position : 活力大道 - * status : 1 - */ - - private int alarmContent; - private String deptName; - private String jobStatus; - private String alarmContentName; - private String wellCode; - private String alarmTime; - private String deptid; - private String alarmTypeName; - private String alarmMessage; - private String staff; - private String deviceId; - private String jobId; - private String jobStatusName; - private String alarmType; - private String alarmValue; - private String devcode; - private String statusName; - private String alarmLevel; - private String tel; - private String id; - private String wellId; - private String position; - private String status; - - public int getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(int alarmContent) { - this.alarmContent = alarmContent; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getAlarmContentName() { - return alarmContentName; - } - - public void setAlarmContentName(String alarmContentName) { - this.alarmContentName = alarmContentName; - } - - public String getWellCode() { - return wellCode; - } - - public void setWellCode(String wellCode) { - this.wellCode = wellCode; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getDeptid() { - return deptid; - } - - public void setDeptid(String deptid) { - this.deptid = deptid; - } - - public String getAlarmTypeName() { - return alarmTypeName; - } - - public void setAlarmTypeName(String alarmTypeName) { - this.alarmTypeName = alarmTypeName; - } - - public String getAlarmMessage() { - return alarmMessage; - } - - public void setAlarmMessage(String alarmMessage) { - this.alarmMessage = alarmMessage; - } - - public String getStaff() { - return staff; - } - - public void setStaff(String staff) { - this.staff = staff; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public String getJobStatusName() { - return jobStatusName; - } - - public void setJobStatusName(String jobStatusName) { - this.jobStatusName = jobStatusName; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(String alarmValue) { - this.alarmValue = alarmValue; - } - - public String getDevcode() { - return devcode; - } - - public void setDevcode(String devcode) { - this.devcode = devcode; - } - - public String getStatusName() { - return statusName; - } - - public void setStatusName(String statusName) { - this.statusName = statusName; - } - - public String getAlarmLevel() { - return alarmLevel; - } - - public void setAlarmLevel(String alarmLevel) { - this.alarmLevel = alarmLevel; - } - - public String getTel() { - return tel; - } - - public void setTel(String tel) { - this.tel = tel; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWellId() { - return wellId; - } - - public void setWellId(String wellId) { - this.wellId = wellId; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - } - } -} diff --git a/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java new file mode 100644 index 0000000..0578f7b --- /dev/null +++ b/app/src/main/java/com/casic/dcms/model/WellAlarmListBean.java @@ -0,0 +1,301 @@ +package com.casic.dcms.model; + +import java.util.List; + +public class WellAlarmListBean { + + private int code; + private DataBean data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataBean getData() { + return data; + } + + public void setData(DataBean data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataBean { + + private int total; + private List rows; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public static class RowsBean { + /** + * alarmContent : 1 + * deptName : 崇仁县城管局 + * jobStatus : 0 + * alarmContentName : 井盖开盖报警 + * wellCode : GX_WSD_4107_HLDD037 + * alarmTime : 2019-06-24 11:47:10 + * deptid : 24 + * alarmTypeName : 一次报警 + * alarmMessage : 井盖开盖报警 + * staff : 超级管理员 + * deviceId : 1356438698347016196 + * jobId : 1232266 + * jobStatusName : 待处理 + * alarmType : 1 + * alarmValue : -- + * devcode : 412020110003 + * statusName : 正在报警 + * alarmLevel : + * tel : 18200000000 + * id : 11409 + * wellId : 36962 + * position : 活力大道 + * status : 1 + */ + + private int alarmContent; + private String deptName; + private String jobStatus; + private String alarmContentName; + private String wellCode; + private String alarmTime; + private String deptid; + private String alarmTypeName; + private String alarmMessage; + private String staff; + private String deviceId; + private String jobId; + private String jobStatusName; + private String alarmType; + private String alarmValue; + private String devcode; + private String statusName; + private String alarmLevel; + private String tel; + private String id; + private String wellId; + private String position; + private String status; + + public int getAlarmContent() { + return alarmContent; + } + + public void setAlarmContent(int alarmContent) { + this.alarmContent = alarmContent; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getAlarmContentName() { + return alarmContentName; + } + + public void setAlarmContentName(String alarmContentName) { + this.alarmContentName = alarmContentName; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmMessage() { + return alarmMessage; + } + + public void setAlarmMessage(String alarmMessage) { + this.alarmMessage = alarmMessage; + } + + public String getStaff() { + return staff; + } + + public void setStaff(String staff) { + this.staff = staff; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobStatusName() { + return jobStatusName; + } + + public void setJobStatusName(String jobStatusName) { + this.jobStatusName = jobStatusName; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getAlarmValue() { + return alarmValue; + } + + public void setAlarmValue(String alarmValue) { + this.alarmValue = alarmValue; + } + + public String getDevcode() { + return devcode; + } + + public void setDevcode(String devcode) { + this.devcode = devcode; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWellId() { + return wellId; + } + + public void setWellId(String wellId) { + this.wellId = wellId; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + } + } +} diff --git a/app/src/main/java/com/casic/dcms/model/WellListBean.java b/app/src/main/java/com/casic/dcms/model/WellListBean.java index 31e7f14..22e4c60 100644 --- a/app/src/main/java/com/casic/dcms/model/WellListBean.java +++ b/app/src/main/java/com/casic/dcms/model/WellListBean.java @@ -42,17 +42,8 @@ } public static class DataBean { - - private int total; private List rows; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } + private int total; public List getRows() { return rows; @@ -62,48 +53,24 @@ this.rows = rows; } - public static class RowsBean { - /** - * area : 361024100 - * bfzt : 1 - * bfztName : 布防 - * coordinateX : 116.076 - * coordinateY : 27.755 - * deep : 2.96 - * deptName : 崇仁县城管局 - * deptid : 24 - * deviceCount : 1 - * id : 36925 - * latBaidu : - * latGaode : 27.751926269532 - * lngBaidu : - * lngGaode : 116.081106499566 - * notes : - * photos : - * position : 巴山二路 - * qu : 361024 - * responsibleDept : 1344110695992258561 - * responsibleDeptName : 市政工程管理所 - * ts : - * valid : 1 - * wellCode : GX_WSD_4107_BSEL001 - * wellFlag1 : - * wellFlag2 : - * wellFlag3 : - * wellName : YS092 - * wellType : 2 - * wellTypeName : 污水井 - */ + public int getTotal() { + return total; + } + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { private String area; private String bfzt; private String bfztName; private String coordinateX; private String coordinateY; - private double deep; + private String deep; private String deptName; private String deptid; - private int deviceCount; + private String deviceCount; private String id; private String latBaidu; private String latGaode; @@ -165,11 +132,11 @@ this.coordinateY = coordinateY; } - public double getDeep() { + public String getDeep() { return deep; } - public void setDeep(double deep) { + public void setDeep(String deep) { this.deep = deep; } @@ -189,11 +156,11 @@ this.deptid = deptid; } - public int getDeviceCount() { + public String getDeviceCount() { return deviceCount; } - public void setDeviceCount(int deviceCount) { + public void setDeviceCount(String deviceCount) { this.deviceCount = deviceCount; } diff --git a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java index 90dafdc..7346dcf 100644 --- a/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java +++ b/app/src/main/java/com/casic/dcms/utils/DataBaseManager.java @@ -34,8 +34,6 @@ private final MapConfigBeanDao mapConfigBeanDao = BaseApplication.getDaoSession().getMapConfigBeanDao(); private final ToiletListBeanDao toiletListBeanDao = BaseApplication.getDaoSession().getToiletListBeanDao(); - /***路灯本地数据管理************************************************************/ - /***通知本地数据管理************************************************************/ public void savePushNotice(NoticeLocaleBean noticeBean) { noticeBeanDao.save(noticeBean); diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 797541d..55015db 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -105,11 +105,10 @@ public static final String SHOP_PUNISH_LIST = "/shop/punish/listByMerchant?merchantId="; public static final String SHOP_PUNISH_TYPE = "/shop/punish/statisticByMerchant?merchantId="; public static final String SHOP_MERCHANT_ID = "/shop/merchant/getIdByCode?shopCode="; - public static final String LIGHT_DETAIL = "/lightCr/overview/lampDetail?lampId="; //配置项 public static final String PROJECT_CONFIG = "http://111.198.10.15:11404/bridge/static/project.config.json"; public static final String LAYER_CONFIG = "http://111.198.10.15:11404/dcms/static/project.config.json"; - static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 + public static final String TOILET_SERVICE_URL = "/arcgis/rest/services/crbjfc/FeatureServer";//崇仁公厕特征图层 } diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 747b380..91cd135 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -621,7 +621,7 @@ /** * 报警列表 */ - public static Observable getAlarmListResult(int limit, int offset) { + public static Observable getAlarmList(int limit, int offset) { return api.getAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } @@ -642,7 +642,7 @@ /** * 窨井列表 */ - public static Observable getWellListResult(int offset) { + public static Observable getWellList(int offset) { return api.getWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); diff --git a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java deleted file mode 100644 index 31ede76..0000000 --- a/app/src/main/java/com/casic/dcms/view/map/WarningOnMapActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.casic.dcms.view.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.casic.dcms.R; -import com.casic.dcms.databinding.ActivityMapWarningBinding; -import com.casic.dcms.model.AlarmDataBean; -import com.casic.dcms.model.WellDetailBean; -import com.casic.dcms.utils.ArcGisMapCreator; -import com.casic.dcms.utils.LocaleConstant; -import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.vm.AlarmViewModel; -import com.casic.dcms.vm.WellViewModel; -import com.esri.arcgisruntime.geometry.Point; -import com.esri.arcgisruntime.mapping.ArcGISMap; -import com.esri.arcgisruntime.mapping.Basemap; -import com.esri.arcgisruntime.mapping.BasemapStyle; -import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; -import com.esri.arcgisruntime.mapping.view.Graphic; -import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; -import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; -import com.esri.arcgisruntime.util.ListenableList; -import com.pengxh.androidx.lite.base.AndroidxBaseActivity; -import com.pengxh.androidx.lite.utils.LoadState; -import com.pengxh.androidx.lite.utils.SaveKeyValues; -import com.qmuiteam.qmui.util.QMUIDisplayHelper; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.popup.QMUIPopup; -import com.qmuiteam.qmui.widget.popup.QMUIPopups; - -import java.util.ArrayList; -import java.util.List; - -public class WarningOnMapActivity extends AndroidxBaseActivity { - - private static final String TAG = "WarningOnMapActivity"; - private final Context context = this; - private final List geometryList = new ArrayList<>(); - private AlarmViewModel alarmViewModel; - private WellViewModel wellViewModel; - - @Override - protected void setupTopBarLayout() { - ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); - - binding.titleBarLayout.titleView.setText("报警分布"); - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - } - - @Override - protected void observeRequestState() { - - } - - @Override - public void initOnCreate(@Nullable Bundle savedInstanceState) { - binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 - binding.mapView.setViewpointScaleAsync(64000); - ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); - //创建底图、并设置底图图层 - Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); - arcGISMap.setBasemap(basemap); - binding.mapView.setMap(arcGISMap); - - int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); - alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.getAlarmList(this, alarmTotal, 1); - - wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public void initEvent() { - binding.expandMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); - } - }); - binding.minusMapView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); - } - }); - - alarmViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(AlarmDataBean alarmDataBean) { - if (alarmDataBean.getCode() == 200) { - List dataRows = alarmDataBean.getData().getRows(); - for (AlarmDataBean.DataBean.RowsBean rowsBean : dataRows) { - String queryParam = "编号='" + rowsBean.getWellCode() + "'"; - wellViewModel.getWellDetail(context, queryParam); - } - } - } - }); - - alarmViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - wellViewModel.resultModel.observe(this, new Observer() { - @Override - public void onChanged(WellDetailBean wellDetailBean) { - List features = wellDetailBean.getFeatures(); - if (features.size() > 0) { - WellDetailBean.FeaturesBean featuresBean = features.get(0); - //将获取到的井数据缓存起来 - geometryList.add(featuresBean); - WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); - //每获取一个点就绘制出 - addMarker(new Point(geometryBean.getX(), geometryBean.getY())); - } - } - }); - - wellViewModel.loadState.observe(this, new Observer() { - @Override - public void onChanged(LoadState loadState) { - - } - }); - - binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); - Point clickPoint = binding.mapView.screenToLocation(screenPoint); - if (geometryList.size() > 0) { - List tempList = new ArrayList<>(); - for (WellDetailBean.FeaturesBean featuresBean : geometryList) { - WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); - if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && - Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { - tempList.add(featuresBean); - } - } - if (tempList.size() > 0) { - QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); - menuDialogBuilder.setTitle("请选择您要查看的窨井"); - for (WellDetailBean.FeaturesBean dataBean : tempList) { - menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - - View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); - TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); - TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); - TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); - - WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); - wellCodeView.setText(attributes.get编号()); - wellTypeView.setText(attributes.get附属物名称()); - wellPositionView.setText(attributes.get所属道路()); - - QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) - .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) - .view(popupView) - .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) - .dimAmount(0.6f) - .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) - .onDismiss(null) - .show(binding.mapView); - } - }); - } - menuDialogBuilder.create().show(); - } - } - return super.onSingleTapConfirmed(e); - } - }); - } - - protected void onResume() { - binding.mapView.resume(); - super.onResume(); - } - - @Override - protected void onPause() { - binding.mapView.pause(); - super.onPause(); - } - - @Override - protected void onDestroy() { - binding.mapView.dispose(); - super.onDestroy(); - } - - private void addMarker(Point point) { - SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); - Graphic graphic = new Graphic(point, simpleMarkerSymbol); - GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); - ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); - ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); - overlayGraphics.add(graphic); - graphicsOverlays.add(mGraphicsOverlay); - } -} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java index 8c65f4d..3654fde 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/PipelineManagerActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -17,10 +18,9 @@ import com.casic.dcms.adapter.NormalRecyclerAdapter; import com.casic.dcms.databinding.ActivityPipeBinding; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.LocaleConstant; import com.casic.dcms.utils.ViewGroupHub; -import com.casic.dcms.view.map.WarningOnMapActivity; import com.casic.dcms.vm.AlarmViewModel; import com.casic.dcms.widgets.CancelAlarmDialog; import com.pengxh.androidx.lite.adapter.ViewHolder; @@ -32,6 +32,7 @@ import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.SaveKeyValues; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; import com.qmuiteam.qmui.widget.popup.QMUIPopups; @@ -42,45 +43,51 @@ import java.util.ArrayList; import java.util.List; -public class PipelineManagerActivity extends AndroidxBaseActivity { +public class PipelineManagerActivity extends AndroidxBaseActivity implements Handler.Callback { private static final String TAG = "PipelineManagerActivity"; private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private AlarmViewModel alarmViewModel; - private NormalRecyclerAdapter adapter; - private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private NormalRecyclerAdapter adapter; + private List dataBeans = new ArrayList<>(); + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("管网管理"); - binding.titleBarLayout.rightImageView.setOnClickListener(v -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchCancelDialog(); - break; - case 1: - ContextKit.navigatePageTo(context, WarningOnMapActivity.class); - break; - case 2: - ContextKit.navigatePageTo(context, WellListActivity.class); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_LIST_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchCancelDialog(); + break; + case 1: + ContextKit.navigatePageTo(context, WarningOnMapActivity.class); + break; + case 2: + ContextKit.navigatePageTo(context, WellListActivity.class); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -89,10 +96,12 @@ alarmViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(PipelineManagerActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -100,14 +109,13 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); - alarmViewModel.resultModel.observe(this, new Observer() { + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { @Override - public void onChanged(AlarmDataBean alarmDataBean) { + public void onChanged(WellAlarmListBean alarmDataBean) { if (alarmDataBean.getCode() == 200) { SaveKeyValues.putValue("alarmTotal", alarmDataBean.getData().getTotal()); - List dataRows = alarmDataBean.getData().getRows(); + List dataRows = alarmDataBean.getData().getRows(); if (isRefresh) { adapter.refresh(dataRows); binding.refreshLayout.finishRefresh(); @@ -126,6 +134,7 @@ } } }); + getAlarmList(); alarmViewModel.cancelActionModel.observe(this, new Observer() { @Override @@ -134,7 +143,7 @@ StringKit.show(context, "取消报警成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getAlarmList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -143,15 +152,8 @@ }); } - @Override - protected void onResume() { - super.onResume(); - pageIndex = 1; - getAlarmList(); - } - private void getAlarmList() { - alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, pageIndex); + alarmViewModel.getAlarmList(this, LocaleConstant.PAGE_LIMIT, page); } @Override @@ -161,7 +163,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getAlarmList(); } }); @@ -169,27 +171,22 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getAlarmList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210626) { if (dataBeans.size() == 0) { - binding.emptyView.show(false, "设备状态很好,没有任何报警", null, "刷新", new View.OnClickListener() { - @Override - public void onClick(View v) { - pageIndex = 1; - getAlarmList(); - } - }); + binding.emptyView.show("设备状态很好,没有任何报警", null); } else { binding.emptyView.hide(); - adapter = new NormalRecyclerAdapter(R.layout.item_alarm_recycleview, dataBeans) { + adapter = new NormalRecyclerAdapter(R.layout.item_alarm_list_rv_l, dataBeans) { @Override - public void convertView(ViewHolder viewHolder, int position, AlarmDataBean.DataBean.RowsBean item) { + public void convertView(ViewHolder viewHolder, int position, WellAlarmListBean.DataBean.RowsBean item) { viewHolder.setText(R.id.alarmMessageView, item.getAlarmMessage()) .setText(R.id.wellCodeView, item.getWellCode()) .setText(R.id.alarmPositionView, item.getPosition()) @@ -207,7 +204,7 @@ } } return true; - }; + } //单个消警 private void showSingleCancelDialog(String jobId) { diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java new file mode 100644 index 0000000..1b2a970 --- /dev/null +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WarningOnMapActivity.java @@ -0,0 +1,230 @@ +package com.casic.dcms.view.pipeline; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; + +import com.casic.dcms.R; +import com.casic.dcms.databinding.ActivityMapWarningBinding; +import com.casic.dcms.model.WellAlarmListBean; +import com.casic.dcms.model.WellDetailBean; +import com.casic.dcms.utils.ArcGisMapCreator; +import com.casic.dcms.utils.LocaleConstant; +import com.casic.dcms.utils.ViewGroupHub; +import com.casic.dcms.vm.AlarmViewModel; +import com.casic.dcms.vm.WellViewModel; +import com.esri.arcgisruntime.geometry.Point; +import com.esri.arcgisruntime.mapping.ArcGISMap; +import com.esri.arcgisruntime.mapping.Basemap; +import com.esri.arcgisruntime.mapping.BasemapStyle; +import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener; +import com.esri.arcgisruntime.mapping.view.Graphic; +import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; +import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol; +import com.esri.arcgisruntime.util.ListenableList; +import com.pengxh.androidx.lite.base.AndroidxBaseActivity; +import com.pengxh.androidx.lite.utils.LoadState; +import com.pengxh.androidx.lite.utils.LoadingDialog; +import com.pengxh.androidx.lite.utils.SaveKeyValues; +import com.pengxh.androidx.lite.widget.TitleBarView; +import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.widget.dialog.QMUIDialog; +import com.qmuiteam.qmui.widget.popup.QMUIPopup; +import com.qmuiteam.qmui.widget.popup.QMUIPopups; + +import java.util.ArrayList; +import java.util.List; + +public class WarningOnMapActivity extends AndroidxBaseActivity { + + private static final String TAG = "WarningOnMapActivity"; + private final Context context = this; + private final List geometryList = new ArrayList<>(); + private AlarmViewModel alarmViewModel; + private WellViewModel wellViewModel; + + @Override + protected void setupTopBarLayout() { + ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } + + @Override + public void onRightClick() { + + } + }); + } + + @Override + protected void observeRequestState() { + alarmViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WarningOnMapActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } + } + }); + + wellViewModel.loadState.observe(this, new Observer() { + @Override + public void onChanged(LoadState loadState) { + + } + }); + } + + @Override + public void initOnCreate(@Nullable Bundle savedInstanceState) { + binding.mapView.setAttributionTextVisible(false);//去掉左下角属性标识 + binding.mapView.setViewpointScaleAsync(64000); + ArcGISMap arcGISMap = new ArcGISMap(BasemapStyle.ARCGIS_STREETS); + //创建底图、并设置底图图层 + Basemap basemap = new Basemap(ArcGisMapCreator.createNoGridLayer()); + arcGISMap.setBasemap(basemap); + binding.mapView.setMap(arcGISMap); + + int alarmTotal = (int) SaveKeyValues.getValue("alarmTotal", LocaleConstant.PAGE_LIMIT); + alarmViewModel = new ViewModelProvider(this).get(AlarmViewModel.class); + alarmViewModel.wellAlarmListResult.observe(this, new Observer() { + @Override + public void onChanged(WellAlarmListBean alarmDataBean) { + if (alarmDataBean.getCode() == 200) { + List dataRows = alarmDataBean.getData().getRows(); + for (WellAlarmListBean.DataBean.RowsBean rowsBean : dataRows) { + String queryParam = "编号='" + rowsBean.getWellCode() + "'"; + wellViewModel.getWellDetail(context, queryParam); + } + } + } + }); + alarmViewModel.getAlarmList(this, alarmTotal, 1); + + wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); + wellViewModel.resultModel.observe(this, new Observer() { + @Override + public void onChanged(WellDetailBean wellDetailBean) { + List features = wellDetailBean.getFeatures(); + if (features.size() > 0) { + WellDetailBean.FeaturesBean featuresBean = features.get(0); + //将获取到的井数据缓存起来 + geometryList.add(featuresBean); + WellDetailBean.FeaturesBean.GeometryBean geometryBean = featuresBean.getGeometry(); + //每获取一个点就绘制出 + addMarker(new Point(geometryBean.getX(), geometryBean.getY())); + } + } + }); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public void initEvent() { + binding.expandMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 0.5); + } + }); + binding.minusMapView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + binding.mapView.setViewpointScaleAsync(binding.mapView.getMapScale() * 2); + } + }); + + binding.mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, binding.mapView) { + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())); + Point clickPoint = binding.mapView.screenToLocation(screenPoint); + if (geometryList.size() > 0) { + List tempList = new ArrayList<>(); + for (WellDetailBean.FeaturesBean featuresBean : geometryList) { + WellDetailBean.FeaturesBean.GeometryBean dataBean = featuresBean.getGeometry(); + if (Math.abs(dataBean.getX() - clickPoint.getX()) <= 10 * LocaleConstant.DELTA_LNG_10 && + Math.abs(dataBean.getY() - clickPoint.getY()) <= 10 * LocaleConstant.DELTA_LNG_10) { + tempList.add(featuresBean); + } + } + if (tempList.size() > 0) { + QMUIDialog.MenuDialogBuilder menuDialogBuilder = new QMUIDialog.MenuDialogBuilder(context); + menuDialogBuilder.setTitle("请选择您要查看的窨井"); + for (WellDetailBean.FeaturesBean dataBean : tempList) { + menuDialogBuilder.addItem(dataBean.getAttributes().get编号(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + + View popupView = LayoutInflater.from(context).inflate(R.layout.popu_well, null); + TextView wellCodeView = popupView.findViewById(R.id.wellCodeView); + TextView wellTypeView = popupView.findViewById(R.id.wellTypeView); + TextView wellPositionView = popupView.findViewById(R.id.wellPositionView); + + WellDetailBean.FeaturesBean.AttributesBean attributes = dataBean.getAttributes(); + wellCodeView.setText(attributes.get编号()); + wellTypeView.setText(attributes.get附属物名称()); + wellPositionView.setText(attributes.get所属道路()); + + QMUIPopups.popup(context, QMUIDisplayHelper.dp2px(context, 290)) + .preferredDirection(QMUIPopup.DIRECTION_BOTTOM) + .view(popupView) + .edgeProtection(QMUIDisplayHelper.dp2px(context, 20)) + .dimAmount(0.6f) + .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER) + .onDismiss(null) + .show(binding.mapView); + } + }); + } + menuDialogBuilder.create().show(); + } + } + return super.onSingleTapConfirmed(e); + } + }); + } + + protected void onResume() { + super.onResume(); + binding.mapView.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + binding.mapView.pause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + binding.mapView.dispose(); + } + + private void addMarker(Point point) { + SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10); + Graphic graphic = new Graphic(point, simpleMarkerSymbol); + GraphicsOverlay mGraphicsOverlay = new GraphicsOverlay(); + ListenableList overlayGraphics = mGraphicsOverlay.getGraphics(); + ListenableList graphicsOverlays = binding.mapView.getGraphicsOverlays(); + overlayGraphics.add(graphic); + graphicsOverlays.add(mGraphicsOverlay); + } +} diff --git a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java index 1492a18..f114534 100644 --- a/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java +++ b/app/src/main/java/com/casic/dcms/view/pipeline/WellListActivity.java @@ -4,6 +4,7 @@ import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,6 +31,7 @@ import com.pengxh.androidx.lite.utils.LoadState; import com.pengxh.androidx.lite.utils.LoadingDialog; import com.pengxh.androidx.lite.utils.WeakReferenceHandler; +import com.pengxh.androidx.lite.widget.TitleBarView; import com.pengxh.androidx.lite.widget.dialog.AlertControlDialog; import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.widget.popup.QMUIPopup; @@ -41,41 +43,47 @@ import java.util.ArrayList; import java.util.List; -public class WellListActivity extends AndroidxBaseActivity { +public class WellListActivity extends AndroidxBaseActivity implements Handler.Callback { private final Context context = this; - private WeakReferenceHandler weakReferenceHandler; + private final WeakReferenceHandler weakReferenceHandler = new WeakReferenceHandler(this); private NormalRecyclerAdapter adapter; private WellViewModel wellViewModel; private List dataBeans = new ArrayList<>(); - private int pageIndex = 1; + private int page = 1; private boolean isRefresh, isLoadMore = false; @Override protected void setupTopBarLayout() { ViewGroupHub.initImmersionBar(binding.rootView, this, true, R.color.white); + binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() { + @Override + public void onLeftClick() { + finish(); + } - binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish()); - binding.titleBarLayout.titleView.setText("窨井列表"); - binding.titleBarLayout.rightImageView.setOnClickListener(view -> { - int popupWidth = QMUIDisplayHelper.dp2px(context, 100); - ArrayAdapter popupListAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); - QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, popupListAdapter, new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - switch (position) { - case 0: - showBatchOptionDialog("布防", "1"); - break; - case 1: - showBatchOptionDialog("撤防", "0"); - break; + @Override + public void onRightClick() { + int popupWidth = QMUIDisplayHelper.dp2px(context, 100); + ArrayAdapter adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, LocaleConstant.POPUP_OPTION_ITEMS); + QMUIPopups.listPopup(context, popupWidth, popupWidth * 2, adapter, new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: + showBatchOptionDialog("布防", "1"); + break; + case 1: + showBatchOptionDialog("撤防", "0"); + break; + } } - } - }).animStyle(QMUIPopup.ANIM_AUTO) - .shadowElevation(10, 1) - .radius(10) - .show(binding.titleBarLayout.rightImageView); + }) + .animStyle(QMUIPopup.ANIM_AUTO) + .shadowElevation(10, 1) + .radius(10) + .show(binding.anchorView); + } }); } @@ -84,10 +92,12 @@ wellViewModel.loadState.observe(this, new Observer() { @Override public void onChanged(LoadState loadState) { - if (loadState == LoadState.Loading) { - LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); - } else { - LoadingDialog.dismiss(); + if (!isRefresh && !isLoadMore) { + if (loadState == LoadState.Loading) { + LoadingDialog.show(WellListActivity.this, "数据加载中,请稍后"); + } else { + LoadingDialog.dismiss(); + } } } }); @@ -95,7 +105,6 @@ @Override public void initOnCreate(@Nullable Bundle savedInstanceState) { - weakReferenceHandler = new WeakReferenceHandler(callback); wellViewModel = new ViewModelProvider(this).get(WellViewModel.class); wellViewModel.listModel.observe(this, new Observer() { @Override @@ -120,6 +129,7 @@ } } }); + getWellList(); wellViewModel.operationActionModel.observe(this, new Observer() { @Override @@ -128,7 +138,7 @@ StringKit.show(context, "操作成功"); //取消成功之后自动刷新列表 isRefresh = true; - pageIndex = 1; + page = 1; getWellList(); } else { StringKit.show(context, "操作失败,请重试"); @@ -137,14 +147,8 @@ }); } - @Override - protected void onResume() { - getWellList(); - super.onResume(); - } - private void getWellList() { - wellViewModel.getWellList(this, pageIndex); + wellViewModel.getWellList(this, page); } @Override @@ -154,7 +158,7 @@ public void onRefresh(@NonNull final RefreshLayout refreshLayout) { isRefresh = true; //刷新之后页码重置 - pageIndex = 1; + page = 1; getWellList(); } }); @@ -162,13 +166,14 @@ @Override public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { isLoadMore = true; - pageIndex++; + page++; getWellList(); } }); } - private final Handler.Callback callback = msg -> { + @Override + public boolean handleMessage(@NonNull Message msg) { if (msg.what == 20210628) { if (dataBeans.size() == 0) { binding.emptyView.show("抱歉,无法为您查到窨井数据", null); @@ -195,6 +200,10 @@ viewHolder.setOnClickListener(R.id.wellNameView, new View.OnClickListener() { @Override public void onClick(View v) { + if (item.getDeep().isEmpty()) { + StringKit.show(context, "该位置井深未知"); + return; + } StringKit.show(context, "井深" + item.getDeep() + "m"); } }); @@ -232,7 +241,7 @@ } } return true; - }; + } //单个撤防/布防 private void showSingleOptionDialog(String bfztName, String id, String bfzt) { diff --git a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java index 73960d7..1e5dabd 100644 --- a/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/AlarmViewModel.java @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData; import com.casic.dcms.model.ActionResultBean; -import com.casic.dcms.model.AlarmDataBean; +import com.casic.dcms.model.WellAlarmListBean; import com.casic.dcms.utils.StringHelper; import com.casic.dcms.utils.retrofit.RetrofitServiceManager; import com.google.gson.Gson; @@ -22,12 +22,12 @@ public class AlarmViewModel extends BaseViewModel { private final Gson gson = new Gson(); - public MutableLiveData resultModel = new MutableLiveData<>(); + public MutableLiveData wellAlarmListResult = new MutableLiveData<>(); public MutableLiveData cancelActionModel = new MutableLiveData<>(); public void getAlarmList(Context context, int limit, int offset) { loadState.setValue(LoadState.Loading); - Observable alarmListObservable = RetrofitServiceManager.getAlarmListResult(limit, offset); + Observable alarmListObservable = RetrofitServiceManager.getAlarmList(limit, offset); ObserverSubscriber.addSubscribe(alarmListObservable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { @@ -45,9 +45,9 @@ String response = responseBody.string(); int responseCode = StringHelper.getResponseCode(response); if (responseCode == 200) { - AlarmDataBean alarmDataBean = gson.fromJson(response, new TypeToken() { + WellAlarmListBean alarmDataBean = gson.fromJson(response, new TypeToken() { }.getType()); - resultModel.setValue(alarmDataBean); + wellAlarmListResult.setValue(alarmDataBean); loadState.setValue(LoadState.Success); } else { loadState.setValue(LoadState.Fail); diff --git a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java index ef688c0..37e8f93 100644 --- a/app/src/main/java/com/casic/dcms/vm/WellViewModel.java +++ b/app/src/main/java/com/casic/dcms/vm/WellViewModel.java @@ -29,7 +29,7 @@ public void getWellList(Context context, int offset) { loadState.setValue(LoadState.Loading); - Observable observable = RetrofitServiceManager.getWellListResult(offset); + Observable observable = RetrofitServiceManager.getWellList(offset); ObserverSubscriber.addSubscribe(observable, new ObserverSubscriber.OnObserverCallback() { @Override public void onCompleted() { diff --git a/app/src/main/res/layout/activity_lamp_box_manager.xml b/app/src/main/res/layout/activity_lamp_box_manager.xml index ff06cf2..f0dbb28 100644 --- a/app/src/main/res/layout/activity_lamp_box_manager.xml +++ b/app/src/main/res/layout/activity_lamp_box_manager.xml @@ -4,6 +4,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + diff --git a/app/src/main/res/layout/activity_pipe.xml b/app/src/main/res/layout/activity_pipe.xml index 3abfc61..126f3ca 100644 --- a/app/src/main/res/layout/activity_pipe.xml +++ b/app/src/main/res/layout/activity_pipe.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/res/layout/activity_well_list.xml b/app/src/main/res/layout/activity_well_list.xml index b827fc8..45222cd 100644 --- a/app/src/main/res/layout/activity_well_list.xml +++ b/app/src/main/res/layout/activity_well_list.xml @@ -4,11 +4,30 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/white" android:orientation="vertical"> - + + + + + + diff --git a/app/src/main/res/layout/item_alarm_list_rv_l.xml b/app/src/main/res/layout/item_alarm_list_rv_l.xml new file mode 100644 index 0000000..f09f353 --- /dev/null +++ b/app/src/main/res/layout/item_alarm_list_rv_l.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_alarm_recycleview.xml b/app/src/main/res/layout/item_alarm_recycleview.xml deleted file mode 100644 index f09f353..0000000 --- a/app/src/main/res/layout/item_alarm_recycleview.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file