diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt index 5ac5c96..1f91f43 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt @@ -46,7 +46,7 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.inspectMsgView, item.inspectionTitle) + viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") .setText(R.id.startTimeView, item.startTime) .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt index 5ac5c96..1f91f43 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt @@ -46,7 +46,7 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.inspectMsgView, item.inspectionTitle) + viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") .setText(R.id.startTimeView, item.startTime) .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt index 06bf6c8..9b49ff6 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt @@ -33,6 +33,7 @@ private val realPaths: ArrayList = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var inspectionId: String + private lateinit var deviceCode: String private lateinit var title: String private lateinit var type: String private var isWarning: Boolean = true @@ -49,8 +50,9 @@ isWarning = args[0].toString() == "0" inspectionId = args[1] title = args[2] - longitude = args[3].toDouble() - latitude = args[4].toDouble() + deviceCode = args[3] + longitude = args[4].toDouble() + latitude = args[5].toDouble() if (isWarning) { binding.titleInclude.titleView.text = "报警事件记录" @@ -126,6 +128,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = inspectionId, + deviceCode = deviceCode, eventTitle = title, createTime = binding.createTimeView.text.toString(), type = type, diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt index 5ac5c96..1f91f43 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt @@ -46,7 +46,7 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.inspectMsgView, item.inspectionTitle) + viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") .setText(R.id.startTimeView, item.startTime) .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt index 06bf6c8..9b49ff6 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt @@ -33,6 +33,7 @@ private val realPaths: ArrayList = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var inspectionId: String + private lateinit var deviceCode: String private lateinit var title: String private lateinit var type: String private var isWarning: Boolean = true @@ -49,8 +50,9 @@ isWarning = args[0].toString() == "0" inspectionId = args[1] title = args[2] - longitude = args[3].toDouble() - latitude = args[4].toDouble() + deviceCode = args[3] + longitude = args[4].toDouble() + latitude = args[5].toDouble() if (isWarning) { binding.titleInclude.titleView.text = "报警事件记录" @@ -126,6 +128,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = inspectionId, + deviceCode = deviceCode, eventTitle = title, createTime = binding.createTimeView.text.toString(), type = type, diff --git a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 88354c2..d95fd83 100644 --- a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt @@ -175,6 +175,7 @@ fun addEvent( taskId: String, inspectionId: String, + deviceCode: String, eventTitle: String, createTime: String, lng: Double, @@ -187,6 +188,7 @@ val bean = TaskEventLocalBean() bean.taskId = taskId bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.eventTitle = eventTitle bean.createTime = createTime bean.lng = lng diff --git a/app/build.gradle b/app/build.gradle index c1c3a37..81c86ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.greenrobot.greendao' android { @@ -21,8 +20,8 @@ applicationId "com.casic.birmm.inspect" minSdkVersion 23 targetSdkVersion 33 - versionCode 1003 - versionName "1.0.0.3" + versionCode 1004 + versionName "1.0.0.4" } buildTypes { diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java index b28d94a..6392365 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/TaskEventLocalBean.java @@ -13,6 +13,7 @@ @Unique private String taskId; //事件id private String inspectionId; // 巡检id + private String deviceCode; // 设备code private String eventTitle; // 事件标题:巡检标签-事件类型 private String createTime; //开始时间 private double lng; // 经度 @@ -23,13 +24,15 @@ private String description; // 事件描述 private String user; - @Generated(hash = 1163567033) + @Generated(hash = 1550169679) public TaskEventLocalBean(Long id, String taskId, String inspectionId, - String eventTitle, String createTime, double lng, double lat, - String type, int data, String images, String description, String user) { + String deviceCode, String eventTitle, String createTime, double lng, + double lat, String type, int data, String images, String description, + String user) { this.id = id; this.taskId = taskId; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.eventTitle = eventTitle; this.createTime = createTime; this.lng = lng; @@ -69,6 +72,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getEventTitle() { return this.eventTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt index 570fb00..359975a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryEventFragment.kt @@ -125,6 +125,7 @@ viewHolder.setText(R.id.inspectMsgView, item.name) .setText(R.id.inspectTypeView, "类型:${item.type}") +// .setText(R.id.deviceCodeView, "设备:${item.deviceCode}") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt index 2d8b8b4..87d82c2 100644 --- a/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/fragment/QueryInspectionFragment.kt @@ -113,8 +113,7 @@ viewHolder: ViewHolder, position: Int, item: InspectListModel.DataModel.RowsModel ) { - viewHolder - .setText(R.id.inspectMsgView, item.name) + viewHolder.setText(R.id.inspectMsgView, "任务:${item.name}") .setText(R.id.startTimeView, item.startTime) // .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java index 5b65241..6d85d41 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/TaskEventLocalBeanDao.java @@ -27,15 +27,16 @@ public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); public final static Property InspectionId = new Property(2, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property EventTitle = new Property(3, String.class, "eventTitle", false, "EVENT_TITLE"); - public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Lng = new Property(5, double.class, "lng", false, "LNG"); - public final static Property Lat = new Property(6, double.class, "lat", false, "LAT"); - public final static Property Type = new Property(7, String.class, "type", false, "TYPE"); - public final static Property Data = new Property(8, int.class, "data", false, "DATA"); - public final static Property Images = new Property(9, String.class, "images", false, "IMAGES"); - public final static Property Description = new Property(10, String.class, "description", false, "DESCRIPTION"); - public final static Property User = new Property(11, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(3, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property EventTitle = new Property(4, String.class, "eventTitle", false, "EVENT_TITLE"); + public final static Property CreateTime = new Property(5, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Lng = new Property(6, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(7, double.class, "lat", false, "LAT"); + public final static Property Type = new Property(8, String.class, "type", false, "TYPE"); + public final static Property Data = new Property(9, int.class, "data", false, "DATA"); + public final static Property Images = new Property(10, String.class, "images", false, "IMAGES"); + public final static Property Description = new Property(11, String.class, "description", false, "DESCRIPTION"); + public final static Property User = new Property(12, String.class, "user", false, "USER"); } @@ -54,15 +55,16 @@ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TASK_ID\" TEXT UNIQUE ," + // 1: taskId "\"INSPECTION_ID\" TEXT," + // 2: inspectionId - "\"EVENT_TITLE\" TEXT," + // 3: eventTitle - "\"CREATE_TIME\" TEXT," + // 4: createTime - "\"LNG\" REAL NOT NULL ," + // 5: lng - "\"LAT\" REAL NOT NULL ," + // 6: lat - "\"TYPE\" TEXT," + // 7: type - "\"DATA\" INTEGER NOT NULL ," + // 8: data - "\"IMAGES\" TEXT," + // 9: images - "\"DESCRIPTION\" TEXT," + // 10: description - "\"USER\" TEXT);"); // 11: user + "\"DEVICE_CODE\" TEXT," + // 3: deviceCode + "\"EVENT_TITLE\" TEXT," + // 4: eventTitle + "\"CREATE_TIME\" TEXT," + // 5: createTime + "\"LNG\" REAL NOT NULL ," + // 6: lng + "\"LAT\" REAL NOT NULL ," + // 7: lat + "\"TYPE\" TEXT," + // 8: type + "\"DATA\" INTEGER NOT NULL ," + // 9: data + "\"IMAGES\" TEXT," + // 10: images + "\"DESCRIPTION\" TEXT," + // 11: description + "\"USER\" TEXT);"); // 12: user } /** Drops the underlying database table. */ @@ -79,48 +81,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -132,48 +139,53 @@ if (id != null) { stmt.bindLong(1, id); } - + String taskId = entity.getTaskId(); if (taskId != null) { stmt.bindString(2, taskId); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(3, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(4, deviceCode); + } + String eventTitle = entity.getEventTitle(); if (eventTitle != null) { - stmt.bindString(4, eventTitle); + stmt.bindString(5, eventTitle); } - + String createTime = entity.getCreateTime(); if (createTime != null) { - stmt.bindString(5, createTime); + stmt.bindString(6, createTime); } - stmt.bindDouble(6, entity.getLng()); - stmt.bindDouble(7, entity.getLat()); - + stmt.bindDouble(7, entity.getLng()); + stmt.bindDouble(8, entity.getLat()); + String type = entity.getType(); if (type != null) { - stmt.bindString(8, type); + stmt.bindString(9, type); } - stmt.bindLong(9, entity.getData()); - + stmt.bindLong(10, entity.getData()); + String images = entity.getImages(); if (images != null) { - stmt.bindString(10, images); + stmt.bindString(11, images); } String description = entity.getDescription(); if (description != null) { - stmt.bindString(11, description); + stmt.bindString(12, description); } String user = entity.getUser(); if (user != null) { - stmt.bindString(12, user); + stmt.bindString(13, user); } } @@ -188,15 +200,16 @@ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionId - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // eventTitle - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // createTime - cursor.getDouble(offset + 5), // lng - cursor.getDouble(offset + 6), // lat - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // type - cursor.getInt(offset + 8), // data - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // images - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // description - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // user + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // deviceCode + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // eventTitle + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createTime + cursor.getDouble(offset + 6), // lng + cursor.getDouble(offset + 7), // lat + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // type + cursor.getInt(offset + 9), // data + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // images + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // description + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // user ); return entity; } @@ -206,16 +219,17 @@ entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setInspectionId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setEventTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setLng(cursor.getDouble(offset + 5)); - entity.setLat(cursor.getDouble(offset + 6)); - entity.setType(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setData(cursor.getInt(offset + 8)); - entity.setImages(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setDescription(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setUser(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - } + entity.setDeviceCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setEventTitle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setLng(cursor.getDouble(offset + 6)); + entity.setLat(cursor.getDouble(offset + 7)); + entity.setType(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setData(cursor.getInt(offset + 9)); + entity.setImages(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setDescription(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setUser(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + } @Override protected final Long updateKeyAfterInsert(TaskEventLocalBean entity, long rowId) { diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt index 3834d69..d2454ea 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/HomePageFragment.kt @@ -202,8 +202,11 @@ requireContext().navigatePageTo( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt index 5ac5c96..1f91f43 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt @@ -46,7 +46,7 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.inspectMsgView, item.inspectionTitle) + viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") .setText(R.id.startTimeView, item.startTime) .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt index 06bf6c8..9b49ff6 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt @@ -33,6 +33,7 @@ private val realPaths: ArrayList = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var inspectionId: String + private lateinit var deviceCode: String private lateinit var title: String private lateinit var type: String private var isWarning: Boolean = true @@ -49,8 +50,9 @@ isWarning = args[0].toString() == "0" inspectionId = args[1] title = args[2] - longitude = args[3].toDouble() - latitude = args[4].toDouble() + deviceCode = args[3] + longitude = args[4].toDouble() + latitude = args[5].toDouble() if (isWarning) { binding.titleInclude.titleView.text = "报警事件记录" @@ -126,6 +128,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = inspectionId, + deviceCode = deviceCode, eventTitle = title, createTime = binding.createTimeView.text.toString(), type = type, diff --git a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 88354c2..d95fd83 100644 --- a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt @@ -175,6 +175,7 @@ fun addEvent( taskId: String, inspectionId: String, + deviceCode: String, eventTitle: String, createTime: String, lng: Double, @@ -187,6 +188,7 @@ val bean = TaskEventLocalBean() bean.taskId = taskId bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.eventTitle = eventTitle bean.createTime = createTime bean.lng = lng diff --git a/app/src/main/res/layout/item_event_rv_l.xml b/app/src/main/res/layout/item_event_rv_l.xml index f133879..dd630d8 100644 --- a/app/src/main/res/layout/item_event_rv_l.xml +++ b/app/src/main/res/layout/item_event_rv_l.xml @@ -11,8 +11,8 @@ + + ( addAll( position.toString(), - newInspectionModel!!.id, newInspectionModel!!.name, - latLngs.last.longitude.toString(), latLngs.last.latitude.toString() + newInspectionModel!!.id, + newInspectionModel!!.name, + connectedDeviceName, + latLngs.last.longitude.toString(), + latLngs.last.latitude.toString() ) ) } @@ -606,6 +609,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, eventTitle = newInspectionModel!!.name, createTime = System.currentTimeMillis().timestampToCompleteDate(), type = "报警事件", diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt index f775478..e9037c9 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryEventFragment.kt @@ -61,8 +61,15 @@ } } + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "" + } else { + item.deviceCode + } + viewHolder.setText(R.id.inspectMsgView, item.eventTitle) .setText(R.id.inspectTypeView, "类型:${item.type}") + .setText(R.id.deviceCodeView, "设备:$deviceCode") .setText(R.id.inspectDateView, "时间:${item.createTime}") } } diff --git a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt index 5ac5c96..1f91f43 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/fragment/QueryInspectionFragment.kt @@ -46,7 +46,7 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.inspectMsgView, item.inspectionTitle) + viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") .setText(R.id.startTimeView, item.startTime) .setText(R.id.startLocationView, item.startAddress) .setText(R.id.endTimeView, item.endTime) diff --git a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt index 06bf6c8..9b49ff6 100644 --- a/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt +++ b/app/src/main/java/com/casic/birmm/inspect/single/view/NewEventActivity.kt @@ -33,6 +33,7 @@ private val realPaths: ArrayList = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var inspectionId: String + private lateinit var deviceCode: String private lateinit var title: String private lateinit var type: String private var isWarning: Boolean = true @@ -49,8 +50,9 @@ isWarning = args[0].toString() == "0" inspectionId = args[1] title = args[2] - longitude = args[3].toDouble() - latitude = args[4].toDouble() + deviceCode = args[3] + longitude = args[4].toDouble() + latitude = args[5].toDouble() if (isWarning) { binding.titleInclude.titleView.text = "报警事件记录" @@ -126,6 +128,7 @@ DataBaseManager.get.addEvent( taskId = UUID.randomUUID().toString(), inspectionId = inspectionId, + deviceCode = deviceCode, eventTitle = title, createTime = binding.createTimeView.text.toString(), type = type, diff --git a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 88354c2..d95fd83 100644 --- a/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt @@ -175,6 +175,7 @@ fun addEvent( taskId: String, inspectionId: String, + deviceCode: String, eventTitle: String, createTime: String, lng: Double, @@ -187,6 +188,7 @@ val bean = TaskEventLocalBean() bean.taskId = taskId bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.eventTitle = eventTitle bean.createTime = createTime bean.lng = lng diff --git a/app/src/main/res/layout/item_event_rv_l.xml b/app/src/main/res/layout/item_event_rv_l.xml index f133879..dd630d8 100644 --- a/app/src/main/res/layout/item_event_rv_l.xml +++ b/app/src/main/res/layout/item_event_rv_l.xml @@ -11,8 +11,8 @@ + + @@ -34,7 +34,7 @@ @@ -97,6 +97,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:text="2023-8-24 18:21:44" android:textColor="@color/black" android:textSize="@dimen/sp_14" /> @@ -105,6 +106,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:text="北京市海淀区永定路航天科工二院" android:textColor="@color/lightGray" android:textSize="@dimen/sp_12" /> @@ -121,6 +123,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:text="2023-8-24 18:21:44" android:textColor="@color/black" android:textSize="@dimen/sp_14" /> @@ -129,6 +132,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:text="北京市海淀区永定路航天科工二院" android:textColor="@color/lightGray" android:textSize="@dimen/sp_12" /> @@ -164,6 +168,7 @@ android:layout_height="wrap_content" android:fontFamily="sans-serif-black" android:singleLine="true" + android:text="0" android:textColor="@color/black" android:textSize="@dimen/sp_12" />