diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1e8c843..f9e8484 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,7 +82,6 @@ tools:replace="android:allowBackup" tools:targetApi="s"> - @@ -446,6 +445,9 @@ + @@ -1039,7 +1041,7 @@ android:windowSoftInputMode="adjustResize|stateHidden" /> data; + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public static class DeviceVibrationMonitoringData { + // 设备时间 + private Date deviceTime; + // --- 温度 + private Double temperature; + // --- 轴位移 + private Double xDisplacement; + private Double yDisplacement; + private Double zDisplacement; + + // --- 轴速度 + private Double xSpeed; + private Double ySpeed; + private Double zSpeed; + + // --- 轴加速度 + private Double xAcceleration; + private Double yAcceleration; + private Double zAcceleration; + + // --- 直流分量 + private Double xDcComponent; + private Double yDcComponent; + private Double zDcComponent; + + // --- 最强频率 + private Double xFrequency; + private Double yFrequency; + private Double zFrequency; + + // --- FREQ对应幅值 + private Double xFreq; + private Double yFreq; + private Double zFreq; + + public Date getDeviceTime() { + return deviceTime; + } + + public void setDeviceTime(Date deviceTime) { + this.deviceTime = deviceTime; + } + + public Double getTemperature() { + return temperature; + } + + public void setTemperature(Double temperature) { + this.temperature = temperature; + } + + public Double getxDisplacement() { + return xDisplacement; + } + + public void setxDisplacement(Double xDisplacement) { + this.xDisplacement = xDisplacement; + } + + public Double getyDisplacement() { + return yDisplacement; + } + + public void setyDisplacement(Double yDisplacement) { + this.yDisplacement = yDisplacement; + } + + public Double getzDisplacement() { + return zDisplacement; + } + + public void setzDisplacement(Double zDisplacement) { + this.zDisplacement = zDisplacement; + } + + public Double getxSpeed() { + return xSpeed; + } + + public void setxSpeed(Double xSpeed) { + this.xSpeed = xSpeed; + } + + public Double getySpeed() { + return ySpeed; + } + + public void setySpeed(Double ySpeed) { + this.ySpeed = ySpeed; + } + + public Double getzSpeed() { + return zSpeed; + } + + public void setzSpeed(Double zSpeed) { + this.zSpeed = zSpeed; + } + + public Double getxAcceleration() { + return xAcceleration; + } + + public void setxAcceleration(Double xAcceleration) { + this.xAcceleration = xAcceleration; + } + + public Double getyAcceleration() { + return yAcceleration; + } + + public void setyAcceleration(Double yAcceleration) { + this.yAcceleration = yAcceleration; + } + + public Double getzAcceleration() { + return zAcceleration; + } + + public void setzAcceleration(Double zAcceleration) { + this.zAcceleration = zAcceleration; + } + + public Double getxDcComponent() { + return xDcComponent; + } + + public void setxDcComponent(Double xDcComponent) { + this.xDcComponent = xDcComponent; + } + + public Double getyDcComponent() { + return yDcComponent; + } + + public void setyDcComponent(Double yDcComponent) { + this.yDcComponent = yDcComponent; + } + + public Double getzDcComponent() { + return zDcComponent; + } + + public void setzDcComponent(Double zDcComponent) { + this.zDcComponent = zDcComponent; + } + + public Double getxFrequency() { + return xFrequency; + } + + public void setxFrequency(Double xFrequency) { + this.xFrequency = xFrequency; + } + + public Double getyFrequency() { + return yFrequency; + } + + public void setyFrequency(Double yFrequency) { + this.yFrequency = yFrequency; + } + + public Double getzFrequency() { + return zFrequency; + } + + public void setzFrequency(Double zFrequency) { + this.zFrequency = zFrequency; + } + + public Double getxFreq() { + return xFreq; + } + + public void setxFreq(Double xFreq) { + this.xFreq = xFreq; + } + + public Double getyFreq() { + return yFreq; + } + + public void setyFreq(Double yFreq) { + this.yFreq = yFreq; + } + + public Double getzFreq() { + return zFreq; + } + + public void setzFreq(Double zFreq) { + this.zFreq = zFreq; + } + } +} diff --git a/app/src/main/java/com/rehome/zhdcoa/ui/activity/BaseWebActivity.java b/app/src/main/java/com/rehome/zhdcoa/ui/activity/BaseWebActivity.java index d53434d..bfecd30 100644 --- a/app/src/main/java/com/rehome/zhdcoa/ui/activity/BaseWebActivity.java +++ b/app/src/main/java/com/rehome/zhdcoa/ui/activity/BaseWebActivity.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; +import android.util.Log; import android.view.KeyEvent; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -19,6 +20,7 @@ import com.just.agentweb.AgentWeb; import com.just.agentweb.DefaultWebClient; import com.just.agentweb.WebChromeClient; import com.just.agentweb.WebViewClient; +import com.rehome.zhdcoa.Contans; import com.rehome.zhdcoa.R; import com.rehome.zhdcoa.weiget.WebLayout; @@ -84,7 +86,10 @@ public class BaseWebActivity extends AppCompatActivity { }; public String getUrl(String id) { - return "http://10.19.0.72:8082/M_CD/CD_RLCW_DGL_ZXT_SS.aspx?id=" + id; + //return "http://10.19.0.72:8082/M_CD/CD_RLCW_DGL_ZXT_SS.aspx?id=" + id; + String url = Contans.IP+"M_CD/CD_RLCW_DGL_ZXT_SS.aspx?id="+ id; + Log.i("app",url); + return url; } @Override diff --git a/app/src/main/java/com/rehome/zhdcoa/ui/activity/DeviceAlarmInfoDetailActivity.kt b/app/src/main/java/com/rehome/zhdcoa/ui/activity/DeviceAlarmInfoDetailActivity.kt index eaff2fb..cffd0c2 100644 --- a/app/src/main/java/com/rehome/zhdcoa/ui/activity/DeviceAlarmInfoDetailActivity.kt +++ b/app/src/main/java/com/rehome/zhdcoa/ui/activity/DeviceAlarmInfoDetailActivity.kt @@ -1,6 +1,7 @@ package com.rehome.zhdcoa.ui.activity import android.annotation.SuppressLint +import android.content.Intent import android.graphics.Color import android.view.View import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding @@ -9,14 +10,22 @@ import com.rehome.zhdcoa.databinding.ActivityDeviceAlarmInfoDetailBinding import com.rehome.zhdcoa.utils.GsonUtils class DeviceAlarmInfoDetailActivity : BaseActivityOaToolbarViewBinding() { + private var deviceCode:String?=null override fun getViewBinding() = ActivityDeviceAlarmInfoDetailBinding.inflate(layoutInflater) override fun getToolbar() = binding.toolbarView.toolbar override fun initView() { - initToolbar("设备预警信息详情", "",{ - - }) + initToolbar("设备预警信息详情", "曲线图") { + if(deviceCode!=null){ + val intent = Intent(context, DeviceAlarmInfoLineChartActivity::class.java) + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) + intent.putExtra("deviceCode",GsonUtils.GsonString(deviceCode)) + startActivity(intent) + }else{ + showToast("设备编码不存在") + } + } //binding.tvPaiHao.setTextColor(Color.parseColor("#0099ff")) binding.itemZt.tvBjz.setTextColor(Color.parseColor("#0099ff")) binding.itemZt.vHead.visibility= View.VISIBLE @@ -31,6 +40,7 @@ class DeviceAlarmInfoDetailActivity : BaseActivityOaToolbarViewBinding { + private String deviceCode; + private List deviceAlarmDataList = new ArrayList<>(); + + @Override + protected ActivityDeviceAlarmInfoLineChartBinding getBinding() { + return ActivityDeviceAlarmInfoLineChartBinding.inflate(LayoutInflater.from(this)); + } + + @Override + protected Toolbar getToolbar() { + return binding.toolbarView.toolbarYx; + } + + @Override + protected void initView() { + this.setStatusBar(); + binding.toolbarView.titleYx.setText("曲线图-测振测温设备"); + setBack(); + String deviceCodeTemp = getIntent().getStringExtra("deviceCode"); + if(deviceCodeTemp != null&&deviceCodeTemp.contains("\"")){ + deviceCode=deviceCodeTemp.replace("\"","").trim(); + } + } + + @Override + protected void initData() { + //http://10.19.0.17:1700/dserver/device/vibration/monitoring/list?deviceCode=002c005e&startTime=2026-01-21+14:37:00&endTime=2026-01-22+23:59:59&v=1769063841074 + /** + * deviceCode + * 002c005e + * startTime + * 2026-01-21 14:37:00 + * endTime + * 2026-01-22 23:59:59 + * v + * 1769063841074 + */ + if(deviceCode!=null){ + showLog(deviceCode); + getDeviceAlarmInfoLineChartData(); + } + } + + public void getDeviceAlarmInfoLineChartData() { + //格式化日期的对象(转化成习惯的时间格式) + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd"); + //静态方法getInstance()使用默认时区和语言环境获得一个日历。 + Calendar calendar = Calendar.getInstance(); + //输出当前系统时间; + //System.out.println("当前系统时间: "+sdFormat.format(calendar.getTime())); + //add()增加日期,以天为单位(Calendar封装了很多静态的操作时间的单位) + //增加10天,负数则为减少天数 + calendar.add(Calendar.DATE, -1); + //输出增加10天后的时间; + String startTime = sdf.format(calendar.getTime()); + showLog("startTime: "+startTime); + Calendar calendarEnd = Calendar.getInstance(); + String endTime = sdfDay.format(calendarEnd.getTime())+" 23:59:59"; + showLog("endTime: "+endTime); + + + + + String url = Contans.IP + Contans.DeviceAlermInfoDataListUrl; + Request request = NoHttp.createStringRequest(url, RequestMethod.GET); + request.add("deviceCode", deviceCode); + request.add("startTime", startTime); + request.add("endTime", endTime); + + NohttpUtils.getInstance().add(this,0, request, new HttpListener() { + + @Override + public void onSucceed(int what, com.yolanda.nohttp.rest.Response response) { + + String result = response.get(); + showLog(result); + + DeviceAlarmInfoLineChartBean bean = GsonToBean(result, DeviceAlarmInfoLineChartBean.class); + if(bean!=null && bean.getCode()==20000 && bean.isSuccess() && bean.getData()!=null && !bean.getData().isEmpty()){ + deviceAlarmDataList.clear(); + deviceAlarmDataList.addAll(bean.getData()); + + } + } + + @Override + public void onFailed(int what, com.yolanda.nohttp.rest.Response response) { + + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_device_alarm_info_line_chart.xml b/app/src/main/res/layout/activity_device_alarm_info_line_chart.xml new file mode 100644 index 0000000..16aee34 --- /dev/null +++ b/app/src/main/res/layout/activity_device_alarm_info_line_chart.xml @@ -0,0 +1,21 @@ + + + + + + + + +