设备预警信息 列表完成

master
wenfei 2 weeks ago
parent f2ed4ad2f9
commit dd01c167c7

@ -442,7 +442,7 @@
android:name=".ui.activity.SbinfoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.DeviceAlarmInfofoActivity"
android:name=".ui.activity.DeviceAlarmInfoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.YdckglActivity"

@ -0,0 +1,34 @@
package com.rehome.zhdcoa.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.rehome.zhdcoa.base.BaseViewBindingAdapter
import com.rehome.zhdcoa.bean.DeviceAlarmListResultBean
import com.rehome.zhdcoa.databinding.AdapterDeviceAlarmInfoBinding
class DeviceAlarmInfoAdapter(var context: Context,var data: MutableList<DeviceAlarmListResultBean.DeviceWarning>) : BaseViewBindingAdapter<AdapterDeviceAlarmInfoBinding>(context){
override fun getCount(): Int {
return data.count()
}
override fun getItem(position: Int): Any {
return data[position]
}
override fun getItemId(position: Int): Long {
return position.toLong()
}
override fun getBinding(inflater: LayoutInflater,parent: ViewGroup?) = AdapterDeviceAlarmInfoBinding.inflate(inflater, parent, false)
override fun handleData(position: Int, binding: AdapterDeviceAlarmInfoBinding) {
val item: DeviceAlarmListResultBean.DeviceWarning = data[position]
binding.tvSbwz.text = item.deviceName
binding.tvSbid.text = item.deviceCode
binding.tvZj.text = item.specialtyStr
binding.tvBjqx.text = item.description
binding.tvSj.text = item.warningTime
}
}

