diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override 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 d2d1502..6105c0f 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 @@ -167,8 +167,8 @@ binding.inspectTimeView.text = startTime newInspectionModel = NewInspectionModel( - currentTimeMillis.id(), value, startTime, - "", currentTimeMillis.timestampToDate(), + currentTimeMillis.id(), value, + startTime, "", currentTimeMillis.timestampToDate(), 0.0, 0.0, 0.0, 0.0, ArrayList(), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override 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 d2d1502..6105c0f 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 @@ -167,8 +167,8 @@ binding.inspectTimeView.text = startTime newInspectionModel = NewInspectionModel( - currentTimeMillis.id(), value, startTime, - "", currentTimeMillis.timestampToDate(), + currentTimeMillis.id(), value, + startTime, "", currentTimeMillis.timestampToDate(), 0.0, 0.0, 0.0, 0.0, ArrayList(), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), 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 146a114..2812b5c 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 @@ -63,7 +63,7 @@ } val deviceCode = if (item.deviceCode.isNullOrBlank()) { - "" + "未绑定设备" } else { item.deviceCode } diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override 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 d2d1502..6105c0f 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 @@ -167,8 +167,8 @@ binding.inspectTimeView.text = startTime newInspectionModel = NewInspectionModel( - currentTimeMillis.id(), value, startTime, - "", currentTimeMillis.timestampToDate(), + currentTimeMillis.id(), value, + startTime, "", currentTimeMillis.timestampToDate(), 0.0, 0.0, 0.0, 0.0, ArrayList(), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), 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 146a114..2812b5c 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 @@ -63,7 +63,7 @@ } val deviceCode = if (item.deviceCode.isNullOrBlank()) { - "" + "未绑定设备" } else { item.deviceCode } 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 1f91f43..6a5559b 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,14 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "未绑定设备" + } else { + item.deviceCode + } + + viewHolder.setText(R.id.deviceCodeView, deviceCode) + .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/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override 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 d2d1502..6105c0f 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 @@ -167,8 +167,8 @@ binding.inspectTimeView.text = startTime newInspectionModel = NewInspectionModel( - currentTimeMillis.id(), value, startTime, - "", currentTimeMillis.timestampToDate(), + currentTimeMillis.id(), value, + startTime, "", currentTimeMillis.timestampToDate(), 0.0, 0.0, 0.0, 0.0, ArrayList(), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), 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 146a114..2812b5c 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 @@ -63,7 +63,7 @@ } val deviceCode = if (item.deviceCode.isNullOrBlank()) { - "" + "未绑定设备" } else { item.deviceCode } 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 1f91f43..6a5559b 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,14 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "未绑定设备" + } else { + item.deviceCode + } + + viewHolder.setText(R.id.deviceCodeView, deviceCode) + .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/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 64093a7..efda213 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 @@ -36,6 +36,7 @@ * */ fun addInspection( inspectionId: String, + deviceCode: String, inspectionName: String, startTime: String, endTime: String, @@ -48,6 +49,7 @@ ) { val bean = InspectionLocalBean() bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.inspectionTitle = inspectionName bean.startTime = startTime bean.endTime = endTime diff --git a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java index 93a8a4c..2aa752d 100644 --- a/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java +++ b/app/src/main/java/com/casic/birmm/inspect/bean/InspectionLocalBean.java @@ -13,6 +13,7 @@ @Unique private String inspectionId; //巡检id + private String deviceCode; // 设备code private String inspectionTitle; // 巡检标签 private String startTime; //开始事件 private String endTime; // 结束时间 @@ -26,13 +27,14 @@ private double distance; // 路线点距离 private String user; // 巡检人 - @Generated(hash = 874301046) - public InspectionLocalBean(Long id, String inspectionId, String inspectionTitle, - String startTime, String endTime, String date, double startLng, - double startLat, String startAddress, double endLng, double endLat, - String endAddress, double distance, String user) { + @Generated(hash = 869701728) + public InspectionLocalBean(Long id, String inspectionId, String deviceCode, + String inspectionTitle, String startTime, String endTime, String date, + double startLng, double startLat, String startAddress, double endLng, + double endLat, String endAddress, double distance, String user) { this.id = id; this.inspectionId = inspectionId; + this.deviceCode = deviceCode; this.inspectionTitle = inspectionTitle; this.startTime = startTime; this.endTime = endTime; @@ -67,6 +69,14 @@ this.inspectionId = inspectionId; } + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getInspectionTitle() { return this.inspectionTitle; } diff --git a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java index 2a8e110..23b971a 100644 --- a/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java +++ b/app/src/main/java/com/casic/birmm/inspect/greendao/InspectionLocalBeanDao.java @@ -26,18 +26,19 @@ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property InspectionId = new Property(1, String.class, "inspectionId", false, "INSPECTION_ID"); - public final static Property InspectionTitle = new Property(2, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); - public final static Property StartTime = new Property(3, String.class, "startTime", false, "START_TIME"); - public final static Property EndTime = new Property(4, String.class, "endTime", false, "END_TIME"); - public final static Property Date = new Property(5, String.class, "date", false, "DATE"); - public final static Property StartLng = new Property(6, double.class, "startLng", false, "START_LNG"); - public final static Property StartLat = new Property(7, double.class, "startLat", false, "START_LAT"); - public final static Property StartAddress = new Property(8, String.class, "startAddress", false, "START_ADDRESS"); - public final static Property EndLng = new Property(9, double.class, "endLng", false, "END_LNG"); - public final static Property EndLat = new Property(10, double.class, "endLat", false, "END_LAT"); - public final static Property EndAddress = new Property(11, String.class, "endAddress", false, "END_ADDRESS"); - public final static Property Distance = new Property(12, double.class, "distance", false, "DISTANCE"); - public final static Property User = new Property(13, String.class, "user", false, "USER"); + public final static Property DeviceCode = new Property(2, String.class, "deviceCode", false, "DEVICE_CODE"); + public final static Property InspectionTitle = new Property(3, String.class, "inspectionTitle", false, "INSPECTION_TITLE"); + public final static Property StartTime = new Property(4, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(5, String.class, "endTime", false, "END_TIME"); + public final static Property Date = new Property(6, String.class, "date", false, "DATE"); + public final static Property StartLng = new Property(7, double.class, "startLng", false, "START_LNG"); + public final static Property StartLat = new Property(8, double.class, "startLat", false, "START_LAT"); + public final static Property StartAddress = new Property(9, String.class, "startAddress", false, "START_ADDRESS"); + public final static Property EndLng = new Property(10, double.class, "endLng", false, "END_LNG"); + public final static Property EndLat = new Property(11, double.class, "endLat", false, "END_LAT"); + public final static Property EndAddress = new Property(12, String.class, "endAddress", false, "END_ADDRESS"); + public final static Property Distance = new Property(13, double.class, "distance", false, "DISTANCE"); + public final static Property User = new Property(14, String.class, "user", false, "USER"); } @@ -55,18 +56,19 @@ db.execSQL("CREATE TABLE " + constraint + "\"INSPECTION_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"INSPECTION_ID\" TEXT UNIQUE ," + // 1: inspectionId - "\"INSPECTION_TITLE\" TEXT," + // 2: inspectionTitle - "\"START_TIME\" TEXT," + // 3: startTime - "\"END_TIME\" TEXT," + // 4: endTime - "\"DATE\" TEXT," + // 5: date - "\"START_LNG\" REAL NOT NULL ," + // 6: startLng - "\"START_LAT\" REAL NOT NULL ," + // 7: startLat - "\"START_ADDRESS\" TEXT," + // 8: startAddress - "\"END_LNG\" REAL NOT NULL ," + // 9: endLng - "\"END_LAT\" REAL NOT NULL ," + // 10: endLat - "\"END_ADDRESS\" TEXT," + // 11: endAddress - "\"DISTANCE\" REAL NOT NULL ," + // 12: distance - "\"USER\" TEXT);"); // 13: user + "\"DEVICE_CODE\" TEXT," + // 2: deviceCode + "\"INSPECTION_TITLE\" TEXT," + // 3: inspectionTitle + "\"START_TIME\" TEXT," + // 4: startTime + "\"END_TIME\" TEXT," + // 5: endTime + "\"DATE\" TEXT," + // 6: date + "\"START_LNG\" REAL NOT NULL ," + // 7: startLng + "\"START_LAT\" REAL NOT NULL ," + // 8: startLat + "\"START_ADDRESS\" TEXT," + // 9: startAddress + "\"END_LNG\" REAL NOT NULL ," + // 10: endLng + "\"END_LAT\" REAL NOT NULL ," + // 11: endLat + "\"END_ADDRESS\" TEXT," + // 12: endAddress + "\"DISTANCE\" REAL NOT NULL ," + // 13: distance + "\"USER\" TEXT);"); // 14: user } /** Drops the underlying database table. */ @@ -78,110 +80,120 @@ @Override protected final void bindValues(DatabaseStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @Override protected final void bindValues(SQLiteStatement stmt, InspectionLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String inspectionId = entity.getInspectionId(); if (inspectionId != null) { stmt.bindString(2, inspectionId); } - + + String deviceCode = entity.getDeviceCode(); + if (deviceCode != null) { + stmt.bindString(3, deviceCode); + } + String inspectionTitle = entity.getInspectionTitle(); if (inspectionTitle != null) { - stmt.bindString(3, inspectionTitle); + stmt.bindString(4, inspectionTitle); } - + String startTime = entity.getStartTime(); if (startTime != null) { - stmt.bindString(4, startTime); + stmt.bindString(5, startTime); } - + String endTime = entity.getEndTime(); if (endTime != null) { - stmt.bindString(5, endTime); + stmt.bindString(6, endTime); } String date = entity.getDate(); if (date != null) { - stmt.bindString(6, date); + stmt.bindString(7, date); } - stmt.bindDouble(7, entity.getStartLng()); - stmt.bindDouble(8, entity.getStartLat()); + stmt.bindDouble(8, entity.getStartLng()); + stmt.bindDouble(9, entity.getStartLat()); String startAddress = entity.getStartAddress(); if (startAddress != null) { - stmt.bindString(9, startAddress); + stmt.bindString(10, startAddress); } - stmt.bindDouble(10, entity.getEndLng()); - stmt.bindDouble(11, entity.getEndLat()); + stmt.bindDouble(11, entity.getEndLng()); + stmt.bindDouble(12, entity.getEndLat()); String endAddress = entity.getEndAddress(); if (endAddress != null) { - stmt.bindString(12, endAddress); + stmt.bindString(13, endAddress); } - stmt.bindDouble(13, entity.getDistance()); + stmt.bindDouble(14, entity.getDistance()); String user = entity.getUser(); if (user != null) { - stmt.bindString(14, user); + stmt.bindString(15, user); } } @@ -195,18 +207,19 @@ InspectionLocalBean entity = new InspectionLocalBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // inspectionId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionTitle - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // date - cursor.getDouble(offset + 6), // startLng - cursor.getDouble(offset + 7), // startLat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // startAddress - cursor.getDouble(offset + 9), // endLng - cursor.getDouble(offset + 10), // endLat - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // endAddress - cursor.getDouble(offset + 12), // distance - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // user + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // deviceCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // inspectionTitle + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startTime + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // endTime + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // date + cursor.getDouble(offset + 7), // startLng + cursor.getDouble(offset + 8), // startLat + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startAddress + cursor.getDouble(offset + 10), // endLng + cursor.getDouble(offset + 11), // endLat + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // endAddress + cursor.getDouble(offset + 13), // distance + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // user ); return entity; } @@ -215,18 +228,19 @@ public void readEntity(Cursor cursor, InspectionLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setInspectionId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setInspectionTitle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setStartLng(cursor.getDouble(offset + 6)); - entity.setStartLat(cursor.getDouble(offset + 7)); - entity.setStartAddress(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setEndLng(cursor.getDouble(offset + 9)); - entity.setEndLat(cursor.getDouble(offset + 10)); - entity.setEndAddress(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setDistance(cursor.getDouble(offset + 12)); - entity.setUser(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setDeviceCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setInspectionTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStartTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setEndTime(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setStartLng(cursor.getDouble(offset + 7)); + entity.setStartLat(cursor.getDouble(offset + 8)); + entity.setStartAddress(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setEndLng(cursor.getDouble(offset + 10)); + entity.setEndLat(cursor.getDouble(offset + 11)); + entity.setEndAddress(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setDistance(cursor.getDouble(offset + 13)); + entity.setUser(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override 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 d2d1502..6105c0f 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 @@ -167,8 +167,8 @@ binding.inspectTimeView.text = startTime newInspectionModel = NewInspectionModel( - currentTimeMillis.id(), value, startTime, - "", currentTimeMillis.timestampToDate(), + currentTimeMillis.id(), value, + startTime, "", currentTimeMillis.timestampToDate(), 0.0, 0.0, 0.0, 0.0, ArrayList(), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), 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 146a114..2812b5c 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 @@ -63,7 +63,7 @@ } val deviceCode = if (item.deviceCode.isNullOrBlank()) { - "" + "未绑定设备" } else { item.deviceCode } 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 1f91f43..6a5559b 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,14 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "未绑定设备" + } else { + item.deviceCode + } + + viewHolder.setText(R.id.deviceCodeView, deviceCode) + .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/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 64093a7..efda213 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 @@ -36,6 +36,7 @@ * */ fun addInspection( inspectionId: String, + deviceCode: String, inspectionName: String, startTime: String, endTime: String, @@ -48,6 +49,7 @@ ) { val bean = InspectionLocalBean() bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.inspectionTitle = inspectionName bean.startTime = startTime bean.endTime = endTime diff --git a/app/src/main/res/drawable/ic_delete.xml b/app/src/main/res/drawable/ic_delete.xml index f5e1824..82a5b7d 100644 --- a/app/src/main/res/drawable/ic_delete.xml +++ b/app/src/main/res/drawable/ic_delete.xml @@ -1,6 +1,6 @@ (), "超级管理员" ) @@ -549,6 +549,7 @@ } DataBaseManager.get.addInspection( inspectionId = newInspectionModel!!.id, + deviceCode = connectedDeviceName, inspectionName = newInspectionModel!!.name, startTime = newInspectionModel!!.startTime, endTime = System.currentTimeMillis().timestampToCompleteDate(), 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 146a114..2812b5c 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 @@ -63,7 +63,7 @@ } val deviceCode = if (item.deviceCode.isNullOrBlank()) { - "" + "未绑定设备" } else { item.deviceCode } 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 1f91f43..6a5559b 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,14 @@ override fun convertView( viewHolder: ViewHolder, position: Int, item: InspectionLocalBean ) { - viewHolder.setText(R.id.taskNameView, "任务:${item.inspectionTitle}") + val deviceCode = if (item.deviceCode.isNullOrBlank()) { + "未绑定设备" + } else { + item.deviceCode + } + + viewHolder.setText(R.id.deviceCodeView, deviceCode) + .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/utils/DataBaseManager.kt b/app/src/main/java/com/casic/birmm/inspect/utils/DataBaseManager.kt index 64093a7..efda213 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 @@ -36,6 +36,7 @@ * */ fun addInspection( inspectionId: String, + deviceCode: String, inspectionName: String, startTime: String, endTime: String, @@ -48,6 +49,7 @@ ) { val bean = InspectionLocalBean() bean.inspectionId = inspectionId + bean.deviceCode = deviceCode bean.inspectionTitle = inspectionName bean.startTime = startTime bean.endTime = endTime diff --git a/app/src/main/res/drawable/ic_delete.xml b/app/src/main/res/drawable/ic_delete.xml index f5e1824..82a5b7d 100644 --- a/app/src/main/res/drawable/ic_delete.xml +++ b/app/src/main/res/drawable/ic_delete.xml @@ -1,6 +1,6 @@ + + + + + + + + + + android:orientation="horizontal" + android:paddingVertical="@dimen/dp_3"> - - + android:text="任务名称:测试任务标题" + android:textColor="@color/black" />