diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java new file mode 100644 index 0000000..a2d7e26 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java @@ -0,0 +1,73 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellTypeAndCountModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List 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 DataDTO { + private String wellTypeName; + private String wellCount; + private String wellType; + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + + public String getWellCount() { + return wellCount; + } + + public void setWellCount(String wellCount) { + this.wellCount = wellCount; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java new file mode 100644 index 0000000..a2d7e26 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java @@ -0,0 +1,73 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellTypeAndCountModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List 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 DataDTO { + private String wellTypeName; + private String wellCount; + private String wellType; + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + + public String getWellCount() { + return wellCount; + } + + public void setWellCount(String wellCount) { + this.wellCount = wellCount; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java index 9d3581b..a85de08 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java @@ -5,7 +5,7 @@ public class WellTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,33 +41,33 @@ this.success = success; } - public static class DataDTO { - private String wellTypeName; - private String wellCount; - private String wellType; + public static class DataBean { + private String name; + private String id; + private String value; - public String getWellTypeName() { - return wellTypeName; + public String getName() { + return name; } - public void setWellTypeName(String wellTypeName) { - this.wellTypeName = wellTypeName; + public void setName(String name) { + this.name = name; } - public String getWellCount() { - return wellCount; + public String getId() { + return id; } - public void setWellCount(String wellCount) { - this.wellCount = wellCount; + public void setId(String id) { + this.id = id; } - public String getWellType() { - return wellType; + public String getValue() { + return value; } - public void setWellType(String wellType) { - this.wellType = wellType; + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java new file mode 100644 index 0000000..a2d7e26 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java @@ -0,0 +1,73 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellTypeAndCountModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List 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 DataDTO { + private String wellTypeName; + private String wellCount; + private String wellType; + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + + public String getWellCount() { + return wellCount; + } + + public void setWellCount(String wellCount) { + this.wellCount = wellCount; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java index 9d3581b..a85de08 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java @@ -5,7 +5,7 @@ public class WellTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,33 +41,33 @@ this.success = success; } - public static class DataDTO { - private String wellTypeName; - private String wellCount; - private String wellType; + public static class DataBean { + private String name; + private String id; + private String value; - public String getWellTypeName() { - return wellTypeName; + public String getName() { + return name; } - public void setWellTypeName(String wellTypeName) { - this.wellTypeName = wellTypeName; + public void setName(String name) { + this.name = name; } - public String getWellCount() { - return wellCount; + public String getId() { + return id; } - public void setWellCount(String wellCount) { - this.wellCount = wellCount; + public void setId(String id) { + this.id = id; } - public String getWellType() { - return wellType; + public String getValue() { + return value; } - public void setWellType(String wellType) { - this.wellType = wellType; + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 81764d3..7bf15e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -186,7 +186,7 @@ * 获取闸井类别 */ @GET("/statics/wellStaticsByType") - suspend fun obtainWellType(@Header("token") token: String): String + suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** * 获取设备类别 @@ -234,22 +234,37 @@ * @param keywords 关键字 * @param wellType 窨井类型 * @param deptid 部门ID - * @param isAlarm 是否报警 * @param limit 每页数据条数 * @param offset 页码 */ @GET("/well/list") - suspend fun obtainWellList( + suspend fun obtainWellPageList( @Header("token") token: String, @Query("keywords") keywords: String?, @Query("wellType") wellType: String?, @Query("deptid") deptid: String?, - @Query("isAlarm") isAlarm: String?, @Query("limit") limit: Int, - @Query("offset") offset: Int + @Query("offset") offset: Int, + @Query("sort") sort: String, + @Query("order") order: String ): String /** + * 获取权属单位 + */ + @GET("/dept/tree") + suspend fun obtainOwnerShip( + @Header("token") token: String, + @Query("deptType") deptType: String + ): String + + /** + * 获取闸井类别 + */ + @GET("/dict/code/sluicewellType") + suspend fun obtainWellType(@Header("token") token: String): String + + /** * 获取井下监控设备列表 * * @param id 窨井ID diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java new file mode 100644 index 0000000..a2d7e26 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java @@ -0,0 +1,73 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellTypeAndCountModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List 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 DataDTO { + private String wellTypeName; + private String wellCount; + private String wellType; + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + + public String getWellCount() { + return wellCount; + } + + public void setWellCount(String wellCount) { + this.wellCount = wellCount; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java index 9d3581b..a85de08 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java @@ -5,7 +5,7 @@ public class WellTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,33 +41,33 @@ this.success = success; } - public static class DataDTO { - private String wellTypeName; - private String wellCount; - private String wellType; + public static class DataBean { + private String name; + private String id; + private String value; - public String getWellTypeName() { - return wellTypeName; + public String getName() { + return name; } - public void setWellTypeName(String wellTypeName) { - this.wellTypeName = wellTypeName; + public void setName(String name) { + this.name = name; } - public String getWellCount() { - return wellCount; + public String getId() { + return id; } - public void setWellCount(String wellCount) { - this.wellCount = wellCount; + public void setId(String id) { + this.id = id; } - public String getWellType() { - return wellType; + public String getValue() { + return value; } - public void setWellType(String wellType) { - this.wellType = wellType; + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 81764d3..7bf15e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -186,7 +186,7 @@ * 获取闸井类别 */ @GET("/statics/wellStaticsByType") - suspend fun obtainWellType(@Header("token") token: String): String + suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** * 获取设备类别 @@ -234,22 +234,37 @@ * @param keywords 关键字 * @param wellType 窨井类型 * @param deptid 部门ID - * @param isAlarm 是否报警 * @param limit 每页数据条数 * @param offset 页码 */ @GET("/well/list") - suspend fun obtainWellList( + suspend fun obtainWellPageList( @Header("token") token: String, @Query("keywords") keywords: String?, @Query("wellType") wellType: String?, @Query("deptid") deptid: String?, - @Query("isAlarm") isAlarm: String?, @Query("limit") limit: Int, - @Query("offset") offset: Int + @Query("offset") offset: Int, + @Query("sort") sort: String, + @Query("order") order: String ): String /** + * 获取权属单位 + */ + @GET("/dept/tree") + suspend fun obtainOwnerShip( + @Header("token") token: String, + @Query("deptType") deptType: String + ): String + + /** + * 获取闸井类别 + */ + @GET("/dict/code/sluicewellType") + suspend fun obtainWellType(@Header("token") token: String): String + + /** * 获取井下监控设备列表 * * @param id 窨井ID diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt index bcf1d4d..b40c104 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt @@ -188,10 +188,10 @@ } /** - * 获取闸井类别 + * 获取闸井类别以及数量 */ - suspend fun obtainWellType(): String { - return api.obtainWellType(AuthenticationHelper.token!!) + suspend fun obtainWellTypeAndCount(): String { + return api.obtainWellTypeAndCount(AuthenticationHelper.token!!) } /** @@ -226,23 +226,38 @@ ) } -// /** -// * 获取获取闸井列表 -// */ -// suspend fun obtainWellList( -// keywords: String?, wellType: String?, deptid: String?, isAlarm: String?, page: Int -// ): String { -// return api.obtainWellList( -// AuthenticationHelper.token!!, -// keywords, -// wellType, -// deptid, -// isAlarm, -// Constant.PAGE_LIMIT, -// page -// ) -// } -// + /** + * 获取获取闸井列表-分页 + */ + suspend fun obtainWellPageList( + keywords: String?, wellType: String?, deptid: String?, offset: Int + ): String { + return api.obtainWellPageList( + AuthenticationHelper.token!!, + keywords, + wellType, + deptid, + Constant.PAGE_LIMIT, + offset, + "wellCode", + "asc" + ) + } + + /** + * 获取权属单位 + */ + suspend fun obtainOwnerShip(deptType: String): String { + return api.obtainOwnerShip(AuthenticationHelper.token!!, deptType) + } + + /** + * 获取闸井类别 + */ + suspend fun obtainWellType(): String { + return api.obtainWellType(AuthenticationHelper.token!!) + } + // /** // * 获取井下监控设备列表 // */ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2932de8..7f601e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,6 +45,7 @@ + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun onCreateViewHolder( + parent: ViewGroup, viewType: Int + ): WellListAdapter.ItemViewHolder { + return ItemViewHolder( + layoutInflater.inflate(R.layout.item_well_manage_recycleview, parent, false) + ) + } + + override fun getItemCount(): Int = dataRows.size + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + val wellType = rowsBean.wellTypeName.toString() + if (wellType == "其他") { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_gray) + } else { + holder.wellTypeView.setBackgroundResource(R.drawable.bg_text_tag_cyan) + } + holder.wellTypeView.text = wellType + holder.wellCodeView.text = rowsBean.wellCode + holder.wellDepthView.text = String.format("${rowsBean.deep}m") + holder.ownerShipView.text = String.format("权属单位:${rowsBean.deptName}") + holder.wellLocationView.text = String.format("详细地址:${rowsBean.position}") + holder.wellDeviceView.text = String.format("井下设备数:${rowsBean.deviceCount}") + //绑定事件 + if (listener != null) { + holder.itemView.setOnClickListener { + listener!!.onClicked(position) + } + holder.alarmHistoryButton.setOnClickListener { + listener!!.onHistoryClicked(position) + } + holder.editButton.setOnClickListener { + listener!!.onEditClicked(position) + } + holder.operationButton.setOnClickListener { + listener!!.onOperationClicked(position) + } + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var wellTypeView: TextView = view.findViewById(R.id.wellTypeView) + var wellCodeView: TextView = view.findViewById(R.id.wellCodeView) + var wellDepthView: TextView = view.findViewById(R.id.wellDepthView) + var ownerShipView: TextView = view.findViewById(R.id.ownerShipView) + var wellLocationView: TextView = view.findViewById(R.id.wellLocationView) + var wellDeviceView: TextView = view.findViewById(R.id.wellDeviceView) + var alarmHistoryButton: QMUIRoundButton = view.findViewById(R.id.alarmHistoryButton) + var editButton: QMUIRoundButton = view.findViewById(R.id.editButton) + var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onClicked(position: Int) + + fun onHistoryClicked(position: Int) + + fun onEditClicked(position: Int) + + fun onOperationClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index 7449c1c..eb24d44 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -107,7 +107,7 @@ val bottomSheetBehavior = BottomSheetBehavior.from(homeView.bottomBehaviorLayout) homeView.coordinatorLayout.post { bottomSheetBehavior.isFitToContents = false - bottomSheetBehavior.halfExpandedRatio = 0.55f + bottomSheetBehavior.halfExpandedRatio = 0.21f bottomSheetBehavior.isHideable = false bottomSheetBehavior.peekHeight = SizeUtil.dp2px(requireContext(), 30f) } @@ -204,11 +204,11 @@ }) //获取闸井类别 - wellViewModel.obtainWellType() - wellViewModel.wellTypeModel.observe(viewLifecycleOwner, { + wellViewModel.obtainWellTypeAndCount() + wellViewModel.wellTypeAndCountModel.observe(viewLifecycleOwner, { if (it.code == 200) { - val xAxisLabel: MutableList = java.util.ArrayList() - val barEntries: MutableList = java.util.ArrayList() + val xAxisLabel: MutableList = ArrayList() + val barEntries: MutableList = ArrayList() it.data?.forEachIndexed { index, dataBean -> xAxisLabel.add(dataBean.wellTypeName.toString()) val dataValue = if (dataBean.wellCount.toString().isBlank()) { diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java new file mode 100644 index 0000000..ef54cb8 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/OwnerShipModel.java @@ -0,0 +1,130 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class OwnerShipModel { + + 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 List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static class ListBean { + private boolean checked; + private String code; + private String id; + private String name; + private boolean open; + private String pcodes; + private String pid; + private String value; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public String getPcodes() { + return pcodes; + } + + public void setPcodes(String pcodes) { + this.pcodes = pcodes; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java new file mode 100644 index 0000000..3370c22 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellListPageModel.java @@ -0,0 +1,328 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellListPageModel { + + 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 List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsBean { + private String area; + private String bfzt; + private String bfztName; + private String coordinateX; + private String coordinateY; + private int deep; + private String deptName; + private String deptid; + private int deviceCount; + private String id; + private String latBaidu; + private String latGaode; + private String lngBaidu; + private String lngGaode; + private String notes; + private String photos; + private String position; + private String qu; + private String responsibleDept; + private String responsibleDeptName; + private String ts; + private String valid; + private String wellCode; + private String wellFlag1; + private String wellFlag2; + private String wellFlag3; + private String wellName; + private String wellType; + private String wellTypeName; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getBfzt() { + return bfzt; + } + + public void setBfzt(String bfzt) { + this.bfzt = bfzt; + } + + public String getBfztName() { + return bfztName; + } + + public void setBfztName(String bfztName) { + this.bfztName = bfztName; + } + + public String getCoordinateX() { + return coordinateX; + } + + public void setCoordinateX(String coordinateX) { + this.coordinateX = coordinateX; + } + + public String getCoordinateY() { + return coordinateY; + } + + public void setCoordinateY(String coordinateY) { + this.coordinateY = coordinateY; + } + + public int getDeep() { + return deep; + } + + public void setDeep(int deep) { + this.deep = deep; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public int getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(int deviceCount) { + this.deviceCount = deviceCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLatBaidu() { + return latBaidu; + } + + public void setLatBaidu(String latBaidu) { + this.latBaidu = latBaidu; + } + + public String getLatGaode() { + return latGaode; + } + + public void setLatGaode(String latGaode) { + this.latGaode = latGaode; + } + + public String getLngBaidu() { + return lngBaidu; + } + + public void setLngBaidu(String lngBaidu) { + this.lngBaidu = lngBaidu; + } + + public String getLngGaode() { + return lngGaode; + } + + public void setLngGaode(String lngGaode) { + this.lngGaode = lngGaode; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPhotos() { + return photos; + } + + public void setPhotos(String photos) { + this.photos = photos; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getQu() { + return qu; + } + + public void setQu(String qu) { + this.qu = qu; + } + + public String getResponsibleDept() { + return responsibleDept; + } + + public void setResponsibleDept(String responsibleDept) { + this.responsibleDept = responsibleDept; + } + + public String getResponsibleDeptName() { + return responsibleDeptName; + } + + public void setResponsibleDeptName(String responsibleDeptName) { + this.responsibleDeptName = responsibleDeptName; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getValid() { + return valid; + } + + public void setValid(String valid) { + this.valid = valid; + } + + public String getWellCode() { + return wellCode; + } + + public void setWellCode(String wellCode) { + this.wellCode = wellCode; + } + + public String getWellFlag1() { + return wellFlag1; + } + + public void setWellFlag1(String wellFlag1) { + this.wellFlag1 = wellFlag1; + } + + public String getWellFlag2() { + return wellFlag2; + } + + public void setWellFlag2(String wellFlag2) { + this.wellFlag2 = wellFlag2; + } + + public String getWellFlag3() { + return wellFlag3; + } + + public void setWellFlag3(String wellFlag3) { + this.wellFlag3 = wellFlag3; + } + + public String getWellName() { + return wellName; + } + + public void setWellName(String wellName) { + this.wellName = wellName; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java new file mode 100644 index 0000000..a2d7e26 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeAndCountModel.java @@ -0,0 +1,73 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class WellTypeAndCountModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List 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 DataDTO { + private String wellTypeName; + private String wellCount; + private String wellType; + + public String getWellTypeName() { + return wellTypeName; + } + + public void setWellTypeName(String wellTypeName) { + this.wellTypeName = wellTypeName; + } + + public String getWellCount() { + return wellCount; + } + + public void setWellCount(String wellCount) { + this.wellCount = wellCount; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java index 9d3581b..a85de08 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/WellTypeModel.java @@ -5,7 +5,7 @@ public class WellTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,33 +41,33 @@ this.success = success; } - public static class DataDTO { - private String wellTypeName; - private String wellCount; - private String wellType; + public static class DataBean { + private String name; + private String id; + private String value; - public String getWellTypeName() { - return wellTypeName; + public String getName() { + return name; } - public void setWellTypeName(String wellTypeName) { - this.wellTypeName = wellTypeName; + public void setName(String name) { + this.name = name; } - public String getWellCount() { - return wellCount; + public String getId() { + return id; } - public void setWellCount(String wellCount) { - this.wellCount = wellCount; + public void setId(String id) { + this.id = id; } - public String getWellType() { - return wellType; + public String getValue() { + return value; } - public void setWellType(String wellType) { - this.wellType = wellType; + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 81764d3..7bf15e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -186,7 +186,7 @@ * 获取闸井类别 */ @GET("/statics/wellStaticsByType") - suspend fun obtainWellType(@Header("token") token: String): String + suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** * 获取设备类别 @@ -234,22 +234,37 @@ * @param keywords 关键字 * @param wellType 窨井类型 * @param deptid 部门ID - * @param isAlarm 是否报警 * @param limit 每页数据条数 * @param offset 页码 */ @GET("/well/list") - suspend fun obtainWellList( + suspend fun obtainWellPageList( @Header("token") token: String, @Query("keywords") keywords: String?, @Query("wellType") wellType: String?, @Query("deptid") deptid: String?, - @Query("isAlarm") isAlarm: String?, @Query("limit") limit: Int, - @Query("offset") offset: Int + @Query("offset") offset: Int, + @Query("sort") sort: String, + @Query("order") order: String ): String /** + * 获取权属单位 + */ + @GET("/dept/tree") + suspend fun obtainOwnerShip( + @Header("token") token: String, + @Query("deptType") deptType: String + ): String + + /** + * 获取闸井类别 + */ + @GET("/dict/code/sluicewellType") + suspend fun obtainWellType(@Header("token") token: String): String + + /** * 获取井下监控设备列表 * * @param id 窨井ID diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt index bcf1d4d..b40c104 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt @@ -188,10 +188,10 @@ } /** - * 获取闸井类别 + * 获取闸井类别以及数量 */ - suspend fun obtainWellType(): String { - return api.obtainWellType(AuthenticationHelper.token!!) + suspend fun obtainWellTypeAndCount(): String { + return api.obtainWellTypeAndCount(AuthenticationHelper.token!!) } /** @@ -226,23 +226,38 @@ ) } -// /** -// * 获取获取闸井列表 -// */ -// suspend fun obtainWellList( -// keywords: String?, wellType: String?, deptid: String?, isAlarm: String?, page: Int -// ): String { -// return api.obtainWellList( -// AuthenticationHelper.token!!, -// keywords, -// wellType, -// deptid, -// isAlarm, -// Constant.PAGE_LIMIT, -// page -// ) -// } -// + /** + * 获取获取闸井列表-分页 + */ + suspend fun obtainWellPageList( + keywords: String?, wellType: String?, deptid: String?, offset: Int + ): String { + return api.obtainWellPageList( + AuthenticationHelper.token!!, + keywords, + wellType, + deptid, + Constant.PAGE_LIMIT, + offset, + "wellCode", + "asc" + ) + } + + /** + * 获取权属单位 + */ + suspend fun obtainOwnerShip(deptType: String): String { + return api.obtainOwnerShip(AuthenticationHelper.token!!, deptType) + } + + /** + * 获取闸井类别 + */ + suspend fun obtainWellType(): String { + return api.obtainWellType(AuthenticationHelper.token!!) + } + // /** // * 获取井下监控设备列表 // */ diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/view/WellManageActivity.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/view/WellManageActivity.kt new file mode 100644 index 0000000..173e216 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/view/WellManageActivity.kt @@ -0,0 +1,234 @@ +package com.casic.app.smartwell.sanxi.view + +import android.os.Handler +import android.view.View +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import androidx.core.view.GravityCompat +import androidx.drawerlayout.widget.DrawerLayout +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.LinearLayoutManager +import com.casic.app.smartwell.sanxi.R +import com.casic.app.smartwell.sanxi.adapter.WellListAdapter +import com.casic.app.smartwell.sanxi.base.BaseActivity +import com.casic.app.smartwell.sanxi.extensions.show +import com.casic.app.smartwell.sanxi.extensions.showEmptyPage +import com.casic.app.smartwell.sanxi.model.OwnerShipModel +import com.casic.app.smartwell.sanxi.model.WellListPageModel +import com.casic.app.smartwell.sanxi.utils.WeakReferenceHandler +import com.casic.app.smartwell.sanxi.vm.AuthenticateViewModel +import com.casic.app.smartwell.sanxi.vm.WellViewModel +import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet +import kotlinx.android.synthetic.main.activity_well_manage.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_select_title.* + +class WellManageActivity : BaseActivity(), DrawerLayout.DrawerListener { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var wellViewModel: WellViewModel + private lateinit var authenticateViewModel: AuthenticateViewModel + private lateinit var wellListAdapter: WellListAdapter + private var dataBeans: MutableList = ArrayList() + private var keywords = "" + private var wellType = "" + private var deptId = "" + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initLayoutView(): Int = R.layout.activity_well_manage + + override fun setupTopBarLayout() { + leftBackView.setOnClickListener { finish() } + titleView.text = "闸井列表" + rightOptionView.setOnClickListener { + if (rightDrawerLayout.isDrawerOpen(GravityCompat.END)) { + rightDrawerLayout.closeDrawer(GravityCompat.END) + } else { + rightDrawerLayout.openDrawer(GravityCompat.END) + } + } + rightDrawerLayout.addDrawerListener(this) + } + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + //初始化vm + wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) + obtainWellListByPage() + authenticateViewModel = ViewModelProvider(this).get(AuthenticateViewModel::class.java) + } + + override fun initEvent() { + resultRefreshLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + obtainWellListByPage() + } + resultRefreshLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + obtainWellListByPage() + } + + wellViewModel.wellListPageModel.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows!! + resultRefreshLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows?.size == 0) { + "到底了,别拉了".show() + } + dataBeans.addAll(dataRows!!) + resultRefreshLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows!! + } + } + weakReferenceHandler.sendEmptyMessage(2022060901) + } + }) + + wellViewModel.wellTypeModel.observe(this, { + if (it.code == 200) { + val sheetBuilder = QMUIBottomSheet.BottomListSheetBuilder(this) + sheetBuilder.setTitle("井类型") + it.data.forEach { type -> + sheetBuilder.addItem(type.name) + } + sheetBuilder.setGravityCenter(true) + .setOnSheetItemClickListener { dialog, _, position, tag -> + wellTypeView.text = tag + this.wellType = it.data[position].id.toString() + + dialog.dismiss() + }.build().show() + } + }) + + authenticateViewModel.resultModel.observe(this, { + if (it.code == 200) { + val ownerShipModel: MutableList = ArrayList() + it.data?.list?.forEach { listBean -> + ownerShipModel.add(listBean) + } + val sheetBuilder = QMUIBottomSheet.BottomListSheetBuilder(this) + sheetBuilder.setTitle("权属单位") + ownerShipModel.forEach { model -> + sheetBuilder.addItem(model.name) + } + sheetBuilder.setGravityCenter(true) + .setOnSheetItemClickListener { dialog, _, position, tag -> + ownerShipView.text = tag + this.deptId = ownerShipModel[position].id.toString() + + dialog.dismiss() + }.build().show() + } + }) + } + + override fun onDrawerSlide(drawerView: View, slideOffset: Float) { + + } + + override fun onDrawerOpened(drawerView: View) { + val wellCodeView = drawerView.findViewById(R.id.wellCodeView) + val wellTypeView = drawerView.findViewById(R.id.wellTypeView) + val ownerShipView = drawerView.findViewById(R.id.ownerShipView) + val searchButton = drawerView.findViewById