@ -0,0 +1,33 @@
package com.rehome.zhdcoa.bean;
public class DeviceAlarmBaseBean {
private boolean success;
//信息提示
private int code;
private String message;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

@ -2,18 +2,85 @@ package com.rehome.zhdcoa.bean;
import java.util.List;
public class DeviceAlarmListResultBean extends AIBaseBean{
private RowsBean data;
public class DeviceAlarmListResultBean extends DeviceAlarmBaseBean{
private Page data;
public RowsBean getData() {
public Page getData() {
return data;
}
public void setData(RowsBean data) {
public void setData(Page data) {
this.data = data;
}
public static class Params {
public static class Page{
/**
*
*/
private Long pageNo;
/**
*
*/
private Long pageSize;
/**
*
*/
private Long totalRow;
/**
*
*/
private Long totalPage;
/**
*
*/
private List<DeviceWarning> dataList;
public Long getPageNo() {
return pageNo;
}
public void setPageNo(Long pageNo) {
this.pageNo = pageNo;
}
public Long getPageSize() {
return pageSize;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
public Long getTotalRow() {
return totalRow;
}
public void setTotalRow(Long totalRow) {
this.totalRow = totalRow;
}
public Long getTotalPage() {
return totalPage;
}
public void setTotalPage(Long totalPage) {
this.totalPage = totalPage;
}
public List<DeviceWarning> getDataList() {
return dataList;
}
public void setDataList(List<DeviceWarning> dataList) {
this.dataList = dataList;
}
}
public static class DeviceParams {
private Double tptAlarmMaxValue;//
private Double spdAlarmMaxValue;//
private Double dpmAlarmMinValue;//
@ -70,53 +137,6 @@ public class DeviceAlarmListResultBean extends AIBaseBean{
}
}
public static class RowsBean {
private int pageNo;//当前页
private int pageSize;//每页条数
private int totalRow;//总条数
private int totalPage;//总页数
private List<DataListBean> dataList;//报警数据列表
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalRow() {
return totalRow;
}
public void setTotalRow(int totalRow) {
this.totalRow = totalRow;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public List<DataListBean> getDataList() {
return dataList;
}
public void setDataList(List<DataListBean> dataList) {
this.dataList = dataList;
}
}
public static class DeviceData{
private Long id;//id
private String mqttIp;//设备ip
@ -353,15 +373,15 @@ public class DeviceAlarmListResultBean extends AIBaseBean{
this.zFreq = zFreq;
}
}
public static class DataListBean {
public static class DeviceWarning {
private Long id;//id
private String warningTime;//预警时间
private String createTime;//创䢖时间
private String description;//报警类型
private String deviceCode;//设备编号
private String deviceName;//设备名称
private Params params;//参数
private DeviceData data;//设备信息
private String params;//参数
private String data;//设备信息
private String statusStr;//设备状态描述
private String specialtyStr;//专业
private String typeStr;//类型描述
@ -414,22 +434,6 @@ public class DeviceAlarmListResultBean extends AIBaseBean{
this.deviceName = deviceName;
}
public Params getParams() {
return params;
}
public void setParams(Params params) {
this.params = params;
}
public DeviceData getData() {
return data;
}
public void setData(DeviceData data) {
this.data = data;
}
public String getStatusStr() {
return statusStr;
}
@ -453,5 +457,21 @@ public class DeviceAlarmListResultBean extends AIBaseBean{
public void setTypeStr(String typeStr) {
this.typeStr = typeStr;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
}

@ -5,15 +5,15 @@ package com.rehome.zhdcoa.ui.activity
import android.content.Intent
import android.text.TextUtils
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import com.rehome.zhdcoa.Contans
import com.rehome.zhdcoa.R
import com.rehome.zhdcoa.adapter.WorkRiskLevelListAdapter
import com.rehome.zhdcoa.adapter.DeviceAlarmInfoAdapter
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.zhdcoa.bean.DeviceAlarmListResultBean
import com.rehome.zhdcoa.bean.DeviceAlarmListResultBean.DataListBean
import com.rehome.zhdcoa.bean.WorkRiskLevelListBean
import com.rehome.zhdcoa.databinding.ActivityDeviceAlarmInfofoBinding
import com.rehome.zhdcoa.utils.AuthenticationLoginAIUtils
import com.rehome.zhdcoa.utils.GsonUtils
@ -23,40 +23,31 @@ import com.rehome.zhdcoa.utils.RSAAndroid
import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response
import java.text.SimpleDateFormat
import java.util.Calendar
/**
* Create By HuangWenFei
* 创建日期2024-04-02 14:34
* 描述每日作业风险清单
*/
class DeviceAlarmInfofoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceAlarmInfofoBinding>() {
class DeviceAlarmInfoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceAlarmInfofoBinding>() {
private lateinit var headView: View
private var datas: MutableList<DeviceAlarmListResultBean.DataListBean> = mutableListOf()//报警数据列表
private var datas: MutableList<DeviceAlarmListResultBean.DeviceWarning> = mutableListOf()//报警数据列表
val specialtyList = mutableListOf<String>("all", "STEAM_TURBINE", "CYCLIZATION", "BOILER", "ELECTRICAL")
private lateinit var mAdapter: WorkRiskLevelListAdapter
private lateinit var deviceAlarmInfoAdapter: DeviceAlarmInfoAdapter
private var selectList: MutableList<Int> = mutableListOf()
private var jobNoList: MutableList<String> = mutableListOf()
private lateinit var spinnerAdapter:ArrayAdapter<CharSequence>
private var selectListAssistant: MutableList<Int> = mutableListOf()
private var jobNoListAssistant: MutableList<String> = mutableListOf()
private lateinit var launcherResultQRCode: ActivityResultLauncher<Intent>
private var pageNo = 1
private var pageSize = 20
private var selectListCustom: MutableList<Int> = mutableListOf()
private var jobNoListCustom: MutableList<String> = mutableListOf()
private var dataA: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private var dataB: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private var dataC1: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private var dataC2: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private var dataC3: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private var dataLowRisk: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
private lateinit var launcherResultQRCode: ActivityResultLauncher<Intent>
override fun getViewBinding() = ActivityDeviceAlarmInfofoBinding.inflate(layoutInflater)
@ -68,54 +59,58 @@ class DeviceAlarmInfofoActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
})
// 创建适配器
spinnerAdapter = ArrayAdapter.createFromResource(
this,
R.array.spinner_items_zy,
android.R.layout.simple_spinner_item
)
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
binding.spZy.adapter = spinnerAdapter
// 设置选择监听
binding.spZy.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
val selectedItem = parent?.getItemAtPosition(position).toString()
showLog(selectedItem)
pageNo=1
}
override fun onNothingSelected(parent: AdapterView<*>?) {
// 处理未选择的情况
}
}
launcherResultQRCode = createQRCodeActivityResultLauncher()
binding.lv.emptyView = binding.tvNodata
headView = View.inflate(this, R.layout.item_work_risk_list, null)
mAdapter = WorkRiskLevelListAdapter(this,datas,
{ position ->
val item = datas[position]
if(item.hazardList!=null&&item.hazardList.size>0){
//进入风险提示页面
val intent = Intent(context, WorkRiskListTipActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.putExtra("hazardList", GsonUtils.GsonString(item.hazardList))
startActivity(intent)
}
},
{ position ->
val item = datas[position]
if(item.hazardList!=null&&item.hazardList.size>0){
//进入修改风险等级
val intent = Intent(context, CustomDialogChangeLevelActivity::class.java)
intent.putExtra("id",item.id)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.putExtra("level", item.level)
intent.putExtra("type", item.type)
launcherResultQRCode.launch(intent)
}
},
{ position ->
val item = datas[position]
showLog("---------")
showLog(GsonUtils.GsonString(item))
//工作情况汇报
val intent = Intent(context, WorkRiskListHuiBaoActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.putExtra("level",item.level)
intent.putExtra("type",item.type)
intent.putExtra("id",item.id)
startActivity(intent)
}
)
//binding.lv.addHeaderView(headView, null, false)
binding.lv.adapter = mAdapter
//格式化日期的对象(转化成习惯的时间格式)
val sdFormat = SimpleDateFormat("yyyy.MM.dd")
//静态方法getInstance()使用默认时区和语言环境获得一个日历。
val calendar = Calendar.getInstance()
deviceAlarmInfoAdapter = DeviceAlarmInfoAdapter(context, datas)
binding.lv.adapter = deviceAlarmInfoAdapter
binding.tvNodata.visibility= View.VISIBLE
binding.lv.visibility=View.GONE
binding.lv.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
val item:DeviceAlarmListResultBean.DeviceWarning = datas[position]
showLog(GsonUtils.GsonString(item))
}
binding.btnQuery.setOnClickListener {
authenticationLoginDeviceAlermInfo()
}
// binding.lv.setOnItemClickListener { _, _, position, _ ->
// val item: WarehouseHuoJiaBean.RowsBean = warehouseHuoJiaList[position]
// val intent = Intent()
// intent.setClass(this, WztpblScDetailActivity::class.java)
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
// intent.putExtra("item",Gson().toJson(item))
// startActivity(intent)
// }
}
override fun initData() {
@ -204,8 +199,27 @@ class DeviceAlarmInfofoActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
RequestMethod.GET
)
request.add("pageNo",1)
request.add("pageSize",10)
request.add("pageNo",pageNo)
request.add("pageSize",pageSize)
val zyTemp:String = binding.spZy.selectedItem.toString()
//binding.spZy.getSelectedItemPosition()
// if(!TextUtils.isEmpty(zyTemp)){
// request.add("specialty",zyTemp)
// }
val zyIndex:Int = binding.spZy.selectedItemPosition
if(zyIndex!=0){
request.add("specialty",specialtyList[zyIndex])
}
showLog(zyTemp)
showLog(zyIndex.toString())
val keyword = binding.etKey.text.toString().trim()
if(!TextUtils.isEmpty(keyword)){
request.add("keyword",keyword)
}
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
@ -217,13 +231,17 @@ class DeviceAlarmInfofoActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
result,
DeviceAlarmListResultBean::class.java
)
showLog(GsonUtils.GsonString(bean))
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null && bean.data.dataList != null && bean.data.dataList.size>0) {
datas.clear()
datas.addAll(bean.data.dataList)
mAdapter.notifyDataSetChanged()
deviceAlarmInfoAdapter.notifyDataSetChanged()
binding.tvNodata.visibility = View.GONE
headView.visibility = View.VISIBLE
}else{
datas.clear()
deviceAlarmInfoAdapter.notifyDataSetChanged()
binding.tvNodata.visibility = View.VISIBLE
headView.visibility = View.VISIBLE
}

@ -49,7 +49,7 @@ import com.rehome.zhdcoa.databinding.FragmentYunxingBinding
import com.rehome.zhdcoa.service.PushService
import com.rehome.zhdcoa.service.UploadDataService
import com.rehome.zhdcoa.ui.activity.AjhxcglActivity
import com.rehome.zhdcoa.ui.activity.DeviceAlarmInfofoActivity
import com.rehome.zhdcoa.ui.activity.DeviceAlarmInfoActivity
import com.rehome.zhdcoa.ui.activity.GdActivity
import com.rehome.zhdcoa.ui.activity.SbinfoActivity
import com.rehome.zhdcoa.ui.activity.SbxdjglActivity
@ -234,7 +234,7 @@ class YunXingFragment : BaseViewBindingKotlinFragment<FragmentYunxingBinding>()
}
9 -> {
intent = Intent(activity, DeviceAlarmInfofoActivity::class.java)
intent = Intent(activity, DeviceAlarmInfoActivity::class.java)
startActivity(intent)
}

@ -10,20 +10,77 @@
<include
android:id="@+id/toolbarView"
layout="@layout/layout_base" />
<include
android:id="@+id/item_head"
layout="@layout/item_work_risk_list"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="10px">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_sysit"
android:padding="3dp"
android:textColor="#333333"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="专业:" />
<Spinner
android:id="@+id/sp_zy"
style="@style/editTextTheme"
android:layout_width="match_parent"
android:layout_height="70px"
android:layout_gravity="center"
android:gravity="center"
android:padding="0px"
android:textSize="@dimen/px_30" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1">
<EditText
android:id="@+id/et_key"
style="@style/editTextTheme"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_weight="1"
android:hint="请转入关键字" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_marginStart="10px"
android:layout_marginEnd="10px"
android:layout_marginTop="5dp"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp">
<Button
android:id="@+id/btn_query"
style="@style/button"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:textSize="18sp"
android:text="查询" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10px"
android:layout_marginEnd="10px"
android:layout_marginBottom="10px"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1">
<ListView
@ -31,7 +88,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#00000000"
android:dividerHeight="0px"/>
android:dividerHeight="5dp"/>
<TextView
android:id="@+id/tv_nodata"

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="UselessParent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="UselessParent">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="设备位置:" />
<TextView
android:id="@+id/tv_sbwz"
style="@style/dagerDetailRightStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设备ID:" />
<TextView
android:id="@+id/tv_sbid"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="专业:" />
<TextView
android:id="@+id/tv_zj"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="报警信息:" />
<TextView
android:id="@+id/tv_bjqx"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="时间:" />
<TextView
android:id="@+id/tv_sj"
style="@style/dagerDetailRightStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="40dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginEnd="3dp"
android:layout_marginStart="3dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/packup"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -45,6 +45,14 @@
<item>https://vpn.zhp.geg.com.cn</item>
</string-array>
<string-array name="spinner_items_zy">
<item>所有</item>
<item>汽机</item>
<item>环化</item>
<item>锅炉</item>
<item>电气</item>
</string-array>
<declare-styleable name="CanBanScrollViewPager">
<attr name="isScroll" format="boolean" />
</declare-styleable>

Loading…
Cancel
Save